2010-04-11 11:35:08 +04:00
# a waf tool to add autoconf-like macros to the configure section
# and for SAMBA_ macros for building libraries, binaries etc
import Options
2010-09-26 12:44:27 +04:00
import Build
2010-04-11 11:35:08 +04:00
from optparse import SUPPRESS_HELP
2010-04-11 12:34:12 +04:00
def SAMBA3_ADD_OPTION ( opt , option , help = ( ) , dest = None , default = True ,
with_name = " with " , without_name = " without " ) :
2010-04-11 11:35:08 +04:00
if help == ( ) :
help = ( " Build with %s support " % option )
if dest is None :
2010-04-30 16:21:28 +04:00
dest = " with_ %s " % option . replace ( ' - ' , ' _ ' )
2010-04-11 11:35:08 +04:00
2010-04-11 12:34:12 +04:00
with_val = " -- %s - %s " % ( with_name , option )
without_val = " -- %s - %s " % ( without_name , option )
2010-04-11 11:35:08 +04:00
2010-04-30 16:22:06 +04:00
#FIXME: This is broken and will always default to "default" no matter if
# --with or --without is chosen.
2010-04-11 11:35:08 +04:00
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
2010-09-26 12:44:27 +04:00
def SAMBA3_IS_STATIC_MODULE ( bld , module ) :
''' Check whether module is in static list '''
2010-12-01 14:10:03 +03:00
if module in bld . env [ ' static_modules ' ] :
2010-09-26 12:44:27 +04:00
return True
return False
Build . BuildContext . SAMBA3_IS_STATIC_MODULE = SAMBA3_IS_STATIC_MODULE
def SAMBA3_IS_SHARED_MODULE ( bld , module ) :
''' Check whether module is in shared list '''
2010-12-01 14:10:03 +03:00
if module in bld . env [ ' shared_modules ' ] :
2010-09-26 12:44:27 +04:00
return True
return False
Build . BuildContext . SAMBA3_IS_SHARED_MODULE = SAMBA3_IS_SHARED_MODULE
def SAMBA3_IS_ENABLED_MODULE ( bld , module ) :
''' Check whether module is in either shared or static list '''
return SAMBA3_IS_STATIC_MODULE ( bld , module ) or SAMBA3_IS_SHARED_MODULE ( bld , module )
Build . BuildContext . SAMBA3_IS_ENABLED_MODULE = SAMBA3_IS_ENABLED_MODULE