summaryrefslogtreecommitdiff
path: root/lib/replace
diff options
context:
space:
mode:
Diffstat (limited to 'lib/replace')
-rw-r--r--lib/replace/autoconf.py17
-rw-r--r--lib/replace/wscript7
2 files changed, 16 insertions, 8 deletions
diff --git a/lib/replace/autoconf.py b/lib/replace/autoconf.py
index cb7e7f0bc7..1b16ea35c3 100644
--- a/lib/replace/autoconf.py
+++ b/lib/replace/autoconf.py
@@ -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
diff --git a/lib/replace/wscript b/lib/replace/wscript
index 45ce6cddf6..6baab09b03 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -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(