diff --git a/bindings/python/wscript b/bindings/python/wscript index 8c0c3d2bb..9681e245f 100644 --- a/bindings/python/wscript +++ b/bindings/python/wscript @@ -14,6 +14,8 @@ import Logs import Build import Utils +from waflib.Errors import WafError + ## https://launchpad.net/pybindgen/ REQUIRED_PYBINDGEN_VERSION = (0, 15, 0, 795) REQUIRED_PYGCCXML_VERSION = (0, 9, 5) @@ -52,10 +54,6 @@ def options(opt): help=("Don't build Python bindings."), action="store_true", default=False, dest='python_disable') - opt.add_option('--python-scan', - help=("Rescan Python bindings. Needs working GCCXML / pygccxml environment."), - action="store_true", default=False, - dest='python_scan') opt.add_option('--apiscan', help=("EXPERIMENTAL: Rescan the API for the indicated module(s), for Python bindings. " "Needs working GCCXML / pygccxml environment. " @@ -103,6 +101,21 @@ def configure(conf): conf.report_optional_feature("python", "Python Bindings", False, str(ex)) return + # stupid Mac OSX Python wants to build extensions as "universal + # binaries", i386, x86_64, and ppc, but this way the type + # __uint128_t is not available. We need to disable the multiarch + # crap by removing the -arch parameters. + for flags_var in ["CFLAGS_PYEXT", "CFLAGS_PYEMBED", "CXXFLAGS_PYEMBED", + "CXXFLAGS_PYEXT", "LINKFLAGS_PYEMBED", "LINKFLAGS_PYEXT"]: + flags = conf.env[flags_var] + i = 0 + while i < len(flags): + if flags[i] == '-arch': + del flags[i] + del flags[i] + continue + i += 1 + conf.env[flags_var] = flags if 0: # alternative code to computing PYTHONDIR, that is more correct than the one in waf 1.5.16 @@ -261,7 +274,10 @@ int main () ## Check gccxml version - gccxml = conf.find_program('gccxml', var='GCCXML') + try: + gccxml = conf.find_program('gccxml', var='GCCXML') + except WafError: + gccxml = None if not gccxml: Logs.warn("gccxml missing; automatic scanning of API definitions will not be possible") conf.report_optional_feature("pygccxml", "Python API Scanning Support", False, diff --git a/src/core/model/int64x64-128.h b/src/core/model/int64x64-128.h index d1a60c605..a116b8874 100644 --- a/src/core/model/int64x64-128.h +++ b/src/core/model/int64x64-128.h @@ -6,7 +6,7 @@ #include #include -#if defined(HAVE___UINT128_T)and !defined(HAVE_UINT128_T) +#if defined(HAVE___UINT128_T) && !defined(HAVE_UINT128_T) typedef __uint128_t uint128_t; typedef __int128_t int128_t; #endif diff --git a/src/emu/wscript b/src/emu/wscript index b48b012b8..43c51106d 100644 --- a/src/emu/wscript +++ b/src/emu/wscript @@ -4,7 +4,7 @@ import os.path def configure(conf): if conf.env['ENABLE_THREADING']: - conf.env['ENABLE_EMU'] = conf.check(header_name='netpacket/packet.h', + conf.env['ENABLE_EMU'] = conf.check_nonfatal(header_name='netpacket/packet.h', define_name='HAVE_PACKET_H') conf.report_optional_feature("EmuNetDevice", "Emulated Net Device", conf.env['ENABLE_EMU'], diff --git a/src/openflow/wscript b/src/openflow/wscript index 4a639f7d5..d5580282a 100644 --- a/src/openflow/wscript +++ b/src/openflow/wscript @@ -2,6 +2,7 @@ import os import Options +from waflib.Errors import WafError def options(opt): opt.add_option('--with-openflow', @@ -10,17 +11,20 @@ def options(opt): opt.tool_options('boost', tooldir=["waf-tools"]) def configure(conf): - conf.check_tool('boost') - conf.env['BOOST'] = conf.check_boost(lib = 'signals filesystem', - kind = 'STATIC_BOTH', - score_version = (-1000, 1000), - tag_minscore = 1000) - if not conf.env['BOOST']: + try: + conf.check_tool('boost') conf.env['BOOST'] = conf.check_boost(lib = 'signals filesystem', - kind = 'STATIC_BOTH', - score_version = (-1000, 1000), - tag_minscore = 1000, - libpath="/usr/lib64") + kind = 'STATIC_BOTH', + score_version = (-1000, 1000), + tag_minscore = 1000) + if not conf.env['BOOST']: + conf.env['BOOST'] = conf.check_boost(lib = 'signals filesystem', + kind = 'STATIC_BOTH', + score_version = (-1000, 1000), + tag_minscore = 1000, + libpath="/usr/lib64") + except WafError: + conf.env['BOOST'] = False if not conf.env['BOOST']: conf.report_optional_feature("openflow", "NS-3 OpenFlow Integration", False, diff --git a/src/tap-bridge/wscript b/src/tap-bridge/wscript index 913843232..ab1376b60 100644 --- a/src/tap-bridge/wscript +++ b/src/tap-bridge/wscript @@ -4,7 +4,7 @@ import os.path def configure(conf): if conf.env['ENABLE_THREADING']: - conf.env['ENABLE_TAP'] = conf.check(header_name='linux/if_tun.h', + conf.env['ENABLE_TAP'] = conf.check_nonfatal(header_name='linux/if_tun.h', define_name='HAVE_IF_TUN_H') conf.report_optional_feature("TapBridge", "Tap Bridge", conf.env['ENABLE_TAP'], diff --git a/src/visualizer/wscript b/src/visualizer/wscript index dbfbd5e62..8857f458e 100644 --- a/src/visualizer/wscript +++ b/src/visualizer/wscript @@ -36,8 +36,8 @@ def build(bld): return module.features.append('pyembed') - module.env.append_value('CXXFLAGS', module.env['shlib_CXXFLAGS']) - module.includes = '.' + #module.env.append_value('CXXFLAGS', module.env['shlib_CXXFLAGS']) + #module.includes = '.' module.source.extend([ 'model/pyviz.cc', diff --git a/src/wscript b/src/wscript index 624502bd9..0e670d332 100644 --- a/src/wscript +++ b/src/wscript @@ -308,14 +308,14 @@ def ns3_python_bindings(bld): #mod = mod.split("--lib")[0] pymod.env.append_value('LINKFLAGS', '-l' + mod) pymod.env.append_value('LINKFLAGS', '-Wl,-Bdynamic,--no-whole-archive') - defines = list(pymod.env['CXXDEFINES']) + defines = list(pymod.env['DEFINES']) defines.extend(['NS_DEPRECATED=', 'NS3_DEPRECATED_H']) if Options.platform == 'win32': try: defines.remove('_DEBUG') # causes undefined symbols on win32 except ValueError: pass - pymod.env['CXXDEFINES'] = defines + pymod.env['DEFINES'] = defines pymod.includes = '# bindings' pymod.install_path = '${PYTHONDIR}/ns' return pymod diff --git a/wscript b/wscript index af94866af..29b3b5395 100644 --- a/wscript +++ b/wscript @@ -24,6 +24,8 @@ import Build import Configure import Scripting +from waflib.Errors import WafError + from utils import read_config_file # By default, all modules will be enabled, examples will be disabled, @@ -286,8 +288,8 @@ def configure(conf): env.append_value('LINKFLAGS', '-fprofile-arcs') if Options.options.build_profile == 'debug': - env.append_value('CXXDEFINES', 'NS3_ASSERT_ENABLE') - env.append_value('CXXDEFINES', 'NS3_LOG_ENABLE') + env.append_value('DEFINES', 'NS3_ASSERT_ENABLE') + env.append_value('DEFINES', 'NS3_LOG_ENABLE') env['PLATFORM'] = sys.platform @@ -467,12 +469,10 @@ def configure(conf): conf.env['ENABLE_GSL'], "GSL not found") if have_gsl: - conf.env.append_value('CXXDEFINES', "ENABLE_GSL") - conf.env.append_value('CCDEFINES', "ENABLE_GSL") + conf.env.append_value('DEFINES', "ENABLE_GSL") # for compiling C code, copy over the CXX* flags conf.env.append_value('CCFLAGS', conf.env['CXXFLAGS']) - conf.env.append_value('CCDEFINES', conf.env['CXXDEFINES']) def add_gcc_flag(flag): if env['COMPILER_CXX'] == 'g++' and 'CXXFLAGS' not in os.environ: @@ -486,7 +486,10 @@ def configure(conf): add_gcc_flag('-fstrict-aliasing') add_gcc_flag('-Wstrict-aliasing') - conf.find_program('doxygen', var='DOXYGEN') + try: + conf.find_program('doxygen', var='DOXYGEN') + except WafError: + pass # append user defined flags after all our ones for (confvar, envvar) in [['CCFLAGS', 'CCFLAGS_EXTRA'],