# HG changeset patch # User Gustavo J. A. M. Carneiro # Date 1220872786 -3600 # Node ID f912b24ddf2d1d563208de5e5d1ba72d67d90680 # Parent cd704871a4edf0957d07089177c0dd17f10a08a5 Detect the pthread.h header file and automatically disable components that cannot build without it. diff -r cd704871a4ed -r f912b24ddf2d bindings/python/ns3modulegen.py --- a/bindings/python/ns3modulegen.py Mon Sep 08 11:20:17 2008 +0100 +++ b/bindings/python/ns3modulegen.py Mon Sep 08 12:19:46 2008 +0100 @@ -126,6 +126,15 @@ except KeyError: pass + if 'Threading' not in enabled_features: + for clsname in ['SystemThread', 'SystemMutex', 'SystemCondition', 'CriticalSection']: + root_module.classes.remove(root_module['ns3::%s' % clsname]) + + if 'RealTime' not in enabled_features: + for clsname in ['WallClockSynchronizer', 'RealtimeSimulatorImpl', 'RealtimeEventLock']: + root_module.classes.remove(root_module['ns3::%s' % clsname]) + root_module.enums.remove(root_module['ns3::RealtimeSimulatorImpl::SynchronizationMode']) + root_module.generate(out, '_ns3') out.close() diff -r cd704871a4ed -r f912b24ddf2d src/core/wscript --- a/src/core/wscript Mon Sep 08 11:20:17 2008 +0100 +++ b/src/core/wscript Mon Sep 08 12:19:46 2008 +0100 @@ -28,6 +28,15 @@ e.uselib = 'RT' e.run() + e = conf.create_header_configurator() + e.mandatory = False + e.name = 'pthread.h' + e.define = 'HAVE_PTHREAD_H' + conf.env['ENABLE_THREADING'] = e.run() + conf.report_optional_feature("Threading", "Threading Primitives", + conf.env['ENABLE_THREADING'], + " include not detected") + conf.write_config_header('ns3/core-config.h') def build(bld): @@ -66,24 +75,9 @@ ] core.uselib = 'RT' - if sys.platform == 'win32': - core.source.extend([ - 'win32-system-wall-clock-ms.cc', - ]) - else: - core.source.extend([ - 'unix-system-thread.cc', - 'unix-system-mutex.cc', - 'unix-system-condition.cc', - 'unix-system-wall-clock-ms.cc', - ]) - headers = bld.create_obj('ns3header') headers.module = 'core' headers.source = [ - 'system-mutex.h', - 'system-thread.h', - 'system-condition.h', 'system-wall-clock-ms.h', 'empty.h', 'callback.h', @@ -124,3 +118,24 @@ 'deprecated.h' ] + if sys.platform == 'win32': + core.source.extend([ + 'win32-system-wall-clock-ms.cc', + ]) + else: + core.source.extend([ + 'unix-system-wall-clock-ms.cc', + ]) + + if bld.env()['ENABLE_THREADING']: + core.source.extend([ + 'unix-system-thread.cc', + 'unix-system-mutex.cc', + 'unix-system-condition.cc', + ]) + headers.source.extend([ + 'system-mutex.h', + 'system-thread.h', + 'system-condition.h', + ]) + diff -r cd704871a4ed -r f912b24ddf2d src/simulator/event-impl.h --- a/src/simulator/event-impl.h Mon Sep 08 11:20:17 2008 +0100 +++ b/src/simulator/event-impl.h Mon Sep 08 12:19:46 2008 +0100 @@ -21,7 +21,6 @@ #define EVENT_IMPL_H #include -#include "ns3/system-mutex.h" namespace ns3 { diff -r cd704871a4ed -r f912b24ddf2d src/simulator/wscript --- a/src/simulator/wscript Mon Sep 08 11:20:17 2008 +0100 +++ b/src/simulator/wscript Mon Sep 08 12:19:46 2008 +0100 @@ -44,6 +44,9 @@ conf.write_config_header('ns3/simulator-config.h') + conf.report_optional_feature("RealTime", "Real Time Simulator", + conf.env['ENABLE_THREADING'], + "threading not enabled") def build(bld): @@ -59,11 +62,9 @@ 'event-impl.cc', 'simulator.cc', 'default-simulator-impl.cc', - 'realtime-simulator-impl.cc', 'timer.cc', 'watchdog.cc', 'synchronizer.cc', - 'wall-clock-synchronizer.cc', ] headers = bld.create_obj('ns3header') @@ -76,7 +77,6 @@ 'simulator.h', 'simulator-impl.h', 'default-simulator-impl.h', - 'realtime-simulator-impl.h', 'scheduler.h', 'list-scheduler.h', 'map-scheduler.h', @@ -86,7 +86,6 @@ 'timer-impl.h', 'watchdog.h', 'synchronizer.h', - 'wall-clock-synchronizer.h', ] env = bld.env_of_name('default') @@ -107,3 +106,13 @@ 'cairo-wideint-private.h', ]) + if env['ENABLE_THREADING']: + headers.source.extend([ + 'realtime-simulator-impl.h', + 'wall-clock-synchronizer.h', + ]) + sim.source.extend([ + 'realtime-simulator-impl.cc', + 'wall-clock-synchronizer.cc', + ]) +