3 import string, Utils, Options
4 from dynconfig import *
7 # get all the basic GNU options from the gnu_dirs tool
8 opt.tool_options('gnu_dirs')
9 for option in dir_options.keys():
10 default = dir_options[option][0]
11 help = dir_options[option][1]
12 varname = get_varname(option)
13 opt.add_option('--%s' % option,
14 help=(help + ' [%s]' % default),
15 action="store", dest=varname, default=default)
18 cflags_vars = [ 'CONFIGFILE' ]
21 # get all the basic GNU options from the gnu_dirs tool
22 conf.check_tool('gnu_dirs')
23 for option in dir_options.keys():
24 varname = get_varname(option)
25 value = getattr(Options.options, varname, None)
26 value = Utils.subst_vars(value, conf.env)
27 conf.ASSERT(value is not None, "Missing configure option %s" % varname)
28 conf.ASSERT(varname not in conf.env, "Variable %s already defined" % varname)
29 conf.env[varname] = value
31 for f in dyn_cflags.keys():
32 # substitute twice, as we could have substitutions containing variables
33 v = Utils.subst_vars(dyn_cflags[f], conf.env)
34 v = Utils.subst_vars(v, conf.env)
35 conf.ASSERT(v != '', "Empty dynconfig value for %s" % f)
36 conf.ASSERT(v.find('${') == -1, "Unsubstituted variable in %s : %s : %s" % (f, dyn_cflags[f], v))
40 conf.DEFINE(f, v, quote=True)
43 cflags = dynconfig_cflags(bld)
44 bld.SAMBA_SUBSYSTEM('DYNCONFIG',
46 deps='replace talloc tdb popt',
48 bld.SAMBA_SUBSYSTEM('LOCALE_DIR',
50 cflags='-DLOCALEDIR=\"%s\"' % bld.env.LOCALEDIR)
53 def dynconfig_cflags(bld):
54 '''work out the extra CFLAGS for dynconfig.c'''
56 for f in dyn_cflags.keys():
57 # substitute twice, as we could have substitutions containing variables
58 v = Utils.subst_vars(dyn_cflags[f], bld.env)
59 v = Utils.subst_vars(v, bld.env)
60 bld.ASSERT(v != '', "Empty dynconfig value for %s" % f)
61 bld.ASSERT(v.find('${') == -1, "Unsubstituted variable in %s : %s : %s" % (f, dyn_cflags[f], v))
62 cflags.append('-D%s="%s"' % (f, v))