diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-03-28 16:38:27 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-04-06 20:27:13 +1000 |
commit | bfbf43cc36ab360b34b49d7e07c2f594e2b7e7c9 (patch) | |
tree | 35e0b133c53a859c90962d0678b0e5218943b6f8 /buildtools/wafsamba | |
parent | 505e902436b2a31a7b828fdeddf599339d0229e5 (diff) | |
download | samba-bfbf43cc36ab360b34b49d7e07c2f594e2b7e7c9.tar.gz samba-bfbf43cc36ab360b34b49d7e07c2f594e2b7e7c9.tar.bz2 samba-bfbf43cc36ab360b34b49d7e07c2f594e2b7e7c9.zip |
s4-waf: support the use of system libraries
distros can set --bundled-libraries=NONE to force use of all system
libraries. If the right version isn't found then configure will fail.
Users may choose which libraries to use from the system, and which to
use bundled libs. The default is to try system libs, and use them if
their version matches the one in the source tree.
Diffstat (limited to 'buildtools/wafsamba')
-rw-r--r-- | buildtools/wafsamba/samba_autoconf.py | 17 | ||||
-rw-r--r-- | buildtools/wafsamba/samba_bundled.py | 15 | ||||
-rw-r--r-- | buildtools/wafsamba/wscript | 6 |
3 files changed, 30 insertions, 8 deletions
diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py index b2f1d82040..ff2fa012c4 100644 --- a/buildtools/wafsamba/samba_autoconf.py +++ b/buildtools/wafsamba/samba_autoconf.py @@ -399,8 +399,9 @@ def CHECK_LIB(conf, libs, mandatory=False): (ccflags, ldflags) = library_flags(conf, lib) if not conf.check(lib=lib, uselib_store=lib, ccflags=ccflags, ldflags=ldflags): - conf.ASSERT(not mandatory, - "Mandatory library '%s' not found for functions '%s'" % (lib, list)) + if mandatory: + print("Mandatory library '%s' not found for functions '%s'" % (lib, list)) + sys.exit(1) # if it isn't a mandatory library, then remove it from dependency lists SET_TARGET_TYPE(conf, lib, 'EMPTY') ret = False @@ -449,8 +450,9 @@ def CHECK_FUNCS_IN(conf, list, library, mandatory=False, checklibc=False, header conf.CHECK_LIB(liblist) for lib in liblist[:]: if not GET_TARGET_TYPE(conf, lib) == 'SYSLIB': - conf.ASSERT(not mandatory, - "Mandatory library '%s' not found for functions '%s'" % (lib, list)) + if mandatory: + print("Mandatory library '%s' not found for functions '%s'" % (lib, list)) + sys.exit(1) # if it isn't a mandatory library, then remove it from dependency lists liblist.remove(lib) continue @@ -462,6 +464,11 @@ def CHECK_FUNCS_IN(conf, list, library, mandatory=False, checklibc=False, header return ret +@conf +def IN_LAUNCH_DIR(conf): + '''return True if this rule is being run from the launch directory''' + return os.path.realpath(conf.curdir) == os.path.realpath(Options.launch_dir) + ################################################# # write out config.h in the right directory @@ -469,7 +476,7 @@ def CHECK_FUNCS_IN(conf, list, library, mandatory=False, checklibc=False, header def SAMBA_CONFIG_H(conf, path=None): # we don't want to produce a config.h in places like lib/replace # when we are building projects that depend on lib/replace - if os.path.realpath(conf.curdir) != os.path.realpath(Options.launch_dir): + if not IN_LAUNCH_DIR(conf): return if Options.options.developer: diff --git a/buildtools/wafsamba/samba_bundled.py b/buildtools/wafsamba/samba_bundled.py index d4dbe221db..2a6d75f7c9 100644 --- a/buildtools/wafsamba/samba_bundled.py +++ b/buildtools/wafsamba/samba_bundled.py @@ -40,3 +40,18 @@ def BUNDLED_EXTENSION_DEFAULT(opt, extension, noextenion=''): Options.options['BUNDLED_EXTENSION_DEFAULT'] = extension Options.options['BUNDLED_EXTENSION_EXCEPTION'] = noextenion Options.Handler.BUNDLED_EXTENSION_DEFAULT = BUNDLED_EXTENSION_DEFAULT + + +@conf +def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0'): + if 'ALL' in conf.env.BUNDLED_LIBS or libname in conf.env.BUNDLED_LIBS: + return False + if conf.check_cfg(package=libname, + args='"%s >= %s" --cflags --libs' % (libname, minversion), + msg='Checking for system %s >= %s' % (libname, minversion)): + conf.SET_TARGET_TYPE(libname, 'SYSLIB') + return True + if 'NONE' in conf.env.BUNDLED_LIBS or '!'+libname in conf.env.BUNDLED_LIBS: + print('ERROR: System library %s of version %s not found, and bundling disabled' % (libname, minversion)) + sys.exit(1) + return False diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript index 315c3e58a9..1ff0fd3cb3 100644 --- a/buildtools/wafsamba/wscript +++ b/buildtools/wafsamba/wscript @@ -12,7 +12,7 @@ def set_options(opt): opt.tool_options('gnu_dirs') opt.add_option('--bundled-libraries', - help=("list of bundled libraries. Can be 'NONE' or 'ALL' [auto]"), + help=("comma separated list of bundled libraries. May include !LIBNAME to disable bundling a library. Can be 'NONE' or 'ALL' [auto]"), action="store", dest='BUNDLED_LIBS', default='') extension_default = Options.options['BUNDLED_EXTENSION_DEFAULT'] @@ -22,12 +22,12 @@ def set_options(opt): extension_exception = Options.options['BUNDLED_EXTENSION_EXCEPTION'] opt.add_option('--bundled-extension-exception', - help=("list of libraries to not apply extension to [%s]" % extension_exception), + help=("comman separated list of libraries to not apply extension to [%s]" % extension_exception), action="store", dest='BUNDLED_EXTENSION_EXCEPTION', default=extension_exception) builtin_defauilt = Options.options['BUILTIN_LIBRARIES_DEFAULT'] opt.add_option('--builtin-libraries', - help=("list of libraries to build directly into binaries [%s]" % builtin_defauilt), + help=("command separated list of libraries to build directly into binaries [%s]" % builtin_defauilt), action="store", dest='BUILTIN_LIBRARIES', default=builtin_defauilt) opt.add_option('--libdir', |