build:wafsamba: Waf 1.8 compatible declaration of 'mandatory' configuration tests
authorThomas Nagy <tnagy@waf.io>
Wed, 11 Nov 2015 23:27:31 +0000 (00:27 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 16 Nov 2015 13:50:38 +0000 (14:50 +0100)
The configuration tests raise exceptions by default in later Waf versions,
but the samba tests do not specify whether the errors should be raised or
not. This changes lifts the ambiguity.

Signed-off-by: Thomas Nagy <tnagy@waf.io>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Nov 16 14:50:39 CET 2015 on sn-devel-104

buildtools/wafsamba/samba_autoconf.py
buildtools/wafsamba/samba_conftests.py
buildtools/wafsamba/samba_python.py

index 99ceb776b6f15ec9f13a9e0e7c9156f935974a17..09ce2189d8a3a849099fd6a840024b7803c07181 100644 (file)
@@ -100,6 +100,7 @@ def CHECK_HEADER(conf, h, add_headers=False, lib=None):
                      type='nolink',
                      execute=0,
                      ccflags=ccflags,
+                     mandatory=False,
                      includes=cpppath,
                      uselib=lib.upper(),
                      msg="Checking for header %s" % h)
@@ -485,6 +486,7 @@ def CHECK_LDFLAGS(conf, ldflags):
     return conf.check(fragment='int main(void) { return 0; }\n',
                       execute=0,
                       ldflags=ldflags,
+                      mandatory=False,
                       msg="Checking linker accepts %s" % ldflags)
 
 
@@ -568,9 +570,9 @@ int foo()
 
         (ccflags, ldflags, cpppath) = library_flags(conf, lib)
         if shlib:
-            res = conf.check(features='c cshlib', fragment=fragment, lib=lib, uselib_store=lib, ccflags=ccflags, ldflags=ldflags, uselib=lib.upper())
+            res = conf.check(features='c cshlib', fragment=fragment, lib=lib, uselib_store=lib, ccflags=ccflags, ldflags=ldflags, uselib=lib.upper(), mandatory=False)
         else:
-            res = conf.check(lib=lib, uselib_store=lib, ccflags=ccflags, ldflags=ldflags, uselib=lib.upper())
+            res = conf.check(lib=lib, uselib_store=lib, ccflags=ccflags, ldflags=ldflags, uselib=lib.upper(), mandatory=False)
 
         if not res:
             if mandatory:
@@ -670,6 +672,7 @@ def SAMBA_CONFIG_H(conf, path=None):
         execute=0,
         ccflags='-fstack-protector',
         ldflags='-fstack-protector',
+        mandatory=False,
         msg='Checking if toolchain accepts -fstack-protector'):
             conf.ADD_CFLAGS('-fstack-protector')
             conf.ADD_LDFLAGS('-fstack-protector')
index b4e44c5dc4ef75f4c27818e7b89e8648b00d7749..045f858e9cdaae7ee5754a2c7fbef6642a7fee59 100644 (file)
@@ -196,7 +196,7 @@ int foo(int v) {
     return v * 2;
 }
 '''
-    return conf.check(features='c cshlib',vnum="1",fragment=snip,msg=msg)
+    return conf.check(features='c cshlib',vnum="1",fragment=snip,msg=msg, mandatory=False)
 
 @conf
 def CHECK_NEED_LC(conf, msg):
@@ -258,7 +258,7 @@ int foo(int v) {
     ldb_module = PyImport_ImportModule("ldb");
     return v * 2;
 }'''
-    return conf.check(features='c cshlib',uselib='PYEMBED',fragment=snip,msg=msg)
+    return conf.check(features='c cshlib',uselib='PYEMBED',fragment=snip,msg=msg, mandatory=False)
 
 # this one is quite complex, and should probably be broken up
 # into several parts. I'd quite like to create a set of CHECK_COMPOUND()
index 6f9435002e2c39da6d8a1620269c93d6b137c924..80753812d836f360905f2dff629ea2dce215cf9a 100644 (file)
@@ -1,7 +1,7 @@
 # waf build tool for building IDL files with pidl
 
 import os
-import Build, Logs, Utils
+import Build, Logs, Utils, Configure
 from Configure import conf
 
 @conf
@@ -63,7 +63,12 @@ def SAMBA_CHECK_PYTHON_HEADERS(conf, mandatory=True):
     del(conf.env.defines['PYTHONARCHDIR'])
 
 def _check_python_headers(conf, mandatory):
-    conf.check_python_headers(mandatory=mandatory)
+    try:
+        Configure.ConfigurationError
+        conf.check_python_headers(mandatory=mandatory)
+    except Configure.ConfigurationError:
+        if mandatory:
+             raise
 
     if conf.env['PYTHON_VERSION'] > '3':
         abi_pattern = os.path.splitext(conf.env['pyext_PATTERN'])[0]