attempt to detect broken --enable-static invocations.
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Mon, 04 May 2009 20:21:37 +0200
changeset 4436 56fc927210c6
parent 4433 41a18c7aecfc
child 4437 3e4e052d5058
attempt to detect broken --enable-static invocations.
wscript
--- a/wscript	Fri May 01 09:07:04 2009 -0700
+++ b/wscript	Mon May 04 20:21:37 2009 +0200
@@ -290,9 +290,36 @@
 
     conf.find_program('valgrind', var='VALGRIND')
 
-    if Options.options.enable_static and \
-            env['PLATFORM'].startswith('linux'):
-        conf.env['ENABLE_STATIC_NS3'] = Options.options.enable_static
+    env['ENABLE_STATIC_NS3'] = False
+    if Options.options.enable_static:
+        if env['PLATFORM'].startswith('linux') and \
+                env['CXX_NAME'] == 'gcc':
+            if os.uname()[4] == 'i386':
+                conf.report_optional_feature("static", "Static build", True,
+                                             "Enabled by user request")
+                env['ENABLE_STATIC_NS3'] = True
+            elif os.uname()[4] == 'x86_64':
+                if env['ENABLE_PYTHON_BINDINGS'] and \
+                        not conf.check_compilation_flag('-mcmodel=large'):
+                    conf.report_optional_feature("static", "Static build", False,
+                                                 "Can't enable static builds because " + \
+                                                     "of python and no -mcmodel=large compiler " \
+                                                     "option. Try --disable-python or upgrade your " \
+                                                     "compiler.")
+                else:
+                    conf.report_optional_feature("static", "Static build", True,
+                                                 "Enabled by user request. Try --disable-python " \
+                                                     "to get higher performance.")
+                    env['ENABLE_STATIC_NS3'] = True
+                    
+        else:
+            conf.report_optional_feature("static", "Static build", False,
+                                         "Unsupported platform")
+    else:
+        conf.report_optional_feature("static", "Static build", False,
+                                     "option --enable-static not selected")
+
+
 
     # Write a summary of optional features status
     print "---- Summary of optional NS-3 features:"