fixing merge error.
authorbhurd
Thu, 10 Feb 2011 00:55:27 -0500
changeset 6865 bd32d35a48e2
parent 6864 92b0d5c84e62
child 6866 c8e9530fcbdb
fixing merge error.
src/internet-stack/wscript
--- a/src/internet-stack/wscript	Thu Feb 10 00:39:03 2011 -0500
+++ b/src/internet-stack/wscript	Thu Feb 10 00:55:27 2011 -0500
@@ -1,1 +1,187 @@
-fix
\ No newline at end of file
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+import os
+import sys
+
+import Options
+import Logs
+import Utils
+import Task
+
+# Required NSC version
+NSC_RELEASE_NAME = "nsc-0.5.2"
+
+
+def set_options(opt):
+    opt.add_option('--with-nsc',
+                   help=('Use Network Simulation Cradle, given by the indicated path,'
+                         ' to allow the use of real-world network stacks'),
+                   default='', dest='with_nsc')
+
+
+def configure(conf):
+    conf.env['ENABLE_NSC'] = False
+
+    # checks for flex and bison, which is needed to build NSCs globaliser
+    # TODO: how to move these checks into the allinone scripts?
+    #def check_nsc_buildutils():
+    #    import flex
+    #    import bison
+    #    conf.check_tool('flex bison')
+    #    conf.check(lib='fl', mandatory=True)
+
+    # Check for the location of NSC
+    if Options.options.with_nsc:
+        if os.path.isdir(Options.options.with_nsc):
+            conf.check_message("NSC location", '', True, ("%s (given)" % Options.options.with_nsc))
+            conf.env['WITH_NSC'] = os.path.abspath(Options.options.with_nsc)
+    else:
+        # ns-3-dev uses ../nsc, while ns-3 releases use ../NSC_RELEASE_NAME
+        nsc_dir = os.path.join('..', "nsc")
+        nsc_release_dir = os.path.join('..', NSC_RELEASE_NAME)
+        if os.path.isdir(nsc_dir):
+            conf.check_message("NSC location", '', True, ("%s (guessed)" % nsc_dir))
+            conf.env['WITH_NSC'] = os.path.abspath(nsc_dir)
+        elif os.path.isdir(nsc_release_dir):
+            conf.check_message("NSC location", '', True, ("%s (guessed)" % nsc_release_dir))
+            conf.env['WITH_NSC'] = os.path.abspath(nsc_release_dir)
+        del nsc_dir
+        del nsc_release_dir
+
+    if not conf.env['WITH_NSC']:
+        conf.check_message("NSC location", '', False)
+        conf.report_optional_feature("nsc", "Network Simulation Cradle", False,
+                                     "NSC not found (see option --with-nsc)")
+	return
+    
+    if sys.platform in ['linux2']:
+        arch = os.uname()[4]
+    else:
+        arch = None
+    ok = False
+    if arch in ('x86_64', 'i686', 'i586', 'i486', 'i386'):
+        conf.env['NSC_ENABLED'] = True
+        conf.env.append_value('CXXDEFINES', 'NETWORK_SIMULATION_CRADLE')
+        conf.check(mandatory=True, lib='dl', define_name='HAVE_DL', uselib='DL')
+        ok = True
+    conf.check_message('NSC supported architecture', arch, ok)
+    
+    if not ok:
+        conf.env['NSC_ENABLED'] = False
+        conf.report_optional_feature("nsc", "Network Simulation Cradle", False,
+                                     "architecture %r not supported" % arch)
+        return
+
+    lib_to_check = 'liblinux2.6.26.so'
+
+    if not os.path.exists(os.path.join(conf.env['WITH_NSC'], lib_to_check)):
+        conf.env['NSC_ENABLED'] = False
+        conf.report_optional_feature("nsc", "Network Simulation Cradle", False,
+            "NSC library %s is missing: NSC has not been built?" % lib_to_check)
+        return
+
+    # append the NSC kernel dirs to the module path so that these dirs
+    # will end up in the LD_LIBRARY_PATH, thus allowing the NSC NS-3
+    # module to find the necessary NSC shared libraries.
+    for nsc_module in ['linux-2.6.18', 'linux-2.6.26']:
+        conf.env.append_value('NS3_MODULE_PATH',
+                              os.path.abspath(os.path.join(conf.env['WITH_NSC'], nsc_module)))
+
+    conf.report_optional_feature("nsc", "Network Simulation Cradle", True, "")
+
+
+
+def build(bld):
+    obj = bld.create_ns3_module('internet-stack', ['node'])
+    obj.source = [
+        'tcp-test.cc',
+        'udp-test.cc',
+        'ipv4-test.cc',
+        'ipv4-raw-test.cc',
+        'ipv4-l4-protocol.cc',
+        'udp-header.cc',
+        'tcp-header.cc',
+        'ipv4-interface.cc',
+        'ipv4-l3-protocol.cc',
+        'ipv4-end-point.cc',
+        'udp-l4-protocol.cc',
+        'tcp-l4-protocol.cc',
+        'arp-header.cc',
+        'arp-cache.cc',
+        'arp-l3-protocol.cc',
+        'udp-socket-impl.cc',
+        'ipv4-end-point-demux.cc',
+        'udp-socket-factory-impl.cc',
+        'tcp-socket-factory-impl.cc',
+        'pending-data.cc',
+        'rtt-estimator.cc',
+        'ipv4-raw-socket-factory-impl.cc',
+        'ipv4-raw-socket-impl.cc',
+        'icmpv4.cc',
+        'icmpv4-l4-protocol.cc',
+        'loopback-net-device.cc',
+        'ndisc-cache.cc',
+        'ipv6-interface.cc',
+        'icmpv6-header.cc',
+        'ipv6-l3-protocol.cc',
+        'ipv6-end-point.cc',
+        'ipv6-end-point-demux.cc',
+        'ipv6-l4-protocol.cc',
+        'ipv6-raw-socket-factory-impl.cc',
+        'ipv6-raw-socket-impl.cc',
+        'ipv6-autoconfigured-prefix.cc',
+        'ipv6-extension.cc',
+        'ipv6-extension-header.cc',
+        'ipv6-extension-demux.cc',
+        'ipv6-option.cc',
+        'ipv6-option-header.cc',
+        'ipv6-option-demux.cc',
+        'icmpv6-l4-protocol.cc',
+        'ipv6-test.cc',
+        'ipv6-extension-header-test-suite.cc',
+        'tcp-socket-base.cc',
+        'tcp-rfc793.cc',
+        'tcp-tahoe.cc',
+        'tcp-reno.cc',
+        'tcp-newreno.cc',
+        'tcp-rx-buffer.cc',
+        'tcp-tx-buffer.cc',
+        'ipv4-packet-info-tag.cc',
+        'ipv6-packet-info-tag.cc',
+        ]
+
+    headers = bld.new_task_gen('ns3header')
+    headers.module = 'internet-stack'
+    headers.source = [
+        'udp-header.h',
+        'tcp-header.h',
+        'icmpv4.h',
+        'icmpv6-header.h',
+        # used by routing
+        'ipv4-interface.h',
+        'ipv4-l3-protocol.h',
+        'ipv6-l3-protocol.h',
+        'ipv6-extension-header.h',
+        'ipv6-option-header.h',
+        'arp-l3-protocol.h',
+        'udp-l4-protocol.h',
+        'tcp-l4-protocol.h',
+        'icmpv4-l4-protocol.h',
+        'ipv4-l4-protocol.h',
+        'arp-header.h',
+        'arp-cache.h',
+        'icmpv6-l4-protocol.h',
+        'ipv6-l4-protocol.h',
+        'ipv6-interface.h',
+        'ndisc-cache.h',
+        'loopback-net-device.h',
+        'ipv4-packet-info-tag.h',
+        'ipv6-packet-info-tag.h',
+       ]
+
+    if bld.env['NSC_ENABLED']:
+        obj.source.append ('nsc-tcp-socket-impl.cc')
+        obj.source.append ('nsc-tcp-l4-protocol.cc')
+        obj.source.append ('nsc-tcp-socket-factory-impl.cc')
+        obj.source.append ('nsc-sysctl.cc')
+        headers.source.append('nsc-tcp-l4-protocol.h')
+        obj.uselib = 'DL'