From: Ralf Wildenhues Date: Sat, 7 Aug 2010 05:41:12 +0000 (+0200) Subject: Ensure not to reverse preserving of --debug for relinking/finish. X-Git-Tag: v2.4~96 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3078821c7fc0a7b2eafba35408fd43b44a3e0cd3;p=thirdparty%2Flibtool.git Ensure not to reverse preserving of --debug for relinking/finish. * libltdl/config/ltmain.m4sh (func_check_version_match): Only preserve '--debug' switch if $opt_debug is not equal to ':'. * tests/help.at (debug tracing): New test group. Report by Rainer Tammer. Signed-off-by: Ralf Wildenhues --- diff --git a/ChangeLog b/ChangeLog index 27e8a3d53..8f6cb6524 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-08-07 Ralf Wildenhues + + Ensure not to reverse preserving of --debug for relinking/finish. + * libltdl/config/ltmain.m4sh (func_check_version_match): Only + preserve '--debug' switch if $opt_debug is not equal to ':'. + * tests/help.at (debug tracing): New test group. + Report by Rainer Tammer. + 2010-08-06 Ralf Wildenhues Fix AC_NO_EXECUTABLES test failure on AIX. diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index 32a41c7d3..fad2e64a5 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -393,7 +393,7 @@ M4SH_GETOPTS( fi # preserve --debug - $opt_debug && func_append preserve_args " --debug" + test "$opt_debug" = : || func_append preserve_args " --debug" case $host in *cygwin* | *mingw* | *pw32* | *cegcc*) diff --git a/tests/help.at b/tests/help.at index e1bcbf52c..c4eaa8765 100644 --- a/tests/help.at +++ b/tests/help.at @@ -92,3 +92,100 @@ AT_CHECK([$LIBTOOL cl liba.la], [], [ignore], [ignore]) AT_CLEANUP + + +AT_SETUP([debug tracing]) + +AT_DATA([a.c], +[[int a () { return 0; } +]]) + +AT_DATA([b.c], +[[extern int a (); +int b () { return a (); } +]]) + +AT_DATA([main.c], +[[extern int b (); +int main () { return b (); } +]]) + +inst=`pwd`/inst +libdir=$inst/lib +bindir=$inst/bin +mkdir $inst $libdir $bindir + +# This test will not work correctly if --debug is passed. +AT_CHECK([case "$LIBTOOL $CC $CPPFLAGS $CFLAGS $LDFLAGS " in ]dnl + [ *\ --debug\ *) exit 77;; *) :;; esac]) + +check_trace () +{ + if test "X$trace" = X--debug; then + AT_CHECK([grep 'enabling shell trace mode' stdout stderr], [0], [ignore]) + AT_CHECK([grep ' --mode' stderr], [0], [ignore]) + else + AT_CHECK([grep 'enabling shell trace mode' stdout stderr], [1]) + AT_CHECK([grep ' --mode' stderr], [1]) + fi +} + +orig_LIBTOOL=$LIBTOOL +for trace in '' --debug; do + LIBTOOL="$orig_LIBTOOL $trace" + + # Hypothesis: debug output should happen if (and only if) --debug is + # passed, for compile, link, install, uninstall, and clean modes. + AT_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c], + [], [stdout], [stderr]) + check_trace + AT_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c b.c], + [], [stdout], [stderr]) + check_trace + AT_CHECK([$CC $CPPFLAGS $CFLAGS -c main.c], [], [ignore], [ignore]) + AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo ]dnl + [ -no-undefined -rpath $libdir], [], [stdout], [stderr]) + check_trace + AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libb.la b.lo ]dnl + [ -no-undefined -rpath $libdir liba.la], [], [stdout], [stderr]) + check_trace + AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT ]dnl + [libb.la], [], [stdout], [stderr]) + check_trace + LT_AT_NOINST_EXEC_CHECK([./main], [], [], [stdout], [stderr]) + check_trace + + AT_CHECK([$LIBTOOL --mode=install cp liba.la libb.la $libdir], + [], [stdout], [stderr]) + check_trace + + # Hypothesis: --debug should be passed to relink mode if (and only if) + # it was passed at link mode. + AT_CHECK([$orig_LIBTOOL --mode=install cp liba.la libb.la $libdir], + [], [stdout], [stderr]) + if grep ': relinking ' stdout stderr; then + if test "X$trace" = X--debug; then + AT_CHECK([grep ' --mode=relink' stdout stderr | grep ' --debug '], + [0], [ignore]) + else + AT_CHECK([grep ' --mode=relink' stdout stderr | grep ' --debug '], + [1]) + fi + fi + + AT_CHECK([$LIBTOOL --mode=install cp main$EXEEXT $bindir], + [], [stdout], [stderr]) + check_trace + AT_CHECK([$LIBTOOL --mode=finish $bindir], [], [stdout], [stderr]) + check_trace + + AT_CHECK([$LIBTOOL --mode=uninstall rm -f $bindir/main$EXEEXT ]dnl + [$libdir/libb.la $libdir/liba.la], [], [stdout], [stderr]) + check_trace + AT_CHECK([$LIBTOOL --mode=clean rm -f $bindir/main$EXEEXT ]dnl + [$libdir/libb.la $libdir/liba.la], [], [stdout], [stderr]) + check_trace + +done + +AT_CLEANUP