From 2dfced59d56eae96540bb8721ccfa50487dbdd40 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 7 Mar 2010 16:18:33 +1100 Subject: build: added CHECK_CODE_COMPILES() --- buildtools/wafsamba/samba_autoconf.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'buildtools') diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py index c5114e5a28..3dc2a30884 100644 --- a/buildtools/wafsamba/samba_autoconf.py +++ b/buildtools/wafsamba/samba_autoconf.py @@ -165,6 +165,33 @@ def CHECK_SIZEOF(conf, vars, headers=None, define=None): msg="Checking size of %s" % v) +@conf +def CHECK_CODE_COMPILES(conf, code, define, + always=False, headers=None): + '''check if some code compiles''' + hdrs='' + if headers is not None: + hlist = to_list(headers) + else: + hlist = conf.env.hlist + for h in hlist: + hdrs += '#include <%s>\n' % h + if conf.check(fragment=''' + %s + int main(void) { + %s; + return 0; + } + ''' % (hdrs, code), + execute=0, + msg="Checking %s" % define): + conf.DEFINE(define, 1) + return True + elif always: + conf.DEFINE(define, 0) + return False + + @conf def CHECK_STRUCTURE_MEMBER(conf, structname, member, always=False, define=None, headers=None): -- cgit