s4-waf: ensure we don't end up with mixed versions of talloc/tdb/tevent
authorAndrew Tridgell <tridge@samba.org>
Sun, 28 Mar 2010 13:08:38 +0000 (00:08 +1100)
committerAndrew Tridgell <tridge@samba.org>
Tue, 6 Apr 2010 10:27:15 +0000 (20:27 +1000)
buildtools/wafsamba/samba_bundled.py
lib/tevent/wscript
source4/lib/ldb/wscript

index 47c6a836d63abec50bac2b378c46dff451634875..b2d1b0ef14382c581ad0905f33e00a54d7d15981 100644 (file)
@@ -46,7 +46,7 @@ Options.Handler.BUNDLED_EXTENSION_DEFAULT = BUNDLED_EXTENSION_DEFAULT
 @runonce
 @conf
 def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0',
-                         checkfunctions=None, headers=None):
+                         checkfunctions=None, headers=None, onlyif=None):
     '''check if a library is available as a system library.
     this first tries via pkg-config, then if that fails
     tries by testing for a specified function in the specified lib
@@ -56,6 +56,20 @@ def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0',
     found = 'FOUND_SYSTEMLIB_%s' % libname
     if found in conf.env:
         return conf.env[found]
+
+    # see if the library should only use a system version if another dependent
+    # system version is found. That prevents possible use of mixed library
+    # versions
+    if onlyif:
+        for syslib in TO_LIST(onlyif):
+            f = 'FOUND_SYSTEM_%s' % syslib
+            if not f in conf.env:
+                if 'NONE' in conf.env.BUNDLED_LIBS or '!'+libname in conf.env.BUNDLED_LIBS:
+                    print('ERROR: Use of system library %s depends on missing system library %s' % (libname, syslib))
+                    sys.exit(1)
+                conf.env[found] = False
+                return False
+
     # try pkgconfig first
     if conf.check_cfg(package=libname,
                       args='"%s >= %s" --cflags --libs' % (libname, minversion),
index e6ef67a8d674d41ecd86d2f36033ed6cb01912de..a84dad663c44fa09cbe9a8a51606feecf8ca218d 100644 (file)
@@ -22,7 +22,7 @@ def configure(conf):
     conf.sub_config(LIBREPLACE_DIR)
     conf.sub_config(LIBTALLOC_DIR)
 
-    if conf.CHECK_BUNDLED_SYSTEM('tevent', minversion=VERSION):
+    if conf.CHECK_BUNDLED_SYSTEM('tevent', minversion=VERSION, onlyif='talloc'):
         conf.define('USING_SYSTEM_TEVENT', 1)
 
     if conf.CHECK_FUNCS('epoll_create', headers='sys/epoll.h'):
index e0269d76077380033a67221fb08e2b54fdb20035..ffbb68e4b885551792d23badf7a173c360415d70 100644 (file)
@@ -31,7 +31,8 @@ def configure(conf):
 
 
     if not s4_build:
-        if conf.CHECK_BUNDLED_SYSTEM('ldb', minversion=VERSION):
+        if conf.CHECK_BUNDLED_SYSTEM('ldb', minversion=VERSION,
+                                     onlyif='talloc tdb tevent'):
             conf.define('USING_SYSTEM_LDB', 1)
         # we need this for the ldap backend
         conf.CHECK_FUNCS_IN('ber_flush ldap_open', 'lber ldap', headers='lber.h ldap.h', mandatory=True)