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 <ab@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
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())
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)
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