Bug 1076 - Waf gives an error if you enable only a single module
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Sun, 20 Mar 2011 13:01:40 +0000
changeset 6919 82217d4007bc
parent 6918 614b5388a1ae
child 6920 b1b821ae64c1
Bug 1076 - Waf gives an error if you enable only a single module
bindings/python/wscript
wscript
--- a/bindings/python/wscript	Sun Mar 20 12:18:15 2011 +0000
+++ b/bindings/python/wscript	Sun Mar 20 13:01:40 2011 +0000
@@ -88,6 +88,12 @@
                                      "disabled by user request")
         return
 
+    enabled_modules = list(conf.env['NS3_ENABLED_MODULES'])
+    enabled_modules.sort()
+    available_modules = list(conf.env['NS3_MODULES'])
+    available_modules.sort()
+    all_modules_enabled = (enabled_modules == available_modules)
+
     conf.check_tool('misc')
 
     if sys.platform == 'cygwin':
@@ -204,11 +210,20 @@
                                      "No apidefs are available that can be used in this system")
         return
 
+
+    conf.env['BINDINGS_TYPE'] = Options.options.bindings_type
+
+    if not all_modules_enabled:
+        if conf.env['BINDINGS_TYPE'] == 'both':
+            conf.env['BINDINGS_TYPE'] = 'modular'
+        elif conf.env['BINDINGS_TYPE'] == 'monolithic':
+            conf.report_optional_feature("python", "Python Bindings", False, "Monolithic python bindings need all ns-3 modules to be enabled")
+            return
+            
     ## If all has gone well, we finally enable the Python bindings
     conf.env['ENABLE_PYTHON_BINDINGS'] = True
     conf.report_optional_feature("python", "Python Bindings", True, None)
 
-    conf.env['BINDINGS_TYPE'] = Options.options.bindings_type
     if conf.env['BINDINGS_TYPE'] == 'both':
         msg = "monolithic and modular"
     else:
--- a/wscript	Sun Mar 20 12:18:15 2011 +0000
+++ b/wscript	Sun Mar 20 13:01:40 2011 +0000
@@ -280,7 +280,6 @@
                 env['WL_SONAME_SUPPORTED'] = True
 
     conf.sub_config('src')
-    conf.sub_config('bindings/python')
 
     # Set the list of enabled modules.
     if Options.options.enable_modules:
@@ -296,6 +295,7 @@
             # Enable the modules from the list.
             conf.env['NS3_ENABLED_MODULES'] = ['ns3-'+mod for mod in
                                                modules_enabled]
+    conf.sub_config('bindings/python')
 
     # for MPI
     conf.find_program('mpic++', var='MPI')