|
gjcarneiro@537
|
1 |
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
|
|
gjcarneiro@537
|
2 |
import sys
|
|
gjc@4124
|
3 |
import Options
|
|
gjcarneiro@537
|
4 |
|
|
gjcarneiro@537
|
5 |
def configure(conf):
|
|
gjc@4064
|
6 |
if conf.check(header_name='stdlib.h'):
|
|
gjc@4064
|
7 |
conf.define('HAVE_STDLIB_H', 1)
|
|
gjc@4064
|
8 |
conf.define('HAVE_GETENV', 1)
|
|
gjcarneiro@537
|
9 |
|
|
gjc@4064
|
10 |
conf.check(header_name='signal.h', define_name='HAVE_SIGNAL_H')
|
|
gjcarneiro@537
|
11 |
|
|
gjc@4121
|
12 |
# Check for POSIX threads
|
|
gjc@4121
|
13 |
test_env = conf.env.copy()
|
|
craigdo@4300
|
14 |
if Options.platform != 'darwin' and Options.platform != 'cygwin':
|
|
gjc@4124
|
15 |
test_env.append_value('LINKFLAGS', '-pthread')
|
|
gjc@4124
|
16 |
test_env.append_value('CXXFLAGS', '-pthread')
|
|
gjc@4124
|
17 |
test_env.append_value('CCFLAGS', '-pthread')
|
|
gjc@4123
|
18 |
fragment = r"""
|
|
gjc@4121
|
19 |
#include <pthread.h>
|
|
gjc@4121
|
20 |
int main ()
|
|
gjc@4121
|
21 |
{
|
|
gjc@4121
|
22 |
pthread_mutex_t m;
|
|
gjc@4121
|
23 |
pthread_mutex_init (&m, NULL);
|
|
gjc@4121
|
24 |
return 0;
|
|
gjc@4121
|
25 |
}
|
|
gjc@4123
|
26 |
"""
|
|
gjc@4121
|
27 |
have_pthread = conf.check(header_name='pthread.h', define_name='HAVE_PTHREAD_H',
|
|
gjc@4121
|
28 |
env=test_env, fragment=fragment,
|
|
gjc@4121
|
29 |
errmsg='Could not find pthread support (build/config.log for details)',
|
|
gjc@4121
|
30 |
mandatory=False)
|
|
gjc@4121
|
31 |
if have_pthread:
|
|
gjc@4124
|
32 |
# darwin accepts -pthread but prints a warning saying it is ignored
|
|
craigdo@4300
|
33 |
if Options.platform != 'darwin' and Options.platform != 'cygwin':
|
|
gjc@4124
|
34 |
conf.env['CXXFLAGS_PTHREAD'] = '-pthread'
|
|
gjc@4124
|
35 |
conf.env['CCFLAGS_PTHREAD'] = '-pthread'
|
|
gjc@4124
|
36 |
conf.env['LINKFLAGS_PTHREAD'] = '-pthread'
|
|
gjc@4121
|
37 |
|
|
gjc@4121
|
38 |
conf.env['ENABLE_THREADING'] = have_pthread
|
|
craigdo@3425
|
39 |
|
|
gjc@3648
|
40 |
conf.report_optional_feature("Threading", "Threading Primitives",
|
|
gjc@3648
|
41 |
conf.env['ENABLE_THREADING'],
|
|
gjc@3648
|
42 |
"<pthread.h> include not detected")
|
|
gjc@3648
|
43 |
|
|
gjc@4531
|
44 |
conf.write_config_header('ns3/core-config.h', top=True)
|
|
gjcarneiro@537
|
45 |
|
|
gjcarneiro@537
|
46 |
def build(bld):
|
|
gjc@1217
|
47 |
core = bld.create_ns3_module('core')
|
|
gjcarneiro@537
|
48 |
core.source = [
|
|
craigdo@1498
|
49 |
'log.cc',
|
|
gjc@1018
|
50 |
'breakpoint.cc',
|
|
mathieu@2633
|
51 |
'type-id.cc',
|
|
mathieu@2633
|
52 |
'attribute-list.cc',
|
|
mathieu@2370
|
53 |
'object-base.cc',
|
|
riley@2775
|
54 |
'ref-count-base.cc',
|
|
gjcarneiro@537
|
55 |
'object.cc',
|
|
gjcarneiro@537
|
56 |
'test.cc',
|
|
gjcarneiro@537
|
57 |
'random-variable.cc',
|
|
gjcarneiro@537
|
58 |
'rng-stream.cc',
|
|
gjcarneiro@537
|
59 |
'command-line.cc',
|
|
gjcarneiro@537
|
60 |
'type-name.cc',
|
|
mathieu@2438
|
61 |
'attribute.cc',
|
|
mathieu@2452
|
62 |
'boolean.cc',
|
|
mathieu@2454
|
63 |
'integer.cc',
|
|
mathieu@2455
|
64 |
'uinteger.cc',
|
|
mathieu@2457
|
65 |
'enum.cc',
|
|
mathieu@2456
|
66 |
'double.cc',
|
|
mathieu@2502
|
67 |
'string.cc',
|
|
mathieu@2926
|
68 |
'pointer.cc',
|
|
mathieu@2965
|
69 |
'object-vector.cc',
|
|
mathieu@2395
|
70 |
'object-factory.cc',
|
|
mathieu@2467
|
71 |
'global-value.cc',
|
|
mathieu@2463
|
72 |
'trace-source-accessor.cc',
|
|
mathieu@2474
|
73 |
'config.cc',
|
|
mathieu@3763
|
74 |
'callback.cc',
|
|
craigdo@4147
|
75 |
'names.cc',
|
|
mathieu@4718
|
76 |
'vector.cc',
|
|
craigdo@5255
|
77 |
'attribute-test-suite.cc',
|
|
craigdo@5255
|
78 |
'callback-test-suite.cc',
|
|
craigdo@4772
|
79 |
'names-test-suite.cc',
|
|
craigdo@5248
|
80 |
'type-traits-test-suite.cc',
|
|
craigdo@5298
|
81 |
'traced-callback-test-suite.cc',
|
|
craigdo@5324
|
82 |
'ptr-test-suite.cc',
|
|
gjcarneiro@537
|
83 |
]
|
|
gjcarneiro@537
|
84 |
|
|
gjc@4064
|
85 |
headers = bld.new_task_gen('ns3header')
|
|
gjc@2609
|
86 |
headers.module = 'core'
|
|
gjcarneiro@537
|
87 |
headers.source = [
|
|
gjcarneiro@537
|
88 |
'system-wall-clock-ms.h',
|
|
gjc@760
|
89 |
'empty.h',
|
|
gjcarneiro@537
|
90 |
'callback.h',
|
|
mathieu@2370
|
91 |
'object-base.h',
|
|
mathieu@2776
|
92 |
'ref-count-base.h',
|
|
mathieu@5505
|
93 |
'simple-ref-count.h',
|
|
mathieu@2633
|
94 |
'type-id.h',
|
|
mathieu@2633
|
95 |
'attribute-list.h',
|
|
gjcarneiro@537
|
96 |
'ptr.h',
|
|
gjcarneiro@537
|
97 |
'object.h',
|
|
craigdo@1498
|
98 |
'log.h',
|
|
gjcarneiro@537
|
99 |
'assert.h',
|
|
gjc@1018
|
100 |
'breakpoint.h',
|
|
gjcarneiro@537
|
101 |
'fatal-error.h',
|
|
gjcarneiro@537
|
102 |
'test.h',
|
|
gjcarneiro@537
|
103 |
'random-variable.h',
|
|
gjcarneiro@537
|
104 |
'rng-stream.h',
|
|
gjcarneiro@537
|
105 |
'command-line.h',
|
|
gjcarneiro@537
|
106 |
'type-name.h',
|
|
mathieu@960
|
107 |
'type-traits.h',
|
|
mathieu@1680
|
108 |
'int-to-type.h',
|
|
mathieu@2438
|
109 |
'attribute.h',
|
|
mathieu@2449
|
110 |
'attribute-accessor-helper.h',
|
|
mathieu@2452
|
111 |
'boolean.h',
|
|
mathieu@2454
|
112 |
'integer.h',
|
|
mathieu@2455
|
113 |
'uinteger.h',
|
|
mathieu@2456
|
114 |
'double.h',
|
|
mathieu@2457
|
115 |
'enum.h',
|
|
mathieu@2502
|
116 |
'string.h',
|
|
mathieu@2926
|
117 |
'pointer.h',
|
|
mathieu@2395
|
118 |
'object-factory.h',
|
|
mathieu@2451
|
119 |
'attribute-helper.h',
|
|
mathieu@2467
|
120 |
'global-value.h',
|
|
mathieu@2482
|
121 |
'traced-callback.h',
|
|
mathieu@2482
|
122 |
'traced-value.h',
|
|
mathieu@2463
|
123 |
'trace-source-accessor.h',
|
|
mathieu@2474
|
124 |
'config.h',
|
|
mathieu@2477
|
125 |
'object-vector.h',
|
|
mathieu@3781
|
126 |
'deprecated.h',
|
|
mathieu@3781
|
127 |
'abort.h',
|
|
craigdo@4147
|
128 |
'names.h',
|
|
mathieu@4718
|
129 |
'vector.h',
|
|
mathieu@5486
|
130 |
'object-ref-count.h',
|
|
gjcarneiro@537
|
131 |
]
|
|
gjcarneiro@537
|
132 |
|
|
gjc@3648
|
133 |
if sys.platform == 'win32':
|
|
gjc@3648
|
134 |
core.source.extend([
|
|
gjc@3648
|
135 |
'win32-system-wall-clock-ms.cc',
|
|
gjc@3648
|
136 |
])
|
|
gjc@3648
|
137 |
else:
|
|
gjc@3648
|
138 |
core.source.extend([
|
|
gjc@3648
|
139 |
'unix-system-wall-clock-ms.cc',
|
|
gjc@3648
|
140 |
])
|
|
gjc@3648
|
141 |
|
|
gjc@4064
|
142 |
if bld.env['ENABLE_THREADING']:
|
|
gjc@3648
|
143 |
core.source.extend([
|
|
gjc@3648
|
144 |
'unix-system-thread.cc',
|
|
gjc@3648
|
145 |
'unix-system-mutex.cc',
|
|
gjc@3648
|
146 |
'unix-system-condition.cc',
|
|
gjc@3648
|
147 |
])
|
|
gjc@4121
|
148 |
core.uselib = 'PTHREAD'
|
|
gjc@3648
|
149 |
headers.source.extend([
|
|
gjc@3648
|
150 |
'system-mutex.h',
|
|
gjc@3648
|
151 |
'system-thread.h',
|
|
gjc@3648
|
152 |
'system-condition.h',
|
|
gjc@3648
|
153 |
])
|
|
gjc@3648
|
154 |
|
|
craigdo@4773
|
155 |
if bld.env['ENABLE_GSL']:
|
|
kovalenko@5238
|
156 |
core.uselib = 'GSL GSLCBLAS M'
|
|
craigdo@4773
|
157 |
core.source.extend(['rng-test-suite.cc'])
|