build: add require_headers option to CHECK_BUNDLED_SYSTEM()
authorAndrew Tridgell <tridge@samba.org>
Tue, 30 Mar 2010 11:06:32 +0000 (22:06 +1100)
committerAndrew Tridgell <tridge@samba.org>
Tue, 6 Apr 2010 10:27:18 +0000 (20:27 +1000)
Useful to ensure the package has usable headers

buildtools/wafsamba/samba_bundled.py

index 28116fcd696bee8cc1c1d1a86da062b857dc1f56..34199381b396390814a513d2762955ce365e091a 100644 (file)
@@ -47,7 +47,8 @@ Options.Handler.BUNDLED_EXTENSION_DEFAULT = BUNDLED_EXTENSION_DEFAULT
 @conf
 def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0',
                          checkfunctions=None, headers=None,
-                         onlyif=None, implied_deps=None):
+                         onlyif=None, implied_deps=None,
+                         require_headers=True):
     '''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
@@ -81,7 +82,10 @@ def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0',
             conf.SET_SYSLIB_DEPS(libname, implied_deps)
         return True
     if checkfunctions is not None:
-        if conf.CHECK_FUNCS_IN(checkfunctions, libname, headers=headers, empty_decl=False):
+        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):
             conf.env[found] = True
             if implied_deps:
                 conf.SET_SYSLIB_DEPS(libname, implied_deps)