2007-05-07 12:01:51 +01:00
|
|
|
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
|
|
|
|
|
import sys
|
2009-01-25 15:39:36 +00:00
|
|
|
import Options
|
2007-05-07 12:01:51 +01:00
|
|
|
|
|
|
|
|
def configure(conf):
|
2008-12-29 13:28:54 +00:00
|
|
|
if conf.check(header_name='stdlib.h'):
|
|
|
|
|
conf.define('HAVE_STDLIB_H', 1)
|
|
|
|
|
conf.define('HAVE_GETENV', 1)
|
2007-05-07 12:01:51 +01:00
|
|
|
|
2008-12-29 13:28:54 +00:00
|
|
|
conf.check(header_name='signal.h', define_name='HAVE_SIGNAL_H')
|
2007-05-07 12:01:51 +01:00
|
|
|
|
2009-01-24 19:25:33 +00:00
|
|
|
# Check for POSIX threads
|
|
|
|
|
test_env = conf.env.copy()
|
2009-03-27 09:58:04 -07:00
|
|
|
if Options.platform != 'darwin' and Options.platform != 'cygwin':
|
2009-01-25 15:39:36 +00:00
|
|
|
test_env.append_value('LINKFLAGS', '-pthread')
|
|
|
|
|
test_env.append_value('CXXFLAGS', '-pthread')
|
|
|
|
|
test_env.append_value('CCFLAGS', '-pthread')
|
2009-01-25 14:52:09 +00:00
|
|
|
fragment = r"""
|
2009-01-24 19:25:33 +00:00
|
|
|
#include <pthread.h>
|
|
|
|
|
int main ()
|
|
|
|
|
{
|
|
|
|
|
pthread_mutex_t m;
|
|
|
|
|
pthread_mutex_init (&m, NULL);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2009-01-25 14:52:09 +00:00
|
|
|
"""
|
2009-01-24 19:25:33 +00:00
|
|
|
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:
|
2009-01-25 15:39:36 +00:00
|
|
|
# darwin accepts -pthread but prints a warning saying it is ignored
|
2009-03-27 09:58:04 -07:00
|
|
|
if Options.platform != 'darwin' and Options.platform != 'cygwin':
|
2009-01-25 15:39:36 +00:00
|
|
|
conf.env['CXXFLAGS_PTHREAD'] = '-pthread'
|
|
|
|
|
conf.env['CCFLAGS_PTHREAD'] = '-pthread'
|
|
|
|
|
conf.env['LINKFLAGS_PTHREAD'] = '-pthread'
|
2007-08-02 13:59:08 +01:00
|
|
|
|
2009-01-24 19:25:33 +00:00
|
|
|
conf.env['ENABLE_THREADING'] = have_pthread
|
2007-05-07 12:01:51 +01:00
|
|
|
|
2008-09-08 12:19:46 +01:00
|
|
|
conf.report_optional_feature("Threading", "Threading Primitives",
|
|
|
|
|
conf.env['ENABLE_THREADING'],
|
|
|
|
|
"<pthread.h> include not detected")
|
|
|
|
|
|
2009-06-12 12:33:37 +01:00
|
|
|
conf.write_config_header('ns3/core-config.h', top=True)
|
2007-05-07 12:01:51 +01:00
|
|
|
|
|
|
|
|
def build(bld):
|
2007-08-08 15:10:36 +01:00
|
|
|
core = bld.create_ns3_module('core')
|
2007-05-07 12:01:51 +01:00
|
|
|
core.source = [
|
2007-09-12 16:24:31 -07:00
|
|
|
'log.cc',
|
2007-08-02 13:59:08 +01:00
|
|
|
'breakpoint.cc',
|
2008-03-16 20:55:18 +01:00
|
|
|
'type-id.cc',
|
|
|
|
|
'attribute-list.cc',
|
2008-01-30 17:25:06 +01:00
|
|
|
'object-base.cc',
|
2008-03-27 15:28:54 -07:00
|
|
|
'ref-count-base.cc',
|
2007-05-07 12:01:51 +01:00
|
|
|
'ptr.cc',
|
|
|
|
|
'object.cc',
|
|
|
|
|
'test.cc',
|
|
|
|
|
'random-variable.cc',
|
|
|
|
|
'rng-stream.cc',
|
|
|
|
|
'command-line.cc',
|
|
|
|
|
'type-name.cc',
|
2008-02-20 21:45:42 +01:00
|
|
|
'attribute.cc',
|
2008-02-21 18:57:34 +01:00
|
|
|
'boolean.cc',
|
2008-02-21 19:04:18 +01:00
|
|
|
'integer.cc',
|
2008-02-21 19:09:05 +01:00
|
|
|
'uinteger.cc',
|
2008-02-21 19:16:00 +01:00
|
|
|
'enum.cc',
|
2008-02-21 19:13:39 +01:00
|
|
|
'double.cc',
|
2008-02-27 21:41:34 +01:00
|
|
|
'string.cc',
|
2008-04-09 11:46:04 -07:00
|
|
|
'pointer.cc',
|
2008-02-11 04:26:09 +01:00
|
|
|
'object-vector.cc',
|
2008-04-17 13:42:25 -07:00
|
|
|
'object-factory.cc',
|
2008-02-23 05:23:59 +01:00
|
|
|
'global-value.cc',
|
2008-02-22 00:08:00 +01:00
|
|
|
'trace-source-accessor.cc',
|
2008-02-26 01:07:16 +01:00
|
|
|
'config.cc',
|
2008-10-17 14:15:52 +02:00
|
|
|
'callback.cc',
|
2009-01-22 23:07:34 -08:00
|
|
|
'names.cc',
|
2009-08-14 11:53:23 +02:00
|
|
|
'vector.cc',
|
2009-09-23 15:20:23 -07:00
|
|
|
'attribute-test-suite.cc',
|
2009-09-25 14:10:28 -07:00
|
|
|
'callback-test-suite.cc',
|
|
|
|
|
'names-test-suite.cc',
|
2009-09-24 23:48:35 -07:00
|
|
|
'type-traits-test-suite.cc',
|
2009-09-29 20:45:27 -07:00
|
|
|
'traced-callback-test-suite.cc',
|
2007-05-07 12:01:51 +01:00
|
|
|
]
|
|
|
|
|
|
2008-12-29 13:28:54 +00:00
|
|
|
headers = bld.new_task_gen('ns3header')
|
2007-12-26 13:40:39 +00:00
|
|
|
headers.module = 'core'
|
2007-05-07 12:01:51 +01:00
|
|
|
headers.source = [
|
|
|
|
|
'system-wall-clock-ms.h',
|
2007-06-12 14:05:01 +01:00
|
|
|
'empty.h',
|
2007-05-07 12:01:51 +01:00
|
|
|
'callback.h',
|
2008-01-30 17:25:06 +01:00
|
|
|
'object-base.h',
|
2008-03-27 15:32:15 -07:00
|
|
|
'ref-count-base.h',
|
2008-03-16 20:55:18 +01:00
|
|
|
'type-id.h',
|
|
|
|
|
'attribute-list.h',
|
2007-05-07 12:01:51 +01:00
|
|
|
'ptr.h',
|
|
|
|
|
'object.h',
|
2007-09-12 16:24:31 -07:00
|
|
|
'log.h',
|
2007-05-07 12:01:51 +01:00
|
|
|
'assert.h',
|
2007-08-02 13:59:08 +01:00
|
|
|
'breakpoint.h',
|
2007-05-07 12:01:51 +01:00
|
|
|
'fatal-error.h',
|
|
|
|
|
'test.h',
|
|
|
|
|
'random-variable.h',
|
|
|
|
|
'rng-stream.h',
|
|
|
|
|
'command-line.h',
|
|
|
|
|
'type-name.h',
|
2007-07-23 14:41:34 +02:00
|
|
|
'type-traits.h',
|
2007-09-28 10:32:59 +02:00
|
|
|
'int-to-type.h',
|
2008-02-20 21:45:42 +01:00
|
|
|
'attribute.h',
|
2008-02-21 18:44:27 +01:00
|
|
|
'attribute-accessor-helper.h',
|
2008-02-21 18:57:34 +01:00
|
|
|
'boolean.h',
|
2008-02-21 19:04:18 +01:00
|
|
|
'integer.h',
|
2008-02-21 19:09:05 +01:00
|
|
|
'uinteger.h',
|
2008-02-21 19:13:39 +01:00
|
|
|
'double.h',
|
2008-02-21 19:16:00 +01:00
|
|
|
'enum.h',
|
2008-02-27 21:41:34 +01:00
|
|
|
'string.h',
|
2008-04-09 11:46:04 -07:00
|
|
|
'pointer.h',
|
2008-02-08 02:22:04 +01:00
|
|
|
'object-factory.h',
|
2008-02-21 18:54:02 +01:00
|
|
|
'attribute-helper.h',
|
2008-02-23 05:23:59 +01:00
|
|
|
'global-value.h',
|
2008-02-26 19:51:33 +01:00
|
|
|
'traced-callback.h',
|
|
|
|
|
'traced-value.h',
|
2008-02-22 00:08:00 +01:00
|
|
|
'trace-source-accessor.h',
|
2008-02-26 01:07:16 +01:00
|
|
|
'config.h',
|
2008-02-26 18:03:44 +01:00
|
|
|
'object-vector.h',
|
2008-10-24 10:29:06 +02:00
|
|
|
'deprecated.h',
|
|
|
|
|
'abort.h',
|
2009-01-22 23:07:34 -08:00
|
|
|
'names.h',
|
2009-08-14 11:53:23 +02:00
|
|
|
'vector.h',
|
2007-05-07 12:01:51 +01:00
|
|
|
]
|
|
|
|
|
|
2008-09-08 12:19:46 +01:00
|
|
|
if sys.platform == 'win32':
|
|
|
|
|
core.source.extend([
|
|
|
|
|
'win32-system-wall-clock-ms.cc',
|
|
|
|
|
])
|
|
|
|
|
else:
|
|
|
|
|
core.source.extend([
|
|
|
|
|
'unix-system-wall-clock-ms.cc',
|
|
|
|
|
])
|
|
|
|
|
|
2008-12-29 13:28:54 +00:00
|
|
|
if bld.env['ENABLE_THREADING']:
|
2008-09-08 12:19:46 +01:00
|
|
|
core.source.extend([
|
|
|
|
|
'unix-system-thread.cc',
|
|
|
|
|
'unix-system-mutex.cc',
|
|
|
|
|
'unix-system-condition.cc',
|
|
|
|
|
])
|
2009-01-24 19:25:33 +00:00
|
|
|
core.uselib = 'PTHREAD'
|
2008-09-08 12:19:46 +01:00
|
|
|
headers.source.extend([
|
|
|
|
|
'system-mutex.h',
|
|
|
|
|
'system-thread.h',
|
|
|
|
|
'system-condition.h',
|
|
|
|
|
])
|
|
|
|
|
|
2009-09-12 20:00:36 -07:00
|
|
|
if bld.env['ENABLE_GSL']:
|
2009-09-23 20:48:43 +04:00
|
|
|
core.uselib = 'GSL GSLCBLAS M'
|
2009-09-12 20:00:36 -07:00
|
|
|
core.source.extend(['rng-test-suite.cc'])
|