]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
wafsamba: Add strict option to CHECK_CODE
authorAmitay Isaacs <amitay@gmail.com>
Tue, 3 Jul 2018 03:56:13 +0000 (13:56 +1000)
committerKarolin Seeger <kseeger@samba.org>
Tue, 10 Jul 2018 08:44:13 +0000 (10:44 +0200)
Some compilers (e.g. xlc) ignores unsupported features, generates a
warning, but does not fail compilation.

This ensures that any compiler warnings are treated as errors and the
feature support is correctly identified.  This adds equivalent compiler
option to -Werror for xlc.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13493

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit c08d65c3eea997d52e311f027d84bdc3f9c93059)

buildtools/wafsamba/samba_autoconf.py

index cc08e0d5c3db07e5978a3bd21eea7da9e35859d2..1b1e88a0d6903dd8eb4af2f1c0240b1126b595f1 100644 (file)
@@ -365,7 +365,7 @@ def CHECK_CODE(conf, code, define,
                headers=None, msg=None, cflags='', includes='# .',
                local_include=True, lib=None, link=True,
                define_ret=False, quote=False,
-               on_target=True):
+               on_target=True, strict=False):
     '''check if some code compiles and/or runs'''
 
     if CONFIG_SET(conf, define):
@@ -395,6 +395,16 @@ def CHECK_CODE(conf, code, define,
 
     cflags = TO_LIST(cflags)
 
+    # Be strict when relying on a compiler check
+    # Some compilers (e.g. xlc) ignore non-supported features as warnings
+    if strict:
+        extra_cflags = None
+        if conf.env["CC_NAME"] == "gcc":
+            extra_cflags = "-Werror"
+        elif conf.env["CC_NAME"] == "xlc":
+            extra_cflags = "-qhalt=w"
+        cflags.append(extra_cflags)
+
     if local_include:
         cflags.append('-I%s' % conf.curdir)