diff options
author | Andreas Schwab <schwab@suse.de> | 2005-10-03 21:50:17 +0000 |
---|---|---|
committer | Andreas Schwab <schwab@gcc.gnu.org> | 2005-10-03 21:50:17 +0000 |
commit | 37150080504338dc8288ac8eeb0cc2636031fd07 (patch) | |
tree | 4a4ab0b951c6da14bfdc8b43bad65851f9769b44 /ltmain.sh | |
parent | re PR middle-end/24135 (nonlocal goto from nested function gets 'undefined sy... (diff) | |
download | gcc-37150080504338dc8288ac8eeb0cc2636031fd07.tar.gz gcc-37150080504338dc8288ac8eeb0cc2636031fd07.tar.bz2 gcc-37150080504338dc8288ac8eeb0cc2636031fd07.tar.xz |
backport: ltmain.sh: add support for installing into temporary staging area (e.g.
Backport from libtool CVS:
2002-11-03 Ossama Othman <ossama@doc.ece.uci.edu>
* ltmain.sh: add support for installing into temporary
staging area (e.g. 'make install DESTDIR=...')
From-SVN: r104913
Diffstat (limited to 'ltmain.sh')
-rw-r--r-- | ltmain.sh | 50 |
1 files changed, 49 insertions, 1 deletions
@@ -829,6 +829,7 @@ EOF | |||
829 | linker_flags= | 829 | linker_flags= |
830 | dllsearchpath= | 830 | dllsearchpath= |
831 | lib_search_path=`pwd` | 831 | lib_search_path=`pwd` |
832 | inst_prefix_dir= | ||
832 | 833 | ||
833 | avoid_version=no | 834 | avoid_version=no |
834 | dlfiles= | 835 | dlfiles= |
@@ -961,6 +962,11 @@ EOF | |||
961 | prev= | 962 | prev= |
962 | continue | 963 | continue |
963 | ;; | 964 | ;; |
965 | inst_prefix) | ||
966 | inst_prefix_dir="$arg" | ||
967 | prev= | ||
968 | continue | ||
969 | ;; | ||
964 | release) | 970 | release) |
965 | release="-$arg" | 971 | release="-$arg" |
966 | prev= | 972 | prev= |
@@ -1187,6 +1193,11 @@ EOF | |||
1187 | continue | 1193 | continue |
1188 | ;; | 1194 | ;; |
1189 | 1195 | ||
1196 | -inst-prefix-dir) | ||
1197 | prev=inst_prefix | ||
1198 | continue | ||
1199 | ;; | ||
1200 | |||
1190 | # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* | 1201 | # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* |
1191 | # so, if we see these flags be careful not to treat them like -L | 1202 | # so, if we see these flags be careful not to treat them like -L |
1192 | -L[A-Z][A-Z]*:*) | 1203 | -L[A-Z][A-Z]*:*) |
@@ -2171,6 +2182,14 @@ EOF | |||
2171 | add="$dir/$linklib" | 2182 | add="$dir/$linklib" |
2172 | elif test "$hardcode_minus_L" = yes; then | 2183 | elif test "$hardcode_minus_L" = yes; then |
2173 | add_dir="-L$dir" | 2184 | add_dir="-L$dir" |
2185 | # Try looking first in the location we're being installed to. | ||
2186 | if test -n "$inst_prefix_dir"; then | ||
2187 | case "$libdir" in | ||
2188 | [\\/]*) | ||
2189 | add_dir="$add_dir -L$inst_prefix_dir$libdir" | ||
2190 | ;; | ||
2191 | esac | ||
2192 | fi | ||
2174 | add="-l$name" | 2193 | add="-l$name" |
2175 | elif test "$hardcode_shlibpath_var" = yes; then | 2194 | elif test "$hardcode_shlibpath_var" = yes; then |
2176 | add_shlibpath="$dir" | 2195 | add_shlibpath="$dir" |
@@ -2229,6 +2248,14 @@ EOF | |||
2229 | else | 2248 | else |
2230 | # We cannot seem to hardcode it, guess we'll fake it. | 2249 | # We cannot seem to hardcode it, guess we'll fake it. |
2231 | add_dir="-L$libdir" | 2250 | add_dir="-L$libdir" |
2251 | # Try looking first in the location we're being installed to. | ||
2252 | if test -n "$inst_prefix_dir"; then | ||
2253 | case "$libdir" in | ||
2254 | [\\/]*) | ||
2255 | add_dir="$add_dir -L$inst_prefix_dir$libdir" | ||
2256 | ;; | ||
2257 | esac | ||
2258 | fi | ||
2232 | add="-l$name" | 2259 | add="-l$name" |
2233 | fi | 2260 | fi |
2234 | 2261 | ||
@@ -4460,7 +4487,7 @@ fi\ | |||
4460 | for tag in $taglist; do | 4487 | for tag in $taglist; do |
4461 | tagopts="$tagopts --tag $tag" | 4488 | tagopts="$tagopts --tag $tag" |
4462 | done | 4489 | done |
4463 | relink_command="(cd `pwd`; $SHELL $0$tagopts --mode=relink $libtool_args)" | 4490 | relink_command="(cd `pwd`; $SHELL $0$tagopts --mode=relink $libtool_args @inst_prefix_dir@)" |
4464 | relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` | 4491 | relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` |
4465 | 4492 | ||
4466 | # Only create the output if not a dry run. | 4493 | # Only create the output if not a dry run. |
@@ -4761,6 +4788,27 @@ relink_command=\"$relink_command\"" | |||
4761 | dir="$dir$objdir" | 4788 | dir="$dir$objdir" |
4762 | 4789 | ||
4763 | if test -n "$relink_command"; then | 4790 | if test -n "$relink_command"; then |
4791 | # Determine the prefix the user has applied to our future dir. | ||
4792 | inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"` | ||
4793 | |||
4794 | # Don't allow the user to place us outside of our expected | ||
4795 | # location b/c this prevents finding dependent libraries that | ||
4796 | # are installed to the same prefix. | ||
4797 | # At present, this check doesn't affect windows .dll's that | ||
4798 | # are installed into $libdir/../bin (currently, that works fine) | ||
4799 | # but it's something to keep an eye on. | ||
4800 | if test "$inst_prefix_dir" = "$destdir"; then | ||
4801 | $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 | ||
4802 | exit $EXIT_FAILURE | ||
4803 | fi | ||
4804 | |||
4805 | if test -n "$inst_prefix_dir"; then | ||
4806 | # Stick the inst_prefix_dir data into the link command. | ||
4807 | relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` | ||
4808 | else | ||
4809 | relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"` | ||
4810 | fi | ||
4811 | |||
4764 | $echo "$modename: warning: relinking \`$file'" 1>&2 | 4812 | $echo "$modename: warning: relinking \`$file'" 1>&2 |
4765 | $show "$relink_command" | 4813 | $show "$relink_command" |
4766 | if $run eval "$relink_command"; then : | 4814 | if $run eval "$relink_command"; then : |