s3-auth: Simplify how we free the auth_context
[Samba.git] / source3 / build / wscript
blobf27e279d6b4facab3d1eca4e53eea6f6600ba0fc
1 #!/usr/bin/env python
3 import string, Utils, Options
4 from dynconfig import *
6 def set_options(opt):
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' ]
20 def configure(conf):
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 conf.ASSERT(value is not None, "Missing configure option %s" % varname)
27 conf.ASSERT(varname not in conf.env, "Variable %s already defined" % varname)
28 conf.env[varname] = value
30 for f in dyn_cflags.keys():
31 # substitute twice, as we could have substitutions containing variables
32 v = Utils.subst_vars(dyn_cflags[f], conf.env)
33 v = Utils.subst_vars(v, conf.env)
34 conf.ASSERT(v != '', "Empty dynconfig value for %s" % f)
35 conf.ASSERT(v.find('${') == -1, "Unsubstituted variable in %s : %s : %s" % (f, dyn_cflags[f], v))
36 conf.env[f] = v
37 if f in cflags_vars:
38 conf.DEFINE(f, v, quote=True)
40 def build(bld):
41 cflags = dynconfig_cflags(bld)
42 bld.SAMBA_SUBSYSTEM('DYNCONFIG',
43 '../dynconfig.c',
44 deps='replace talloc tdb popt',
45 cflags=cflags)
47 def dynconfig_cflags(bld):
48 '''work out the extra CFLAGS for dynconfig.c'''
49 cflags = []
50 for f in dyn_cflags.keys():
51 # substitute twice, as we could have substitutions containing variables
52 v = Utils.subst_vars(dyn_cflags[f], bld.env)
53 v = Utils.subst_vars(v, bld.env)
54 bld.ASSERT(v != '', "Empty dynconfig value for %s" % f)
55 bld.ASSERT(v.find('${') == -1, "Unsubstituted variable in %s : %s : %s" % (f, dyn_cflags[f], v))
56 cflags.append('-D%s="%s"' % (f, v))
57 return cflags