From 3d79cd9ff455d85e788398bfe4fdc4544fabceb5 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 18 Apr 2025 14:01:38 -0700 Subject: [PATCH] Avoid grep in minimal configure MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE): Use ‘sed -n '$='’ instead of ‘grep -c’, since these are the only uses of grep in a minimal ‘configure’ and we are already using sed elsewhere. --- doc/install.texi | 12 ++++++------ lib/autoconf/status.m4 | 5 ++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/doc/install.texi b/doc/install.texi index f9e5e7fa6..98eebe3d1 100644 --- a/doc/install.texi +++ b/doc/install.texi @@ -138,15 +138,15 @@ you can type @samp{make uninstall} to remove the installed files. Installation requires a POSIX-like environment with a shell and at least the following standard utilities: -@example -awk cat cp diff echo expr false -grep ls mkdir mv printf pwd -rm rmdir sed sort test tr -@end example +@quotation +@t{awk cat cp diff echo expr false +ls mkdir mv printf pwd +rm rmdir sed sort test tr} +@end quotation @noindent This package's installation may need other standard utilities such as -@command{cmp}, @command{make}, @command{sleep} and @command{touch}, +@command{grep}, @command{make}, @command{sleep} and @command{touch}, along with compilers like @command{gcc}. @node Compilers and Options diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4 index 8bbf4b385..0ac451dca 100644 --- a/lib/autoconf/status.m4 +++ b/lib/autoconf/status.m4 @@ -403,14 +403,13 @@ rm -f conf$$files.sh echo "_ACEOF" } >conf$$subs.sh || AC_MSG_ERROR([could not make $CONFIG_STATUS]) -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim_num=`echo "$ac_subst_vars" | sed -n '$='` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || AC_MSG_ERROR([could not make $CONFIG_STATUS]) -dnl Do not use grep on conf$$subs.awk, since AIX grep has a line length limit. - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | sed -n '$='` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then -- 2.47.3