1 # a waf tool to add autoconf-like macros to the configure section
2 # and for SAMBA_ macros for building libraries, binaries etc
6 from optparse
import SUPPRESS_HELP
8 def SAMBA3_ADD_OPTION(opt
, option
, help=(), dest
=None, default
=True,
9 with_name
="with", without_name
="without"):
11 help = ("Build with %s support" % option
)
13 dest
= "with_%s" % option
.replace('-', '_')
15 with_val
= "--%s-%s" % (with_name
, option
)
16 without_val
= "--%s-%s" % (without_name
, option
)
18 #FIXME: This is broken and will always default to "default" no matter if
19 # --with or --without is chosen.
20 opt
.add_option(with_val
, help=help, action
="store_true", dest
=dest
,
22 opt
.add_option(without_val
, help=SUPPRESS_HELP
, action
="store_false",
24 Options
.Handler
.SAMBA3_ADD_OPTION
= SAMBA3_ADD_OPTION
26 def SAMBA3_IS_STATIC_MODULE(bld
, module
):
27 '''Check whether module is in static list'''
28 if module
.lower() in bld
.env
['static_modules']:
31 Build
.BuildContext
.SAMBA3_IS_STATIC_MODULE
= SAMBA3_IS_STATIC_MODULE
33 def SAMBA3_IS_SHARED_MODULE(bld
, module
):
34 '''Check whether module is in shared list'''
35 if module
.lower() in bld
.env
['shared_modules']:
38 Build
.BuildContext
.SAMBA3_IS_SHARED_MODULE
= SAMBA3_IS_SHARED_MODULE
40 def SAMBA3_IS_ENABLED_MODULE(bld
, module
):
41 '''Check whether module is in either shared or static list '''
42 return SAMBA3_IS_STATIC_MODULE(bld
, module
) or SAMBA3_IS_SHARED_MODULE(bld
, module
)
43 Build
.BuildContext
.SAMBA3_IS_ENABLED_MODULE
= SAMBA3_IS_ENABLED_MODULE