summaryrefslogtreecommitdiff
path: root/build-aux/reloc-ldflags
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2019-02-20 02:39:52 +0100
committerBruno Haible <bruno@clisp.org>2019-02-20 02:39:52 +0100
commit35e462817a08e484b4cddbb9ef25019f6910fc5f (patch)
tree13f2ebe8a5efea06c56d77bb113a9f91c632b13d /build-aux/reloc-ldflags
parent18f4d4133eae7d8ac228ed2986748c52825f3d0e (diff)
downloadgnulib-35e462817a08e484b4cddbb9ef25019f6910fc5f.tar.gz
relocatable-prog: Use $ORIGIN trick on more platforms.
* m4/relocatable.m4 (gl_RELOCATABLE_BODY): Use $ORIGIN trick also on FreeBSD >= 7.3, DragonFly >= 3.0, NetBSD >= 8.0, OpenBSD >= 5.4, Solaris >= 10, Haiku. But don't use it on Android. * build-aux/reloc-ldflags: Allow the use of the $ORIGIN trick also on Hurd, FreeBSD, DragonFly, NetBSD, OpenBSD, Solaris, Haiku.
Diffstat (limited to 'build-aux/reloc-ldflags')
-rwxr-xr-xbuild-aux/reloc-ldflags16
1 files changed, 14 insertions, 2 deletions
diff --git a/build-aux/reloc-ldflags b/build-aux/reloc-ldflags
index 4f2b10d3eb..3aed3308dc 100755
--- a/build-aux/reloc-ldflags
+++ b/build-aux/reloc-ldflags
@@ -54,7 +54,12 @@ case "$installdir" in
esac
case "$host_os" in
- linux* | kfreebsd*)
+ linux* | gnu* | kfreebsd* | \
+ freebsd* | dragonfly* | \
+ netbsd* | \
+ openbsd* | \
+ solaris* | \
+ haiku*)
rpath=
save_IFS="$IFS"; IFS=":"
for dir in $library_path_value; do
@@ -89,7 +94,14 @@ case "$host_os" in
IFS="$save_IFS"
# Output it.
if test -n "$rpath"; then
- echo "-Wl,-rpath,$rpath"
+ case "$host_os" in
+ # At least some versions of FreeBSD, DragonFly, and OpenBSD need the
+ # linker option "-z origin". See <https://lekensteyn.nl/rpath.html>.
+ freebsd* | dragonfly* | openbsd*)
+ echo "-Wl,-z,origin -Wl,-rpath,$rpath" ;;
+ *)
+ echo "-Wl,-rpath,$rpath" ;;
+ esac
fi
;;
*)