WAF: add back the --enable-rpath option, per Mathieu's request, though disabled by default.
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Fri, 20 Jul 2007 11:38:16 +0100
changeset 955 c9be0df711d2
parent 954 a54d59850d03
child 956 cf63e1cc64be
child 957 426b85bab45f
WAF: add back the --enable-rpath option, per Mathieu's request, though disabled by default.
src/wscript
--- a/src/wscript	Fri Jul 20 11:27:34 2007 +0100
+++ b/src/wscript	Fri Jul 20 11:38:16 2007 +0100
@@ -22,26 +22,37 @@
 
 def set_options(opt):
     opt.sub_options('simulator')
-    
+
+    opt.add_option('--enable-rpath',
+                   help=("Link programs with rpath"
+                         " (normally not needed, see "
+                         " --run and --shell; moreover, only works in some"
+                         " specific platforms, such as Linux and Solaris)"),
+                   action="store_true", dest='enable_rpath', default=False)
+
+
 def configure(conf):
     conf.sub_config('core')
     conf.sub_config('simulator')
 
     blddir = os.path.abspath(os.path.join(conf.m_blddir, conf.env.variant()))
     for module in all_modules:
-        conf.env.append_value('NS3_MODULE_PATH', os.path.join(blddir, 'src', module))
+        module_path = os.path.join(blddir, 'src', module)
+        conf.env.append_value('NS3_MODULE_PATH', module_path)
+        if Params.g_options.enable_rpath:
+            conf.env.append_value('RPATH', '-Wl,-rpath=%s' % (module_path,))
 
     ## Used to link the 'run-tests' program with all of ns-3 code
     conf.env['NS3_MODULES'] = ['ns3-' + module.split('/')[-1] for module in all_modules]
 
 
+
 def build(bld):
     Object.register('ns3header', Ns3Header)
     Action.Action('ns3header', func=_ns3_headers_inst, color='BLUE')
     
     bld.add_subdirs(all_modules)
 
-
 class Ns3Header(Object.genobj):
     """A set of NS-3 header files"""
     def __init__(self, env=None):