branch merge
This commit is contained in:
commit
6b7eeeff77
38 files changed
+344
-409
No files matched your search
+28
-4
@@ -1,6 +1,6 @@
|
||||
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
|
||||
import sys
|
||||
|
||||
import Options
|
||||
|
||||
def configure(conf):
|
||||
if conf.check(header_name='stdlib.h'):
|
||||
@@ -9,9 +9,33 @@ def configure(conf):
|
||||
|
||||
conf.check(header_name='signal.h', define_name='HAVE_SIGNAL_H')
|
||||
|
||||
conf.check(lib='rt', uselib='RT', define_name='HAVE_RT')
|
||||
# Check for POSIX threads
|
||||
test_env = conf.env.copy()
|
||||
if Options.platform != 'darwin':
|
||||
test_env.append_value('LINKFLAGS', '-pthread')
|
||||
test_env.append_value('CXXFLAGS', '-pthread')
|
||||
test_env.append_value('CCFLAGS', '-pthread')
|
||||
fragment = r"""
|
||||
#include <pthread.h>
|
||||
int main ()
|
||||
{
|
||||
pthread_mutex_t m;
|
||||
pthread_mutex_init (&m, NULL);
|
||||
return 0;
|
||||
}
|
||||
"""
|
||||
have_pthread = conf.check(header_name='pthread.h', define_name='HAVE_PTHREAD_H',
|
||||
env=test_env, fragment=fragment,
|
||||
errmsg='Could not find pthread support (build/config.log for details)',
|
||||
mandatory=False)
|
||||
if have_pthread:
|
||||
# darwin accepts -pthread but prints a warning saying it is ignored
|
||||
if Options.platform != 'darwin':
|
||||
conf.env['CXXFLAGS_PTHREAD'] = '-pthread'
|
||||
conf.env['CCFLAGS_PTHREAD'] = '-pthread'
|
||||
conf.env['LINKFLAGS_PTHREAD'] = '-pthread'
|
||||
|
||||
conf.env['ENABLE_THREADING'] = conf.check(header_name='pthread.h', define_name='HAVE_PTHREAD_H')
|
||||
conf.env['ENABLE_THREADING'] = have_pthread
|
||||
|
||||
conf.report_optional_feature("Threading", "Threading Primitives",
|
||||
conf.env['ENABLE_THREADING'],
|
||||
@@ -55,7 +79,6 @@ def build(bld):
|
||||
'callback.cc',
|
||||
'names.cc',
|
||||
]
|
||||
core.uselib = 'RT'
|
||||
|
||||
headers = bld.new_task_gen('ns3header')
|
||||
headers.module = 'core'
|
||||
@@ -117,6 +140,7 @@ def build(bld):
|
||||
'unix-system-mutex.cc',
|
||||
'unix-system-condition.cc',
|
||||
])
|
||||
core.uselib = 'PTHREAD'
|
||||
headers.source.extend([
|
||||
'system-mutex.h',
|
||||
'system-thread.h',
|
||||
|
||||
Reference in new issue
Block a user