Detect the pthread.h header file and automatically disable components that cannot build without it.

This commit is contained in:
Gustavo J. A. M. Carneiro
2008-09-08 12:19:46 +01:00
parent 8b080ef574
commit e1f187d38a
4 changed files with 52 additions and 20 deletions

View File

@@ -126,6 +126,15 @@ def main():
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()

View File

@@ -28,6 +28,15 @@ def configure(conf):
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'],
"<pthread.h> include not detected")
conf.write_config_header('ns3/core-config.h')
def build(bld):
@@ -66,24 +75,9 @@ def build(bld):
]
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 @@ def build(bld):
'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',
])

View File

@@ -21,7 +21,6 @@
#define EVENT_IMPL_H
#include <stdint.h>
#include "ns3/system-mutex.h"
namespace ns3 {

View File

@@ -44,6 +44,9 @@ def configure(conf):
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 @@ def build(bld):
'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 @@ def build(bld):
'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 @@ def build(bld):
'timer-impl.h',
'watchdog.h',
'synchronizer.h',
'wall-clock-synchronizer.h',
]
env = bld.env_of_name('default')
@@ -107,3 +106,13 @@ def build(bld):
'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',
])