# HG changeset patch # User Bruno Haible # Date 1550626792 -3600 # Node ID ef116535bf1a3f0053a051063ec7afb7a8487b95 # Parent 3ba41edecde63edcf4eb0cfc95a7ab98dea35315 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. diff -r 3ba41edecde6 -r ef116535bf1a ChangeLog --- a/ChangeLog Tue Feb 19 21:42:54 2019 +0100 +++ b/ChangeLog Wed Feb 20 02:39:52 2019 +0100 @@ -1,3 +1,12 @@ +2019-02-19 Bruno Haible + + 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. + 2019-02-19 Bruno Haible progreloc: Speed up executable lookup on various platforms. diff -r 3ba41edecde6 -r ef116535bf1a build-aux/reloc-ldflags --- a/build-aux/reloc-ldflags Tue Feb 19 21:42:54 2019 +0100 +++ b/build-aux/reloc-ldflags Wed Feb 20 02:39:52 2019 +0100 @@ -54,7 +54,12 @@ 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 @@ 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 . + freebsd* | dragonfly* | openbsd*) + echo "-Wl,-z,origin -Wl,-rpath,$rpath" ;; + *) + echo "-Wl,-rpath,$rpath" ;; + esac fi ;; *) diff -r 3ba41edecde6 -r ef116535bf1a m4/relocatable.m4 --- a/m4/relocatable.m4 Tue Feb 19 21:42:54 2019 +0100 +++ b/m4/relocatable.m4 Wed Feb 20 02:39:52 2019 +0100 @@ -1,4 +1,4 @@ -# relocatable.m4 serial 19 +# relocatable.m4 serial 20 dnl Copyright (C) 2003, 2005-2007, 2009-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -40,10 +40,34 @@ enable_rpath=no AC_CHECK_HEADERS([mach-o/dyld.h]) AC_CHECK_FUNCS([_NSGetExecutablePath]) +changequote(,)dnl case "$host_os" in mingw*) is_noop=yes ;; + # For the platforms that support $ORIGIN, see + # . + # glibc systems, Linux with musl libc: yes. Android: no. + # Hurd: no . + linux*-android*) ;; + gnu*) ;; linux* | kfreebsd*) use_elf_origin_trick=yes ;; + # FreeBSD >= 7.3, DragonFly >= 3.0: yes. + freebsd | freebsd[1-7] | freebsd[1-6].* | freebsd7.[0-2]) ;; + dragonfly | dragonfly[1-2] | dragonfly[1-2].*) ;; + freebsd* | dragonfly*) use_elf_origin_trick=yes ;; + # NetBSD >= 8.0: yes. + netbsd | netbsd[1-7] | netbsd[1-7].*) ;; + netbsdelf | netbsdelf[1-7] | netbsdelf[1-7].*) ;; + netbsd*) use_elf_origin_trick=yes ;; + # OpenBSD >= 5.4: yes. + openbsd | openbsd[1-5] | openbsd[1-4].* | openbsd5.[0-3]) ;; + openbsd*) use_elf_origin_trick=yes ;; + # Solaris >= 10: yes. + solaris | solaris2.[1-9] | solaris2.[1-9].*) ;; + solaris*) use_elf_origin_trick=yes ;; + # Haiku: yes. + haiku*) use_elf_origin_trick=yes ;; esac +changequote([,])dnl if test $is_noop = yes; then RELOCATABLE_LDFLAGS=: AC_SUBST([RELOCATABLE_LDFLAGS])