diff options
author | Gary V. Vaughan <gary@gnu.org> | 2013-10-30 18:25:44 +1300 |
---|---|---|
committer | Gary V. Vaughan <gary@gnu.org> | 2014-01-02 12:06:30 +1300 |
commit | 7f99bfd86c97038b73a1e5d1445ef31c6ec59983 (patch) | |
tree | 85ee8334b8556288e8f1012cf72791cd3fe1b741 | |
parent | 0e1ba2182cbbae47d5da09984c776774ab2616ea (diff) | |
download | libtool-7f99bfd86c97038b73a1e5d1445ef31c6ec59983.tar.gz |
maint: use $SED and $GREP, not sed and grep in all scripts.
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>
-rwxr-xr-x | bootstrap | 25 | ||||
-rw-r--r-- | build-aux/ltmain.in | 8 | ||||
-rwxr-xr-x | gl/build-aux/bootstrap.in | 8 | ||||
-rwxr-xr-x | gl/build-aux/extract-trace | 2 | ||||
-rw-r--r-- | gl/build-aux/funclib.sh | 8 | ||||
-rw-r--r-- | libtoolize.in | 8 |
6 files changed, 32 insertions, 27 deletions
@@ -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 } diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in index 0da8ad7c..d2fb2d5b 100644 --- a/build-aux/ltmain.in +++ b/build-aux/ltmain.in @@ -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 diff --git a/gl/build-aux/bootstrap.in b/gl/build-aux/bootstrap.in index e83835cd..e0237435 100755 --- a/gl/build-aux/bootstrap.in +++ b/gl/build-aux/bootstrap.in @@ -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 } diff --git a/gl/build-aux/extract-trace b/gl/build-aux/extract-trace index 5e42ea78..ece24d77 100755 --- a/gl/build-aux/extract-trace +++ b/gl/build-aux/extract-trace @@ -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" diff --git a/gl/build-aux/funclib.sh b/gl/build-aux/funclib.sh index 7dd99c17..2746827b 100644 --- a/gl/build-aux/funclib.sh +++ b/gl/build-aux/funclib.sh @@ -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` } diff --git a/libtoolize.in b/libtoolize.in index 3e2ec7c2..eea6eda5 100644 --- a/libtoolize.in +++ b/libtoolize.in @@ -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" |