libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: make --debug work better for ksh


From: Bob Friesenhahn
Subject: Re: make --debug work better for ksh
Date: Tue, 21 Dec 2004 09:06:37 -0600 (CST)

On Tue, 21 Dec 2004, Ralf Wildenhues wrote:

OK to apply to HEAD and wiggle into branch-2-0?

Seems ok to me.

Bob

        * libtoolize.m4sh, config/ltmain.m4sh (most functions):
        New variable $opt_debug is either `:' or `set -x' depending on --debug.
        Execute at most function entries to cater for ksh which resets `-x'.
        * tests/defs.m4sh: Ditto for VERBOSE=debug.

Index: libtoolize.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/libtoolize.m4sh,v
retrieving revision 1.6
diff -u -r1.6 libtoolize.m4sh
--- libtoolize.m4sh     20 Dec 2004 13:08:34 -0000      1.6
+++ libtoolize.m4sh     21 Dec 2004 08:04:30 -0000
@@ -70,6 +70,7 @@
opt_force=false
opt_install=false
opt_link=:
+opt_debug=:

seen_libtool=false
seen_ltdl=false
@@ -106,7 +107,8 @@
                        ;;

      --debug)          func_echo "enabling shell trace mode"
-                       set -x
+                       opt_debug='set -x'
+                       $opt_debug
                        ;;

      --dry-run|-n)     if $opt_dry_run; then :; else
@@ -185,6 +187,7 @@
# then try to copy SRCFILE to DESTFILE.
func_copy ()
{
+    $opt_debug
    my_srcfile="$1"
    my_destfile="$2"
    my_return_status=1
@@ -212,6 +215,7 @@
# used by func_copy_all_files callbacks.
func_copy_cb ()
{
+    $opt_debug
    func_copy "$2/$1" "$3/$1"
}

@@ -222,6 +226,7 @@
# to DESTDIR.
func_copy_all_from_path ()
{
+    $opt_debug
    if test "X$1" = X-r; then
      my_args=-r
      shift
@@ -255,6 +260,7 @@
# checks to decide whether to overwrite the dest file.
func_copy_all_files ()
{
+    $opt_debug
    my_opt_recurse=false
    if test "X$1" = X-r; then
      my_opt_recurse=:
@@ -308,6 +314,7 @@
# convention is needed to allow spaces in file and directory names.
func_copy_some_files ()
{
+    $opt_debug
    my_srcfile_spec="$1"
    my_srcdirs="$2"
    my_destdir="$3"
@@ -346,6 +353,7 @@
# configure.(ac|in) and aclocal.m4.
func_scan_files ()
{
+    $opt_debug
    # Prefer configure.ac to configure.in
    test -f configure.ac && configure_ac=configure.ac
    test -f "$configure_ac" \
@@ -449,6 +457,7 @@
# Output INCLUDEFILE if SEARCHFILE m4_includes it, else output SEARCHFILE.
func_included_files ()
{
+    $opt_debug
    my_searchfile="$1"

    my_include_regex=
@@ -471,6 +480,7 @@
# func_filename_path_search filename dirs
func_filename_path_search ()
{
+    $opt_debug
    func_filename_path_search_result=

    my_save_IFS="$IFS"; IFS=:
@@ -489,6 +499,7 @@
# comment line must also match MACRO_REGEX, if given.
func_serial ()
{
+    $opt_debug
    my_filename="$1"
    my_macro_regex="$2"
    my_sed_serial='/^# serial [1-9][0-9]*[      ]*'"$my_macro_regex"'[        
]*$/ {
@@ -521,6 +532,7 @@
# OLD_MACRO_REGEX must match any text after "# serial N" in both files.
func_serial_update ()
{
+    $opt_debug
    my_filename="$1"
    my_srcdirs="$2"
    my_destdir="$3"
@@ -588,6 +600,7 @@
# Sanity check macros from aclocal.m4 against installed versions.
func_check_macros ()
{
+    $opt_debug
    # Don't trace for this, we're just checking the user didn't invoke it
    # directly from configure.ac.
    $SED 's,[d]nl .*$,,; s,# .*$,,' "$configure_ac" | grep AC_PROG_RANLIB \
@@ -606,6 +619,7 @@
# specified `--force' at the command line.
func_ltmain_update ()
{
+    $opt_debug
    my_filename="$1"
    my_srcdirs="$2"
    my_destdir="$3"
@@ -641,6 +655,7 @@
# specified `--force' at the command line.
func_config_update ()
{
+    $opt_debug
    my_filename="$1"
    my_srcdirs="$2"
    my_destdir="$3"
Index: config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/config/ltmain.m4sh,v
retrieving revision 1.36
diff -u -r1.36 ltmain.m4sh
--- config/ltmain.m4sh  20 Dec 2004 15:03:39 -0000      1.36
+++ config/ltmain.m4sh  21 Dec 2004 08:04:36 -0000
@@ -118,6 +118,7 @@
opt_dry_run=false
opt_duplicate_deps=false
opt_silent=false
+opt_debug=:

# If this variable is set in any of the actions, the command in it
# will be execed at the end.  This prevents here-documents from being
@@ -438,7 +439,8 @@

      --debug)          preserve_args="$preserve_args $opt"
                        func_echo "enabling shell trace mode"
-                       set -x
+                       opt_debug='set -x'
+                       $opt_debug
                        ;;

      -dlopen)          test "$#" -eq 0 && func_missing_arg "$opt" && break
@@ -627,6 +629,7 @@
# Has to be a shell function in order to 'eat' the argument
# that is supplied when $file_magic_command is called.
func_win32_libid () {
+  $opt_debug
  win32_libid_type="unknown"
  win32_fileres=`file -L $1 2>/dev/null`
  case $win32_fileres in
@@ -668,6 +671,7 @@
# command doesn't match the default compiler.
# arg is usually of the form 'gcc ...'
func_infer_tag () {
+    $opt_debug
    if test -n "$available_tags" && test -z "$tagname"; then
      CC_quoted=
      for arg in $CC; do
@@ -722,6 +726,7 @@
# Extract symbols from dlprefiles and create ${outputname}S.o with
# a dlpreopen symbol table.
func_generate_dlsyms () {
+    $opt_debug
    my_outputname="$1"
    my_originator="$2"
    my_pic_p="${3-no}"
@@ -963,6 +968,7 @@

# func_extract_an_archive dir oldlib
func_extract_an_archive () {
+    $opt_debug
    f_ex_an_ar_dir="$1"; shift
    f_ex_an_ar_oldlib="$1"
    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit 
$?
@@ -999,6 +1005,7 @@

# func_extract_archives gentop oldlib ...
func_extract_archives () {
+    $opt_debug
    my_gentop="$1"; shift
    my_oldlibs=${1+"$@"}
    my_oldobjs=""
@@ -1072,6 +1079,7 @@
# func_mode_compile arg...
func_mode_compile ()
{
+    $opt_debug
    # Get the compilation command and the source file.
    base_compile=
    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
@@ -1460,6 +1468,7 @@
# func_mode_execute arg...
func_mode_execute ()
{
+    $opt_debug
    # The first argument is the command name.
    cmd="$nonopt"
    test -z "$cmd" && \
@@ -1589,6 +1598,7 @@
# func_mode_finish arg...
func_mode_finish ()
{
+    $opt_debug
    libdirs="$nonopt"
    admincmds=

@@ -1673,6 +1683,7 @@
# func_mode_install arg...
func_mode_install ()
{
+    $opt_debug
    # There may be an optional sh(1) argument at the beginning of
    # install_prog (especially on Windows NT).
    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
@@ -2136,6 +2147,7 @@
# func_mode_link arg...
func_mode_link ()
{
+    $opt_debug
    case $host in
    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
      # It is impossible to link a dll without this setting, and
@@ -6460,6 +6472,7 @@
# func_mode_uninstall arg...
func_mode_uninstall ()
{
+    $opt_debug
    RM="$nonopt"
    files=
    rmforce=
Index: tests/defs.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/defs.m4sh,v
retrieving revision 1.5
diff -u -r1.5 defs.m4sh
--- tests/defs.m4sh     24 Nov 2004 14:04:15 -0000      1.5
+++ tests/defs.m4sh     21 Dec 2004 08:04:46 -0000
@@ -45,13 +45,15 @@
# How verbose should we be?  Default is no test output.
# Setting VERBOSE=yes enables test output.
# Setting VERBOSE=debug also puts the shell in debug mode.
+opt_debug=:
test "${VERBOSE+set}" != "set" && VERBOSE=no
case "$VERBOSE" in
NO | no | 0 | "")
  exec > /dev/null 2>&1
  ;;
DEBUG | debug )
-  set -x
+  opt_debug='set -x'
+  $opt_debug
  ;;
esac

@@ -85,6 +87,7 @@
# func_get_config varname_list src [failp] [regex]
func_get_config ()
{
+  $opt_debug
  my_varname_list="$1"
  my_src="$2"
  my_failp="false";  test -z "$3" || my_failp=:
@@ -123,6 +126,7 @@
# func_mkprefixdir
func_mkprefixdir ()
{
+    $opt_debug
    # An absolute path to a test installation directory.
    func_mkdir_p "$prefix"
    prefix=`cd $prefix && pwd`
@@ -131,6 +135,7 @@
# func_rmprefixdir
func_rmprefixdir ()
{
+    $opt_debug
    test -d $prefix && rm -rf $prefix
    prefix=NONE
}
@@ -139,6 +144,7 @@
# Make sure a directory exists, and then change to it.
func_cd ()
{
+    $opt_debug
    my_dir="$1"

    # Maybe we have a VPATH build, in which case, create a new subdir.
@@ -153,6 +159,7 @@
# If FILE does not exist, give a fatal error regarding running PREREQ first.
func_require ()
{
+    $opt_debug
    my_prereq="$1"; shift
    my_files=${1+"$@"}

@@ -166,6 +173,7 @@
# Configure the demonstration.
func_configure ()
{
+    $opt_debug
    my_args=${1+"$@"}
    my_dir=`pwd | $SED "$basename"`
    my_testdir="$srcdir/$my_dir"
@@ -192,6 +200,7 @@
# for the expected STATICP and SHAREDP library building
func_check_static_shared ()
{
+    $opt_debug
    my_staticp="$1"
    my_sharedp="$2"

@@ -208,6 +217,7 @@
# Do the actual build.
func_make ()
{
+    $opt_debug
    my_args=${1+"$@"}
    my_dir=`pwd | $SED "$basename"`

@@ -221,6 +231,7 @@
# Possibly clean up the distribution.
func_make_distclean ()
{
+    $opt_debug
    if test -f Makefile; then
      func_make distclean
    fi
@@ -233,6 +244,7 @@
# Ignore dotfiles, so that .nfsXXX files don't screw up the test.
func_make_uninstall ()
{
+    $opt_debug
    func_make uninstall

    leftovers=`find $prefix ! -type d ! -name '.*' -print`
@@ -247,6 +259,7 @@
# func_exec_init mode
func_exec_init ()
{
+    $opt_debug
    func_msg "Executing $1 programs in $my_dir"

    # Windows hosts search for dlls in the command path
@@ -259,6 +272,7 @@
# Check to see if PROGRAM was built. If not display MSG.
func_exec_check ()
{
+    $opt_debug
    my_program="$1"

    if test -f "$my_program"; then :
@@ -274,6 +288,7 @@
# If not display MSG.
func_exec ()
{
+    $opt_debug
    my_program="$1"
    my_exp_output="$2"
    my_dir=`pwd | $SED "$basename"`



======================================
Bob Friesenhahn
address@hidden
http://www.simplesystems.org/users/bfriesen




reply via email to

[Prev in Thread] Current Thread [Next in Thread]