View | Details | Raw Unified | Return to bug 1562
Collapse All | Expand All

(-)a/bindings/python/wscript (-30 / +18 lines)
 Lines 6-30    Link Here 
6
import shutil
6
import shutil
7
import sys
7
import sys
8
8
9
import Task
9
from waflib import Task, Options, Configure, TaskGen, Logs, Build, Utils, Errors
10
import Options
10
from waflib.Errors import WafError
11
import Configure
12
import TaskGen
13
import Logs
14
import Build
15
import Utils
16
11
17
from waflib.Errors import WafError
12
feature  = TaskGen.feature
13
after = TaskGen.after
18
14
19
## https://launchpad.net/pybindgen/
15
## https://launchpad.net/pybindgen/
20
REQUIRED_PYBINDGEN_VERSION = (0, 15, 0, 809)
16
REQUIRED_PYBINDGEN_VERSION = (0, 15, 0, 809)
21
REQUIRED_PYGCCXML_VERSION = (0, 9, 5)
17
REQUIRED_PYGCCXML_VERSION = (0, 9, 5)
22
18
23
19
24
from TaskGen import feature, after
25
import Task
26
27
28
20
29
def add_to_python_path(path):
21
def add_to_python_path(path):
30
    if os.environ.get('PYTHONPATH', ''):
22
    if os.environ.get('PYTHONPATH', ''):
 Lines 38-44    Link Here 
38
30
39
31
40
def options(opt):
32
def options(opt):
41
    opt.tool_options('python')
33
    opt.load('python')
42
    opt.add_option('--disable-python',
34
    opt.add_option('--disable-python',
43
                   help=("Don't build Python bindings."),
35
                   help=("Don't build Python bindings."),
44
                   action="store_true", default=False,
36
                   action="store_true", default=False,
 Lines 76-82    Link Here 
76
    available_modules.sort()
68
    available_modules.sort()
77
    all_modules_enabled = (enabled_modules == available_modules)
69
    all_modules_enabled = (enabled_modules == available_modules)
78
70
79
    conf.check_tool('misc', tooldir=['waf-tools'])
71
    conf.load('misc', tooldir=['waf-tools'])
80
72
81
    if sys.platform == 'cygwin':
73
    if sys.platform == 'cygwin':
82
        conf.report_optional_feature("python", "Python Bindings", False,
74
        conf.report_optional_feature("python", "Python Bindings", False,
 Lines 91-110    Link Here 
91
        conf.env.PYTHON = Options.options.with_python
83
        conf.env.PYTHON = Options.options.with_python
92
84
93
    try:
85
    try:
94
        conf.check_tool('python')
86
        conf.load('python')
95
    except Configure.ConfigurationError, ex:
87
    except Errors.ConfigurationError, ex:
96
        conf.report_optional_feature("python", "Python Bindings", False,
88
        conf.report_optional_feature("python", "Python Bindings", False,
97
                                     "The python interpreter was not found")
89
                                     "The python interpreter was not found")
98
        return
90
        return
99
    try:
91
    try:
100
        conf.check_python_version((2,3))
92
        conf.check_python_version((2,3))
101
    except Configure.ConfigurationError, ex:
93
    except Errors.ConfigurationError, ex:
102
        conf.report_optional_feature("python", "Python Bindings", False,
94
        conf.report_optional_feature("python", "Python Bindings", False,
103
                                     "The python found version is too low (2.3 required)")
95
                                     "The python found version is too low (2.3 required)")
104
        return
96
        return
105
    try:
97
    try:
106
        conf.check_python_headers()
98
        conf.check_python_headers()
107
    except Configure.ConfigurationError, ex:
99
    except Errors.ConfigurationError, ex:
108
        conf.report_optional_feature("python", "Python Bindings", False,
100
        conf.report_optional_feature("python", "Python Bindings", False,
109
                                     "Python library or headers missing")
101
                                     "Python library or headers missing")
110
        return
102
        return
 Lines 161-167    Link Here 
161
153
162
    try:
154
    try:
163
        conf.check_python_module('pybindgen')
155
        conf.check_python_module('pybindgen')
164
    except Configure.ConfigurationError:
156
    except Errors.ConfigurationError:
165
        Logs.warn("pybindgen missing => no python bindings")
157
        Logs.warn("pybindgen missing => no python bindings")
166
        conf.report_optional_feature("python", "Python Bindings", False,
158
        conf.report_optional_feature("python", "Python Bindings", False,
167
                                     "PyBindGen missing")
159
                                     "PyBindGen missing")
 Lines 197-205    Link Here 
197
189
198
        try:
190
        try:
199
            ret = conf.run_c_code(code=test_program,
191
            ret = conf.run_c_code(code=test_program,
200
                                  env=conf.env.copy(), compile_filename='test.cc',
192
                                  env=conf.env.derive(), compile_filename='test.cc',
201
                                  features='cxx cprogram', execute=False)
193
                                  features='cxx cprogram', execute=False)
202
        except Configure.ConfigurationError:
194
        except Errors.ConfigurationError:
203
            ret = 1
195
            ret = 1
204
        conf.msg('Checking for types %s and %s equivalence' % (t1, t2), (ret and 'no' or 'yes'))
196
        conf.msg('Checking for types %s and %s equivalence' % (t1, t2), (ret and 'no' or 'yes'))
205
        return not ret
197
        return not ret
 Lines 250-256    Link Here 
250
    ## Check for pygccxml
242
    ## Check for pygccxml
251
    try:
243
    try:
252
        conf.check_python_module('pygccxml')
244
        conf.check_python_module('pygccxml')
253
    except Configure.ConfigurationError:
245
    except Errors.ConfigurationError:
254
        conf.report_optional_feature("pygccxml", "Python API Scanning Support", False,
246
        conf.report_optional_feature("pygccxml", "Python API Scanning Support", False,
255
                                     "Missing 'pygccxml' Python module")
247
                                     "Missing 'pygccxml' Python module")
256
        return
248
        return
 Lines 322-328    Link Here 
322
    """Uses gccxml to scan the file 'everything.h' and extract API definitions.
314
    """Uses gccxml to scan the file 'everything.h' and extract API definitions.
323
    """
315
    """
324
    after = 'gen_ns3_module_header ns3header'
316
    after = 'gen_ns3_module_header ns3header'
325
    before = 'cc cxx command'
317
    before = 'cxx command'
326
    color = "BLUE"
318
    color = "BLUE"
327
    def __init__(self, curdirnode, env, bld, target, cflags, module):
319
    def __init__(self, curdirnode, env, bld, target, cflags, module):
328
        self.bld = bld
320
        self.bld = bld
 Lines 393-399    Link Here 
393
    """Tasks that waits for the python-scan-* tasks to complete and then signals WAF to exit
385
    """Tasks that waits for the python-scan-* tasks to complete and then signals WAF to exit
394
    """
386
    """
395
    after = 'apiscan'
387
    after = 'apiscan'
396
    before = 'cc cxx'
388
    before = 'cxx'
397
    color = "BLUE"
389
    color = "BLUE"
398
    def __init__(self, curdirnode, env, bld):
390
    def __init__(self, curdirnode, env, bld):
399
        self.bld = bld
391
        self.bld = bld
 Lines 415-421    Link Here 
415
407
416
class gen_ns3_compat_pymod_task(Task.Task):
408
class gen_ns3_compat_pymod_task(Task.Task):
417
    """Generates a 'ns3.py' compatibility module."""
409
    """Generates a 'ns3.py' compatibility module."""
418
    before = 'cc cxx'
410
    before = 'cxx'
419
    color = 'BLUE'
411
    color = 'BLUE'
420
    
412
    
421
    def run(self):
413
    def run(self):
 Lines 437-444    Link Here 
437
        return
429
        return
438
430
439
    env = bld.env
431
    env = bld.env
440
    curdir = bld.path.abspath()
441
442
    set_pybindgen_pythonpath(env)
432
    set_pybindgen_pythonpath(env)
443
433
444
    if Options.options.apiscan:
434
    if Options.options.apiscan:
 Lines 489-497    Link Here 
489
        grp = bld.get_group(bld.current_group)
479
        grp = bld.get_group(bld.current_group)
490
        grp.append(task)
480
        grp.append(task)
491
481
492
        bld.new_task_gen(features='copy',
482
        bld(features='copy', source="ns__init__.py", target='ns/__init__.py')
493
                         source="ns__init__.py",
494
                         target='ns/__init__.py')
495
        bld.install_as('${PYTHONARCHDIR}/ns/__init__.py', 'ns__init__.py')
483
        bld.install_as('${PYTHONARCHDIR}/ns/__init__.py', 'ns__init__.py')
496
484
497
485
(-)a/src/antenna/wscript (-1 / +1 lines)
 Lines 21-27    Link Here 
21
        'test/test-parabolic-antenna.cc',
21
        'test/test-parabolic-antenna.cc',
22
        ]
22
        ]
23
    
23
    
24
    headers = bld.new_task_gen(features=['ns3header'])
24
    headers = bld(features='ns3header')
25
    headers.module = 'antenna'
25
    headers.module = 'antenna'
26
    headers.source = [
26
    headers.source = [
27
        'model/angles.h',
27
        'model/angles.h',
(-)a/src/aodv/wscript (-2 / +2 lines)
 Lines 23-29    Link Here 
23
        'test/loopback.cc',
23
        'test/loopback.cc',
24
        ]
24
        ]
25
25
26
    headers = bld.new_task_gen(features=['ns3header'])
26
    headers = bld(features='ns3header')
27
    headers.module = 'aodv'
27
    headers.module = 'aodv'
28
    headers.source = [
28
    headers.source = [
29
        'model/aodv-id-cache.h',
29
        'model/aodv-id-cache.h',
 Lines 37-42    Link Here 
37
        ]
37
        ]
38
38
39
    if bld.env['ENABLE_EXAMPLES']:
39
    if bld.env['ENABLE_EXAMPLES']:
40
        bld.add_subdirs('examples')
40
        bld.recurse('examples')
41
41
42
    bld.ns3_python_bindings()
42
    bld.ns3_python_bindings()
(-)a/src/applications/wscript (-1 / +1 lines)
 Lines 32-38    Link Here 
32
        'test/udp-client-server-test.cc',
32
        'test/udp-client-server-test.cc',
33
        ]
33
        ]
34
34
35
    headers = bld.new_task_gen(features=['ns3header'])
35
    headers = bld(features='ns3header')
36
    headers.module = 'applications'
36
    headers.module = 'applications'
37
    headers.source = [
37
    headers.source = [
38
        'model/bulk-send-application.h',
38
        'model/bulk-send-application.h',
(-)a/src/bridge/wscript (-2 / +2 lines)
 Lines 7-13    Link Here 
7
        'model/bridge-channel.cc',
7
        'model/bridge-channel.cc',
8
        'helper/bridge-helper.cc',
8
        'helper/bridge-helper.cc',
9
        ]
9
        ]
10
    headers = bld.new_task_gen(features=['ns3header'])
10
    headers = bld(features='ns3header')
11
    headers.module = 'bridge'
11
    headers.module = 'bridge'
12
    headers.source = [
12
    headers.source = [
13
        'model/bridge-net-device.h',
13
        'model/bridge-net-device.h',
 Lines 16-21    Link Here 
16
        ]
16
        ]
17
17
18
    if bld.env['ENABLE_EXAMPLES']:
18
    if bld.env['ENABLE_EXAMPLES']:
19
        bld.add_subdirs('examples')
19
        bld.recurse('examples')
20
20
21
    bld.ns3_python_bindings()
21
    bld.ns3_python_bindings()
(-)a/src/brite/wscript (-3 / +5 lines)
 Lines 1-6    Link Here 
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
2
import os
3
import os
3
import Options
4
5
from waflib import Options
4
6
5
7
6
def options(opt):
8
def options(opt):
 Lines 89-95    Link Here 
89
    if bld.env['BRITE'] and bld.env['DL']:
91
    if bld.env['BRITE'] and bld.env['DL']:
90
        module.uselib = 'BRITE DL'
92
        module.uselib = 'BRITE DL'
91
93
92
    headers = bld.new_task_gen(features=['ns3header'])
94
    headers = bld(features='ns3header')
93
    headers.module = 'brite'
95
    headers.module = 'brite'
94
    headers.source = [
96
    headers.source = [
95
        ]
97
        ]
 Lines 100-103    Link Here 
100
        module_test.source.append('test/brite-test-topology.cc')
102
        module_test.source.append('test/brite-test-topology.cc')
101
103
102
    if bld.env['ENABLE_EXAMPLES'] and bld.env['ENABLE_BRITE']:
104
    if bld.env['ENABLE_EXAMPLES'] and bld.env['ENABLE_BRITE']:
103
      bld.add_subdirs('examples')
105
      bld.recurse('examples')
(-)a/src/buildings/wscript (-2 / +2 lines)
 Lines 25-31    Link Here 
25
        'test/buildings-shadowing-test.cc',
25
        'test/buildings-shadowing-test.cc',
26
        ]
26
        ]
27
    
27
    
28
    headers = bld.new_task_gen(features=['ns3header'])
28
    headers = bld(features='ns3header')
29
    headers.module = 'buildings'
29
    headers.module = 'buildings'
30
    headers.source = [
30
    headers.source = [
31
        'model/building.h',
31
        'model/building.h',
 Lines 42-48    Link Here 
42
        ]
42
        ]
43
43
44
    if (bld.env['ENABLE_EXAMPLES']):
44
    if (bld.env['ENABLE_EXAMPLES']):
45
        bld.add_subdirs('examples')
45
        bld.recurse('examples')
46
46
47
47
48
    bld.ns3_python_bindings()
48
    bld.ns3_python_bindings()
(-)a/src/click/wscript (-3 / +4 lines)
 Lines 1-7    Link Here 
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
2
3
import os
3
import os
4
import Options
4
5
from waflib import Options
5
6
6
7
7
def options(opt):
8
def options(opt):
 Lines 107-113    Link Here 
107
        module.use.extend(['NSCLICK', 'DL'])
108
        module.use.extend(['NSCLICK', 'DL'])
108
        module_test.use.extend(['NSCLICK', 'DL'])
109
        module_test.use.extend(['NSCLICK', 'DL'])
109
110
110
    headers = bld.new_task_gen(features=['ns3header'])
111
    headers = bld(features='ns3header')
111
    headers.module = 'click'
112
    headers.module = 'click'
112
    headers.source = [
113
    headers.source = [
113
        'model/ipv4-click-routing.h',
114
        'model/ipv4-click-routing.h',
 Lines 116-121    Link Here 
116
        ]
117
        ]
117
118
118
    if bld.env['ENABLE_EXAMPLES']:
119
    if bld.env['ENABLE_EXAMPLES']:
119
        bld.add_subdirs('examples')
120
        bld.recurse('examples')
120
121
121
    bld.ns3_python_bindings()
122
    bld.ns3_python_bindings()
(-)a/src/config-store/wscript (-12 / +16 lines)
 Lines 11-35    Link Here 
11
11
12
def configure(conf):
12
def configure(conf):
13
    if Options.options.disable_gtk:
13
    if Options.options.disable_gtk:
14
        conf.env['ENABLE_GTK_CONFIG_STORE'] = False
14
        conf.env['ENABLE_GTK2'] = False
15
        conf.report_optional_feature("GtkConfigStore", "GtkConfigStore",
15
        conf.report_optional_feature("GtkConfigStore", "GtkConfigStore",
16
                                     conf.env['ENABLE_GTK_CONFIG_STORE'],
16
                                     conf.env['ENABLE_GTK2'],
17
                                     "--disable-gtk option given")
17
                                     "--disable-gtk option given")
18
    else:
18
    else:
19
        have_gtk = conf.pkg_check_modules('GTK_CONFIG_STORE', 'gtk+-2.0 >= 2.12', mandatory=False)
19
        have_gtk2 = conf.check_cfg(package='gtk+-2.0', atleast_version='2.12', 
20
        conf.env['ENABLE_GTK_CONFIG_STORE'] = have_gtk
20
                                   args=['--cflags', '--libs'], uselib_store='GTK2',
21
                                   mandatory=False)
22
23
        conf.env['ENABLE_GTK2'] = have_gtk2
21
        conf.report_optional_feature("GtkConfigStore", "GtkConfigStore",
24
        conf.report_optional_feature("GtkConfigStore", "GtkConfigStore",
22
                                     conf.env['ENABLE_GTK_CONFIG_STORE'],
25
                                     conf.env['ENABLE_GTK2'],
23
                                     "library 'gtk+-2.0 >= 2.12' not found")
26
                                     "library 'gtk+-2.0 >= 2.12' not found")
24
27
25
    have_libxml2 = conf.pkg_check_modules('LIBXML2', 'libxml-2.0 >= 2.6', mandatory=False)
28
    have_libxml2 = conf.check_cfg(package='libxml-2.0', atleast_version='2.7',
26
    if have_libxml2:
29
                                  args=['--cflags', '--libs'], uselib_store='LIBXML2',
27
        conf.define('HAVE_LIBXML2', 1)
30
                                  mandatory=False)
28
31
29
    conf.env['ENABLE_LIBXML2'] = have_libxml2
32
    conf.env['ENABLE_LIBXML2'] = have_libxml2
30
    conf.report_optional_feature("XmlIo", "XmlIo",
33
    conf.report_optional_feature("XmlIo", "XmlIo",
31
                                 conf.env['ENABLE_LIBXML2'],
34
                                 conf.env['ENABLE_LIBXML2'],
32
                                 "library 'libxml-2.0 >= 2.7' not found")
35
                                 "library 'libxml-2.0 >= 2.7' not found")
36
33
    conf.write_config_header('ns3/config-store-config.h', top=True)
37
    conf.write_config_header('ns3/config-store-config.h', top=True)
34
38
35
39
 Lines 45-71    Link Here 
45
        'model/raw-text-config.cc',
49
        'model/raw-text-config.cc',
46
        ]
50
        ]
47
51
48
    headers = bld.new_task_gen(features=['ns3header'])
52
    headers = bld(features='ns3header')
49
    headers.module = 'config-store'
53
    headers.module = 'config-store'
50
    headers.source = [
54
    headers.source = [
51
        'model/file-config.h',
55
        'model/file-config.h',
52
        'model/config-store.h',
56
        'model/config-store.h',
53
        ]
57
        ]
54
58
55
    if bld.env['ENABLE_GTK_CONFIG_STORE']:
59
    if bld.env['ENABLE_GTK2']:
56
        headers.source.append ('model/gtk-config-store.h')
60
        headers.source.append ('model/gtk-config-store.h')
57
        module.source.extend (['model/gtk-config-store.cc',
61
        module.source.extend (['model/gtk-config-store.cc',
58
                               'model/model-node-creator.cc',
62
                               'model/model-node-creator.cc',
59
                               'model/model-typeid-creator.cc',
63
                               'model/model-typeid-creator.cc',
60
                               'model/display-functions.cc',
64
                               'model/display-functions.cc',
61
                               ])
65
                               ])
62
        module.use.append('GTK_CONFIG_STORE')
66
        module.use.append('GTK2')
63
67
64
    if bld.env['ENABLE_LIBXML2']:
68
    if bld.env['ENABLE_LIBXML2']:
65
        module.source.append ('model/xml-config.cc')
69
        module.source.append ('model/xml-config.cc')
66
        module.use.append('LIBXML2')
70
        module.use.append('LIBXML2')
67
71
68
    if bld.env['ENABLE_EXAMPLES']:
72
    if bld.env['ENABLE_EXAMPLES']:
69
        bld.add_subdirs('examples')
73
        bld.recurse('examples')
70
74
71
    bld.ns3_python_bindings()
75
    bld.ns3_python_bindings()
(-)a/src/core/wscript (-5 / +4 lines)
 Lines 1-8    Link Here 
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
import sys
2
import sys
3
3
4
import Options
4
from waflib import Options
5
6
import wutils
5
import wutils
7
6
8
def options(opt):
7
def options(opt):
 Lines 49-55    Link Here 
49
    conf.check_nonfatal(header_name='signal.h', define_name='HAVE_SIGNAL_H')
48
    conf.check_nonfatal(header_name='signal.h', define_name='HAVE_SIGNAL_H')
50
49
51
    # Check for POSIX threads
50
    # Check for POSIX threads
52
    test_env = conf.env.copy()
51
    test_env = conf.env.derive()
53
    if Options.platform != 'darwin' and Options.platform != 'cygwin':
52
    if Options.platform != 'darwin' and Options.platform != 'cygwin':
54
        test_env.append_value('LINKFLAGS', '-pthread')
53
        test_env.append_value('LINKFLAGS', '-pthread')
55
        test_env.append_value('CXXFLAGS', '-pthread')
54
        test_env.append_value('CXXFLAGS', '-pthread')
 Lines 173-179    Link Here 
173
        'test/watchdog-test-suite.cc',
172
        'test/watchdog-test-suite.cc',
174
        ]
173
        ]
175
174
176
    headers = bld.new_task_gen(features=['ns3header'])
175
    headers = bld(features='ns3header')
177
    headers.module = 'core'
176
    headers.module = 'core'
178
    headers.source = [
177
    headers.source = [
179
        'model/nstime.h',
178
        'model/nstime.h',
 Lines 309-315    Link Here 
309
        core_test.source.extend(['test/rng-test-suite.cc'])
308
        core_test.source.extend(['test/rng-test-suite.cc'])
310
309
311
    if (bld.env['ENABLE_EXAMPLES']):
310
    if (bld.env['ENABLE_EXAMPLES']):
312
        bld.add_subdirs('examples')
311
        bld.recurse('examples')
313
312
314
    pymod = bld.ns3_python_bindings()
313
    pymod = bld.ns3_python_bindings()
315
    if pymod is not None:
314
    if pymod is not None:
(-)a/src/create-module.py (-2 / +2 lines)
 Lines 24-30    Link Here 
24
        'test/%(MODULE)s-test-suite.cc',
24
        'test/%(MODULE)s-test-suite.cc',
25
        ]
25
        ]
26
26
27
    headers = bld.new_task_gen(features=['ns3header'])
27
    headers = bld(features='ns3header')
28
    headers.module = %(MODULE)r
28
    headers.module = %(MODULE)r
29
    headers.source = [
29
    headers.source = [
30
        'model/%(MODULE)s.h',
30
        'model/%(MODULE)s.h',
 Lines 32-38    Link Here 
32
        ]
32
        ]
33
33
34
    if bld.env.ENABLE_EXAMPLES:
34
    if bld.env.ENABLE_EXAMPLES:
35
        bld.add_subdirs('examples')
35
        bld.recurse('examples')
36
36
37
    # bld.ns3_python_bindings()
37
    # bld.ns3_python_bindings()
38
38
(-)a/src/csma-layout/wscript (-2 / +2 lines)
 Lines 5-18    Link Here 
5
    obj.source = [
5
    obj.source = [
6
        'model/csma-star-helper.cc',
6
        'model/csma-star-helper.cc',
7
        ]
7
        ]
8
    headers = bld.new_task_gen(features=['ns3header'])
8
    headers = bld(features='ns3header')
9
    headers.module = 'csma-layout'
9
    headers.module = 'csma-layout'
10
    headers.source = [
10
    headers.source = [
11
        'model/csma-star-helper.h',
11
        'model/csma-star-helper.h',
12
        ]
12
        ]
13
13
14
    if bld.env['ENABLE_EXAMPLES']:
14
    if bld.env['ENABLE_EXAMPLES']:
15
        bld.add_subdirs('examples')
15
        bld.recurse('examples')
16
16
17
    bld.ns3_python_bindings()
17
    bld.ns3_python_bindings()
18
18
(-)a/src/csma/wscript (-2 / +2 lines)
 Lines 8-14    Link Here 
8
        'model/csma-channel.cc',
8
        'model/csma-channel.cc',
9
        'helper/csma-helper.cc',
9
        'helper/csma-helper.cc',
10
        ]
10
        ]
11
    headers = bld.new_task_gen(features=['ns3header'])
11
    headers = bld(features='ns3header')
12
    headers.module = 'csma'
12
    headers.module = 'csma'
13
    headers.source = [
13
    headers.source = [
14
        'model/backoff.h',
14
        'model/backoff.h',
 Lines 18-23    Link Here 
18
        ]
18
        ]
19
19
20
    if bld.env['ENABLE_EXAMPLES']:
20
    if bld.env['ENABLE_EXAMPLES']:
21
        bld.add_subdirs('examples')
21
        bld.recurse('examples')
22
22
23
    bld.ns3_python_bindings()
23
    bld.ns3_python_bindings()
(-)a/src/dsdv/wscript (-2 / +2 lines)
 Lines 16-22    Link Here 
16
        'test/dsdv-testcase.cc',
16
        'test/dsdv-testcase.cc',
17
        ]
17
        ]
18
18
19
    headers = bld.new_task_gen(features=['ns3header'])
19
    headers = bld(features='ns3header')
20
    headers.module = 'dsdv'
20
    headers.module = 'dsdv'
21
    headers.source = [
21
    headers.source = [
22
        'model/dsdv-rtable.h',
22
        'model/dsdv-rtable.h',
 Lines 26-31    Link Here 
26
        'helper/dsdv-helper.h',
26
        'helper/dsdv-helper.h',
27
        ]
27
        ]
28
    if (bld.env['ENABLE_EXAMPLES']):
28
    if (bld.env['ENABLE_EXAMPLES']):
29
      bld.add_subdirs('examples')
29
      bld.recurse('examples')
30
30
31
    bld.ns3_python_bindings()
31
    bld.ns3_python_bindings()
(-)a/src/dsr/wscript (-2 / +2 lines)
 Lines 24-30    Link Here 
24
        'test/dsr-test-suite.cc',
24
        'test/dsr-test-suite.cc',
25
        ]
25
        ]
26
        
26
        
27
    headers = bld.new_task_gen(features=['ns3header'])
27
    headers = bld(features='ns3header')
28
    headers.module = 'dsr'
28
    headers.module = 'dsr'
29
    headers.source = [
29
    headers.source = [
30
        'model/dsr-routing.h',
30
        'model/dsr-routing.h',
 Lines 43-48    Link Here 
43
        ]
43
        ]
44
44
45
    if (bld.env['ENABLE_EXAMPLES']):
45
    if (bld.env['ENABLE_EXAMPLES']):
46
      bld.add_subdirs('examples')
46
      bld.recurse('examples')
47
47
48
    bld.ns3_python_bindings()
48
    bld.ns3_python_bindings()
(-)a/src/emu/wscript (-2 / +2 lines)
 Lines 36-42    Link Here 
36
            'helper/emu-helper.cc',
36
            'helper/emu-helper.cc',
37
        ]
37
        ]
38
38
39
    headers = bld.new_task_gen(features=['ns3header'])
39
    headers = bld(features='ns3header')
40
    headers.module = 'emu'
40
    headers.module = 'emu'
41
    headers.source = [
41
    headers.source = [
42
            'model/emu-net-device.h',
42
            'model/emu-net-device.h',
 Lines 52-57    Link Here 
52
    module.env.append_value("DEFINES", "EMU_SOCK_CREATOR=\"%s\"" % (creator.target,))
52
    module.env.append_value("DEFINES", "EMU_SOCK_CREATOR=\"%s\"" % (creator.target,))
53
53
54
    if bld.env['ENABLE_EXAMPLES']:
54
    if bld.env['ENABLE_EXAMPLES']:
55
        bld.add_subdirs('examples')
55
        bld.recurse('examples')
56
56
57
    bld.ns3_python_bindings()
57
    bld.ns3_python_bindings()
(-)a/src/energy/wscript (-2 / +2 lines)
 Lines 25-31    Link Here 
25
        'test/li-ion-energy-source-test.cc',
25
        'test/li-ion-energy-source-test.cc',
26
        ]
26
        ]
27
27
28
    headers = bld.new_task_gen(features=['ns3header'])
28
    headers = bld(features='ns3header')
29
    headers.module = 'energy'
29
    headers.module = 'energy'
30
    headers.source = [
30
    headers.source = [
31
        'model/wifi-radio-energy-model.h',
31
        'model/wifi-radio-energy-model.h',
 Lines 44-49    Link Here 
44
        ]
44
        ]
45
45
46
    if (bld.env['ENABLE_EXAMPLES']):
46
    if (bld.env['ENABLE_EXAMPLES']):
47
      bld.add_subdirs('examples')
47
      bld.recurse('examples')
48
48
49
    bld.ns3_python_bindings()
49
    bld.ns3_python_bindings()
(-)a/src/fd-net-device/wscript (-2 / +2 lines)
 Lines 72-78    Link Here 
72
        'helper/creator-utils.cc',
72
        'helper/creator-utils.cc',
73
        ]
73
        ]
74
74
75
    headers = bld.new_task_gen(features=['ns3header'])
75
    headers = bld(features='ns3header')
76
    headers.module = 'fd-net-device'
76
    headers.module = 'fd-net-device'
77
    headers.source = [
77
    headers.source = [
78
        'model/fd-net-device.h',
78
        'model/fd-net-device.h',
 Lines 117-123    Link Here 
117
           "PLANETLAB_TAP_CREATOR=\"%s\"" % (creator.target,))
117
           "PLANETLAB_TAP_CREATOR=\"%s\"" % (creator.target,))
118
118
119
    if bld.env['ENABLE_EXAMPLES']:
119
    if bld.env['ENABLE_EXAMPLES']:
120
        bld.add_subdirs('examples')
120
        bld.recurse('examples')
121
121
122
    bld.ns3_python_bindings()
122
    bld.ns3_python_bindings()
123
123
(-)a/src/flow-monitor/wscript (-2 / +2 lines)
 Lines 17-23    Link Here 
17
        'test/histogram-test-suite.cc',
17
        'test/histogram-test-suite.cc',
18
        ]
18
        ]
19
19
20
    headers = bld.new_task_gen(features=['ns3header'])
20
    headers = bld(features='ns3header')
21
    headers.module = 'flow-monitor'
21
    headers.module = 'flow-monitor'
22
    headers.source = ["model/%s" % s for s in [
22
    headers.source = ["model/%s" % s for s in [
23
       'flow-monitor.h',
23
       'flow-monitor.h',
 Lines 30-35    Link Here 
30
    headers.source.append("helper/flow-monitor-helper.h")
30
    headers.source.append("helper/flow-monitor-helper.h")
31
31
32
    if bld.env['ENABLE_EXAMPLES']:
32
    if bld.env['ENABLE_EXAMPLES']:
33
        bld.add_subdirs('examples')
33
        bld.recurse('examples')
34
34
35
    bld.ns3_python_bindings()
35
    bld.ns3_python_bindings()
(-)a/src/internet/wscript (-6 / +4 lines)
 Lines 2-11    Link Here 
2
import os
2
import os
3
import sys
3
import sys
4
4
5
import Options
5
from waflib import Options, Logs, Utils, Task
6
import Logs
6
7
import Utils
8
import Task
9
7
10
# Required NSC version
8
# Required NSC version
11
NSC_RELEASE_NAME = "nsc-0.5.3"
9
NSC_RELEASE_NAME = "nsc-0.5.3"
 Lines 211-217    Link Here 
211
        'test/ipv6-address-helper-test-suite.cc',
209
        'test/ipv6-address-helper-test-suite.cc',
212
        ]
210
        ]
213
211
214
    headers = bld.new_task_gen(features=['ns3header'])
212
    headers = bld(features='ns3header')
215
    headers.module = 'internet'
213
    headers.module = 'internet'
216
    headers.source = [
214
    headers.source = [
217
        'model/udp-header.h',
215
        'model/udp-header.h',
 Lines 295-301    Link Here 
295
        internet_test.use.append('DL')
293
        internet_test.use.append('DL')
296
294
297
    if (bld.env['ENABLE_EXAMPLES']):
295
    if (bld.env['ENABLE_EXAMPLES']):
298
        bld.add_subdirs('examples')
296
        bld.recurse('examples')
299
297
300
    bld.ns3_python_bindings()
298
    bld.ns3_python_bindings()
301
299
(-)a/src/lte/wscript (-2 / +2 lines)
 Lines 114-120    Link Here 
114
        'test/lte-test-mimo.cc'
114
        'test/lte-test-mimo.cc'
115
        ]
115
        ]
116
116
117
    headers = bld.new_task_gen(features=['ns3header'])
117
    headers = bld(features='ns3header')
118
    headers.module = 'lte'
118
    headers.module = 'lte'
119
    headers.source = [
119
    headers.source = [
120
        'model/lte-common.h',
120
        'model/lte-common.h',
 Lines 190-195    Link Here 
190
        ]
190
        ]
191
191
192
    if (bld.env['ENABLE_EXAMPLES']):
192
    if (bld.env['ENABLE_EXAMPLES']):
193
      bld.add_subdirs('examples')
193
      bld.recurse('examples')
194
194
195
    bld.ns3_python_bindings()
195
    bld.ns3_python_bindings()
(-)a/src/mesh/wscript (-2 / +2 lines)
 Lines 53-59    Link Here 
53
        'test/flame/regression.cc',
53
        'test/flame/regression.cc',
54
        ]
54
        ]
55
55
56
    headers = bld.new_task_gen(features=['ns3header'])
56
    headers = bld(features='ns3header')
57
    headers.module = 'mesh'
57
    headers.module = 'mesh'
58
    headers.source = [
58
    headers.source = [
59
        'model/mesh-information-element.h',
59
        'model/mesh-information-element.h',
 Lines 90-95    Link Here 
90
        ]
90
        ]
91
91
92
    if bld.env['ENABLE_EXAMPLES']:
92
    if bld.env['ENABLE_EXAMPLES']:
93
        bld.add_subdirs('examples')
93
        bld.recurse('examples')
94
94
95
    bld.ns3_python_bindings()
95
    bld.ns3_python_bindings()
(-)a/src/mobility/wscript (-2 / +2 lines)
 Lines 31-37    Link Here 
31
        'test/waypoint-mobility-model-test.cc',
31
        'test/waypoint-mobility-model-test.cc',
32
        ]
32
        ]
33
33
34
    headers = bld.new_task_gen(features=['ns3header'])
34
    headers = bld(features='ns3header')
35
    headers.module = 'mobility'
35
    headers.module = 'mobility'
36
    headers.source = [
36
    headers.source = [
37
        'model/box.h',
37
        'model/box.h',
 Lines 55-60    Link Here 
55
        ]
55
        ]
56
56
57
    if (bld.env['ENABLE_EXAMPLES']):
57
    if (bld.env['ENABLE_EXAMPLES']):
58
        bld.add_subdirs('examples')
58
        bld.recurse('examples')
59
59
60
    bld.ns3_python_bindings()
60
    bld.ns3_python_bindings()
(-)a/src/mpi/wscript (-3 / +4 lines)
 Lines 1-7    Link Here 
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
import sys
2
import sys
3
import subprocess
3
import subprocess
4
import Options
4
5
from waflib import Options
5
from waflib.Errors import WafError
6
from waflib.Errors import WafError
6
7
7
def configure(conf):
8
def configure(conf):
 Lines 39-45    Link Here 
39
        'model/mpi-receiver.cc',
40
        'model/mpi-receiver.cc',
40
        ]
41
        ]
41
42
42
    headers = bld.new_task_gen(features=['ns3header'])
43
    headers = bld(features='ns3header')
43
    headers.module = 'mpi'
44
    headers.module = 'mpi'
44
    headers.source = [
45
    headers.source = [
45
        'model/distributed-simulator-impl.h',
46
        'model/distributed-simulator-impl.h',
 Lines 51-56    Link Here 
51
        sim.use.append('MPI')
52
        sim.use.append('MPI')
52
53
53
    if bld.env['ENABLE_EXAMPLES']:
54
    if bld.env['ENABLE_EXAMPLES']:
54
        bld.add_subdirs('examples')
55
        bld.recurse('examples')
55
      
56
      
56
    bld.ns3_python_bindings()
57
    bld.ns3_python_bindings()
(-)a/src/netanim/wscript (-2 / +2 lines)
 Lines 18-24    Link Here 
18
        	'test/netanim-test.cc',
18
        	'test/netanim-test.cc',
19
        ]
19
        ]
20
20
21
	headers = bld.new_task_gen (features=['ns3header'])
21
	headers = bld(features='ns3header')
22
	headers.module = 'netanim'
22
	headers.module = 'netanim'
23
	headers.source = [
23
	headers.source = [
24
			  'model/animation-interface.h',
24
			  'model/animation-interface.h',
 Lines 26-30    Link Here 
26
  			 ]
26
  			 ]
27
27
28
	if (bld.env['ENABLE_EXAMPLES']) :
28
	if (bld.env['ENABLE_EXAMPLES']) :
29
		bld.add_subdirs ('examples')
29
		bld.recurse('examples')
30
30
(-)a/src/network/wscript (-2 / +2 lines)
 Lines 72-78    Link Here 
72
        'test/sequence-number-test-suite.cc',
72
        'test/sequence-number-test-suite.cc',
73
        ]
73
        ]
74
74
75
    headers = bld.new_task_gen(features=['ns3header'])
75
    headers = bld(features='ns3header')
76
    headers.module = 'network'
76
    headers.module = 'network'
77
    headers.source = [
77
    headers.source = [
78
        'model/address.h',
78
        'model/address.h',
 Lines 136-141    Link Here 
136
        ]
136
        ]
137
137
138
    if (bld.env['ENABLE_EXAMPLES']):
138
    if (bld.env['ENABLE_EXAMPLES']):
139
        bld.add_subdirs('examples')
139
        bld.recurse('examples')
140
140
141
    bld.ns3_python_bindings()
141
    bld.ns3_python_bindings()
(-)a/src/nix-vector-routing/wscript (-2 / +2 lines)
 Lines 8-14    Link Here 
8
	'helper/ipv4-nix-vector-helper.cc',
8
	'helper/ipv4-nix-vector-helper.cc',
9
        ]
9
        ]
10
10
11
    headers = bld.new_task_gen(features=['ns3header'])
11
    headers = bld(features='ns3header')
12
    headers.module = 'nix-vector-routing'
12
    headers.module = 'nix-vector-routing'
13
    headers.source = [
13
    headers.source = [
14
        'model/ipv4-nix-vector-routing.h',
14
        'model/ipv4-nix-vector-routing.h',
 Lines 16-21    Link Here 
16
        ]
16
        ]
17
17
18
    if bld.env['ENABLE_EXAMPLES']:
18
    if bld.env['ENABLE_EXAMPLES']:
19
        bld.add_subdirs('examples')
19
        bld.recurse('examples')
20
20
21
    bld.ns3_python_bindings()
21
    bld.ns3_python_bindings()
(-)a/src/olsr/wscript (-2 / +2 lines)
 Lines 20-26    Link Here 
20
        'test/tc-regression-test.cc',
20
        'test/tc-regression-test.cc',
21
        ]
21
        ]
22
22
23
    headers = bld.new_task_gen(features=['ns3header'])
23
    headers = bld(features='ns3header')
24
    headers.module = 'olsr'
24
    headers.module = 'olsr'
25
    headers.source = [
25
    headers.source = [
26
        'model/olsr-routing-protocol.h',
26
        'model/olsr-routing-protocol.h',
 Lines 32-37    Link Here 
32
32
33
33
34
    if bld.env['ENABLE_EXAMPLES']:
34
    if bld.env['ENABLE_EXAMPLES']:
35
        bld.add_subdirs('examples')
35
        bld.recurse('examples')
36
36
37
    bld.ns3_python_bindings()
37
    bld.ns3_python_bindings()
(-)a/src/openflow/wscript (-13 / +28 lines)
 Lines 1-25    Link Here 
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
2
3
import os
3
import os
4
import Options
4
from waflib import Logs, Options
5
from waflib.Errors import WafError
5
from waflib.Errors import WafError
6
6
7
def options(opt):
7
def options(opt):
8
    opt.add_option('--with-openflow',
8
    opt.add_option('--with-openflow',
9
		   help=('Path to OFSID source for NS-3 OpenFlow Integration support'),
9
		   help=('Path to OFSID source for NS-3 OpenFlow Integration support'),
10
		   default='', dest='with_openflow')
10
		   default='', dest='with_openflow')
11
    opt.tool_options('boost', tooldir=["waf-tools"])
11
12
REQUIRED_BOOST_LIBS = ['system', 'signals', 'filesystem']
13
14
def required_boost_libs(conf):
15
    conf.env['REQUIRED_BOOST_LIBS'] += REQUIRED_BOOST_LIBS
12
16
13
def configure(conf):
17
def configure(conf):
14
    try:
18
    if not conf.env['LIB_BOOST']:
15
        conf.check_tool('boost')
16
        conf.check_boost(lib='signals filesystem')
17
        if not conf.env.LIB_BOOST:
18
            conf.check_boost(lib='signals filesystem', libpath="/usr/lib64")
19
    except WafError:
20
        conf.env['LIB_BOOST'] = []
21
22
    if not conf.env.LIB_BOOST:
23
	conf.report_optional_feature("openflow", "NS-3 OpenFlow Integration", False,
19
	conf.report_optional_feature("openflow", "NS-3 OpenFlow Integration", False,
24
				     "Required boost libraries not found")
20
				     "Required boost libraries not found")
25
21
 Lines 29-34    Link Here 
29
25
30
	return 
26
	return 
31
27
28
    present_boost_libs = []
29
    for boost_lib_name in conf.env['LIB_BOOST']:
30
        if boost_lib_name.startswith("boost_"):
31
            boost_lib_name = boost_lib_name[6:]
32
        if boost_lib_name.endswith("-mt"):
33
            boost_lib_name = boost_lib_name[:-3]
34
        present_boost_libs.append(boost_lib_name)
35
36
    missing_boost_libs = [lib for lib in REQUIRED_BOOST_LIBS if lib not in present_boost_libs]
37
    if missing_boost_libs != []:
38
	conf.report_optional_feature("openflow", "NS-3 OpenFlow Integration", False,
39
				     "Required boost libraries not found, missing: %s" % ', '.join(missing_boost_libs))
40
41
        # Add this module to the list of modules that won't be built
42
        # if they are enabled.
43
        conf.env['MODULES_NOT_BUILT'].append('openflow')
44
45
	return 
46
32
    if Options.options.with_openflow:
47
    if Options.options.with_openflow:
33
	if os.path.isdir(Options.options.with_openflow):
48
	if os.path.isdir(Options.options.with_openflow):
34
	    conf.msg("Checking for OpenFlow location", ("%s (given)" % Options.options.with_openflow))
49
	    conf.msg("Checking for OpenFlow location", ("%s (given)" % Options.options.with_openflow))
 Lines 142-148    Link Here 
142
	obj.use.extend('OPENFLOW DL XML2'.split())
157
	obj.use.extend('OPENFLOW DL XML2'.split())
143
	obj_test.use.extend('OPENFLOW DL XML2'.split())
158
	obj_test.use.extend('OPENFLOW DL XML2'.split())
144
159
145
    headers = bld.new_task_gen(features=['ns3header'])
160
    headers = bld(features='ns3header')
146
    headers.module = 'openflow'
161
    headers.module = 'openflow'
147
    headers.source = [
162
    headers.source = [
148
        ]
163
        ]
 Lines 160-163    Link Here 
160
	headers.source.append('helper/openflow-switch-helper.h')
175
	headers.source.append('helper/openflow-switch-helper.h')
161
176
162
    if bld.env['ENABLE_EXAMPLES'] and bld.env['ENABLE_OPENFLOW']:
177
    if bld.env['ENABLE_EXAMPLES'] and bld.env['ENABLE_OPENFLOW']:
163
        bld.add_subdirs('examples')
178
        bld.recurse('examples')
(-)a/src/point-to-point-layout/wscript (-1 / +1 lines)
 Lines 9-15    Link Here 
9
        'model/point-to-point-star.cc',
9
        'model/point-to-point-star.cc',
10
        ]
10
        ]
11
11
12
    headers = bld.new_task_gen(features=['ns3header'])
12
    headers = bld(features='ns3header')
13
    headers.module = 'point-to-point-layout'
13
    headers.module = 'point-to-point-layout'
14
    headers.source = [
14
    headers.source = [
15
        'model/point-to-point-dumbbell.h',
15
        'model/point-to-point-dumbbell.h',
(-)a/src/point-to-point/wscript (-2 / +2 lines)
 Lines 16-22    Link Here 
16
        'test/point-to-point-test.cc',
16
        'test/point-to-point-test.cc',
17
        ]
17
        ]
18
18
19
    headers = bld.new_task_gen(features=['ns3header'])
19
    headers = bld(features='ns3header')
20
    headers.module = 'point-to-point'
20
    headers.module = 'point-to-point'
21
    headers.source = [
21
    headers.source = [
22
        'model/point-to-point-net-device.h',
22
        'model/point-to-point-net-device.h',
 Lines 27-32    Link Here 
27
        ]
27
        ]
28
28
29
    if (bld.env['ENABLE_EXAMPLES']):
29
    if (bld.env['ENABLE_EXAMPLES']):
30
        bld.add_subdirs('examples')
30
        bld.recurse('examples')
31
31
32
    bld.ns3_python_bindings()
32
    bld.ns3_python_bindings()
(-)a/src/propagation/wscript (-2 / +2 lines)
 Lines 24-30    Link Here 
24
        'test/itu-r-1411-nlos-over-rooftop-test-suite.cc',
24
        'test/itu-r-1411-nlos-over-rooftop-test-suite.cc',
25
        ]
25
        ]
26
26
27
    headers = bld.new_task_gen(features=['ns3header'])
27
    headers = bld(features='ns3header')
28
    headers.module = 'propagation'
28
    headers.module = 'propagation'
29
    headers.source = [
29
    headers.source = [
30
        'model/propagation-delay-model.h',
30
        'model/propagation-delay-model.h',
 Lines 41-46    Link Here 
41
        ]
41
        ]
42
42
43
    if (bld.env['ENABLE_EXAMPLES']):
43
    if (bld.env['ENABLE_EXAMPLES']):
44
        bld.add_subdirs('examples')
44
        bld.recurse('examples')
45
45
46
    bld.ns3_python_bindings()
46
    bld.ns3_python_bindings()
(-)a/src/spectrum/wscript (-2 / +2 lines)
 Lines 41-47    Link Here 
41
        'test/spectrum-ideal-phy-test.cc',
41
        'test/spectrum-ideal-phy-test.cc',
42
        ]
42
        ]
43
    
43
    
44
    headers = bld.new_task_gen(features=['ns3header'])
44
    headers = bld(features='ns3header')
45
    headers.module = 'spectrum'
45
    headers.module = 'spectrum'
46
    headers.source = [
46
    headers.source = [
47
        'model/spectrum-model.h',
47
        'model/spectrum-model.h',
 Lines 76-82    Link Here 
76
        ]
76
        ]
77
77
78
    if (bld.env['ENABLE_EXAMPLES']):
78
    if (bld.env['ENABLE_EXAMPLES']):
79
        bld.add_subdirs('examples')
79
        bld.recurse('examples')
80
80
81
81
82
    bld.ns3_python_bindings()
82
    bld.ns3_python_bindings()
(-)a/src/stats/wscript (-7 / +8 lines)
 Lines 1-13    Link Here 
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
2
3
def configure(conf):
3
def configure(conf):
4
   conf.env['SQLITE_STATS'] = conf.check_nonfatal(lib='sqlite3', define_name='SQLITE3', uselib_store='SQLITE3')
4
    have_sqlite3 = conf.check_cfg(package='sqlite3', uselib_store='SQLITE3',
5
   if not conf.env['SQLITE_STATS']:
5
                                  args=['--cflags', '--libs'],
6
      conf.env['SQLITE_STATS'] = conf.pkg_check_modules('SQLITE3', 'sqlite3', mandatory=False)
6
                                  mandatory=False)
7
   conf.report_optional_feature("SqliteDataOutput", "SQlite stats data output",
8
                                conf.env['SQLITE_STATS'],
9
                                "library 'sqlite3' not found")
10
7
8
    conf.env['SQLITE_STATS'] = have_sqlite3
9
    conf.report_optional_feature("SqliteDataOutput", "SQlite stats data output",
10
                                 conf.env['SQLITE_STATS'],
11
                                 "library 'sqlite3' not found")
11
12
12
def build(bld):
13
def build(bld):
13
    obj = bld.create_ns3_module('stats', ['network'])
14
    obj = bld.create_ns3_module('stats', ['network'])
 Lines 25-31    Link Here 
25
        'test/basic-data-calculators-test-suite.cc',
26
        'test/basic-data-calculators-test-suite.cc',
26
        ]
27
        ]
27
28
28
    headers = bld.new_task_gen(features=['ns3header'])
29
    headers = bld(features='ns3header')
29
    headers.module = 'stats'
30
    headers.module = 'stats'
30
    headers.source = [
31
    headers.source = [
31
        'model/data-calculator.h',
32
        'model/data-calculator.h',
(-)a/src/tap-bridge/wscript (-2 / +2 lines)
 Lines 34-40    Link Here 
34
        'model/tap-encode-decode.cc',
34
        'model/tap-encode-decode.cc',
35
        'helper/tap-bridge-helper.cc',
35
        'helper/tap-bridge-helper.cc',
36
        ]
36
        ]
37
    headers = bld.new_task_gen(features=['ns3header'])
37
    headers = bld(features='ns3header')
38
    headers.module = 'tap-bridge'
38
    headers.module = 'tap-bridge'
39
    headers.source = [
39
    headers.source = [
40
        'model/tap-bridge.h',
40
        'model/tap-bridge.h',
 Lines 52-57    Link Here 
52
    module.env.append_value("DEFINES", "TAP_CREATOR=\"%s\"" % (tap_creator.target,))
52
    module.env.append_value("DEFINES", "TAP_CREATOR=\"%s\"" % (tap_creator.target,))
53
53
54
    if bld.env['ENABLE_EXAMPLES']:
54
    if bld.env['ENABLE_EXAMPLES']:
55
        bld.add_subdirs('examples')
55
        bld.recurse('examples')
56
56
57
    bld.ns3_python_bindings()
57
    bld.ns3_python_bindings()
(-)a/src/test/wscript (-1 / +1 lines)
 Lines 16-22    Link Here 
16
        return
16
        return
17
17
18
    test = bld.create_ns3_module('test', ['internet', 'mobility', 'applications', 'csma', 'bridge', 'config-store', 'tools', 'point-to-point', 'csma-layout', 'flow-monitor', 'wifi'])
18
    test = bld.create_ns3_module('test', ['internet', 'mobility', 'applications', 'csma', 'bridge', 'config-store', 'tools', 'point-to-point', 'csma-layout', 'flow-monitor', 'wifi'])
19
    headers = bld.new_task_gen(features=['ns3header'])
19
    headers = bld(features='ns3header')
20
    headers.module = 'test'
20
    headers.module = 'test'
21
21
22
    test_test = bld.create_ns3_module_test_library('test')
22
    test_test = bld.create_ns3_module_test_library('test')
(-)a/src/tools/wscript (-2 / +2 lines)
 Lines 15-21    Link Here 
15
        'test/event-garbage-collector-test-suite.cc',
15
        'test/event-garbage-collector-test-suite.cc',
16
        ]
16
        ]
17
    
17
    
18
    headers = bld.new_task_gen(features=['ns3header'])
18
    headers = bld(features='ns3header')
19
    headers.module = 'tools'
19
    headers.module = 'tools'
20
    headers.source = [
20
    headers.source = [
21
        'model/average.h',
21
        'model/average.h',
 Lines 25-30    Link Here 
25
        ]
25
        ]
26
26
27
    if (bld.env['ENABLE_EXAMPLES']):
27
    if (bld.env['ENABLE_EXAMPLES']):
28
        bld.add_subdirs('examples')
28
        bld.recurse('examples')
29
29
30
    bld.ns3_python_bindings()
30
    bld.ns3_python_bindings()
(-)a/src/topology-read/wscript (-2 / +2 lines)
 Lines 15-21    Link Here 
15
        'test/rocketfuel-topology-reader-test-suite.cc',
15
        'test/rocketfuel-topology-reader-test-suite.cc',
16
        ]
16
        ]
17
17
18
    headers = bld.new_task_gen(features=['ns3header'])
18
    headers = bld(features='ns3header')
19
    headers.module = 'topology-read'
19
    headers.module = 'topology-read'
20
    headers.source = [
20
    headers.source = [
21
       'model/topology-reader.h',
21
       'model/topology-reader.h',
 Lines 26-31    Link Here 
26
        ]
26
        ]
27
27
28
    if bld.env['ENABLE_EXAMPLES']:
28
    if bld.env['ENABLE_EXAMPLES']:
29
        bld.add_subdirs('examples')
29
        bld.recurse('examples')
30
30
31
    bld.ns3_python_bindings()
31
    bld.ns3_python_bindings()
(-)a/src/uan/wscript (-2 / +2 lines)
 Lines 34-40    Link Here 
34
        'test/uan-test.cc',
34
        'test/uan-test.cc',
35
        'test/uan-energy-model-test.cc',
35
        'test/uan-energy-model-test.cc',
36
        ]
36
        ]
37
    headers = bld.new_task_gen(features=['ns3header'])
37
    headers = bld(features='ns3header')
38
    headers.module = 'uan'
38
    headers.module = 'uan'
39
    headers.source = [
39
    headers.source = [
40
        'model/uan-channel.h',
40
        'model/uan-channel.h',
 Lines 64-69    Link Here 
64
        ]
64
        ]
65
65
66
    if (bld.env['ENABLE_EXAMPLES']):
66
    if (bld.env['ENABLE_EXAMPLES']):
67
      bld.add_subdirs('examples')
67
      bld.recurse('examples')
68
68
69
    bld.ns3_python_bindings()
69
    bld.ns3_python_bindings()
(-)a/src/virtual-net-device/wscript (-2 / +2 lines)
 Lines 6-18    Link Here 
6
    module.source = [
6
    module.source = [
7
        'model/virtual-net-device.cc',
7
        'model/virtual-net-device.cc',
8
        ]
8
        ]
9
    headers = bld.new_task_gen(features=['ns3header'])
9
    headers = bld(features='ns3header')
10
    headers.module = 'virtual-net-device'
10
    headers.module = 'virtual-net-device'
11
    headers.source = [
11
    headers.source = [
12
        'model/virtual-net-device.h',
12
        'model/virtual-net-device.h',
13
        ]
13
        ]
14
14
15
    if bld.env['ENABLE_EXAMPLES']:
15
    if bld.env['ENABLE_EXAMPLES']:
16
        bld.add_subdirs('examples')
16
        bld.recurse('examples')
17
17
18
    bld.ns3_python_bindings()
18
    bld.ns3_python_bindings()
(-)a/src/visualizer/wscript (-3 / +3 lines)
 Lines 1-5    Link Here 
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
import Options
2
from waflib import Options
3
3
4
required_python_modules = [
4
required_python_modules = [
5
    'gtk',
5
    'gtk',
 Lines 38-44    Link Here 
38
def build(bld):
38
def build(bld):
39
39
40
    module = bld.create_ns3_module('visualizer', ['internet', 'wifi', 'point-to-point'])
40
    module = bld.create_ns3_module('visualizer', ['internet', 'wifi', 'point-to-point'])
41
    headers = bld.new_task_gen(features=['ns3header'])
41
    headers = bld(features='ns3header')
42
    headers.module = 'visualizer'
42
    headers.module = 'visualizer'
43
43
44
    # Don't do anything more for this module if Python was explicitly
44
    # Don't do anything more for this module if Python was explicitly
 Lines 61-67    Link Here 
61
        'model/dummy-file-for-static-builds.cc',
61
        'model/dummy-file-for-static-builds.cc',
62
        ]
62
        ]
63
63
64
    module.features.append('pyembed')
64
    module.features += ' pyembed'
65
    #module.env.append_value('CXXFLAGS', module.env['shlib_CXXFLAGS'])
65
    #module.env.append_value('CXXFLAGS', module.env['shlib_CXXFLAGS'])
66
    #module.includes = '.'
66
    #module.includes = '.'
67
67
(-)a/src/wifi/wscript (-2 / +2 lines)
 Lines 76-82    Link Here 
76
        'test/wifi-test.cc',
76
        'test/wifi-test.cc',
77
        ]
77
        ]
78
78
79
    headers = bld.new_task_gen(features=['ns3header'])
79
    headers = bld(features='ns3header')
80
    headers.module = 'wifi'
80
    headers.module = 'wifi'
81
    headers.source = [
81
    headers.source = [
82
        'model/wifi-information-element.h',
82
        'model/wifi-information-element.h',
 Lines 146-152    Link Here 
146
        obj_test.use.extend(['GSL', 'GSLCBLAS', 'M'])
146
        obj_test.use.extend(['GSL', 'GSLCBLAS', 'M'])
147
147
148
    if (bld.env['ENABLE_EXAMPLES']):
148
    if (bld.env['ENABLE_EXAMPLES']):
149
        bld.add_subdirs('examples')
149
        bld.recurse('examples')
150
150
151
    bld.ns3_python_bindings()
151
    bld.ns3_python_bindings()
152
152
(-)a/src/wimax/wscript (-2 / +2 lines)
 Lines 63-69    Link Here 
63
            'test/wimax-fragmentation-test.cc',
63
            'test/wimax-fragmentation-test.cc',
64
            ]
64
            ]
65
		            
65
		            
66
    headers = bld.new_task_gen(features=['ns3header'])
66
    headers = bld(features='ns3header')
67
    headers.module = 'wimax'
67
    headers.module = 'wimax'
68
    headers.source = [
68
    headers.source = [
69
            'model/wimax-channel.h',
69
            'model/wimax-channel.h',
 Lines 113-118    Link Here 
113
		            ]
113
		            ]
114
114
115
    if bld.env['ENABLE_EXAMPLES']:
115
    if bld.env['ENABLE_EXAMPLES']:
116
        bld.add_subdirs('examples')
116
        bld.recurse('examples')
117
117
118
    bld.ns3_python_bindings()
118
    bld.ns3_python_bindings()
(-)a/src/wscript (-34 / +43 lines)
 Lines 6-19    Link Here 
6
import types
6
import types
7
import warnings
7
import warnings
8
8
9
from waflib import TaskGen, Task, Options, Build, Utils
9
from waflib.Errors import WafError
10
from waflib.Errors import WafError
10
11
import TaskGen
12
import Task
13
import Options
14
import Build
15
import Utils
16
17
import wutils
11
import wutils
18
12
19
try:
13
try:
 Lines 47-59    Link Here 
47
                   help=("Build only these modules (and dependencies)"),
41
                   help=("Build only these modules (and dependencies)"),
48
                   dest='enable_modules')
42
                   dest='enable_modules')
49
43
44
    opt.load('boost', tooldir=['waf-tools'])
45
50
    for module in all_modules:
46
    for module in all_modules:
51
        opt.sub_options(module, mandatory=False)
47
        opt.recurse(module, mandatory=False)
52
53
48
54
def configure(conf):
49
def configure(conf):
50
    conf.env['REQUIRED_BOOST_LIBS'] = []
55
    for module in all_modules:
51
    for module in all_modules:
56
        conf.sub_config(module, mandatory=False)
52
        conf.recurse (module, name="required_boost_libs", mandatory=False)
53
54
    if conf.env['REQUIRED_BOOST_LIBS'] is not []:
55
        try:
56
            conf.load('boost')
57
            conf.check_boost(lib=' '.join (conf.env['REQUIRED_BOOST_LIBS']), require_all=False)
58
            if not conf.env['LIB_BOOST']:
59
                conf.check_boost(lib=' '.join (conf.env['REQUIRED_BOOST_LIBS']), libpath="/usr/lib64", require_all=False)
60
        except WafError:
61
            conf.env['LIB_BOOST'] = []
62
63
    for module in all_modules:
64
        conf.recurse(module, mandatory=False)
57
65
58
    blddir = os.path.abspath(os.path.join(conf.bldnode.abspath(), conf.variant))
66
    blddir = os.path.abspath(os.path.join(conf.bldnode.abspath(), conf.variant))
59
    conf.env.append_value('NS3_MODULE_PATH', blddir)
67
    conf.env.append_value('NS3_MODULE_PATH', blddir)
 Lines 75-84    Link Here 
75
    static = bool(bld.env.ENABLE_STATIC_NS3)
83
    static = bool(bld.env.ENABLE_STATIC_NS3)
76
    # Create a separate library for this module.
84
    # Create a separate library for this module.
77
    if static:
85
    if static:
78
        module = bld.new_task_gen(features=['cxx', 'cxxstlib', 'ns3module'])
86
        module = bld(features='cxx cxxstlib ns3module')
79
    else:
87
    else:
80
        module = bld.new_task_gen(features=['cxx', 'cxxshlib', 'ns3module'])
88
        module = bld(features='cxx cxxshlib ns3module')
81
    module.target = '%s/ns%s-%s%s' % (bld.srcnode.relpath_gen(module.path), wutils.VERSION,
89
    module.target = '%s/ns%s-%s%s' % (bld.srcnode.path_from(module.path), wutils.VERSION,
82
                                       name, bld.env.BUILD_SUFFIX)
90
                                       name, bld.env.BUILD_SUFFIX)
83
    linkflags = []
91
    linkflags = []
84
    cxxflags = []
92
    cxxflags = []
 Lines 119-125    Link Here 
119
    module.use = ['ns3-' + dep for dep in dependencies]
127
    module.use = ['ns3-' + dep for dep in dependencies]
120
    module.test = test
128
    module.test = test
121
    module.is_ns3_module = True
129
    module.is_ns3_module = True
122
    module.ns3_dir_location = bld.path.relpath_gen(bld.srcnode)
130
    module.ns3_dir_location = bld.path.path_from(bld.srcnode)
123
131
124
    module.env.append_value("INCLUDES", '#')
132
    module.env.append_value("INCLUDES", '#')
125
133
 Lines 133-139    Link Here 
133
def apply_incpaths_ns3testlib(self):
141
def apply_incpaths_ns3testlib(self):
134
    if not self.source:
142
    if not self.source:
135
        return
143
        return
136
    testdir = self.source[-1].parent.relpath_gen(self.bld.srcnode)
144
    testdir = self.source[-1].parent.path_from(self.bld.srcnode)
137
    self.env.append_value("DEFINES", 'NS_TEST_SOURCEDIR="%s"' % (testdir,))
145
    self.env.append_value("DEFINES", 'NS_TEST_SOURCEDIR="%s"' % (testdir,))
138
146
139
147
 Lines 142-148    Link Here 
142
    # the module being tested.
150
    # the module being tested.
143
    library_name = name + "-test"
151
    library_name = name + "-test"
144
    library = bld.create_ns3_module(library_name, [name], test=True)
152
    library = bld.create_ns3_module(library_name, [name], test=True)
145
    library.features.append("ns3testlib")
153
    library.features += " ns3testlib"
146
154
147
    # Modify attributes for the test library that are different from a
155
    # Modify attributes for the test library that are different from a
148
    # normal module.
156
    # normal module.
 Lines 154-160    Link Here 
154
    bld.env.append_value('NS3_MODULES_WITH_TEST_LIBRARIES', [(library.module_name, library.name)])
162
    bld.env.append_value('NS3_MODULES_WITH_TEST_LIBRARIES', [(library.module_name, library.name)])
155
163
156
    # Set the include path from the build directory to modules. 
164
    # Set the include path from the build directory to modules. 
157
    relative_path_from_build_to_here = bld.path.relpath_gen(bld.bldnode)
165
    relative_path_from_build_to_here = bld.path.path_from(bld.bldnode)
158
    include_flag = '-I' + relative_path_from_build_to_here
166
    include_flag = '-I' + relative_path_from_build_to_here
159
    library.env.append_value('CXXFLAGS', include_flag)
167
    library.env.append_value('CXXFLAGS', include_flag)
160
    library.env.append_value('CCFLAGS',  include_flag)
168
    library.env.append_value('CCFLAGS',  include_flag)
 Lines 162-170    Link Here 
162
    return library
170
    return library
163
171
164
def create_obj(bld, *args):
172
def create_obj(bld, *args):
165
    warnings.warn("(in %s) Use bld.new_task_gen(...) now, instead of bld.create_obj(...)" % str(bld.path),
173
    warnings.warn("(in %s) Use bld(...) call now, instead of bld.create_obj(...)" % str(bld.path),
166
                  DeprecationWarning, stacklevel=2)
174
                  DeprecationWarning, stacklevel=2)
167
    return bld.new_task_gen(*args)
175
    return bld(*args)
168
176
169
177
170
def ns3_python_bindings(bld):
178
def ns3_python_bindings(bld):
 Lines 197-219    Link Here 
197
205
198
    #debug = ('PYBINDGEN_DEBUG' in os.environ)
206
    #debug = ('PYBINDGEN_DEBUG' in os.environ)
199
    debug = True # XXX
207
    debug = True # XXX
200
    source = [bld.srcnode.find_resource('bindings/python/ns3modulegen-modular.py').relpath_gen(bld.path),
208
    source = [bld.srcnode.find_resource('bindings/python/ns3modulegen-modular.py'),
201
              "bindings/modulegen__%s.py" % apidefs]
209
              bld.path.find_resource("bindings/modulegen__%s.py" % apidefs)]
202
210
203
    if bindings_dir.find_resource("modulegen_customizations.py") is not None:
211
    modulegen_customizations = bindings_dir.find_resource("modulegen_customizations.py")
204
        source.append("bindings/modulegen_customizations.py")
212
    if modulegen_customizations is not None:
213
        source.append(modulegen_customizations)
205
214
215
    modulegen_local = bld.path.find_resource("bindings/modulegen_local.py")
206
    # the local customization file may or not exist
216
    # the local customization file may or not exist
207
    if bld.path.find_resource("bindings/modulegen_local.py"):
217
    if modulegen_local is not None:
208
        source.append("bindings/modulegen_local.py")
218
        source.append("bindings/modulegen_local.py")
209
219
210
    module_py_name = module.replace('-', '_')
220
    module_py_name = module.replace('-', '_')
211
    module_target_dir = bld.srcnode.find_dir("bindings/python/ns").relpath_gen(bld.path)
221
    module_target_dir = bld.srcnode.find_dir("bindings/python/ns").path_from(bld.path)
212
222
213
    # if bindings/<module>.py exists, it becomes the module frontend, and the C extension befomes _<module>
223
    # if bindings/<module>.py exists, it becomes the module frontend, and the C extension befomes _<module>
214
    if bld.path.find_resource("bindings/%s.py" % (module_py_name,)) is not None:
224
    if bld.path.find_resource("bindings/%s.py" % (module_py_name,)) is not None:
215
        bld.new_task_gen(
225
        bld(features='copy',
216
            features='copy',
217
            source=("bindings/%s.py" % (module_py_name,)),
226
            source=("bindings/%s.py" % (module_py_name,)),
218
            target=('%s/%s.py' % (module_target_dir, module_py_name)))
227
            target=('%s/%s.py' % (module_target_dir, module_py_name)))
219
        extension_name = '_%s' % (module_py_name,)
228
        extension_name = '_%s' % (module_py_name,)
 Lines 240-246    Link Here 
240
        if was_enabled:
249
        if was_enabled:
241
            features.append(name)
250
            features.append(name)
242
251
243
    bindgen = bld.new_task_gen(features=['command'], source=source, target=target, command=argv)
252
    bindgen = bld(features='command', source=source, target=target, command=argv)
244
    bindgen.env['FEATURES'] = ','.join(features)
253
    bindgen.env['FEATURES'] = ','.join(features)
245
    bindgen.dep_vars = ['FEATURES', "GCC_RTTI_ABI_COMPLETE"]
254
    bindgen.dep_vars = ['FEATURES', "GCC_RTTI_ABI_COMPLETE"]
246
    bindgen.before = 'cxx'
255
    bindgen.before = 'cxx'
 Lines 249-255    Link Here 
249
    bindgen.install_path = None
258
    bindgen.install_path = None
250
259
251
    # generate the extension module
260
    # generate the extension module
252
    pymod = bld.new_task_gen(features='cxx cxxshlib pyext')
261
    pymod = bld(features='cxx cxxshlib pyext')
253
    pymod.source = ['bindings/ns3module.cc']
262
    pymod.source = ['bindings/ns3module.cc']
254
    pymod.target = '%s/%s' % (module_target_dir, extension_name)
263
    pymod.target = '%s/%s' % (module_target_dir, extension_name)
255
    pymod.name = 'ns3module_%s' % module
264
    pymod.name = 'ns3module_%s' % module
 Lines 305-318    Link Here 
305
        if not_built in all_modules:
314
        if not_built in all_modules:
306
            all_modules.remove(not_built)
315
            all_modules.remove(not_built)
307
316
308
    bld.add_subdirs(list(all_modules))
317
    bld.recurse(list(all_modules))
309
318
310
    for module in all_modules:
319
    for module in all_modules:
311
        modheader = bld.new_task_gen(features=['ns3moduleheader'])
320
        modheader = bld(features='ns3moduleheader')
312
        modheader.module = module.split('/')[-1]
321
        modheader.module = module.split('/')[-1]
313
322
314
class ns3pcfile_task(Task.Task):
323
class ns3pcfile_task(Task.Task):
315
    after = 'cc cxx'
324
    after = 'cxx'
316
325
317
    def __str__(self):
326
    def __str__(self):
318
        "string to display to the user"
327
        "string to display to the user"
 Lines 448-454    Link Here 
448
457
449
458
450
class ns3header_task(Task.Task):
459
class ns3header_task(Task.Task):
451
    before = 'cc cxx gen_ns3_module_header'
460
    before = 'cxx gen_ns3_module_header'
452
    color = 'BLUE'
461
    color = 'BLUE'
453
462
454
    def __str__(self):
463
    def __str__(self):
 Lines 517-523    Link Here 
517
526
518
527
519
class gen_ns3_module_header_task(Task.Task):
528
class gen_ns3_module_header_task(Task.Task):
520
    before = 'cc cxx'
529
    before = 'cxx'
521
    after = 'ns3header'
530
    after = 'ns3header'
522
    color = 'BLUE'
531
    color = 'BLUE'
523
532
(-)a/waf-tools/boost.py (-45 / +127 lines)
 Lines 9-42    Link Here 
9
# rewritten for waf 1.6.2, Sylvain Rouquette, 2011
9
# rewritten for waf 1.6.2, Sylvain Rouquette, 2011
10
10
11
'''
11
'''
12
13
This is an extra tool, not bundled with the default waf binary.
12
To add the boost tool to the waf file:
14
To add the boost tool to the waf file:
13
$ ./waf-light --tools=compat15,boost
15
$ ./waf-light --tools=compat15,boost
14
	or, if you have waf >= 1.6.2
16
	or, if you have waf >= 1.6.2
15
$ ./waf update --files=boost
17
$ ./waf update --files=boost
16
18
17
The wscript will look like:
19
When using this tool, the wscript will look like:
18
20
19
def options(opt):
21
	def options(opt):
20
	opt.load('compiler_cxx boost')
22
		opt.load('compiler_cxx boost')
21
23
22
def configure(conf):
24
	def configure(conf):
23
	conf.load('compiler_cxx boost')
25
		conf.load('compiler_cxx boost')
24
	conf.check_boost(lib='system filesystem', mt=True, static=True)
26
		conf.check_boost(lib='system filesystem')
25
27
26
def build(bld):
28
	def build(bld):
27
	bld(source='main.cpp', target='app', use='BOOST')
29
		bld(source='main.cpp', target='app', use='BOOST')
30
31
Options are generated, in order to specify the location of boost includes/libraries.
32
The `check_boost` configuration function allows to specify the used boost libraries.
33
It can also provide default arguments to the --boost-static and --boost-mt command-line arguments.
34
Everything will be packaged together in a BOOST component that you can use.
35
36
When using MSVC, a lot of compilation flags need to match your BOOST build configuration:
37
 - you may have to add /EHsc to your CXXFLAGS or define boost::throw_exception if BOOST_NO_EXCEPTIONS is defined.
38
   Errors: C4530
39
 - boost libraries will try to be smart and use the (pretty but often not useful) auto-linking feature of MSVC
40
   So before calling `conf.check_boost` you might want to disabling by adding:
41
   	conf.env.DEFINES_BOOST += ['BOOST_ALL_NO_LIB']
42
   Errors: 
43
 - boost might also be compiled with /MT, which links the runtime statically.
44
   If you have problems with redefined symbols, 
45
		self.env['DEFINES_%s' % var] += ['BOOST_ALL_NO_LIB']
46
		self.env['CXXFLAGS_%s' % var] += ['/MD', '/EHsc']
47
Passing `--boost-linkage_autodetect` might help ensuring having a correct linkage in some basic cases.
48
28
'''
49
'''
29
50
30
import sys
51
import sys
31
import re
52
import re
32
from waflib import Utils, Logs
53
from waflib import Utils, Logs, Errors
33
from waflib.Configure import conf
54
from waflib.Configure import conf
34
from waflib.Errors import WafError
35
55
36
BOOST_LIBS = ('/usr/lib', '/usr/local/lib',
56
BOOST_LIBS = ['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib']
37
			  '/opt/local/lib', '/sw/lib', '/lib')
57
BOOST_INCLUDES = ['/usr/include', '/usr/local/include', '/opt/local/include', '/sw/include']
38
BOOST_INCLUDES = ('/usr/include', '/usr/local/include',
39
				  '/opt/local/include', '/sw/include')
40
BOOST_VERSION_FILE = 'boost/version.hpp'
58
BOOST_VERSION_FILE = 'boost/version.hpp'
41
BOOST_VERSION_CODE = '''
59
BOOST_VERSION_CODE = '''
42
#include <iostream>
60
#include <iostream>
 Lines 76-96    Link Here 
76
def options(opt):
94
def options(opt):
77
	opt.add_option('--boost-includes', type='string',
95
	opt.add_option('--boost-includes', type='string',
78
				   default='', dest='boost_includes',
96
				   default='', dest='boost_includes',
79
				   help='''path to the boost directory where the includes are
97
				   help='''path to the boost includes root (~boost root)
80
				   e.g. /boost_1_45_0/include''')
98
				   e.g. /path/to/boost_1_47_0''')
81
	opt.add_option('--boost-libs', type='string',
99
	opt.add_option('--boost-libs', type='string',
82
				   default='', dest='boost_libs',
100
				   default='', dest='boost_libs',
83
				   help='''path to the directory where the boost libs are
101
				   help='''path to the directory where the boost libs are
84
				   e.g. /boost_1_45_0/stage/lib''')
102
				   e.g. /path/to/boost_1_47_0/stage/lib''')
85
	opt.add_option('--boost-static', action='store_true',
103
	opt.add_option('--boost-static', action='store_true',
86
				   default=False, dest='boost_static',
104
				   default=False, dest='boost_static',
87
				   help='link static libraries')
105
				   help='link with static boost libraries (.lib/.a)')
88
	opt.add_option('--boost-mt', action='store_true',
106
	opt.add_option('--boost-mt', action='store_true',
89
				   default=False, dest='boost_mt',
107
				   default=False, dest='boost_mt',
90
				   help='select multi-threaded libraries')
108
				   help='select multi-threaded libraries')
91
	opt.add_option('--boost-abi', type='string', default='', dest='boost_abi',
109
	opt.add_option('--boost-abi', type='string', default='', dest='boost_abi',
92
				   help='''select libraries with tags (dgsyp, d for debug),
110
				   help='''select libraries with tags (dgsyp, d for debug),
93
				   see doc Boost, Getting Started, chapter 6.1''')
111
				   see doc Boost, Getting Started, chapter 6.1''')
112
	opt.add_option('--boost-linkage_autodetect', action="store_true", dest='boost_linkage_autodetect',
113
				   help="auto-detect boost linkage options (don't get used to it / might break other stuff)")
94
	opt.add_option('--boost-toolset', type='string',
114
	opt.add_option('--boost-toolset', type='string',
95
				   default='', dest='boost_toolset',
115
				   default='', dest='boost_toolset',
96
				   help='force a toolset e.g. msvc, vc90, \
116
				   help='force a toolset e.g. msvc, vc90, \
 Lines 117-124    Link Here 
117
	try:
137
	try:
118
		val = re_but.search(self.__boost_get_version_file(dir).read()).group(1)
138
		val = re_but.search(self.__boost_get_version_file(dir).read()).group(1)
119
	except:
139
	except:
120
		val = self.check_cxx(fragment=BOOST_VERSION_CODE, includes=[dir],
140
		val = self.check_cxx(fragment=BOOST_VERSION_CODE, includes=[dir], execute=False, define_ret=True)
121
							 execute=True, define_ret=True)
122
	return val
141
	return val
123
142
124
143
 Lines 133-139    Link Here 
133
	if includes:
152
	if includes:
134
		self.fatal('headers not found in %s' % includes)
153
		self.fatal('headers not found in %s' % includes)
135
	else:
154
	else:
136
		self.fatal('headers not found, use --boost-includes=/path/to/boost')
155
		self.fatal('headers not found, please provide a --boost-includes argument (see help)')
137
156
138
157
139
@conf
158
@conf
 Lines 176-186    Link Here 
176
		if libs:
195
		if libs:
177
			self.fatal('libs not found in %s' % libs)
196
			self.fatal('libs not found in %s' % libs)
178
		else:
197
		else:
179
			self.fatal('libs not found, \
198
			self.fatal('libs not found, please provide a --boost-libs argument (see help)')
180
					   use --boost-includes=/path/to/boost/lib')
199
200
	self.to_log('Found the boost path in %r with the libraries:' % path)
201
	for x in files:
202
		self.to_log('    %r' % x)
181
	return path, files
203
	return path, files
182
204
183
184
@conf
205
@conf
185
def boost_get_libs(self, *k, **kw):
206
def boost_get_libs(self, *k, **kw):
186
	'''
207
	'''
 Lines 194-230    Link Here 
194
	if kw.get('abi', None):
215
	if kw.get('abi', None):
195
		t.append(kw['abi'])
216
		t.append(kw['abi'])
196
	tags = t and '(-%s)+' % '-'.join(t) or ''
217
	tags = t and '(-%s)+' % '-'.join(t) or ''
197
	toolset = '(-%s[0-9]{0,3})+' % self.boost_get_toolset(kw.get('toolset', ''))
218
	toolset = self.boost_get_toolset(kw.get('toolset', ''))
219
	toolset_pat = '(-%s[0-9]{0,3})+' % toolset
198
	version = '(-%s)+' % self.env.BOOST_VERSION
220
	version = '(-%s)+' % self.env.BOOST_VERSION
199
221
200
	def find_lib(re_lib, files):
222
	def find_lib(re_lib, files):
201
		for file in files:
223
		for file in files:
202
			if re_lib.search(file.name):
224
			if re_lib.search(file.name):
225
				self.to_log('Found boost lib %s' % file)
203
				return file
226
				return file
204
		return None
227
		return None
205
228
206
	def format_lib_name(name):
229
	def format_lib_name(name):
207
		if name.startswith('lib'):
230
		if name.startswith('lib') and self.env.CC_NAME != 'msvc':
208
			name = name[3:]
231
			name = name[3:]
209
		return name.split('.')[0]
232
		return name[:name.rfind('.')]
210
233
211
	libs = []
234
	libs = []
212
	for lib in Utils.to_list(k and k[0] or kw.get('lib', None)):
235
	for lib in Utils.to_list(k and k[0] or kw.get('lib', None)):
213
		py = (lib == 'python') and '(-py%s)+' % kw['python'] or ''
236
		py = (lib == 'python') and '(-py%s)+' % kw['python'] or ''
214
		# Trying libraries, from most strict match to least one
237
		# Trying libraries, from most strict match to least one
215
		for pattern in ['boost_%s%s%s%s%s' % (lib, toolset, tags, py, version),
238
		for pattern in ['boost_%s%s%s%s%s' % (lib, toolset_pat, tags, py, version),
216
						'boost_%s%s%s%s' % (lib, tags, py, version),
239
						'boost_%s%s%s%s' % (lib, tags, py, version),
217
						'boost_%s%s%s' % (lib, tags, version),
240
						'boost_%s%s%s' % (lib, tags, version),
218
						# Give up trying to find the right version
241
						# Give up trying to find the right version
219
						'boost_%s%s%s%s' % (lib, toolset, tags, py),
242
						'boost_%s%s%s%s' % (lib, toolset_pat, tags, py),
220
						'boost_%s%s%s' % (lib, tags, py),
243
						'boost_%s%s%s' % (lib, tags, py),
221
						'boost_%s%s' % (lib, tags)]:
244
						'boost_%s%s' % (lib, tags)]:
245
			self.to_log('Trying pattern %s' % pattern)
222
			file = find_lib(re.compile(pattern), files)
246
			file = find_lib(re.compile(pattern), files)
223
			if file:
247
			if file:
224
				libs.append(format_lib_name(file.name))
248
				libs.append(format_lib_name(file.name))
225
				break
249
				break
226
		else:
250
		else:
227
			self.fatal('lib %s not found in %s' % (lib, path))
251
			self.fatal('lib %s not found in %s' % (lib, path.abspath()))
228
252
229
	return path.abspath(), libs
253
	return path.abspath(), libs
230
254
 Lines 232-241    Link Here 
232
@conf
256
@conf
233
def check_boost(self, *k, **kw):
257
def check_boost(self, *k, **kw):
234
	"""
258
	"""
235
	initialize boost
259
	Initialize boost libraries to be used.
236
260
237
	You can pass the same parameters as the command line (without "--boost-"),
261
	Keywords: you can pass the same parameters as with the command line (without "--boost-").
238
	but the command line has the priority.
262
	Note that the command line has the priority, and should preferably be used.
239
	"""
263
	"""
240
	if not self.env['CXX']:
264
	if not self.env['CXX']:
241
		self.fatal('load a c++ compiler first, conf.load("compiler_cxx")')
265
		self.fatal('load a c++ compiler first, conf.load("compiler_cxx")')
 Lines 250-261    Link Here 
250
	var = kw.get('uselib_store', 'BOOST')
274
	var = kw.get('uselib_store', 'BOOST')
251
275
252
	self.start_msg('Checking boost includes')
276
	self.start_msg('Checking boost includes')
253
	try:
277
	self.env['INCLUDES_%s' % var] = inc = self.boost_get_includes(**params)
254
		self.env['INCLUDES_%s' % var] = self.boost_get_includes(**params)
278
	self.env.BOOST_VERSION = self.boost_get_version(inc)
255
		self.env.BOOST_VERSION = self.boost_get_version(self.env['INCLUDES_%s' % var])
256
	except WafError:
257
		self.end_msg("not found", 'YELLOW')
258
		raise
259
	self.end_msg(self.env.BOOST_VERSION)
279
	self.end_msg(self.env.BOOST_VERSION)
260
	if Logs.verbose:
280
	if Logs.verbose:
261
		Logs.pprint('CYAN', '	path : %s' % self.env['INCLUDES_%s' % var])
281
		Logs.pprint('CYAN', '	path : %s' % self.env['INCLUDES_%s' % var])
 Lines 263-274    Link Here 
263
	if not params['lib']:
283
	if not params['lib']:
264
		return
284
		return
265
	self.start_msg('Checking boost libs')
285
	self.start_msg('Checking boost libs')
266
	try:
286
	suffix = params.get('static', None) and 'ST' or ''
267
		suffix = params.get('static', 'ST') or ''
287
	path, libs = self.boost_get_libs(**params)
268
		path, libs = self.boost_get_libs(**params)
269
	except WafError:
270
		self.end_msg("not found", 'YELLOW')
271
		raise
272
	self.env['%sLIBPATH_%s' % (suffix, var)] = [path]
288
	self.env['%sLIBPATH_%s' % (suffix, var)] = [path]
273
	self.env['%sLIB_%s' % (suffix, var)] = libs
289
	self.env['%sLIB_%s' % (suffix, var)] = libs
274
	self.end_msg('ok')
290
	self.end_msg('ok')
 Lines 276-278    Link Here 
276
		Logs.pprint('CYAN', '	path : %s' % path)
292
		Logs.pprint('CYAN', '	path : %s' % path)
277
		Logs.pprint('CYAN', '	libs : %s' % libs)
293
		Logs.pprint('CYAN', '	libs : %s' % libs)
278
294
295
296
	def try_link():
297
		if 'system' in params['lib']:
298
			self.check_cxx(
299
			 fragment="\n".join([
300
			  '#include <boost/system/error_code.hpp>',
301
			  'int main() { boost::system::error_code c; }',
302
			 ]),
303
			 use=var,
304
			 execute=False,
305
			)
306
		if 'thread' in params['lib']:
307
			self.check_cxx(
308
			 fragment="\n".join([
309
			  '#include <boost/thread.hpp>',
310
			  'int main() { boost::thread t; }',
311
			 ]),
312
			 use=var,
313
			 execute=False,
314
			)
315
316
	if params.get('linkage_autodetect', False):
317
		self.start_msg("Attempting to detect boost linkage flags")
318
		toolset = self.boost_get_toolset(kw.get('toolset', ''))
319
		if toolset in ['vc']:
320
			# disable auto-linking feature, causing error LNK1181
321
			# because the code wants to be linked against
322
			self.env['DEFINES_%s' % var] += ['BOOST_ALL_NO_LIB']
323
324
			# if no dlls are present, we guess the .lib files are not stubs
325
			has_dlls = False
326
			for x in Utils.listdir(path):
327
				if x.endswith(self.env.cxxshlib_PATTERN % ''):
328
					has_dlls = True
329
					break
330
			if not has_dlls:
331
				self.env['STLIBPATH_%s' % var] = [path]
332
				self.env['STLIB_%s' % var] = libs
333
				del self.env['LIB_%s' % var]
334
				del self.env['LIBPATH_%s' % var]
335
336
			# we attempt to play with some known-to-work CXXFLAGS combinations
337
			for cxxflags in (['/MD', '/EHsc'], []):
338
				self.env.stash()
339
				self.env["CXXFLAGS_%s" % var] += cxxflags
340
				try:
341
					try_link()
342
					self.end_msg("ok: winning cxxflags combination: %s" % (self.env["CXXFLAGS_%s" % var]))
343
					e = None
344
					break
345
				except Errors.ConfigurationError as exc:
346
					self.env.revert()
347
					e = exc
348
349
			if e is not None:
350
				self.fatal("Could not auto-detect boost linking flags combination, you may report it to boost.py author", ex=e)
351
		else:
352
			self.fatal("Boost linkage flags auto-detection not implemented (needed ?) for this toolchain")
353
	else:
354
		self.start_msg('Checking for boost linkage')
355
		try:
356
			try_link()
357
		except Errors.ConfigurationError as e:
358
			self.fatal("Could not link against boost libraries using supplied options")
359
		self.end_msg('ok')
360
(-)a/waf-tools/cflags.py (-3 / +1 lines)
 Lines 1-6    Link Here 
1
import Logs
1
from waflib import Logs, Options, Utils
2
import Options
3
import Utils
4
2
5
3
6
class CompilerTraits(object):
4
class CompilerTraits(object):
(-)a/waf-tools/command.py (-9 / +6 lines)
 Lines 1-18    Link Here 
1
import TaskGen# import feature, taskgen_method, before_method, task_gen
1
import re
2
import Node, Task, Utils, Build
3
import subprocess
2
import subprocess
4
import Options
3
4
# import feature, taskgen_method, before_method, task_gen
5
from waflib import TaskGen, Node, Task, Utils, Build, Options, Logs, Task
6
debug = Logs.debug
7
error = Logs.error
5
8
6
import shellcmd
9
import shellcmd
7
#shellcmd.subprocess = pproc # the WAF version of the subprocess module is supposedly less buggy
10
#shellcmd.subprocess = pproc # the WAF version of the subprocess module is supposedly less buggy
8
9
from Logs import debug, error
10
shellcmd.debug = debug
11
shellcmd.debug = debug
11
12
12
import Task
13
14
import re
15
16
13
17
arg_rx = re.compile(r"(?P<dollar>\$\$)|(?P<subst>\$\{(?P<var>\w+)(?P<code>.*?)\})", re.M)
14
arg_rx = re.compile(r"(?P<dollar>\$\$)|(?P<subst>\$\{(?P<var>\w+)(?P<code>.*?)\})", re.M)
18
15
(-)a/waf-tools/misc.py (-3 lines)
 Lines 322-330    Link Here 
322
322
323
	if self.cwd is None:
323
	if self.cwd is None:
324
		cwd = None
324
		cwd = None
325
	else:
326
		assert isinstance(cwd, CmdDirArg)
327
		self.cwd.find_node(self.path)
328
325
329
	args = []
326
	args = []
330
	inputs = []
327
	inputs = []
(-)a/waf-tools/pkgconfig.py (-78 lines)
 Lines 1-78    Link Here 
1
# -*- mode: python; encoding: utf-8 -*-
2
# Gustavo Carneiro (gjamc) 2008
3
4
import Options
5
import Configure
6
import subprocess
7
import config_c
8
import sys
9
10
def configure(conf):
11
	pkg_config = conf.find_program('pkg-config', var='PKG_CONFIG')
12
	if not pkg_config: return
13
14
@Configure.conf
15
def pkg_check_modules(conf, uselib_name, expression, mandatory=True):
16
	pkg_config = conf.env['PKG_CONFIG']
17
	if not pkg_config:
18
		if mandatory:
19
			conf.fatal("pkg-config is not available")
20
		else:
21
			return False
22
23
	if Options.options.verbose:
24
		extra_msg = ' (%s)' % expression
25
	else:
26
		extra_msg = ''
27
28
	conf.start_msg('Checking for pkg-config flags for %s%s' % (uselib_name, extra_msg))
29
30
	argv = [pkg_config, '--cflags', '--libs', expression]
31
	cmd = subprocess.Popen(argv, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
32
	out, err = cmd.communicate()
33
	retval = cmd.wait()
34
35
	conf.to_log('%r: %r (exit code %i)\n%s' % (argv, out, retval, err))
36
37
	if retval != 0:
38
		conf.end_msg(False)
39
		sys.stderr.write(err)
40
	else:
41
		if Options.options.verbose:
42
			conf.end_msg(out)
43
		else:
44
			conf.end_msg(True)
45
46
	if retval == 0:
47
		conf.parse_flags(out, uselib_name, conf.env)
48
		conf.env[uselib_name] = True
49
		return True
50
51
	else:
52
53
		conf.env[uselib_name] = False
54
		if mandatory:
55
			raise Configure.ConfigurationError('pkg-config check failed')
56
		else:
57
			return False
58
59
@Configure.conf
60
def pkg_check_module_variable(conf, module, variable):
61
	pkg_config = conf.env['PKG_CONFIG']
62
	if not pkg_config:
63
		conf.fatal("pkg-config is not available")
64
65
	argv = [pkg_config, '--variable', variable, module]
66
	cmd = subprocess.Popen(argv, stdout=subprocess.PIPE)
67
	out, dummy = cmd.communicate()
68
	retval = cmd.wait()
69
	out = out.rstrip() # strip the trailing newline
70
71
	msg_checking = ("Checking for pkg-config variable %r in %s" % (variable, module,))
72
	conf.check_message_custom(msg_checking, '', out)
73
	conf.log.write('%r: %r (exit code %i)\n' % (argv, out, retval))
74
75
	if retval == 0:
76
		return out
77
	else:
78
		raise Configure.ConfigurationError('pkg-config check failed')
(-)a/waf-tools/relocation.py (-2 / +2 lines)
 Lines 64-70    Link Here 
64
	try:
64
	try:
65
		return self.uid_
65
		return self.uid_
66
	except AttributeError:
66
	except AttributeError:
67
		# this is not a real hot zone, but we want to avoid surprizes here
67
		# this is not a real hot zone, but we want to avoid surprises here
68
		m = Utils.md5()
68
		m = Utils.md5()
69
		up = m.update
69
		up = m.update
70
		up(self.__class__.__name__.encode())
70
		up(self.__class__.__name__.encode())
 Lines 80-85    Link Here 
80
	lst = self.to_incnodes(self.to_list(getattr(self, 'includes', [])) + self.env['INCLUDES'])
80
	lst = self.to_incnodes(self.to_list(getattr(self, 'includes', [])) + self.env['INCLUDES'])
81
	self.includes_nodes = lst
81
	self.includes_nodes = lst
82
	bld = self.bld
82
	bld = self.bld
83
	self.env['INCPATHS'] = [x.is_child_of(bld.srcnode) and x.path_from(bld.srcnode) or x.abspath() for x in lst]
83
	self.env['INCPATHS'] = [x.is_child_of(bld.srcnode) and x.path_from(bld.bldnode) or x.abspath() for x in lst]
84
84
85
85
(-)a/wscript (-64 / +43 lines)
 Lines 8-32    Link Here 
8
import os.path
8
import os.path
9
import re
9
import re
10
import shlex
10
import shlex
11
import subprocess
11
import textwrap
12
import textwrap
12
13
14
from utils import read_config_file
15
16
13
# WAF modules
17
# WAF modules
14
import subprocess
18
from waflib import Utils, Scripting, Configure, Build, Options, TaskGen, Context, Task, Logs, Errors
15
import Options
16
17
import Logs
18
import TaskGen
19
20
import Task
21
22
import Utils
23
import Build
24
import Configure
25
import Scripting
26
27
from waflib.Errors import WafError
19
from waflib.Errors import WafError
28
20
29
from utils import read_config_file
21
22
# local modules
23
import wutils
24
30
25
31
# By default, all modules will be enabled, examples will be disabled,
26
# By default, all modules will be enabled, examples will be disabled,
32
# and tests will be disabled.
27
# and tests will be disabled.
 Lines 52-60    Link Here 
52
	}
47
	}
53
cflags.default_profile = 'debug'
48
cflags.default_profile = 'debug'
54
49
55
# local modules
56
import wutils
57
58
Configure.autoconfig = 0
50
Configure.autoconfig = 0
59
51
60
# the following two variables are used by the target "waf dist"
52
# the following two variables are used by the target "waf dist"
 Lines 214-222    Link Here 
214
                   dest='doxygen_no_build')
206
                   dest='doxygen_no_build')
215
207
216
    # options provided in subdirectories
208
    # options provided in subdirectories
217
    opt.sub_options('src')
209
    opt.recurse('src')
218
    opt.sub_options('bindings/python')
210
    opt.recurse('bindings/python')
219
    opt.sub_options('src/internet')
211
    opt.recurse('src/internet')
220
212
221
213
222
def _check_compilation_flag(conf, flag, mode='cxx', linkflags=None):
214
def _check_compilation_flag(conf, flag, mode='cxx', linkflags=None):
 Lines 240-246    Link Here 
240
        flag_str = flag_str[:28] + "..."
232
        flag_str = flag_str[:28] + "..."
241
233
242
    conf.start_msg('Checking for compilation %s support' % (flag_str,))
234
    conf.start_msg('Checking for compilation %s support' % (flag_str,))
243
    env = conf.env.copy()
235
    env = conf.env.derive()
244
236
245
    if mode == 'cc':
237
    if mode == 'cc':
246
        mode = 'c'
238
        mode = 'c'
 Lines 259-265    Link Here 
259
        retval = conf.run_c_code(code='#include <stdio.h>\nint main() { return 0; }\n',
251
        retval = conf.run_c_code(code='#include <stdio.h>\nint main() { return 0; }\n',
260
                                 env=env, compile_filename=fname,
252
                                 env=env, compile_filename=fname,
261
                                 features=[mode, mode+'program'], execute=False)
253
                                 features=[mode, mode+'program'], execute=False)
262
    except Configure.ConfigurationError:
254
    except Errors.ConfigurationError:
263
        ok = False
255
        ok = False
264
    else:
256
    else:
265
        ok = (retval == 0)
257
        ok = (retval == 0)
 Lines 286-292    Link Here 
286
        return None
278
        return None
287
279
288
def configure(conf):
280
def configure(conf):
289
    conf.check_tool("relocation", ["waf-tools"])
281
    conf.load('relocation', tooldir=['waf-tools'])
290
282
291
    # attach some extra methods
283
    # attach some extra methods
292
    conf.check_nonfatal = types.MethodType(_check_nonfatal, conf)
284
    conf.check_nonfatal = types.MethodType(_check_nonfatal, conf)
 Lines 295-309    Link Here 
295
    conf.check_optional_feature = types.MethodType(check_optional_feature, conf)
287
    conf.check_optional_feature = types.MethodType(check_optional_feature, conf)
296
    conf.env['NS3_OPTIONAL_FEATURES'] = []
288
    conf.env['NS3_OPTIONAL_FEATURES'] = []
297
289
298
    conf.check_tool('compiler_c')
290
    conf.load('compiler_c')
299
    conf.check_tool('compiler_cxx')
291
    conf.load('compiler_cxx')
300
    conf.check_tool('cflags', ['waf-tools'])
292
    conf.load('cflags', tooldir=['waf-tools'])
301
    try:
293
    conf.load('command', tooldir=['waf-tools'])
302
        conf.check_tool('pkgconfig', ['waf-tools'])
294
    conf.load('gnu_dirs')
303
    except Configure.ConfigurationError:
304
        pass
305
    conf.check_tool('command', ['waf-tools'])
306
    conf.check_tool('gnu_dirs')
307
295
308
    env = conf.env
296
    env = conf.env
309
297
 Lines 376-384    Link Here 
376
364
377
    conf.env['MODULES_NOT_BUILT'] = []
365
    conf.env['MODULES_NOT_BUILT'] = []
378
366
379
    conf.sub_config('bindings/python')
367
    conf.recurse('bindings/python')
380
368
381
    conf.sub_config('src')
369
    conf.recurse('src')
382
370
383
    # Set the list of enabled modules.
371
    # Set the list of enabled modules.
384
    if Options.options.enable_modules:
372
    if Options.options.enable_modules:
 Lines 410-416    Link Here 
410
            if not conf.env['NS3_ENABLED_MODULES']:
398
            if not conf.env['NS3_ENABLED_MODULES']:
411
                raise WafError('Exiting because the ' + not_built + ' module can not be built and it was the only one enabled.')
399
                raise WafError('Exiting because the ' + not_built + ' module can not be built and it was the only one enabled.')
412
400
413
    conf.sub_config('src/mpi')
401
    conf.recurse('src/mpi')
414
402
415
    # for suid bits
403
    # for suid bits
416
    try:
404
    try:
 Lines 488-506    Link Here 
488
    # These flags are used for the implicitly dependent modules.
476
    # These flags are used for the implicitly dependent modules.
489
    if env['ENABLE_STATIC_NS3']:
477
    if env['ENABLE_STATIC_NS3']:
490
        if sys.platform == 'darwin':
478
        if sys.platform == 'darwin':
491
            env.STATICLIB_MARKER = '-Wl,-all_load'
479
            env.STLIB_MARKER = '-Wl,-all_load'
492
        else:
480
        else:
493
            env.STATICLIB_MARKER = '-Wl,--whole-archive,-Bstatic'
481
            env.STLIB_MARKER = '-Wl,--whole-archive,-Bstatic'
494
            env.SHLIB_MARKER = '-Wl,-Bdynamic,--no-whole-archive'
482
            env.SHLIB_MARKER = '-Wl,-Bdynamic,--no-whole-archive'
495
483
496
    have_gsl = conf.pkg_check_modules('GSL', 'gsl', mandatory=False)
484
485
    have_gsl = conf.check_cfg(package='gsl', args=['--cflags', '--libs'],
486
                              uselib_store='GSL', mandatory=False)
497
    conf.env['ENABLE_GSL'] = have_gsl
487
    conf.env['ENABLE_GSL'] = have_gsl
498
499
    conf.report_optional_feature("GSL", "GNU Scientific Library (GSL)",
488
    conf.report_optional_feature("GSL", "GNU Scientific Library (GSL)",
500
                                 conf.env['ENABLE_GSL'],
489
                                 conf.env['ENABLE_GSL'],
501
                                 "GSL not found")
490
                                 "GSL not found")
502
    if have_gsl:
503
        conf.env.append_value('DEFINES', "ENABLE_GSL")
504
491
505
    # for compiling C code, copy over the CXX* flags
492
    # for compiling C code, copy over the CXX* flags
506
    conf.env.append_value('CCFLAGS', conf.env['CXXFLAGS'])
493
    conf.env.append_value('CCFLAGS', conf.env['CXXFLAGS'])
 Lines 543-549    Link Here 
543
        print "%-30s: %s%s%s" % (caption, Logs.colors_lst[color], status, Logs.colors_lst['NORMAL'])
530
        print "%-30s: %s%s%s" % (caption, Logs.colors_lst[color], status, Logs.colors_lst['NORMAL'])
544
531
545
532
546
class SuidBuild_task(Task.TaskBase):
533
class SuidBuild_task(Task.Task):
547
    """task that makes a binary Suid
534
    """task that makes a binary Suid
548
    """
535
    """
549
    after = 'link'
536
    after = 'link'
 Lines 555-561    Link Here 
555
        except ValueError, ex:
542
        except ValueError, ex:
556
            raise WafError(str(ex))
543
            raise WafError(str(ex))
557
        program_node = program_obj.path.find_or_declare(program_obj.target)
544
        program_node = program_obj.path.find_or_declare(program_obj.target)
558
        self.filename = program_node.abspath()
545
        self.filename = program_node.get_bld().abspath()
559
546
560
547
561
    def run(self):
548
    def run(self):
 Lines 580-586    Link Here 
580
def create_suid_program(bld, name):
567
def create_suid_program(bld, name):
581
    grp = bld.current_group
568
    grp = bld.current_group
582
    bld.add_group() # this to make sure no two sudo tasks run at the same time
569
    bld.add_group() # this to make sure no two sudo tasks run at the same time
583
    program = bld.new_task_gen(features=['cxx', 'cxxprogram'])
570
    program = bld(features='cxx cxxprogram')
584
    program.is_ns3_program = True
571
    program.is_ns3_program = True
585
    program.module_deps = list()
572
    program.module_deps = list()
586
    program.name = name
573
    program.name = name
 Lines 594-600    Link Here 
594
    return program
581
    return program
595
582
596
def create_ns3_program(bld, name, dependencies=('core',)):
583
def create_ns3_program(bld, name, dependencies=('core',)):
597
    program = bld.new_task_gen(features=['cxx', 'cxxprogram'])
584
    program = bld(features='cxx cxxprogram')
598
585
599
    program.is_ns3_program = True
586
    program.is_ns3_program = True
600
    program.name = name
587
    program.name = name
 Lines 607-613    Link Here 
607
        if sys.platform == 'darwin':
594
        if sys.platform == 'darwin':
608
            program.env.STLIB_MARKER = '-Wl,-all_load'
595
            program.env.STLIB_MARKER = '-Wl,-all_load'
609
        else:
596
        else:
610
            program.env.STLIB_MARKER = '-Wl,--whole-archive,-Bstatic'
597
            program.env.STLIB_MARKER = '-Wl,-Bstatic,--whole-archive'
611
            program.env.SHLIB_MARKER = '-Wl,-Bdynamic,--no-whole-archive'
598
            program.env.SHLIB_MARKER = '-Wl,-Bdynamic,--no-whole-archive'
612
    else:
599
    else:
613
        if program.env.DEST_BINFMT == 'elf':
600
        if program.env.DEST_BINFMT == 'elf':
 Lines 628-635    Link Here 
628
            if dir.startswith('.') or dir == 'CVS':
615
            if dir.startswith('.') or dir == 'CVS':
629
                continue
616
                continue
630
            if os.path.isdir(os.path.join('examples', dir)):
617
            if os.path.isdir(os.path.join('examples', dir)):
631
                bld.add_subdirs(os.path.join('examples', dir))
618
                bld.recurse(os.path.join('examples', dir))
632
633
619
634
def add_scratch_programs(bld):
620
def add_scratch_programs(bld):
635
    all_modules = [mod[len("ns3-"):] for mod in bld.env['NS3_ENABLED_MODULES']]
621
    all_modules = [mod[len("ns3-"):] for mod in bld.env['NS3_ENABLED_MODULES']]
 Lines 652-658    Link Here 
652
            obj.name = obj.target
638
            obj.name = obj.target
653
            obj.install_path = None
639
            obj.install_path = None
654
640
655
656
def _get_all_task_gen(self):
641
def _get_all_task_gen(self):
657
    for group in self.groups:
642
    for group in self.groups:
658
        for taskgen in group:
643
        for taskgen in group:
 Lines 699-705    Link Here 
699
684
700
    wutils.bld = bld
685
    wutils.bld = bld
701
    if Options.options.no_task_lines:
686
    if Options.options.no_task_lines:
702
        import Runner
687
        from waflib import Runner
703
        def null_printout(s):
688
        def null_printout(s):
704
            pass
689
            pass
705
        Runner.printout = null_printout
690
        Runner.printout = null_printout
 Lines 717-723    Link Here 
717
        _cleandocs()
702
        _cleandocs()
718
703
719
    # process subfolders from here
704
    # process subfolders from here
720
    bld.add_subdirs('src')
705
    bld.recurse('src')
721
706
722
    # If modules have been enabled, then set lists of enabled modules
707
    # If modules have been enabled, then set lists of enabled modules
723
    # and enabled module test libraries.
708
    # and enabled module test libraries.
 Lines 784-790    Link Here 
784
                    # launch directory.
769
                    # launch directory.
785
                    launch_dir = os.path.abspath(Context.launch_dir)
770
                    launch_dir = os.path.abspath(Context.launch_dir)
786
                    object_relative_path = os.path.join(
771
                    object_relative_path = os.path.join(
787
                        wutils.relpath(obj.path.abspath(), launch_dir),
772
                        wutils.relpath(obj.path.get_bld().abspath(), launch_dir),
788
                        object_name)
773
                        object_name)
789
774
790
                    bld.env.append_value('NS3_RUNNABLE_PROGRAMS', object_relative_path)
775
                    bld.env.append_value('NS3_RUNNABLE_PROGRAMS', object_relative_path)
 Lines 825-835    Link Here 
825
        if script_runnable:
810
        if script_runnable:
826
            bld.env.append_value('NS3_RUNNABLE_SCRIPTS', script)
811
            bld.env.append_value('NS3_RUNNABLE_SCRIPTS', script)
827
812
828
    bld.add_subdirs('bindings/python')
813
    bld.recurse('bindings/python')
829
814
830
    # Process this subfolder here after the lists of enabled modules
815
    # Process this subfolder here after the lists of enabled modules
831
    # and module test libraries have been set.
816
    # and module test libraries have been set.
832
    bld.add_subdirs('utils')
817
    bld.recurse('utils')
833
818
834
    # Set this so that the lists will be printed at the end of this
819
    # Set this so that the lists will be printed at the end of this
835
    # build command.
820
    # build command.
 Lines 943-949    Link Here 
943
928
944
929
945
930
946
from waflib import Context, Build
947
class CheckContext(Context.Context):
931
class CheckContext(Context.Context):
948
    """run the equivalent of the old ns-3 unit tests using test.py"""
932
    """run the equivalent of the old ns-3 unit tests using test.py"""
949
    cmd = 'check'
933
    cmd = 'check'
 Lines 961-967    Link Here 
961
945
962
946
963
class print_introspected_doxygen_task(Task.TaskBase):
947
class print_introspected_doxygen_task(Task.TaskBase):
964
    after = 'cc cxx link'
948
    after = 'cxx link'
965
    color = 'BLUE'
949
    color = 'BLUE'
966
950
967
    def __init__(self, bld):
951
    def __init__(self, bld):
 Lines 985-991    Link Here 
985
                           # --enable-modules=xxx
969
                           # --enable-modules=xxx
986
            pass
970
            pass
987
        else:
971
        else:
988
            prog = program_obj.path.find_or_declare(ccroot.get_target_name(program_obj)).abspath(env)
972
            prog = program_obj.path.find_or_declare(ccroot.get_target_name(program_obj)).get_bld().abspath(env)
989
973
990
            # Create a header file with the introspected information.
974
            # Create a header file with the introspected information.
991
            doxygen_out = open(os.path.join('doc', 'introspected-doxygen.h'), 'w')
975
            doxygen_out = open(os.path.join('doc', 'introspected-doxygen.h'), 'w')
 Lines 1000-1006    Link Here 
1000
            text_out.close()
984
            text_out.close()
1001
985
1002
class run_python_unit_tests_task(Task.TaskBase):
986
class run_python_unit_tests_task(Task.TaskBase):
1003
    after = 'cc cxx link'
987
    after = 'cxx link'
1004
    color = 'BLUE'
988
    color = 'BLUE'
1005
989
1006
    def __init__(self, bld):
990
    def __init__(self, bld):
 Lines 1039-1045    Link Here 
1039
        raise WafError(msg)
1023
        raise WafError(msg)
1040
1024
1041
1025
1042
from waflib import Context, Build
1043
class Ns3ShellContext(Context.Context):
1026
class Ns3ShellContext(Context.Context):
1044
    """run a shell with an environment suitably modified to run locally built programs"""
1027
    """run a shell with an environment suitably modified to run locally built programs"""
1045
    cmd = 'shell'
1028
    cmd = 'shell'
 Lines 1085-1091    Link Here 
1085
        raise SystemExit(1)
1068
        raise SystemExit(1)
1086
        return
1069
        return
1087
1070
1088
    prog = program_obj.path.find_or_declare(program_obj.target).abspath()
1071
    prog = program_obj.path.find_or_declare(program_obj.target).get_bld().abspath()
1089
1072
1090
    if not os.path.exists(prog):
1073
    if not os.path.exists(prog):
1091
        Logs.error("print-introspected-doxygen has not been built yet."
1074
        Logs.error("print-introspected-doxygen has not been built yet."
 Lines 1112-1119    Link Here 
1112
        raise SystemExit(1)
1095
        raise SystemExit(1)
1113
1096
1114
1097
1115
from waflib import Context, Build
1116
1117
def _getVersion():
1098
def _getVersion():
1118
    """update the ns3_version.js file, when building documentation"""
1099
    """update the ns3_version.js file, when building documentation"""
1119
1100
 Lines 1133-1139    Link Here 
1133
	bld.execute()
1114
	bld.execute()
1134
        _doxygen(bld)
1115
        _doxygen(bld)
1135
1116
1136
from waflib import Context, Build
1137
class Ns3SphinxContext(Context.Context):
1117
class Ns3SphinxContext(Context.Context):
1138
    """build the Sphinx documentation: manual, tutorial, models"""
1118
    """build the Sphinx documentation: manual, tutorial, models"""
1139
    
1119
    
 Lines 1154-1160    Link Here 
1154
            self.sphinx_build(os.path.join("doc", sphinxdir))
1134
            self.sphinx_build(os.path.join("doc", sphinxdir))
1155
     
1135
     
1156
1136
1157
from waflib import Context, Build
1158
class Ns3DocContext(Context.Context):
1137
class Ns3DocContext(Context.Context):
1159
    """build all the documentation: doxygen, manual, tutorial, models"""
1138
    """build all the documentation: doxygen, manual, tutorial, models"""
1160
    
1139
    
(-)a/wutils.py (-7 / +3 lines)
 Lines 1-16    Link Here 
1
import os
1
import os
2
import os.path
2
import os.path
3
import re
3
import sys
4
import sys
4
import subprocess
5
import subprocess
5
import shlex
6
import shlex
6
7
7
# WAF modules
8
# WAF modules
8
import Options
9
from waflib import Options, Utils, Logs, TaskGen, Build, Context
9
import Utils
10
import Logs
11
import TaskGen
12
import Build
13
import re
14
from waflib.Errors import WafError
10
from waflib.Errors import WafError
15
11
16
# these are set from the main wscript file
12
# these are set from the main wscript file
 Lines 47-53    Link Here 
47
            return os.path.curdir
43
            return os.path.curdir
48
        return os.path.join(*rel_list)
44
        return os.path.join(*rel_list)
49
45
50
from waflib import Context
46
51
def find_program(program_name, env):
47
def find_program(program_name, env):
52
    launch_dir = os.path.abspath(Context.launch_dir)
48
    launch_dir = os.path.abspath(Context.launch_dir)
53
    #top_dir = os.path.abspath(Options.cwd_launch)
49
    #top_dir = os.path.abspath(Options.cwd_launch)

Return to bug 1562