build: fixed a typo that prevented --bundled-libraries from working correctly
[samba.git] / buildtools / wafsamba / samba_autoconf.py
index 4731a4e13d5db52b9946442796dd4aafc6fd04ac..cbb10a27caf49b0da61ff5ec1e4a81b90bbc0478 100644 (file)
@@ -1,9 +1,10 @@
 # a waf tool to add autoconf-like macros to the configure section
 
-import Build, os, Options, preproc
+import Build, os, Options, preproc, Logs
 import string
 from Configure import conf
 from samba_utils import *
+import samba_cross
 
 missing_headers = set()
 
@@ -204,7 +205,7 @@ def CHECK_VARIABLE(conf, v, define=None, always=False,
 
 
 @conf
-def CHECK_DECLS(conf, vars, reverse=False, headers=None):
+def CHECK_DECLS(conf, vars, reverse=False, headers=None, always=False):
     '''check a list of variable declarations, using the HAVE_DECL_xxx form
        of define
 
@@ -219,7 +220,8 @@ def CHECK_DECLS(conf, vars, reverse=False, headers=None):
         if not CHECK_VARIABLE(conf, v,
                               define=define,
                               headers=headers,
-                              msg='Checking for declaration of %s' % v):
+                              msg='Checking for declaration of %s' % v,
+                              always=always):
             ret = False
     return ret
 
@@ -366,6 +368,8 @@ def CHECK_CODE(conf, code, define,
     cflags = TO_LIST(cflags)
     cflags.extend(ccflags)
 
+    exec_args = conf.SAMBA_CROSS_ARGS()
+
     ret = conf.check(fragment=fragment,
                      execute=execute,
                      define_name = define,
@@ -377,6 +381,7 @@ def CHECK_CODE(conf, code, define,
                      type=type,
                      msg=msg,
                      quote=quote,
+                     exec_args=exec_args,
                      define_ret=define_ret)
     if not ret and CONFIG_SET(conf, define):
         # sometimes conf.check() returns false, but it
@@ -449,14 +454,14 @@ def CHECK_LIB(conf, libs, mandatory=False, empty_decl=True):
     liblist  = TO_LIST(libs)
     ret = True
     for lib in liblist[:]:
-        if GET_TARGET_TYPE(conf, lib):
+        if GET_TARGET_TYPE(conf, lib) == 'SYSLIB':
             continue
 
         (ccflags, ldflags) = library_flags(conf, lib)
 
         if not conf.check(lib=lib, uselib_store=lib, ccflags=ccflags, ldflags=ldflags):
             if mandatory:
-                print("Mandatory library '%s' not found for functions '%s'" % (lib, list))
+                Logs.error("Mandatory library '%s' not found for functions '%s'" % (lib, list))
                 sys.exit(1)
             if empty_decl:
                 # if it isn't a mandatory library, then remove it from dependency lists
@@ -511,7 +516,7 @@ def CHECK_FUNCS_IN(conf, list, library, mandatory=False, checklibc=False,
     for lib in liblist[:]:
         if not GET_TARGET_TYPE(conf, lib) == 'SYSLIB':
             if mandatory:
-                print("Mandatory library '%s' not found for functions '%s'" % (lib, list))
+                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)