summaryrefslogtreecommitdiff
path: root/buildtools
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2019-11-12 17:17:02 +1300
committerAndreas Schneider <asn@cryptomilk.org>2019-11-13 10:29:00 +0000
commit86e418f992e1bb1faaa099567e0f80f280d391b6 (patch)
tree19a464873bda1df1afacc6a455dd3a837e776d59 /buildtools
parentdc5db1e8d819f442060015bc93a132cc4b3f7ad9 (diff)
downloadsamba-86e418f992e1bb1faaa099567e0f80f280d391b6.tar.gz
build: Refuse to build if ADDITIONAL_LDFLAGS or ADDITIONAL_CFLAGS do not work
This avoids these being silently ignored. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: David Mulder <dmulder@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Wed Nov 13 10:29:00 UTC 2019 on sn-devel-184
Diffstat (limited to 'buildtools')
-rw-r--r--buildtools/wafsamba/samba_autoconf.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
index 683f0d5316b..1ccee54bb63 100644
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -487,7 +487,8 @@ def CHECK_STRUCTURE_MEMBER(conf, structname, member,
@conf
-def CHECK_CFLAGS(conf, cflags, fragment='int main(void) { return 0; }\n'):
+def CHECK_CFLAGS(conf, cflags, fragment='int main(void) { return 0; }\n',
+ mandatory=False):
'''check if the given cflags are accepted by the compiler
'''
check_cflags = TO_LIST(cflags)
@@ -495,19 +496,20 @@ def CHECK_CFLAGS(conf, cflags, fragment='int main(void) { return 0; }\n'):
check_cflags.extend(conf.env['WERROR_CFLAGS'])
return conf.check(fragment=fragment,
execute=0,
- mandatory=False,
+ mandatory=mandatory,
type='nolink',
cflags=check_cflags,
msg="Checking compiler accepts %s" % cflags)
@conf
-def CHECK_LDFLAGS(conf, ldflags):
+def CHECK_LDFLAGS(conf, ldflags,
+ mandatory=False):
'''check if the given ldflags are accepted by the linker
'''
return conf.check(fragment='int main(void) { return 0; }\n',
execute=0,
ldflags=ldflags,
- mandatory=False,
+ mandatory=mandatory,
msg="Checking linker accepts %s" % ldflags)
@@ -813,11 +815,19 @@ int main(void) {
#
# The CFLAGS and LDFLAGS environment variables are also
# used for the configure checks which might impact their results.
+ #
+ # If these variables don't pass a smoke test, fail the configure
+
conf.add_os_flags('ADDITIONAL_CFLAGS')
- if conf.env.ADDITIONAL_CFLAGS and conf.CHECK_CFLAGS(conf.env['ADDITIONAL_CFLAGS']):
+ if conf.env.ADDITIONAL_CFLAGS:
+ conf.CHECK_CFLAGS(conf.env['ADDITIONAL_CFLAGS'],
+ mandatory=True)
conf.env['EXTRA_CFLAGS'].extend(conf.env['ADDITIONAL_CFLAGS'])
+
conf.add_os_flags('ADDITIONAL_LDFLAGS')
- if conf.env.ADDITIONAL_LDFLAGS and conf.CHECK_LDFLAGS(conf.env['ADDITIONAL_LDFLAGS']):
+ if conf.env.ADDITIONAL_LDFLAGS:
+ conf.CHECK_LDFLAGS(conf.env['ADDITIONAL_LDFLAGS'],
+ mandatory=True)
conf.env['EXTRA_LDFLAGS'].extend(conf.env['ADDITIONAL_LDFLAGS'])
if path is None: