libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fix flags test failure when ld is used as linker.


From: Ralf Wildenhues
Subject: Fix flags test failure when ld is used as linker.
Date: Sat, 19 Jun 2010 21:10:22 +0200
User-agent: Mutt/1.5.20 (2010-04-22)

The flags.at tests were still not right.  Gosh.

I tested this one on GNU/Linux, without and with --disable-shared,
and on HP-UX 10.20 (which uses $LD for linking).  I'm still afraid
I might have overlooked one case, so I'll appreciate a look over
but will otherwise apply in a couple of days.

Thanks,
Ralf

    Fix flags test failure when ld is used as linker.
    
    * tests/flags.at (passing CC flags through libtool): When $LD
    is used for linking libraries, ensure flags passed with `-Wc,'
    are not passed through to $LD, but flags passed with `-Wl,' use
    $wl when linking programs.  Fixed testsuite failure on HP-UX
    10.20.

diff --git a/tests/flags.at b/tests/flags.at
index 7f600be..f865757 100644
--- a/tests/flags.at
+++ b/tests/flags.at
@@ -73,8 +73,8 @@ AT_CHECK([$LIBTOOL --tag=lt_tag --mode=compile $compile -c 
$source],
 # Linker flags are prefixed with ${wl} iff they are passed to the
 # compiler driver, instead of directly to the linker.
 case $archive_cmds in
-*\$LD*\$linker_flags*) maybe_wl= ;;
-*) maybe_wl=$wl ;;
+*\$LD*\$linker_flags*) maybe_wl= compiler_flags_in_liblink=false ;;
+*) maybe_wl=$wl compiler_flags_in_liblink=: ;;
 esac
 
 for flag in -Wc, -Wl, '-Xcompiler ' '-Xlinker '; do
@@ -83,19 +83,32 @@ for flag in -Wc, -Wl, '-Xcompiler ' '-Xlinker '; do
     AT_CHECK([$LIBTOOL -n --tag=lt_tag --mode=compile $compile ]dnl
             [$flag-foo -c $source], [], [stdout], [ignore])
     AT_CHECK([$FGREP " -foo" stdout], [], [ignore])
-    flag_prefix=
+    flag_prefix_prog=
+    flag_prefix_lib=
+    flags_in_liblink=$compiler_flags_in_liblink
     ;;
   -Wl, | -Xlinker\ )
-    flag_prefix=$maybe_wl
+    flag_prefix_prog=$wl
+    flag_prefix_lib=$maybe_wl
+    flags_in_liblink=:
     ;;
   esac
 
-  eval set program$EXEEXT "$library_and_module"
+  AT_CHECK([$LIBTOOL -n --tag=lt_tag --mode=link $link ]dnl
+          [-o program$EXEEXT a.lo $flag-foo], [], [stdout], [ignore])
+  AT_CHECK([$FGREP " $flag_prefix_prog-foo" stdout], [], [ignore])
+
+  eval set x "$library_and_module"
   for output
   do
+    test x = "$output" && continue
     AT_CHECK([$LIBTOOL -n --tag=lt_tag --mode=link $link ]dnl
             [-o $output a.lo -rpath /nowhere $flag-foo], [], [stdout], 
[ignore])
-    AT_CHECK([$FGREP " $flag_prefix-foo" stdout], [], [ignore])
+    if $flags_in_liblink; then
+      AT_CHECK([$FGREP " $flag_prefix_lib-foo" stdout], [], [ignore])
+    else
+      AT_CHECK([$FGREP " $flag_prefix_lib-foo" stdout], [1])
+    fi
   done
 done
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]