s3-waf: Add helper that facilitates defining --with-x and --without-x options
authorKai Blin <kai@samba.org>
Sun, 11 Apr 2010 07:35:08 +0000 (09:35 +0200)
committerKai Blin <kai@samba.org>
Thu, 20 May 2010 20:16:13 +0000 (22:16 +0200)
buildtools/wafsamba/samba3.py [new file with mode: 0644]
source3/wscript

diff --git a/buildtools/wafsamba/samba3.py b/buildtools/wafsamba/samba3.py
new file mode 100644 (file)
index 0000000..ebf2565
--- /dev/null
@@ -0,0 +1,20 @@
+# a waf tool to add autoconf-like macros to the configure section
+# and for SAMBA_ macros for building libraries, binaries etc
+
+import Options
+from optparse import SUPPRESS_HELP
+
+def SAMBA3_ADD_OPTION(opt, option, help=(), dest=None, default=True):
+    if help == ():
+        help = ("Build with %s support" % option)
+    if dest is None:
+        dest = "with_%s" % option
+
+    with_val = "--with-%s" % option
+    without_val = "--without-%s" % option
+
+    opt.add_option(with_val, help=help, action="store_true", dest=dest,
+                   default=default)
+    opt.add_option(without_val, help=SUPPRESS_HELP, action="store_false",
+                   dest=dest)
+Options.Handler.SAMBA3_ADD_OPTION = SAMBA3_ADD_OPTION
index 5b582b5f49145ea6c5d41e7083e0f8504a3713da..bb17c7cccbda5eac6b8b4ded4f49c80e15c4357e 100644 (file)
@@ -4,10 +4,12 @@ srcdir = '..'
 blddir = 'bin'
 
 import sys, os
+from optparse import SUPPRESS_HELP
 sys.path.insert(0, srcdir+"/buildtools/wafsamba")
 import wafsamba, Options
 import build.charset
 from samba_utils import *
+from samba3 import *
 
 def set_options(opt):
     opt.BUILTIN_DEFAULT('NONE')
@@ -25,6 +27,10 @@ def set_options(opt):
                    help=("Comma-separated list of names of modules to build shared"),
                    action="store", dest='shared_modules', default='')
 
+    opt.SAMBA3_ADD_OPTION('winbind')
+    opt.SAMBA3_ADD_OPTION('ads')
+    opt.SAMBA3_ADD_OPTION('cups')
+
 
 def configure(conf):
     conf.define('PACKAGE_NAME', 'Samba')
@@ -269,13 +275,14 @@ yp_get_default_domain
         else:
             conf.DEFINE('static_init_%s' % p, '{}')
 
-    #TODO: Actually check for these
-    conf.DEFINE('WITH_WINBIND', '1')
+    if Options.options.with_winbind:
+        conf.DEFINE('WITH_WINBIND', '1')
+
     conf.DEFINE('WITH_ADS', '1')
 
     # Look for CUPS
     conf.find_program('cups-config', var='CUPS_CONFIG')
-    if conf.env.CUPS_CONFIG:
+    if conf.env.CUPS_CONFIG and Options.options.with_cups:
         conf.check_cfg(path="cups-config", args="--cflags --ldflags --libs",
                        package="", uselib_store="cups")
         conf.CHECK_HEADERS('cups/cups.h cups/language.h', lib='cups')