wafsamba: allow optional 'checkcode' argument to CHECK_BUNDLED_SYSTEM()
authorStefan Metzmacher <metze@samba.org>
Fri, 14 Mar 2014 09:19:41 +0000 (10:19 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 2 Apr 2014 07:03:41 +0000 (09:03 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
buildtools/wafsamba/samba_bundled.py

index 5926ae2d6eb40a7fd31970b03e7d9c5cb9f9d8bc..97ad4aa365b1115d0429635d1881fe71a9071852 100644 (file)
@@ -111,7 +111,7 @@ def CHECK_BUNDLED_SYSTEM_PKG(conf, libname, minversion='0.0.0',
 @runonce
 @conf
 def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0',
-                         checkfunctions=None, headers=None,
+                         checkfunctions=None, headers=None, checkcode=None,
                          onlyif=None, implied_deps=None,
                          require_headers=True, pkg=None):
     '''check if a library is available as a system library.
@@ -124,7 +124,7 @@ def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0',
     if found in conf.env:
         return conf.env[found]
 
-    def check_functions_headers():
+    def check_functions_headers_code():
         '''helper function for CHECK_BUNDLED_SYSTEM'''
         if require_headers and headers and not conf.CHECK_HEADERS(headers, lib=libname):
             return False
@@ -133,6 +133,14 @@ def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0',
                                      empty_decl=False, set_target=False)
             if not ok:
                 return False
+        if checkcode is not None:
+            define='CHECK_BUNDLED_SYSTEM_%s' % libname.upper()
+            ok = conf.CHECK_CODE(checkcode, lib=libname,
+                                 headers=headers, local_include=False,
+                                 msg=msg, define=define)
+            conf.CONFIG_RESET(define)
+            if not ok:
+                return False
         return True
 
 
@@ -162,14 +170,14 @@ def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0',
     if (conf.check_cfg(package=pkg,
                       args='"%s >= %s" --cflags --libs' % (pkg, minversion),
                       msg=msg, uselib_store=uselib_store) and
-        check_functions_headers()):
+        check_functions_headers_code()):
         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:
-        if check_functions_headers():
+        if check_functions_headers_code():
             conf.env[found] = True
             if implied_deps:
                 conf.SET_SYSLIB_DEPS(libname, implied_deps)