From 4b4b121366394e2d646698364676721fe325b390 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Thu, 21 Jun 2007 11:59:55 +0100 Subject: [PATCH 1/3] WAF: be careful not to set gcc-specific flags (like -Werror) when using a non-gcc compiler. --- wscript | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wscript b/wscript index d67039a54..7802dbce8 100644 --- a/wscript +++ b/wscript @@ -59,7 +59,6 @@ def configure(conf): if not conf.check_tool('compiler_cxx'): Params.fatal("No suitable compiler found") - # create the second environment, set the variant and set its name variant_env = conf.env.copy() variant_name = Params.g_options.debug_level.lower() @@ -79,13 +78,17 @@ def configure(conf): conf.setenv(variant_name) variant_env.append_value('CXXDEFINES', 'RUN_SELF_TESTS') - variant_env.append_value('CXXFLAGS', ['-Wall', '-Werror']) + + if os.path.basename(conf.env['CXX']).startswith("g++"): + variant_env.append_value('CXXFLAGS', ['-Wall', '-Werror']) + if 'debug' in Params.g_options.debug_level.lower(): variant_env.append_value('CXXDEFINES', 'NS3_DEBUG_ENABLE') variant_env.append_value('CXXDEFINES', 'NS3_ASSERT_ENABLE') if sys.platform == 'win32': - variant_env.append_value("LINKFLAGS", "-Wl,--enable-runtime-pseudo-reloc") + if os.path.basename(conf.env['CXX']).startswith("g++"): + variant_env.append_value("LINKFLAGS", "-Wl,--enable-runtime-pseudo-reloc") conf.sub_config('src') From ffa52a935a0a534b2d4e0ec046d25a9f84a6df2c Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Thu, 21 Jun 2007 12:26:46 +0100 Subject: [PATCH 2/3] WAF: simplify --debug-level option to only have debug and optimized as possible values (debug becomes the former ultradebug); Add a warning to some options help text saying they only work in configure. --- wscript | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/wscript b/wscript index 7802dbce8..b5be10dda 100644 --- a/wscript +++ b/wscript @@ -7,6 +7,7 @@ import shutil import Params import Object import pproc as subprocess +import optparse Params.g_autoconfig = 1 @@ -23,11 +24,32 @@ def dist_hook(srcdir, blddir): shutil.rmtree("doc/latex") def set_options(opt): + + def debug_option_callback(option, opt, value, parser): + if value == 'debug': + setattr(parser.values, option.dest, 'ultradebug') + elif value == 'optimized': + setattr(parser.values, option.dest, 'optimized') + else: + raise optparse.OptionValueError("allowed --debug-level values" + " are debug, optimized.") + + opt.add_option('-d', '--debug-level', + action='callback', + type=str, dest='debug_level', default='debug', + help=('Specify the debug level, does nothing if CFLAGS is set' + ' in the environment. [Allowed Values: debug, optimized].' + ' WARNING: this option only has effect ' + 'with the configure command.'), + callback=debug_option_callback) + # options provided by the modules opt.tool_options('compiler_cxx') opt.add_option('--enable-gcov', - help=('Enable code coverage analysis'), + help=('Enable code coverage analysis.' + ' WARNING: this option only has effect ' + 'with the configure command.'), action="store_true", default=False, dest='enable_gcov') @@ -61,7 +83,11 @@ def configure(conf): # create the second environment, set the variant and set its name variant_env = conf.env.copy() - variant_name = Params.g_options.debug_level.lower() + debug_level = Params.g_options.debug_level.lower() + if debug_level == 'ultradebug': + variant_name = 'debug' + else: + variant_name = debug_level if Params.g_options.enable_gcov: variant_name += '-gcov' From 7c1e148ffa0311df3df15456d95f8bf0b87ccbed Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Thu, 21 Jun 2007 12:33:50 +0100 Subject: [PATCH 3/3] WAF: add a warning to the --high-precision-as-double option help text saying they it works in configure. --- src/simulator/wscript | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/simulator/wscript b/src/simulator/wscript index 3f038d813..fec0412c0 100644 --- a/src/simulator/wscript +++ b/src/simulator/wscript @@ -7,7 +7,9 @@ import Params def set_options(opt): opt.add_option('--high-precision-as-double', help=('Whether to use a double floating point' - ' type for high precision time values'), + ' type for high precision time values' + ' WARNING: this option only has effect ' + 'with the configure command.'), action="store_true", default=False, dest='high_precision_as_double')