diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-03-07 22:52:13 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-04-06 20:26:44 +1000 |
commit | 1958a0987e5aa252eac6bffd1b829eb1405b9591 (patch) | |
tree | 50b5b6f17ab8523f18623b250e44977d6aad3fa4 /buildtools | |
parent | 481a299fc8c24fa57d3a8742c9d7e6a13808e506 (diff) | |
download | samba-1958a0987e5aa252eac6bffd1b829eb1405b9591.tar.gz samba-1958a0987e5aa252eac6bffd1b829eb1405b9591.tar.bz2 samba-1958a0987e5aa252eac6bffd1b829eb1405b9591.zip |
build: added CHECK_CFLAGS()
Diffstat (limited to 'buildtools')
-rw-r--r-- | buildtools/wafsamba/samba_autoconf.py | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py index 84f6a2d10f..b186804292 100644 --- a/buildtools/wafsamba/samba_autoconf.py +++ b/buildtools/wafsamba/samba_autoconf.py @@ -49,11 +49,14 @@ def CHECK_TYPES(conf, list): @conf -def CHECK_TYPE_IN(conf, t, hdr): +def CHECK_TYPE_IN(conf, t, hdr, define=None): '''check for a type in a specific header''' if conf.check(header_name=hdr): - conf.check(type_name=t, header_name=hdr) - return True + if define is None: + ret = conf.check(type_name=t, header_name=hdr) + else: + ret = conf.check(type_name=t, header_name=hdr, define_name=define) + return ret return False @@ -169,8 +172,8 @@ def CHECK_SIZEOF(conf, vars, headers=None, define=None): @conf def CHECK_CODE(conf, code, define, - always=False, execute=False, addmain=True, - headers=None, msg=None): + always=False, execute=False, addmain=True, mandatory=False, + headers=None, msg=None, cflags=''): '''check if some code compiles and/or runs''' hdrs='' if headers is not None: @@ -197,14 +200,17 @@ def CHECK_CODE(conf, code, define, if conf.check(fragment=fragment, execute=execute, - ccflags='-I%s' % conf.curdir, + define_name = define, + mandatory = mandatory, + ccflags='-I%s %s' % (conf.curdir, cflags), includes='# . ../default', msg=msg): conf.DEFINE(define, 1) return True - elif always: + if always: conf.DEFINE(define, 0) - return False + return False + @conf @@ -238,6 +244,18 @@ def CHECK_STRUCTURE_MEMBER(conf, structname, member, return False +@conf +def CHECK_CFLAGS(conf, cflags, variable): + '''check if the given cflags are accepted by the compiler''' + if conf.check(fragment='int main(void) { return 0; }', + execute=0, + ccflags=cflags, + msg="Checking compiler accepts %s" % cflags): + conf.env[variable] = cflags + return True + return False + + ################################################# # return True if a configuration option was found @conf |