s3-waf: add some missing tdb dependencies.
[kai/samba.git] / source3 / build / wscript
1 #!/usr/bin/env python
2
3 import string, Utils, Options
4 from dynconfig import *
5
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)
16
17
18 cflags_vars = [ 'CONFIGFILE' ]
19
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         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
30
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))
37         if f not in conf.env:
38             conf.env[f] = v
39         if f in cflags_vars:
40             conf.DEFINE(f, v, quote=True)
41
42 def build(bld):
43     cflags = dynconfig_cflags(bld)
44     bld.SAMBA3_SUBSYSTEM('DYNCONFIG',
45                         '../../dynconfig/dynconfig.c',
46                         deps='replace talloc tdb popt',
47                         cflags=cflags)
48
49
50 def dynconfig_cflags(bld):
51     '''work out the extra CFLAGS for dynconfig.c'''
52     cflags = []
53     for f in dyn_cflags.keys():
54         # substitute twice, as we could have substitutions containing variables
55         v = Utils.subst_vars(dyn_cflags[f], bld.env)
56         v = Utils.subst_vars(v, bld.env)
57         bld.ASSERT(v != '', "Empty dynconfig value for %s" % f)
58         bld.ASSERT(v.find('${') == -1, "Unsubstituted variable in %s : %s : %s" % (f, dyn_cflags[f], v))
59         cflags.append('-D%s="%s"' % (f, v))
60     return cflags