s3-waf: Add helper that facilitates defining --with-x and --without-x options
[gd/samba-autobuild/.git] / buildtools / wafsamba / samba3.py
1 # a waf tool to add autoconf-like macros to the configure section
2 # and for SAMBA_ macros for building libraries, binaries etc
3
4 import Options
5 from optparse import SUPPRESS_HELP
6
7 def SAMBA3_ADD_OPTION(opt, option, help=(), dest=None, default=True):
8     if help == ():
9         help = ("Build with %s support" % option)
10     if dest is None:
11         dest = "with_%s" % option
12
13     with_val = "--with-%s" % option
14     without_val = "--without-%s" % option
15
16     opt.add_option(with_val, help=help, action="store_true", dest=dest,
17                    default=default)
18     opt.add_option(without_val, help=SUPPRESS_HELP, action="store_false",
19                    dest=dest)
20 Options.Handler.SAMBA3_ADD_OPTION = SAMBA3_ADD_OPTION