waf: fixed the problem with com_err on Ubuntu 9.04
authorAndrew Tridgell <tridge@samba.org>
Wed, 6 Oct 2010 04:23:58 +0000 (15:23 +1100)
committerAndrew Tridgell <tridge@samba.org>
Wed, 6 Oct 2010 05:06:42 +0000 (05:06 +0000)
this changes CHECK_BUNDLED_SYSTEM() to honor the checkfunctions and
headers options even for libraries found with pkgconfig.

Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Wed Oct  6 05:06:42 UTC 2010 on sn-devel-104

buildtools/wafsamba/samba_autoconf.py
buildtools/wafsamba/samba_bundled.py

index 3f9aa3a34dc22991452e3dffb235d56f3fb80876..5ff8416092f1c75076cc094b82b576d40aee86db 100644 (file)
@@ -461,13 +461,17 @@ def library_flags(conf, libs):
 
 
 @conf
-def CHECK_LIB(conf, libs, mandatory=False, empty_decl=True):
-    '''check if a set of libraries exist'''
+def CHECK_LIB(conf, libs, mandatory=False, empty_decl=True, set_target=True):
+    '''check if a set of libraries exist as system libraries
 
+    returns the sublist of libs that do exist as a syslib or []
+    '''
+
+    ret = []
     liblist  = TO_LIST(libs)
-    ret = True
     for lib in liblist[:]:
         if GET_TARGET_TYPE(conf, lib) == 'SYSLIB':
+            ret.append(lib)
             continue
 
         (ccflags, ldflags) = library_flags(conf, lib)
@@ -478,12 +482,14 @@ def CHECK_LIB(conf, libs, mandatory=False, empty_decl=True):
                 sys.exit(1)
             if empty_decl:
                 # if it isn't a mandatory library, then remove it from dependency lists
-                SET_TARGET_TYPE(conf, lib, 'EMPTY')
-            ret = False
+                if set_target:
+                    SET_TARGET_TYPE(conf, lib, 'EMPTY')
         else:
             conf.define('HAVE_LIB%s' % lib.upper().replace('-','_'), 1)
             conf.env['LIB_' + lib.upper()] = lib
-            LOCAL_CACHE_SET(conf, 'TARGET_TYPE', lib, 'SYSLIB')
+            if set_target:
+                conf.SET_TARGET_TYPE(lib, 'SYSLIB')
+            ret.append(lib)
 
     return ret
 
@@ -491,7 +497,7 @@ def CHECK_LIB(conf, libs, mandatory=False, empty_decl=True):
 
 @conf
 def CHECK_FUNCS_IN(conf, list, library, mandatory=False, checklibc=False,
-                   headers=None, link=True, empty_decl=True):
+                   headers=None, link=True, empty_decl=True, set_target=True):
     """
     check that the functions in 'list' are available in 'library'
     if they are, then make that library available as a dependency
@@ -525,19 +531,15 @@ def CHECK_FUNCS_IN(conf, list, library, mandatory=False, checklibc=False,
                 SET_TARGET_TYPE(conf, lib, 'EMPTY')
         return True
 
-    conf.CHECK_LIB(liblist, empty_decl=empty_decl)
+    checklist = conf.CHECK_LIB(liblist, empty_decl=empty_decl, set_target=set_target)
     for lib in liblist[:]:
-        if not GET_TARGET_TYPE(conf, lib) == 'SYSLIB':
-            if mandatory:
-                Logs.error("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
+        if not lib in checklist and mandatory:
+            Logs.error("Mandatory library '%s' not found for functions '%s'" % (lib, list))
+            sys.exit(1)
 
     ret = True
     for f in remaining:
-        if not CHECK_FUNC(conf, f, lib=' '.join(liblist), headers=headers, link=link):
+        if not CHECK_FUNC(conf, f, lib=' '.join(checklist), headers=headers, link=link):
             ret = False
 
     return ret
index 27e5409b45a4f1c9b260423ee5bf3f814b96217a..29b0a501c87b8b47cb276fe3a5bdc794edddd6ff 100644 (file)
@@ -100,6 +100,15 @@ def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0',
     if found in conf.env:
         return conf.env[found]
 
+    def check_functions_headers():
+        '''helper function for CHECK_BUNDLED_SYSTEM'''
+        if checkfunctions is None:
+            return True
+        if require_headers and headers and not conf.CHECK_HEADERS(headers):
+            return False
+        return conf.CHECK_FUNCS_IN(checkfunctions, libname, headers=headers,
+                                   empty_decl=False, set_target=False)
+
     # 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
@@ -116,22 +125,21 @@ def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0',
     minversion = minimum_library_version(conf, libname, minversion)
 
     # try pkgconfig first
-    if conf.check_cfg(package=libname,
+    if (conf.check_cfg(package=libname,
                       args='"%s >= %s" --cflags --libs' % (libname, minversion),
-                      msg='Checking for system %s >= %s' % (libname, minversion)):
+                      msg='Checking for system %s >= %s' % (libname, minversion)) and
+        check_functions_headers()):
         conf.SET_TARGET_TYPE(libname, 'SYSLIB')
         conf.env[found] = True
         if implied_deps:
             conf.SET_SYSLIB_DEPS(libname, implied_deps)
         return True
     if checkfunctions is not None:
-        headers_ok = True
-        if require_headers and headers and not conf.CHECK_HEADERS(headers):
-            headers_ok = False
-        if headers_ok and conf.CHECK_FUNCS_IN(checkfunctions, libname, headers=headers, empty_decl=False):
+        if check_functions_headers():
             conf.env[found] = True
             if implied_deps:
                 conf.SET_SYSLIB_DEPS(libname, implied_deps)
+            conf.SET_TARGET_TYPE(libname, 'SYSLIB')
             return True
     conf.env[found] = False
     if not conf.LIB_MAY_BE_BUNDLED(libname):