build: added define and always options to CHECK_VARIABLE()
authorAndrew Tridgell <tridge@samba.org>
Sun, 7 Mar 2010 02:48:33 +0000 (13:48 +1100)
committerAndrew Tridgell <tridge@samba.org>
Tue, 6 Apr 2010 10:26:41 +0000 (20:26 +1000)
buildtools/wafsamba/samba_autoconf.py

index 3d18d2e2509da1e29024d98011bef81fbdececd7..898264e474469123e4af5c7bb200fd76ed0d09bb 100644 (file)
@@ -43,15 +43,20 @@ def CHECK_TYPE(conf, t, alternate):
         conf.DEFINE(t, alternate)
 
 @conf
-def CHECK_VARIABLE(conf, v):
+def CHECK_VARIABLE(conf, v, define=None, always=False):
     hdrs=''
     for h in conf.env.hlist:
         hdrs += '#include <%s>\n' % h
+    if define is None:
+        define = 'HAVE_%s' % v.upper()
     if conf.check(fragment=
                   '%s\nint main(void) {void *_x; _x=(void *)&%s; return 0;}\n' % (hdrs, v),
                   execute=0,
                   msg="Checking for variable %s" % v):
-        conf.DEFINE('HAVE_%s' % v.upper(), 1)
+        conf.DEFINE(define, 1)
+    elif always:
+        conf.DEFINE(define, 0)
+
 
 @runonce
 def CHECK_FUNC(conf, f):