2010-03-28 09:48:49 +11:00
#!/usr/bin/env python
2010-03-26 16:52:32 -06:00
import string, Utils, Options
2010-03-23 18:26:49 -06:00
from dynconfig import *
def set_options(opt):
# get all the basic GNU options from the gnu_dirs tool
opt.tool_options('gnu_dirs')
for option in dir_options.keys():
default = dir_options[option][0]
help = dir_options[option][1]
varname = get_varname(option)
opt.add_option('--%s' % option,
help=(help + ' [%s]' % default),
action="store", dest=varname, default=default)
2010-04-07 07:34:12 -06:00
cflags_vars = [ 'CONFIGFILE' ]
2010-03-23 18:26:49 -06:00
def configure(conf):
# get all the basic GNU options from the gnu_dirs tool
conf.check_tool('gnu_dirs')
for option in dir_options.keys():
varname = get_varname(option)
value = getattr(Options.options, varname, None)
2011-01-07 00:05:27 +01:00
value = Utils.subst_vars(value, conf.env)
2010-03-23 18:26:49 -06:00
conf.ASSERT(value is not None, "Missing configure option %s" % varname)
conf.ASSERT(varname not in conf.env, "Variable %s already defined" % varname)
conf.env[varname] = value
2010-03-26 16:52:32 -06:00
for f in dyn_cflags.keys():
# substitute twice, as we could have substitutions containing variables
v = Utils.subst_vars(dyn_cflags[f], conf.env)
v = Utils.subst_vars(v, conf.env)
conf.ASSERT(v != '', "Empty dynconfig value for %s" % f)
conf.ASSERT(v.find('${') == -1, "Unsubstituted variable in %s : %s : %s" % (f, dyn_cflags[f], v))
2011-01-07 00:05:27 +01:00
if f not in conf.env:
conf.env[f] = v
2010-04-07 07:34:12 -06:00
if f in cflags_vars:
conf.DEFINE(f, v, quote=True)
2010-03-26 16:52:32 -06:00
2010-03-23 18:26:49 -06:00
def build(bld):
cflags = dynconfig_cflags(bld)
2011-02-09 15:56:20 +11:00
bld.SAMBA3_SUBSYSTEM('DYNCONFIG',
2010-03-23 18:26:49 -06:00
'../dynconfig.c',
2010-04-30 10:15:11 +02:00
deps='replace talloc tdb popt',
2010-03-23 18:26:49 -06:00
cflags=cflags)
2011-02-09 15:56:20 +11:00
bld.SAMBA3_SUBSYSTEM('LOCALE_DIR',
2010-09-19 22:35:26 +02:00
'../localedir.c',
2010-09-23 01:32:43 -07:00
cflags='-DLOCALEDIR=\"%s\"' % bld.env.LOCALEDIR)
2010-03-26 16:52:32 -06:00
def dynconfig_cflags(bld):
'''work out the extra CFLAGS for dynconfig.c'''
cflags = []
for f in dyn_cflags.keys():
# substitute twice, as we could have substitutions containing variables
v = Utils.subst_vars(dyn_cflags[f], bld.env)
v = Utils.subst_vars(v, bld.env)
bld.ASSERT(v != '', "Empty dynconfig value for %s" % f)
bld.ASSERT(v.find('${') == -1, "Unsubstituted variable in %s : %s : %s" % (f, dyn_cflags[f], v))
cflags.append('-D%s="%s"' % (f, v))
return cflags