From: Alexander Bokovoy Date: Thu, 6 Sep 2018 07:51:00 +0000 (+0000) Subject: wafsamba/samba_autoconf: when setting undefined result, use empty tuple X-Git-Tag: tdb-1.3.17~1716 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=311e1eb67306d6a639ce80b94a16ea2ef19592f0;p=thirdparty%2Fsamba.git wafsamba/samba_autoconf: when setting undefined result, use empty tuple A difference between waf 1.x and 2.x is that we gained 0 as an undefined variable in the cache file. This does not allow to differentiate unset and set to 0 defines. Force to use empty tuple () to signify unset defines. Also, fix handling of extra cflags in case of 'strict=True': if extra_cflags were not defined, we'd append None to the cflags list and it confuses conf.check() later. 'None' is added to the command line of a tool executed by the conf.check() which, depending on a tool, may be treated as an error and cause wrong test result. Signed-off-by: Alexander Bokovoy Reviewed-by: Andrew Bartlett --- diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py index 02fbeecd75e..6b940e53c00 100644 --- a/buildtools/wafsamba/samba_autoconf.py +++ b/buildtools/wafsamba/samba_autoconf.py @@ -402,7 +402,8 @@ def CHECK_CODE(conf, code, define, extra_cflags = "-Werror" elif conf.env["CC_NAME"] == "xlc": extra_cflags = "-qhalt=w" - cflags.append(extra_cflags) + if extra_cflags: + cflags.append(extra_cflags) if local_include: cflags.append('-I%s' % conf.path.abspath()) @@ -451,7 +452,13 @@ def CHECK_CODE(conf, code, define, raise return False else: - # success + # Success is indicated by ret but we should unset + # defines set by WAF's c_config.check() because it + # defines it to int(ret) and we want to undefine it + if not ret: + conf.undefine(define) + conf.COMPOUND_END(False) + return False if not define_ret: conf.DEFINE(define, 1) conf.COMPOUND_END(True) diff --git a/buildtools/wafsamba/samba_waf18.py b/buildtools/wafsamba/samba_waf18.py index ff20bc20885..282755c1fa6 100644 --- a/buildtools/wafsamba/samba_waf18.py +++ b/buildtools/wafsamba/samba_waf18.py @@ -69,10 +69,10 @@ def apply_incpaths(self): def define(self, key, val, quote=True, comment=None): assert key and isinstance(key, str) - if val is True: - val = 1 - elif val in (False, None): - val = 0 + if val is None: + val = () + elif isinstance(val, bool): + val = int(val) # waf 1.5 self.env[key] = val