5fa4c0fa74c675f5548b040602f69f3f718a54d9
[mat/samba.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                       with_name="with", without_name="without"):
9     if help == ():
10         help = ("Build with %s support" % option)
11     if dest is None:
12         dest = "with_%s" % option.replace('-', '_')
13
14     with_val = "--%s-%s" % (with_name, option)
15     without_val = "--%s-%s" % (without_name, option)
16
17     #FIXME: This is broken and will always default to "default" no matter if
18     # --with or --without is chosen.
19     opt.add_option(with_val, help=help, action="store_true", dest=dest,
20                    default=default)
21     opt.add_option(without_val, help=SUPPRESS_HELP, action="store_false",
22                    dest=dest)
23 Options.Handler.SAMBA3_ADD_OPTION = SAMBA3_ADD_OPTION