Charles Wilson wrote:
> This one, I think is OK for pre-2.2.8 -- what do you guys think?
> OK to push?

In response to review comments over here:
"Re: [PATCH] Enable runtime cwrapper debugging; add tests"
http://lists.gnu.org/archive/html/libtool-patches/2009-12/msg00014.html

I've created a followon patch to this one which allows the cwrapper
tests to pass on platforms which don't use the cwrapper but instaed use
the shell wrapper (e.g. linux).

If this follow-on, and the original patch for this thread, are approved,
then I'll squash these two patches into a single commit and update the
log before pushing.

Full test suite in progress on cygwin (but cwrapper test passes, as do a
number of spot-checked tests in the old test suite). Linux results:

Old: All 94 tests passed
New: Only two unexpected results (in particular, the cwrapper test passed)

 21: passing CXX flags through libtool               FAILED (flags.at:24)
100: Run tests with low max_cmd_len                  FAILED
(cmdline_wrap.at:43)

Err.. 21 should have been skipped, because I haven't installed g++ on
the linux box yet. And 100 is just a repeat of 21.

--
Chuck
    Update sh wrapper per review comments
    
    libltdl/config/ltmain.m4sh (func_emit_wrapper): Rename to
    (func_emit_wrapper_impl): this. Change debug messages to
    conform to GCS. In debug mode, print a banner with known
    content before any other output.
    (func_emit_wrapper): New function calls *_impl and adds
    line number information.

diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index 2ebf12e..bb89cef 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -2332,7 +2332,7 @@ func_extract_archives ()
 }
 
 
-# func_emit_wrapper [arg=no]
+# func_emit_wrapper_impl [arg=no]
 #
 # Emit a libtool wrapper script on stdout.
 # Don't directly open a file because we may want to
@@ -2346,9 +2346,9 @@ func_extract_archives ()
 # will assume that the directory in which it is stored is
 # the $objdir directory.  This is a cygwin/mingw-specific
 # behavior.
-func_emit_wrapper ()
+func_emit_wrapper_impl ()
 {
-	func_emit_wrapper_arg1=${1-no}
+	func_emit_wrapper_impl_arg1=${1-no}
 
 	$ECHO "\
 #! $SHELL
@@ -2412,7 +2412,7 @@ _LTECHO_EOF'
 # Very basic option parsing. These options are (a) specific to
 # the libtool wrapper, (b) are identical between the wrapper
 # /script/ and the wrapper /executable/ which is used only on
-# windows platforms, and (c) all exist in the "--lt-" namespace
+# windows platforms, and (c) all begin with the string "--lt-"
 # (application programs are unlikely to have options which match
 # this pattern).
 #
@@ -2443,6 +2443,11 @@ func_parse_lt_options ()
       ;;
     esac
   done
+
+  # Print the debug banner immediately:
+  if test -n \"\$lt_option_debug\"; then
+    echo \"${outputname}:${output}:@@LINENO@@: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
+  fi
 }
 
 # Sets opts_contain_lt_result to \"yes\" if the
@@ -2469,7 +2474,7 @@ func_lt_dump_args ()
   lt_dump_args_N=1;
   for lt_arg
   do
-    \$ECHO \"(main) newargz[\$lt_dump_args_N]   : \$lt_arg\"
+    \$ECHO \"${outputname}:${output}:@@LINENO@@: newargv[\$lt_dump_args_N]: \$lt_arg\"
     lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
   done
 }
@@ -2483,7 +2488,7 @@ func_exec_program_core ()
   *-*-mingw | *-*-os2* | *-cegcc*)
     $ECHO "\
       if test -n \"\$lt_option_debug\"; then
-        \$ECHO \"(main) lt_argv_zero : \$progdir\\\\\$program\" 1>&2
+        \$ECHO \"${outputname}:${output}:@@LINENO@@: newargv[0]: \$progdir\\\\\$program\" 1>&2
         func_lt_dump_args \${1+\"\...@\"} 1>&2
       fi
       exec \"\$progdir\\\\\$program\" \${1+\"\...@\"}
@@ -2493,7 +2498,7 @@ func_exec_program_core ()
   *)
     $ECHO "\
       if test -n \"\$lt_option_debug\"; then
-        \$ECHO \"(main) lt_argv_zero : \$progdir/\$program\" 1>&2
+        \$ECHO \"${outputname}:${output}:@@LINENO@@: newargv[0]: \$progdir/\$program\" 1>&2
         func_lt_dump_args \${1+\"\...@\"} 1>&2
       fi
       exec \"\$progdir/\$program\" \${1+\"\...@\"}
@@ -2559,7 +2564,7 @@ func_exec_program ()
 
   # Usually 'no', except on cygwin/mingw when embedded into
   # the cwrapper.
-  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
+  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_impl_arg1
   if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
     # special case for '.'
     if test \"\$thisdir\" = \".\"; then
@@ -2659,7 +2664,32 @@ func_exec_program ()
 fi\
 "
 }
-
+# func_emit_wrapper [arg1=no]
+#
+# Emit a libtool wrapper script on stdout. See
+# func_emit_wrapper_impl for a more throrough description.
+# This function merely serves to process that function's
+# result to insert line numbers, because we can't assume
+# that \$LINENO works.
+func_emit_wrapper ()
+{
+  # sed script adapted from autoconf's AS_LINENO_PREPARE
+  func_emit_wrapper_impl ${1-no} |\
+  sed -n '
+    p
+    /@@LINENO@@/=
+    ' | sed '
+      s/@@LINENO@@.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/@@LINENO@@\([^A-Za-z0-9_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    '
+}
 
 # func_to_host_path arg
 #

Reply via email to