Add a summary of optional features at the end of the configuration stage.
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Fri, 05 Sep 2008 18:16:29 +0100
changeset 3625 30afad8324d5
parent 3624 422ce0c7bd20
child 3626 2438df52233e
Add a summary of optional features at the end of the configuration stage.
bindings/python/wscript
src/contrib/stats/wscript
src/contrib/wscript
src/internet-stack/wscript
wscript
--- a/bindings/python/wscript	Fri Sep 05 16:47:15 2008 +0100
+++ b/bindings/python/wscript	Fri Sep 05 18:16:29 2008 +0100
@@ -87,11 +87,15 @@
 def configure(conf):
     conf.env['ENABLE_PYTHON_BINDINGS'] = False
     if Params.g_options.python_disable:
+        conf.report_optional_feature("python", "Python Bindings", False,
+                                     "disabled by user request")
         return
 
     conf.check_tool('misc')
 
     if sys.platform == 'cygwin':
+        conf.report_optional_feature("python", "Python Bindings", False,
+                                     "unsupported platform 'cygwin'")
         warning("Python is not supported in CygWin environment.  Try MingW instead.")
         return
 
@@ -100,7 +104,8 @@
         conf.check_tool('python')
         conf.check_python_version((2,3))
         conf.check_python_headers()
-    except Configure.ConfigurationError:
+    except Configure.ConfigurationError, ex:
+        conf.report_optional_feature("python", "Python Bindings", False, str(ex))
         return
 
     ## Check for pybindgen
@@ -112,6 +117,8 @@
     except Configure.ConfigurationError:
         warning("pybindgen missing")
         if not fetch_pybindgen(conf):
+            conf.report_optional_feature("python", "Python Bindings", False,
+                                         "PyBindGen missing and could not be retrieved")
             return
     else:
         out = subprocess.Popen([conf.env['PYTHON'], "-c",
@@ -128,15 +135,20 @@
                     (pybindgen_version_str,
                      '.'.join([str(x) for x in REQUIRED_PYBINDGEN_VERSION])))
             if not fetch_pybindgen(conf):
+                conf.report_optional_feature("python", "Python Bindings", False,
+                                             "PyBindGen too old and newer version could not be retrieved")
                 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)
 
     ## Check for pygccxml
     try:
         conf.check_python_module('pygccxml')
     except Configure.ConfigurationError:
+        conf.report_optional_feature("pygccxml", "Python API Scanning Support", False,
+                                     "Missing 'pygccxml' Python module")
         return
 
     out = subprocess.Popen([conf.env['PYTHON'], "-c",
@@ -152,6 +164,8 @@
                 "automatic scanning of API definitions will not be possible" %
                 (pygccxml_version_str,
                  '.'.join([str(x) for x in REQUIRED_PYGCCXML_VERSION])))
+        conf.report_optional_feature("pygccxml", "Python API Scanning Support", False,
+                                     "pygccxml too old")
         return
     
 
@@ -159,6 +173,8 @@
     gccxml = conf.find_program('gccxml', var='GCCXML')
     if not gccxml:
         warning("gccxml missing; automatic scanning of API definitions will not be possible")
+        conf.report_optional_feature("pygccxml", "Python API Scanning Support", False,
+                                     "gccxml missing")
         return
 
     gccxml_version_line = os.popen(gccxml + " --version").readline().strip()
@@ -168,10 +184,13 @@
     conf.check_message('gccxml', 'version', True, gccxml_version)
     if not gccxml_version_ok:
         warning("gccxml too old, need version >= 0.9; automatic scanning of API definitions will not be possible")
+        conf.report_optional_feature("pygccxml", "Python API Scanning Support", False,
+                                     "gccxml too old")
         return
     
     ## If we reached
     conf.env['ENABLE_PYTHON_SCANNING'] = True
+    conf.report_optional_feature("pygccxml", "Python API Scanning Support", True, None)
 
 
 prio_headers = {
--- a/src/contrib/stats/wscript	Fri Sep 05 16:47:15 2008 +0100
+++ b/src/contrib/stats/wscript	Fri Sep 05 18:16:29 2008 +0100
@@ -7,6 +7,10 @@
    e.define = 'SQLITE3'
    e.uselib = 'SQLITE3'
    conf.env['SQLITE_STATS'] = e.run()
+   conf.report_optional_feature("SqliteDataOutput", "SQlite stats data output",
+                                conf.env['SQLITE_STATS'],
+                                "library 'sqlite3' not found")
+
 
 def build(bld):
     obj = bld.create_ns3_module('stats', ['node'])
--- a/src/contrib/wscript	Fri Sep 05 16:47:15 2008 +0100
+++ b/src/contrib/wscript	Fri Sep 05 18:16:29 2008 +0100
@@ -6,6 +6,10 @@
     check.uselib = 'GTK_CONFIG_STORE'
     check.mandatory = False
     conf.env['ENABLE_GTK_CONFIG_STORE'] = check.run()
+    conf.report_optional_feature("GtkConfigStore", "GtkConfigStore",
+                                 conf.env['ENABLE_GTK_CONFIG_STORE'],
+                                 "library 'gtk+-2.0 >= 2.12' not found")
+
     conf.sub_config('stats')
 
 def build(bld):
--- a/src/internet-stack/wscript	Fri Sep 05 16:47:15 2008 +0100
+++ b/src/internet-stack/wscript	Fri Sep 05 18:16:29 2008 +0100
@@ -37,6 +37,8 @@
         e.run()
 
     if not Params.g_options.nsc:
+        conf.report_optional_feature("nsc", "Network Simulation Cradle", False,
+                                     "--nsc configure option not given")
 	return
 
     check_nsc_buildutils()
@@ -55,6 +57,8 @@
         e.run()
         ok = True
     conf.check_message('NSC supported architecture', arch, ok)
+    conf.report_optional_feature("nsc", "Network Simulation Cradle", ok,
+                                 "architecture %r not supported" % arch)
     nsc_fetch()
 
 
--- a/wscript	Fri Sep 05 16:47:15 2008 +0100
+++ b/wscript	Fri Sep 05 18:16:29 2008 +0100
@@ -197,8 +197,16 @@
     if not ok: # if it doesn't accept, remove it again
         conf.env['CXXFLAGS'] = save_CXXFLAGS
     
+def report_optional_feature(conf, name, caption, was_enabled, reason_not_enabled):
+    conf.env.append_value('NS3_OPTIONAL_FEATURES', (name, caption, was_enabled, reason_not_enabled))
 
 def configure(conf):
+    
+    # attach some extra methods
+    conf.check_compilation_flag = types.MethodType(check_compilation_flag, conf)
+    conf.report_optional_feature = types.MethodType(report_optional_feature, conf)
+    conf.env['NS3_OPTIONAL_FEATURES'] = []
+
     conf.env['NS3_BUILDDIR'] = conf.m_blddir
     conf.check_tool('compiler_cxx')
 
@@ -271,6 +279,15 @@
     ## we cannot run regression tests without diff
     conf.find_program('diff', var='DIFF')
 
+    # Write a summary of optional features status
+    print "---- Summary of optional NS-3 features:"
+    for (name, caption, was_enabled, reason_not_enabled) in conf.env['NS3_OPTIONAL_FEATURES']:
+        if was_enabled:
+            status = 'enabled'
+        else:
+            status = 'not enabled (%s)' % reason_not_enabled
+        print "%-30s: %s" % (caption, status)
+
 
 def create_ns3_program(bld, name, dependencies=('simulator',)):
     program = bld.create_obj('cpp', 'program')