---- libtool-1.4.3/ltmain.sh.wiget Thu Oct 24 16:57:17 2002
-+++ libtool-1.4.3/ltmain.sh Thu Oct 24 16:57:17 2002
+--- libtool-1.4.3/ltmain.sh.wiget Tue Nov 19 13:34:10 2002
++++ libtool-1.4.3/ltmain.sh Tue Nov 19 13:34:56 2002
@@ -768,6 +768,7 @@
linker_flags=
dllsearchpath=
lib_search_path=`pwd`
-+ inst_prefix_dir="$DESTDIR"
++ inst_prefix_dir=
avoid_version=no
dlfiles=
test -n "$add_dir" && deplibs="$add_dir $deplibs"
test -n "$add" && deplibs="$add $deplibs"
fi
+@@ -3928,7 +3952,7 @@
+ fi
+ done
+ # Quote the link command for shipping.
+- relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
++ relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+
+ # Only create the output if not a dry run.
+@@ -4229,6 +4253,24 @@
+ dir="$dir$objdir"
+
+ 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.
++ if test "$inst_prefix_dir" = "$destdir"; then
++ $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
++ exit 1
++ 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
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
+--- libtool-1.4.3/ltmain.in.wiget Tue Nov 19 13:34:10 2002
++++ libtool-1.4.3/ltmain.in Tue Nov 19 13:35:15 2002
+@@ -768,6 +768,7 @@
+ linker_flags=
+ dllsearchpath=
+ lib_search_path=`pwd`
++ inst_prefix_dir=
+
+ avoid_version=no
+ dlfiles=
+@@ -898,6 +899,11 @@
+ prev=
+ continue
+ ;;
++ inst_prefix)
++ inst_prefix_dir="$arg"
++ prev=
++ continue
++ ;;
+ release)
+ release="-$arg"
+ prev=
+@@ -999,6 +1005,11 @@
+ continue
+ ;;
+
++ -inst-prefix-dir)
++ prev=inst_prefix
++ continue
++ ;;
++
+ # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+ # so, if we see these flags be careful not to treat them like -L
+ -L[A-Z][A-Z]*:*)
+@@ -1887,6 +1898,7 @@
+
+ if test $linkmode = prog || test "$mode" = relink; then
+ add_shlibpath=
++ add_prefix_dir=
+ add_dir=
+ add=
+ # Finalize command for both is simple: just hardcode it.
+@@ -1907,10 +1919,22 @@
+ add="-l$name"
+ fi
+
++ if test -n "$inst_prefix_dir"; then
++ case "$libdir" in
++ [\\/]*)
++ add_prefix_dir="-L$inst_prefix_dir$libdir"
++ ;;
++ esac
++ fi
++
++ # add_prefix_dir must be appended instead, otherwise it can
++ # possibly be overrided by any hardcoded -L/... path in deplibs
+ if test $linkmode = prog; then
++ test -n "$add_prefix_dir" && finalize_deplibs="$finalize_deplibs $add_prefix_dir"
+ test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+ test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+ else
++ test -n "$add_prefix_dir" && deplibs="$deplibs $add_prefix_dir"
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ fi
+@@ -3928,7 +3952,7 @@
+ fi
+ done
+ # Quote the link command for shipping.
+- relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
++ relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+
+ # Only create the output if not a dry run.
@@ -4229,6 +4253,24 @@
dir="$dir$objdir"