build: updates to waf scripts for replace and talloc
authorAndrew Tridgell <tridge@samba.org>
Sat, 20 Feb 2010 12:29:59 +0000 (23:29 +1100)
committerAndrew Tridgell <tridge@samba.org>
Tue, 6 Apr 2010 10:26:33 +0000 (20:26 +1000)
lib/replace/autoconf.py
lib/replace/wscript
lib/talloc/wscript

index cb7e7f0bc70668f0365bd3a0f2e32c93f1c7c89e..1b16ea35c396547aaf268e0299d98d6525376401 100644 (file)
@@ -39,8 +39,15 @@ def CHECK_FUNCS_IN(conf, list, library):
         for f in list.rsplit(' '):
             conf.check(function_name=f, lib=library, header_name=conf.env.hlist)
 
-@conf
-def check_rpath(conf):
-    # this should check if rpath works
-    conf.env.append_value('RPATH', '-Wl,-rpath=build/default')
-
+# we want a different rpath when installing and when building
+# this should really check if rpath is available on this platform
+# and it should also honor an --enable-rpath option
+def set_rpath(bld):
+    import Options
+    if Options.is_install:
+        bld.env['RPATH'] = ['-Wl,-rpath=' + bld.env.PREFIX + '/lib']
+    else:
+        bld.env.append_value('RPATH', '-Wl,-rpath=build/default')
+
+import Build
+Build.BuildContext.set_rpath = set_rpath
index 45ce6cddf69bbe668b3f9739018a2585a2b8be6a..6baab09b03aadd7b60a93d2fece491fcddbcde54 100644 (file)
@@ -13,8 +13,7 @@ def configure(conf):
     conf.env.hlist = []
 
     # load our local waf extensions
-    conf.check_tool('autoconf', tooldir='. ../replace')
-    conf.check_rpath()
+    conf.check_tool('autoconf', tooldir=conf.curdir)
 
     conf.check_tool('compiler_cc')
     conf.DEFUN('_GNU_SOURCE', 1)
@@ -114,12 +113,14 @@ main() { foo("hello"); }
     conf.write_config_header('config.h')
 
 def build(bld):
+    bld.set_rpath()
+
     # the libreplace shared library
     bld(
         features = 'cc cshlib',
         source = 'replace.c',
         target='replace',
-        includes = '. default /usr/include')
+        includes = '. default')
 
     # test program
     bld(
index 36d61c005a53bb830f5019848f32d95e056f30fe..879b37595a994d10423b4386e41a8a02d3ec64ad 100644 (file)
@@ -14,7 +14,7 @@ def build(bld):
         features = 'cc cshlib',
         source = 'talloc.c',
         target='talloc',
-        includes = '. ../replace default /usr/include')
+        includes = '. ../replace')
 
     # test program
     bld(
@@ -23,5 +23,3 @@ def build(bld):
         target = 'talloc_testsuite',
         uselib_local = 'replace talloc',
         includes = '. ../replace default /usr/include')
-
-