summaryrefslogtreecommitdiff
path: root/buildtools
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-03-07 16:18:33 +1100
committerAndrew Tridgell <tridge@samba.org>2010-04-06 20:26:43 +1000
commit2dfced59d56eae96540bb8721ccfa50487dbdd40 (patch)
treec43eccfc8582d15962e554401ada2cffc7cd518c /buildtools
parent572fc43a4ac14fba4f721d49d0363b377e678901 (diff)
downloadsamba-2dfced59d56eae96540bb8721ccfa50487dbdd40.tar.gz
samba-2dfced59d56eae96540bb8721ccfa50487dbdd40.tar.bz2
samba-2dfced59d56eae96540bb8721ccfa50487dbdd40.zip
build: added CHECK_CODE_COMPILES()
Diffstat (limited to 'buildtools')
-rw-r--r--buildtools/wafsamba/samba_autoconf.py27
1 files changed, 27 insertions, 0 deletions
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
@@ -166,6 +166,33 @@ def CHECK_SIZEOF(conf, vars, headers=None, define=None):
@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):
'''check for a structure member'''