]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
Ensure not to reverse preserving of --debug for relinking/finish.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 7 Aug 2010 05:41:12 +0000 (07:41 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 7 Aug 2010 05:41:12 +0000 (07:41 +0200)
* 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 <Ralf.Wildenhues@gmx.de>
ChangeLog
libltdl/config/ltmain.m4sh
tests/help.at

index 27e8a3d533b9059bb58acfde05e9ebda7d04e91f..8f6cb6524adfa169473b07de5270393d73b861e3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-08-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       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  <Ralf.Wildenhues@gmx.de>
 
        Fix AC_NO_EXECUTABLES test failure on AIX.
index 32a41c7d3964c275e3e7a79c3d7647dd83d9ec87..fad2e64a5f1b2389cd07729cfbcbbefe92edae4a 100644 (file)
@@ -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*)
index e1bcbf52c7a1ee72287c55dd353bc3ac6714ffbe..c4eaa8765a730484f6fb602cd0681b76078cb947 100644 (file)
@@ -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