Skip to content

Commit

Permalink
build: allow specifying prerequisite flags when checking flags
Browse files Browse the repository at this point in the history
In gcc, "-Wformat-security" is ignored unless "-Wformat" is also
specified. This patch allow adding a "prerequisite flag" to a flag
we're testing during configuration.

Signed-off-by: Uri Simchoni <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
  • Loading branch information
urisimchoni authored and abartlet committed Nov 22, 2017
1 parent 90508f4 commit 34b4be0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions buildtools/wafsamba/samba_autoconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,26 +770,28 @@ def CONFIG_PATH(conf, name, default):
conf.env[name] = conf.env['PREFIX'] + default

@conf
def ADD_NAMED_CFLAGS(conf, name, flags, testflags=False):
def ADD_NAMED_CFLAGS(conf, name, flags, testflags=False, prereq_flags=[]):
'''add some CFLAGS to the command line
optionally set testflags to ensure all the flags work
'''
prereq_flags = TO_LIST(prereq_flags)
if testflags:
ok_flags=[]
for f in flags.split():
if CHECK_CFLAGS(conf, f):
if CHECK_CFLAGS(conf, [f] + prereq_flags):
ok_flags.append(f)
flags = ok_flags
if not name in conf.env:
conf.env[name] = []
conf.env[name].extend(TO_LIST(flags))

@conf
def ADD_CFLAGS(conf, flags, testflags=False):
def ADD_CFLAGS(conf, flags, testflags=False, prereq_flags=[]):
'''add some CFLAGS to the command line
optionally set testflags to ensure all the flags work
'''
ADD_NAMED_CFLAGS(conf, 'EXTRA_CFLAGS', flags, testflags=testflags)
ADD_NAMED_CFLAGS(conf, 'EXTRA_CFLAGS', flags, testflags=testflags,
prereq_flags=prereq_flags)

@conf
def ADD_LDFLAGS(conf, flags, testflags=False):
Expand Down

0 comments on commit 34b4be0

Please sign in to comment.