From 61aac6f3f414b11e624aa5e2fd2acebdd9677122 Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues Date: Sat, 19 Jun 2010 21:07:50 +0200 Subject: [PATCH] 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 --- ChangeLog | 9 +++++++++ tests/flags.at | 25 +++++++++++++++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 17a140675..b79fb9995 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-06-20 Ralf Wildenhues + + 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 [cygwin] Fix segfault in C++ exception handling test diff --git a/tests/flags.at b/tests/flags.at index 7f600be17..f865757d4 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 -- 2.47.3