And here's the patch.
diff --git a/ltmain.sh b/ltmain.sh
index 6939dcc..be92a38 100755
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -2009,6 +2009,10 @@ func_mode_install ()
 	dir="$dir$objdir"
 
 	if test -n "$relink_command"; then
+	  if test -n "$sysroot"; then
+	    libdir=`$ECHO "X$libdir" | $Xsed -e "s%$sysroot%%"`
+	    relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%(\(.*\))%(\1 -L$destdir)%"`
+	  fi
 	  # Determine the prefix the user has applied to our future dir.
 	  inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
 
@@ -4330,6 +4334,13 @@ func_mode_link ()
 	  prev=
 	  continue
 	  ;;
+	sysroot)
+	  sysroot="$arg"
+	  compiler_flags="$compiler_flags --sysroot $arg"
+	  compile_command="$compile_command --sysroot $arg"
+	  prev=
+	  continue
+	  ;;
 	precious_regex)
 	  precious_files_regex="$arg"
 	  prev=
@@ -4462,6 +4473,11 @@ func_mode_link ()
 	continue
 	;;
 
+      --sysroot)
+        prev=sysroot
+        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]*:*)
@@ -5097,7 +5113,7 @@ func_mode_link ()
 	  for searchdir in $searchdirs; do
 	    for search_ext in .la $std_shrext .so .a; do
 	      # Search the libtool library
-	      lib="$searchdir/lib${name}${search_ext}"
+	      lib="${sysroot}$searchdir/lib${name}${search_ext}"
 	      if test -f "$lib"; then
 		if test "$search_ext" = ".la"; then
 		  found=yes
@@ -5784,8 +5800,12 @@ func_mode_link ()
 		add="$libdir/$linklib"
 	      fi
 	    else
-	      # We cannot seem to hardcode it, guess we'll fake it.
-	      add_dir="-L$libdir"
+	      if test -n "$sysroot"; then
+	        libdir=`$ECHO "X$libdir" | $Xsed -e "s%${sysroot}%%"`
+	      else
+	        # We cannot seem to hardcode it, guess we'll fake it.
+	        add_dir="-L$libdir"
+	      fi
 	      # Try looking first in the location we're being installed to.
 	      if test -n "$inst_prefix_dir"; then
 		case $libdir in
@@ -8125,6 +8145,11 @@ EOF
 	  case $host,$output,$installed,$module,$dlname in
 	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
 	  esac
+
+	  if test -n "$install_libdir"; then
+		  install_libdir="${sysroot}$install_libdir"
+	  fi
+
 	  $ECHO > $output "\
 # $outputname - a libtool library file
 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
@@ -8167,6 +8192,10 @@ dlpreopen='$dlprefiles'
 
 # Directory that this library needs to be installed in:
 libdir='$install_libdir'"
+	  if test -n "$sysroot"; then
+	    $ECHO >> $output "\
+sysroot='$sysroot'"
+	  fi
 	  if test "$installed" = no && test "$need_relink" = yes; then
 	    $ECHO >> $output "\
 relink_command=\"$relink_command\""

Attachment: signature.asc
Description: Digital signature

_______________________________________________
http://lists.gnu.org/mailman/listinfo/libtool

Reply via email to