--- embedaddon/libiconv/build-aux/reloc-ldflags 2012/05/29 09:29:44 1.1.1.2 +++ embedaddon/libiconv/build-aux/reloc-ldflags 2021/03/17 13:38:46 1.1.1.3 @@ -2,7 +2,7 @@ # Output a system dependent linker command for putting a relocatable library # search path into an executable. # -# Copyright 2003, 2009-2011 Free Software Foundation, Inc. +# Copyright 2003-2019 Free Software Foundation, Inc. # Written by Bruno Haible , 2003. # # This program is free software: you can redistribute it and/or modify @@ -16,7 +16,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -53,49 +53,67 @@ case "$installdir" in ;; esac +origin_token= case "$host_os" in - linux*) # Supported since Linux 2.1 and glibc 2.1. - rpath= - save_IFS="$IFS"; IFS=":" - for dir in $library_path_value; do - IFS="$save_IFS" - case "$dir" in - /*) - # Make dir relative to installdir. (Works only if dir is absolute.) - idir="$installdir" - while true; do - dfirst=`echo "$dir" | sed -n -e 's,^//*\([^/]*\).*$,/\1,p'` - ifirst=`echo "$idir" | sed -n -e 's,^//*\([^/]*\).*$,/\1,p'` - if test -z "$dfirst" || test -z "$ifirst"; then - break - fi - if test "$dfirst" != "$ifirst"; then - break - fi - dir=`echo "$dir" | sed -e 's,^//*[^/]*,,'` - idir=`echo "$idir" | sed -e 's,^//*[^/]*,,'` - done - dir="\$ORIGIN"`echo "$idir" | sed -e 's,//*[^/]*,/..,g'`"$dir" - # Add dir to rpath. - rpath="${rpath}${rpath:+ }$dir" - ;; - *) - if test -n "$dir"; then - echo "libdir is not absolute: $dir" 1>&2 - fi - ;; - esac - done - IFS="$save_IFS" - # Output it. - if test -n "$rpath"; then - echo "-Wl,-rpath,$rpath" - fi + linux* | gnu* | kfreebsd* | \ + freebsd* | dragonfly* | \ + netbsd* | \ + openbsd* | \ + solaris* | \ + haiku*) + origin_token='$ORIGIN' ;; - *) - echo "relocation via rpath not supported on this system: $host" 1>&2 - exit 1 + darwin*) + origin_token='@loader_path' ;; esac +if test -n "$origin_token"; then + rpath= + save_IFS="$IFS"; IFS=":" + for dir in $library_path_value; do + IFS="$save_IFS" + case "$dir" in + /*) + # Make dir relative to installdir. (Works only if dir is absolute.) + idir="$installdir" + while true; do + dfirst=`echo "$dir" | sed -n -e 's,^//*\([^/]*\).*$,/\1,p'` + ifirst=`echo "$idir" | sed -n -e 's,^//*\([^/]*\).*$,/\1,p'` + if test -z "$dfirst" || test -z "$ifirst"; then + break + fi + if test "$dfirst" != "$ifirst"; then + break + fi + dir=`echo "$dir" | sed -e 's,^//*[^/]*,,'` + idir=`echo "$idir" | sed -e 's,^//*[^/]*,,'` + done + dir="$origin_token"`echo "$idir" | sed -e 's,//*[^/]*,/..,g'`"$dir" + # Add dir to rpath. + rpath="${rpath}${rpath:+ }$dir" + ;; + *) + if test -n "$dir"; then + echo "libdir is not absolute: $dir" 1>&2 + fi + ;; + esac + done + IFS="$save_IFS" + # Output it. + if test -n "$rpath"; then + 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 +else + echo "relocation via rpath not supported on this system: $host" 1>&2 + exit 1 +fi exit 0