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
This commit is contained in:
Andreas Schwab 2005-10-03 21:50:17 +00:00 committed by Andreas Schwab
parent 1718a2aa9b
commit 3715008050
2 changed files with 57 additions and 1 deletions

View File

@ -1,3 +1,11 @@
2005-10-03 Andreas Schwab <schwab@suse.de>
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=...')
2005-10-03 H.J. Lu <hongjiu.lu@intel.com> 2005-10-03 H.J. Lu <hongjiu.lu@intel.com>
* configure.in (*-*-darwin*): Build bfd, binutils and opcodes. * configure.in (*-*-darwin*): Build bfd, binutils and opcodes.

View File

@ -829,6 +829,7 @@ EOF
linker_flags= linker_flags=
dllsearchpath= dllsearchpath=
lib_search_path=`pwd` lib_search_path=`pwd`
inst_prefix_dir=
avoid_version=no avoid_version=no
dlfiles= dlfiles=
@ -961,6 +962,11 @@ EOF
prev= prev=
continue continue
;; ;;
inst_prefix)
inst_prefix_dir="$arg"
prev=
continue
;;
release) release)
release="-$arg" release="-$arg"
prev= prev=
@ -1187,6 +1193,11 @@ EOF
continue continue
;; ;;
-inst-prefix-dir)
prev=inst_prefix
continue
;;
# The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
# so, if we see these flags be careful not to treat them like -L # so, if we see these flags be careful not to treat them like -L
-L[A-Z][A-Z]*:*) -L[A-Z][A-Z]*:*)
@ -2171,6 +2182,14 @@ EOF
add="$dir/$linklib" add="$dir/$linklib"
elif test "$hardcode_minus_L" = yes; then elif test "$hardcode_minus_L" = yes; then
add_dir="-L$dir" add_dir="-L$dir"
# Try looking first in the location we're being installed to.
if test -n "$inst_prefix_dir"; then
case "$libdir" in
[\\/]*)
add_dir="$add_dir -L$inst_prefix_dir$libdir"
;;
esac
fi
add="-l$name" add="-l$name"
elif test "$hardcode_shlibpath_var" = yes; then elif test "$hardcode_shlibpath_var" = yes; then
add_shlibpath="$dir" add_shlibpath="$dir"
@ -2229,6 +2248,14 @@ EOF
else else
# We cannot seem to hardcode it, guess we'll fake it. # We cannot seem to hardcode it, guess we'll fake it.
add_dir="-L$libdir" add_dir="-L$libdir"
# Try looking first in the location we're being installed to.
if test -n "$inst_prefix_dir"; then
case "$libdir" in
[\\/]*)
add_dir="$add_dir -L$inst_prefix_dir$libdir"
;;
esac
fi
add="-l$name" add="-l$name"
fi fi
@ -4460,7 +4487,7 @@ fi\
for tag in $taglist; do for tag in $taglist; do
tagopts="$tagopts --tag $tag" tagopts="$tagopts --tag $tag"
done done
relink_command="(cd `pwd`; $SHELL $0$tagopts --mode=relink $libtool_args)" relink_command="(cd `pwd`; $SHELL $0$tagopts --mode=relink $libtool_args @inst_prefix_dir@)"
relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
# Only create the output if not a dry run. # Only create the output if not a dry run.
@ -4761,6 +4788,27 @@ relink_command=\"$relink_command\""
dir="$dir$objdir" dir="$dir$objdir"
if test -n "$relink_command"; then if test -n "$relink_command"; then
# Determine the prefix the user has applied to our future dir.
inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
# Don't allow the user to place us outside of our expected
# location b/c this prevents finding dependent libraries that
# are installed to the same prefix.
# At present, this check doesn't affect windows .dll's that
# are installed into $libdir/../bin (currently, that works fine)
# but it's something to keep an eye on.
if test "$inst_prefix_dir" = "$destdir"; then
$echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
exit $EXIT_FAILURE
fi
if test -n "$inst_prefix_dir"; then
# Stick the inst_prefix_dir data into the link command.
relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
else
relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
fi
$echo "$modename: warning: relinking \`$file'" 1>&2 $echo "$modename: warning: relinking \`$file'" 1>&2
$show "$relink_command" $show "$relink_command"
if $run eval "$relink_command"; then : if $run eval "$relink_command"; then :