Charles Wilson wrote:

A little digging in the debian bug archives (I'm not a debian user, so this is all new to me...)

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=57087

reveals a reference that Ossama Othman (debian libtool maintainer) submitted a similar patch on Jul 10 2002:

http://mail.gnu.org/pipermail/libtool-patches/2002-July/002061.html

Anyway, I'll see if I can't update it to apply cleanly to current CVS, and see if it fixes the problem. Let's postpone discussion of the 'exit 1' vs 'continue' until after we have a version that applies to HEAD, and appears to fix the main problem.

Okay, I've updated Ossama's patch to apply to HEAD, and tested it against the example posted earlier in this thread. It worked properly -- and the contents of the 'installed' .la files were correct, and contained the 'final' paths, not the 'DESTDIR' paths. as required.

Okay, now's the time to talk about the 'exit 1' vs. 'continue' when the relink fails...
2002-10-30 Ossama Othman <[EMAIL PROTECTED]>

* ltmain.in: add support for installing into temporary
staging area (e.g. 'make install DESTDIR=...')

--Chuck
Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/ltmain.in,v
retrieving revision 1.308
diff -u -r1.308 ltmain.in
--- ltmain.in   31 Oct 2002 00:52:39 -0000      1.308
+++ ltmain.in   31 Oct 2002 04:27:43 -0000
@@ -841,6 +841,7 @@
     linker_flags=
     dllsearchpath=
     lib_search_path=`pwd`
+    inst_prefix_dir=
 
     avoid_version=no
     dlfiles=
@@ -973,6 +974,11 @@
          prev=
          continue
          ;;
+       inst_prefix)
+         inst_prefix_dir="$arg"
+         prev=
+         continue
+         ;;
        release)
          release="-$arg"
          prev=
@@ -1189,6 +1195,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]*:*)
@@ -2243,6 +2254,14 @@
                add="$dir/$linklib"
              elif test "$hardcode_minus_L" = yes; then
                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="-L$inst_prefix_dir$libdir $add_dir"
+                     ;;
+                 esac
+               fi
                add="-l$name"
              elif test "$hardcode_shlibpath_var" = yes; then
                add_shlibpath="$dir"
@@ -2301,6 +2320,14 @@
            else
              # We cannot seem to hardcode it, guess we'll fake it.
              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="-L$inst_prefix_dir$libdir $add_dir"
+                   ;;
+               esac
+             fi
              add="-l$name"
            fi
 
@@ -4467,7 +4494,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.
@@ -4768,12 +4795,33 @@
        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.
+         # 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 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 :
          else
            $echo "$modename: error: relink \`$file' with the above command before 
installing it" 1>&2
-           continue
+           exit 1 
          fi
        fi
 


Reply via email to