wscript
changeset 6099 b37a72870f2d
parent 6001 d563aaa88bc0
child 6113 0ce37bf4f1c1
--- a/wscript	Tue Mar 02 10:58:19 2010 +0300
+++ b/wscript	Tue Mar 02 15:29:53 2010 +0000
@@ -207,18 +207,23 @@
     opt.sub_options('src/internet-stack')
 
 
-def _check_compilation_flag(conf, flag):
+def _check_compilation_flag(conf, flag, mode='cxx'):
     """
     Checks if the C++ compiler accepts a certain compilation flag or flags
     flag: can be a string or a list of strings
     """
 
     env = conf.env.copy()
-    env.append_value('CXXFLAGS', flag)
+    if mode == 'cxx':
+        fname = 'test.cc'
+        env.append_value('CXXFLAGS', flag)
+    else:
+        fname = 'test.c'
+        env.append_value('CCFLAGS', flag)
     try:
         retval = conf.run_c_code(code='#include <stdio.h>\nint main() { return 0; }\n',
-                                 env=env, compile_filename='test.cc',
-                                 compile_mode='cxx',type='cprogram', execute=False)
+                                 env=env, compile_filename=fname,
+                                 compile_mode=mode, type='cprogram', execute=False)
     except Configure.ConfigurationError:
         ok = False
     else:
@@ -279,10 +284,6 @@
     conf.setenv(variant_name)
     env = variant_env
 
-    if env['COMPILER_CXX'] == 'g++' and 'CXXFLAGS' not in os.environ:
-        if conf.check_compilation_flag('-Wno-error=deprecated-declarations'):
-            env.append_value('CXXFLAGS', '-Wno-error=deprecated-declarations')
-        
     if Options.options.build_profile == 'debug':
         env.append_value('CXXDEFINES', 'NS3_ASSERT_ENABLE')
         env.append_value('CXXDEFINES', 'NS3_LOG_ENABLE')
@@ -392,6 +393,13 @@
     conf.env.append_value('CCFLAGS', conf.env['CXXFLAGS'])
     conf.env.append_value('CCDEFINES', conf.env['CXXDEFINES'])
 
+    if env['COMPILER_CXX'] == 'g++' and 'CXXFLAGS' not in os.environ:
+        if conf.check_compilation_flag('-Wno-error=deprecated-declarations', mode='cxx'):
+            env.append_value('CXXFLAGS', '-Wno-error=deprecated-declarations')
+    if env['COMPILER_CC'] == 'gcc' and 'CCFLAGS' not in os.environ:
+        if conf.check_compilation_flag('-Wno-error=deprecated-declarations', mode='cc'):
+            env.append_value('CCFLAGS', '-Wno-error=deprecated-declarations')        
+
     # append user defined flags after all our ones
     for (confvar, envvar) in [['CCFLAGS', 'CCFLAGS_EXTRA'],
                               ['CXXFLAGS', 'CXXFLAGS_EXTRA'],