From 5f87d5a3d0390eb6c9139f78125d223f3a70b7ef Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Fri, 26 Mar 2010 16:52:32 -0600 Subject: s3-waf: Added support dynconfig cflags Pair-Programmed-With: Andrew Tridgell --- source3/build/wscript | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'source3/build/wscript') diff --git a/source3/build/wscript b/source3/build/wscript index a4df794f3a..2940dd569d 100644 --- a/source3/build/wscript +++ b/source3/build/wscript @@ -1,6 +1,6 @@ #!/usr/bin/env python -import Options +import string, Utils, Options from dynconfig import * def set_options(opt): @@ -24,9 +24,29 @@ def configure(conf): conf.ASSERT(varname not in conf.env, "Variable %s already defined" % varname) conf.env[varname] = value + 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)) + conf.env[f] = v + def build(bld): cflags = dynconfig_cflags(bld) bld.SAMBA_SUBSYSTEM('DYNCONFIG', '../dynconfig.c', deps='replace talloc tdb', cflags=cflags) + +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 -- cgit