On systems with hardcode_direct=yes, the following section in
tests/link-order.at will fail:
  AT_CHECK([if $EGREP relinking stderr; then
              $EGREP ' -L.*\/new\/lib -lb -L.*\/old\/lib -lcee' stdout
            else :; fi], [0], [ignore], [], [echo "wrong link order"])

Why? Because "-L.*\/new\/lib -lb" will be converted to
.*\/new\/lib/liblb$shrext_cmds.

Patch attached. Note, the new RE doesn't fully address what you
intended. The original libtool output:
  libtool: install: warning: relinking `src/liba.la'
  stdout:
  libtool: install: (cd /opt/build/libtool/tests/testsuite.dir/14; /bin/sh 
/opt/build/libtool/libtool  --mode=relink cc -z +O2 +Olit=all +Onofltacc 
+Oentrysched +Odataprefetch +Onolimit -no-undefined -o src/liba.la src/a.lo 
src/libb.la -L/opt/build/libtool/tests/testsuite.dir/14/old/lib -lcee -rpath 
/opt/build/libtool/tests/testsuite.dir/14/new/lib )
  libtool: relink: cc -b -Wl,+h -Wl,liba.sl.0 -Wl,+b 
-Wl,/opt/build/libtool/tests/testsuite.dir/14/new/lib -o src/.libs/liba.sl.0.0  
src/.libs/a.o   /opt/build/libtool/tests/testsuite.dir/14/new/lib/libb.sl 
-L/opt/build/libtool/tests/testsuite.dir/14/old/lib 
/opt/build/libtool/tests/testsuite.dir/14/old/lib/libcee.sl -lc     

Note the link order above is:
  /opt/build/libtool/tests/testsuite.dir/14/new/lib/libb.sl
  -L/opt/build/libtool/tests/testsuite.dir/14/old/lib
  /opt/build/libtool/tests/testsuite.dir/14/old/lib/libcee.sl
rather than what you probably want:
  /opt/build/libtool/tests/testsuite.dir/14/new/lib/libb.sl
  /opt/build/libtool/tests/testsuite.dir/14/old/lib/libcee.sl

But the ".*" pattern sucks up the
"-L/opt/build/libtool/tests/testsuite.dir/14/old/lib".


2006-05-25  Albert Chin-A-Young  <[EMAIL PROTECTED]>

        * tests/link-order.at: Take hardcode_direct into consideration
        when testing link order.

-- 
albert chin ([EMAIL PROTECTED])
Index: tests/link-order.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/link-order.at,v
retrieving revision 1.9
diff -u -3 -p -r1.9 link-order.at
--- tests/link-order.at 5 Feb 2006 09:56:44 -0000       1.9
+++ tests/link-order.at 25 Apr 2006 19:51:16 -0000
@@ -20,6 +20,7 @@
 
 AT_SETUP([Link order test.])
 AT_KEYWORDS([libtool])
+eval `$LIBTOOL --config | $EGREP '^(hardcode_direct|shrext_cmds)='`
 LDFLAGS="$LDFLAGS -no-undefined"
 
 prefix_old=`pwd`/old
@@ -68,10 +69,18 @@ case $host_os in
 aix* | interix*) ;;  # These systems have different path syntax
 *)
   # Do not error if we do not relink (e.g. static-only systems)
-  AT_CHECK([if $EGREP relinking stderr; then
-             $EGREP ' -L.*\/new\/lib -lb -L.*\/old\/lib -lcee' stdout
-           else :; fi], [0], [ignore], [], [echo "wrong link order"])
-  ;;
+  case $hardcode_direct in
+  yes)
+    AT_CHECK([if $EGREP relinking stderr; then
+               $EGREP " .*\/new\/lib/libb$shrext_cmds 
.*\/old\/lib/libcee$shrext_cmds" stdout
+             else :; fi], [0], [ignore], [], [echo "wrong link order"])
+    ;;
+  no)
+    AT_CHECK([if $EGREP relinking stderr; then
+               $EGREP " -L.*\/new\/lib -lb -L.*\/old\/lib -lcee" stdout
+             else :; fi], [0], [ignore], [], [echo "wrong link order"])
+    ;;
+  esac
 esac
 
 for i in old new; do

Reply via email to