1. Seems finally get the ultimate patch I want; it is attached. The credit
   goes to redhat (I just did some modification so that it really works).
   Hopefully all evil hacks to include libraries can bye-bye forever.

2. Version 1.4.2 is out.

3. Patch0 and patch1 inside libtool are wrong; they are patching wrong file.
   What they patch is ltmain.in, but this ltmain.in is not touched later
   on at all. Just the ltmain.sh is copied to $datadir/libtool/ . So they
   have to be modified to patch ltmain.sh instead.

Abel

PS Anybody can handle these?
--- libtool-1.4.1/ltmain.sh.relink      Wed Oct  3 02:05:35 2001
+++ libtool-1.4.1/ltmain.sh     Wed Oct  3 05:16:14 2001
@@ -754,6 +754,7 @@
     linker_flags=
     dllsearchpath=
     lib_search_path=`pwd`
+    inst_prefix_dir=
 
     avoid_version=no
     dlfiles=
@@ -884,6 +885,11 @@
          prev=
          continue
          ;;
+        inst_prefix)
+         inst_prefix_dir="$arg"
+         prev=
+         continue
+         ;;
        release)
          release="-$arg"
          prev=
@@ -985,6 +991,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]*:*)
@@ -1866,6 +1877,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.
@@ -1886,10 +1898,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
@@ -3856,7 +3880,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.
@@ -4157,6 +4181,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 :

Reply via email to