]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
maint: use $SED and $GREP, not sed and grep in all scripts.
authorGary V. Vaughan <gary@gnu.org>
Wed, 30 Oct 2013 05:25:44 +0000 (18:25 +1300)
committerGary V. Vaughan <gary@gnu.org>
Wed, 1 Jan 2014 23:06:30 +0000 (12:06 +1300)
Choosing between hardcoding a tool's name, or using the shell
variable with a path to the user's prefered implementation or
configure's idea of the best available is a premature
optimisation.
* build-aux/ltmain.in, gl/build-aux/bootstrap.in,
gl/build-aux/extract-trace, gl/build-aux/funclib.sh,
libtoolize.in: Use $SED and $GREP consistently throughout,
instead of hardcoding sed and grep.
* bootstrap: Regenerate.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
bootstrap
build-aux/ltmain.in
gl/build-aux/bootstrap.in
gl/build-aux/extract-trace
gl/build-aux/funclib.sh
libtoolize.in

index 852efd5d8b3f5399570a2dde20b7ee714b53d836..269f238f1b63a6255020af58e97d38eabf16dd20 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -204,6 +204,11 @@ else
 fi
 
 
+# We want to be able to use the functions in this file before configure
+# has figured out where the best binaries are kept, which means we have
+# to search for them ourselves - except when the results are already set
+# where we skip the searches.
+
 # Unless the user overrides by setting SED, search the path for either GNU
 # sed, or the sed that truncates its output the least.
 test -z "$SED" && {
@@ -246,7 +251,7 @@ test -z "$SED" && {
 
 
 # Unless the user overrides by setting GREP, search the path for either GNU
-# grep, or the sed that truncates its output the least.
+# grep, or the grep that truncates its output the least.
 test -z "$GREP" && {
   func_check_prog_grep ()
   {
@@ -735,11 +740,11 @@ func_echo_infix_1 ()
     for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
     do
       test -n "$_G_tc" && {
-        _G_esc_tc=`$bs_echo "$_G_tc" | sed "$sed_make_literal_regex"`
-        _G_indent=`$bs_echo "$_G_indent" | sed "s|$_G_esc_tc||g"`
+        _G_esc_tc=`$bs_echo "$_G_tc" | $SED "$sed_make_literal_regex"`
+        _G_indent=`$bs_echo "$_G_indent" | $SED "s|$_G_esc_tc||g"`
       }
     done
-    _G_indent="$progname: "`echo "$_G_indent" | sed 's|.| |g'`"  " ## exclude from sc_prohibit_nested_quotes
+    _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`"  " ## exclude from sc_prohibit_nested_quotes
 
     func_echo_infix_1_IFS=$IFS
     IFS=$nl
@@ -1336,7 +1341,7 @@ func_lt_ver ()
 {
     $debug_cmd
 
-    test "x$1" = x`func_sort_ver "$1" "$2" | sed 1q`
+    test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
 }
 
 
@@ -2025,7 +2030,7 @@ func_autoconf_configure ()
 
     # If we were passed a genuine file, make sure it calls AC_INIT.
     test -f "$1" \
-      && _G_ac_init=`$SED "$_G_sed_no_comment" "$1" |grep AC_INIT`
+      && _G_ac_init=`$SED "$_G_sed_no_comment" "$1" |$GREP AC_INIT`
 
     # Otherwise it is not a genuine Autoconf input file.
     test -n "$_G_ac_init"
@@ -2721,7 +2726,7 @@ func_reconfigure ()
         func_ensure_changelog
     else
       $require_gnulib_cache
-      if sed -n '/^gl_MODULES(\[/,/^])$/p' $gnulib_cache 2>/dev/null |
+      if $SED -n '/^gl_MODULES(\[/,/^])$/p' $gnulib_cache 2>/dev/null |
          func_grep_q gitlog-to-changelog
       then
         func_ensure_changelog
@@ -3138,7 +3143,7 @@ func_clean_unused_macros ()
 
       # We use 'ls|grep' instead of 'ls *.m4' to avoid exceeding
       # command line length limits in some shells.
-      for file in `cd "$macro_dir" && ls -1 |grep '\.m4$'`; do
+      for file in `cd "$macro_dir" && ls -1 |$GREP '\.m4$'`; do
 
        # Remove a macro file when aclocal.m4 does not m4_include it...
         func_grep_q 'm4_include([[]'$macro_dir/$file'])' $aclocal_m4s \
@@ -4625,7 +4630,7 @@ func_gitignore_entries ()
 {
     $debug_cmd
 
-    sed -e '/^#/d' -e '/^$/d' "$@"
+    $SED -e '/^#/d' -e '/^$/d' "$@"
 }
 
 
@@ -4658,7 +4663,7 @@ func_insert_if_absent ()
       linesnew=`{ $bs_echo "$str"; cat "$file"; } \
                 |func_gitignore_entries |sort -u |wc -l`
       test "$linesold" -eq "$linesnew" \
-        || { sed "1i\\$nl$str$nl" "$file" >"$file"T && mv "$file"T "$file"; } \
+        || { $SED "1i\\$nl$str$nl" "$file" >"$file"T && mv "$file"T "$file"; } \
         || func_permissions_error "$file"
     done
 }
index 0da8ad7c9496570eaa4087d899ce621b2918602d..d2fb2d5b89903454d5ae378ad9cb0975660b2a8a 100644 (file)
@@ -1878,7 +1878,7 @@ if $opt_help; then
       for opt_mode in compile link execute install finish uninstall clean; do
        func_mode_help
       done
-    } | sed -n '1p; 2,$s/^Usage:/  or: /p'
+    } | $SED -n '1p; 2,$s/^Usage:/  or: /p'
     {
       func_help noexit
       for opt_mode in compile link execute install finish uninstall clean; do
@@ -1886,7 +1886,7 @@ if $opt_help; then
        func_mode_help
       done
     } |
-    sed '1d
+    $SED '1d
       /^When reporting/,/^Report/{
        H
        d
@@ -2076,7 +2076,7 @@ func_mode_finish ()
       else
         tmpdir=`func_mktempdir`
         for lib in $libs; do
-         sed -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
+         $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
            > $tmpdir/tmp-la
          mv -f $tmpdir/tmp-la $lib
        done
@@ -2631,7 +2631,7 @@ func_generate_dlsyms ()
     my_outputname=$1
     my_originator=$2
     my_pic_p=${3-false}
-    my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
+    my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
     my_dlsyms=
 
     if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
index e83835cde151c6454afb9f4163f11cd495d98847..e0237435686c19aed8df9e776dde5c20c5a6e671 100755 (executable)
@@ -357,7 +357,7 @@ func_reconfigure ()
         func_ensure_changelog
     else
       $require_gnulib_cache
-      if sed -n '/^gl_MODULES(\[/,/^])$/p' $gnulib_cache 2>/dev/null |
+      if $SED -n '/^gl_MODULES(\[/,/^])$/p' $gnulib_cache 2>/dev/null |
          func_grep_q gitlog-to-changelog
       then
         func_ensure_changelog
@@ -774,7 +774,7 @@ func_clean_unused_macros ()
 
       # We use 'ls|grep' instead of 'ls *.m4' to avoid exceeding
       # command line length limits in some shells.
-      for file in `cd "$macro_dir" && ls -1 |grep '\.m4$'`; do
+      for file in `cd "$macro_dir" && ls -1 |$GREP '\.m4$'`; do
 
        # Remove a macro file when aclocal.m4 does not m4_include it...
         func_grep_q 'm4_include([[]'$macro_dir/$file'])' $aclocal_m4s \
@@ -2261,7 +2261,7 @@ func_gitignore_entries ()
 {
     $debug_cmd
 
-    sed -e '/^#/d' -e '/^$/d' "$@"
+    $SED -e '/^#/d' -e '/^$/d' "$@"
 }
 
 
@@ -2294,7 +2294,7 @@ func_insert_if_absent ()
       linesnew=`{ $bs_echo "$str"; cat "$file"; } \
                 |func_gitignore_entries |sort -u |wc -l`
       test "$linesold" -eq "$linesnew" \
-        || { sed "1i\\$nl$str$nl" "$file" >"$file"T && mv "$file"T "$file"; } \
+        || { $SED "1i\\$nl$str$nl" "$file" >"$file"T && mv "$file"T "$file"; } \
         || func_permissions_error "$file"
     done
 }
index 5e42ea784cd7e383076f3bd362d0d9fc981ef7cc..ece24d77a1d358db589bf73efd7c6ea98f62735c 100755 (executable)
@@ -68,7 +68,7 @@ func_autoconf_configure ()
 
     # If we were passed a genuine file, make sure it calls AC_INIT.
     test -f "$1" \
-      && _G_ac_init=`$SED "$_G_sed_no_comment" "$1" |grep AC_INIT`
+      && _G_ac_init=`$SED "$_G_sed_no_comment" "$1" |$GREP AC_INIT`
 
     # Otherwise it is not a genuine Autoconf input file.
     test -n "$_G_ac_init"
index 7dd99c17f3e627f33bf8fbf4adae3b49150140eb..2746827b2a00335698073164b049f4d3ae930ef7 100644 (file)
@@ -730,11 +730,11 @@ func_echo_infix_1 ()
     for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
     do
       test -n "$_G_tc" && {
-        _G_esc_tc=`$bs_echo "$_G_tc" | sed "$sed_make_literal_regex"`
-        _G_indent=`$bs_echo "$_G_indent" | sed "s|$_G_esc_tc||g"`
+        _G_esc_tc=`$bs_echo "$_G_tc" | $SED "$sed_make_literal_regex"`
+        _G_indent=`$bs_echo "$_G_indent" | $SED "s|$_G_esc_tc||g"`
       }
     done
-    _G_indent="$progname: "`echo "$_G_indent" | sed 's|.| |g'`"  " ## exclude from sc_prohibit_nested_quotes
+    _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`"  " ## exclude from sc_prohibit_nested_quotes
 
     func_echo_infix_1_IFS=$IFS
     IFS=$nl
@@ -1331,7 +1331,7 @@ func_lt_ver ()
 {
     $debug_cmd
 
-    test "x$1" = x`func_sort_ver "$1" "$2" | sed 1q`
+    test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
 }
 
 
index 3e2ec7c2570f947e34ac078470a4e908de2cabc3..eea6eda5a21f5c4bdf1700f733354e814285396d 100644 (file)
@@ -137,8 +137,8 @@ libtoolize_environment_options ()
     my_sed_env_rest='1s/^[^,:; ]*[,:; ]*\(.*\)$/\1/;q'
 
     while test -n "$LIBTOOLIZE_OPTIONS"; do
-      opt=`echo "$LIBTOOLIZE_OPTIONS" | sed "$my_sed_env_opt"`
-      LIBTOOLIZE_OPTIONS=`echo "$LIBTOOLIZE_OPTIONS" | sed "$my_sed_env_rest"`
+      opt=`echo "$LIBTOOLIZE_OPTIONS" | $SED "$my_sed_env_opt"`
+      LIBTOOLIZE_OPTIONS=`echo "$LIBTOOLIZE_OPTIONS" | $SED "$my_sed_env_rest"`
 
       case $opt in
         --debug|--no-warn|--no-warning|--no-warnings|--quiet|--verbose)
@@ -1188,7 +1188,7 @@ func_check_macros ()
 
     # Don't trace for this, we're just checking the user didn't invoke it
     # directly from configure.ac.
-    $SED 's|dnl .*$||; s|# .*$||' "$configure_ac" | grep AC_PROG_RANLIB >/dev/null &&
+    $SED 's|dnl .*$||; s|# .*$||' "$configure_ac" | $GREP AC_PROG_RANLIB >/dev/null &&
       func_echo "'AC_PROG_RANLIB' is rendered obsolete by 'LT_INIT'"
 
     # FIXME: Ensure ltmain.sh, libtool.m4 and ltdl.m4 are from the same release
@@ -1217,7 +1217,7 @@ func_autoconf_configure ()
 
     # If we were passed a genuine file, make sure it calls AC_INIT.
     test -f "$1" \
-      && _G_ac_init=`$SED "$_G_sed_no_comment" "$1" |grep AC_INIT`
+      && _G_ac_init=`$SED "$_G_sed_no_comment" "$1" |$GREP AC_INIT`
 
     # Otherwise it is not a genuine Autoconf input file.
     test -n "$_G_ac_init"