diff --git a/src/wscript b/src/wscript index 22b343d0e..3c85d4d26 100644 --- a/src/wscript +++ b/src/wscript @@ -83,13 +83,14 @@ def configure(conf): def create_ns3_module(bld, name, dependencies=()): - module = bld.new_task_gen('cxx') + module = bld.new_task_gen('cxx', 'cc') module.name = 'ns3-' + name module.target = module.name module.add_objects = ['ns3-' + dep for dep in dependencies] module.module_deps = list(dependencies) if not module.env['ENABLE_STATIC_NS3']: module.env.append_value('CXXFLAGS', module.env['shlib_CXXFLAGS']) + module.env.append_value('CCFLAGS', module.env['shlib_CXXFLAGS']) elif module.env['CXX_NAME'] in ['gcc', 'icc'] and \ os.uname()[4] == 'x86_64' and \ module.env['ENABLE_PYTHON_BINDINGS']: @@ -97,8 +98,10 @@ def create_ns3_module(bld, name, dependencies=()): # when gcc is present and only when we want python bindings # (it's more efficient to not use this option if we can avoid it) module.env.append_value('CXXFLAGS', '-mcmodel=large') + module.env.append_value('CCFLAGS', '-mcmodel=large') module.env.append_value('CXXDEFINES', "NS3_MODULE_COMPILATION") + module.env.append_value('CCDEFINES', "NS3_MODULE_COMPILATION") return module def create_obj(bld, *args): diff --git a/wscript b/wscript index 6295c6299..f9bb09b95 100644 --- a/wscript +++ b/wscript @@ -112,6 +112,7 @@ def dist_hook(): def set_options(opt): # options provided by the modules + opt.tool_options('compiler_cc') opt.tool_options('compiler_cxx') opt.tool_options('cflags') @@ -236,6 +237,7 @@ def configure(conf): conf.env['NS3_OPTIONAL_FEATURES'] = [] conf.env['NS3_BUILDDIR'] = conf.blddir + conf.check_tool('compiler_cc') conf.check_tool('compiler_cxx') conf.check_tool('cflags') try: @@ -388,6 +390,10 @@ def configure(conf): conf.env.append_value('CXXDEFINES', "ENABLE_GSL") conf.env.append_value('CCDEFINES', "ENABLE_GSL") + # for compiling C code, copy over the CXX* flags + conf.env.append_value('CCFLAGS', conf.env['CXXFLAGS']) + conf.env.append_value('CCDEFINES', conf.env['CXXDEFINES']) + # append user defined flags after all our ones for (confvar, envvar) in [['CCFLAGS', 'CCFLAGS_EXTRA'], ['CXXFLAGS', 'CXXFLAGS_EXTRA'],