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.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
This commit is contained in:
Ralf Wildenhues 2010-06-19 21:07:50 +02:00
parent c4901206cf
commit 61aac6f3f4
2 changed files with 28 additions and 6 deletions

View File

@ -1,3 +1,12 @@
2010-06-20 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
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.
2010-06-19 Charles Wilson <libtool@cwilson.fastmail.fm>
[cygwin] Fix segfault in C++ exception handling test

View File

@ -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