libtool-patches
[Top][All Lists]
Advanced

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

Replace uses of $SED $basename.


From: Ralf Wildenhues
Subject: Replace uses of $SED $basename.
Date: Sun, 23 Nov 2008 15:16:15 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

Further simplification: no more $SED $basename outside of
func_*basename.  Pushed.

Cheers,
Ralf

        Replace uses of $SED $basename.
        * libltdl/config/ltmain.m4sh (func_mode_link): Replace instances
        of `$ECHO ... | $SED' with calls to func_basename.
        * libtoolize.m4sh (func_copy, func_serial)
        (func_massage_aclocal_DATA): Likewise, replace with
        func_dirname_and_basename.
        * tests/defs.m4sh (func_configure_nofail, func_make, func_exec):
        Likewise.

diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index 937f14e..28ad40d 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -4764,7 +4764,8 @@ func_mode_link ()
          # Collect preopened libtool deplibs, except any this library
          # has declared as weak libs
          for deplib in $dependency_libs; do
-            deplib_base=`$ECHO "$deplib" | $SED "$basename"`
+           func_basename "$deplib"
+            deplib_base=$func_basename_result
            case " $weak_libs " in
            *" $deplib_base "*) ;;
            *) deplibs="$deplibs $deplib" ;;
@@ -6846,7 +6847,8 @@ EOF
            save_libobjs=$libobjs
          fi
          save_output=$output
-         output_la=`$ECHO "$output" | $SED "$basename"`
+         func_basename "$output"
+         output_la=$func_basename_result
 
          # Clear the reloadable object creation command queue and
          # initialize k to one.
diff --git a/libtoolize.m4sh b/libtoolize.m4sh
index 1427e61..941ad85 100644
--- a/libtoolize.m4sh
+++ b/libtoolize.m4sh
@@ -269,7 +269,8 @@ func_copy ()
     test -f "$1" || \
       { func_error "\`$1' not copied:  not a regular file"; return 1; }
 
-    my_f1=`$ECHO "$1" | $SED "$basename"`
+    func_dirname_and_basename "$1"
+    my_f1=$func_basename_result
 
     if test -d "$2"; then
 
@@ -279,7 +280,9 @@ func_copy ()
     else
 
       # Supporting this would mean changing the timestamp:
-      test "X$my_f1" = X`$ECHO "$2" | $SED "$basename"` \
+      func_dirname_and_basename "$2"
+      my_tname=$func_basename_result
+      test "X$my_f1" = "X$my_tname" \
         || func_fatal_error "func_copy() cannot change filename on copy"
 
       func_copy_cb "$my_f1" \
@@ -705,10 +708,12 @@ func_serial ()
     # Search FILENAME and all the files it m4_includes for a serial number
     # in the file that AC_DEFUNs MACRO_REGEX.
     my_serial=
+    func_dirname_and_basename "$my_filename"
+    my_filebase=$func_basename_result
     for my_file in `func_included_files "$my_filename"`; do
       if test -z "$my_macro_regex" ||
          test "$my_filename" = aclocal.m4 ||
-         test "$my_macro_regex" = `echo "$my_filename" | $SED "$basename"` ||
+         test "X$my_macro_regex" = "X$my_filebase" ||
          func_grep '^AC_DEFUN(\@<:@'"$my_macro_regex" "$my_file"
       then
         my_serial=`$SED -e "$my_sed_serial" "$my_file"`
@@ -1040,7 +1045,8 @@ func_massage_aclocal_DATA ()
 
     # Massage a value for pkgmacro_files from the value used in Makefile.am.
     for my_filename in @aclocal_DATA@; do
-      my_filename=`$ECHO "$my_filename" | $SED "$basename"`
+      func_dirname_and_basename "$my_filename"
+      my_filename=$func_basename_result
 
       # ignore excluded filenames
       if test -n "$my_glob_exclude"; then
diff --git a/tests/defs.m4sh b/tests/defs.m4sh
index dc23826..27c6f77 100644
--- a/tests/defs.m4sh
+++ b/tests/defs.m4sh
@@ -187,7 +187,8 @@ func_configure_nofail ()
 {
     $opt_debug
     my_args=${1+"$@"}
-    my_dir=`pwd | $SED "$basename"`
+    func_dirname_and_basename "`pwd`"
+    my_dir=$func_basename_result
     my_testdir="$srcdir/tests/$my_dir"
     conf_status=$EXIT_FAILURE
 
@@ -245,7 +246,8 @@ func_make ()
 {
     $opt_debug
     my_args=${1+"$@"}
-    my_dir=`pwd | $SED "$basename"`
+    func_dirname_and_basename "`pwd`"
+    my_dir=$func_basename_result
 
     func_msg "Running \`$MAKE $my_args' in $my_dir"
 
@@ -317,7 +319,8 @@ func_exec ()
     $opt_debug
     my_program="$1"
     my_exp_output="$2"
-    my_dir=`pwd | $SED "$basename"`
+    func_dirname_and_basename "`pwd`"
+    my_dir=$func_basename_result
 
     test -n "$my_exp_output" \
       && my_exp_output="| $EGREP -e "\""$my_exp_output"\"




reply via email to

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