Florin Iucha wrote: > URL: > <http://savannah.gnu.org/bugs/?31646> > > Summary: grep fails to build on Solaris 10, because it lacks > grep > Project: grep > Submitted by: themage > Submitted on: Sat 13 Nov 2010 08:45:37 PM GMT > Category: None > Severity: 3 - Normal > Item Group: None > Status: None > Privacy: Public > Assigned to: None > Open/Closed: Open > Discussion Lock: Any > > > Details: > > I am trying to build GNU grep 2.7 on Solaris 10, and the 'configure' script > fails with:
/usr/xpg4/bin/grep /bin/grep /usr/bin/grep > checking for grep that handles long lines and -e... configure: error: no > acceptable grep could be found in > /usr/bin:/usr/sfw/bin:/opt/solstudio12.2/bin:/opt/sfw/bin:/usr/ccs/bin:/usr/xpg4/bin > > I would rather not have to install an old binary built by somebody, just so I > can build the new version. Thank you for the report. Unfortunately, some check for grep *is* required, since it's used here, to set EGREP ac_cv_path_EGREP="$GREP -E" EGREP="$ac_cv_path_EGREP" and $EGREP is used for each expansion of AC_EGREP_CPP, e.g., $ grep '\$EGREP' configure if test -z "$EGREP"; then ac_cv_path_EGREP=$EGREP $EGREP "memchr" >/dev/null 2>&1; then : $EGREP "free" >/dev/null 2>&1; then : $EGREP "webecray" >/dev/null 2>&1; then : $EGREP "choke me" >/dev/null 2>&1; then : $EGREP "booboo" >/dev/null 2>&1; then : $EGREP "yes" >/dev/null 2>&1; then : $EGREP "yes" >/dev/null 2>&1; then : However, each and every one of those uses is trivial, so even a simple sed, awk or perl-based replacement for grep would be enough to get past the initial configure run. For the record, I've just written this minimal grep based on perl. It doesn't even print anything, but doesn't need to here, since configure ignores $EGREP's output. cat <<\EOF > grep eval '(exit $?0)' && eval 'exec perl -wS -n "$0" ${1+"$@"}' & eval 'exec perl -wS -n "$0" $argv:q' if 0; BEGIN { do { $pat = shift } while ($pat eq '-E') } /$pat/ and $found = 1; END { exit !$found } EOF chmod a+x grep But that was more as proof of concept than anything else. If you don't have grep, you probably don't have perl, either. These days it's not hard to find a pre-built grep binary. While the dependency of AC_EGREP_CPP on AC_PROG_EGREP is unavoidable, there are others that are indeed unnecessary, since they serve only to work around a bug in autoconf-2.57, which is no longer relevant, since we (gnulib-tool) now requires 2.59 or newer. This proposed patch removes the work-around requirements in gnulib. I'll wait to hear from Bruno and Paul before pushing. >From df946aba826832ad14d5fb7bbf2709adc2738596 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Sat, 13 Nov 2010 22:25:32 +0100 Subject: [PATCH] remove autoconf-2.57 work-around that required AC_PROG_EGREP Now we require at least 2.59, and the work-around induced an unwarranted circular dependency in grep's build process. The following .m4 files pulled in the AC_PROG_EGREP requirement, yet $EGREP was never used, and configuring grep on a system without an existing grep program would thus fail unnecessarily. * m4/alloca.m4 (gl_FUNC_ALLOCA): Remove work-around. * m4/dirfd.m4 (gl_FUNC_DIRFD): Likewise. * m4/mmap-anon.m4 (gl_FUNC_MMAP_ANON): Likewise. * m4/strtoimax.m4 (gl_FUNC_STRTOIMAX): Likewise. * m4/strtoumax.m4 (gl_FUNC_STRTOUMAX): Likewise. Prompted by the report, http://savannah.gnu.org/bugs/?31646 by Florin Iucha. --- ChangeLog | 16 ++++++++++++++++ m4/alloca.m4 | 6 +----- m4/dirfd.m4 | 6 +----- m4/mmap-anon.m4 | 6 +----- m4/strtoimax.m4 | 6 +----- m4/strtoumax.m4 | 6 +----- 6 files changed, 21 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 97cebc2..d26d293 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2010-11-13 Jim Meyering <meyer...@redhat.com> + + remove autoconf-2.57 work-around that required AC_PROG_EGREP + Now we require at least 2.59, and the work-around induced an + unwarranted circular dependency in grep's build process. + The following .m4 files pulled in the AC_PROG_EGREP requirement, + yet $EGREP was never used, and configuring grep on a system without + an existing grep program would thus fail unnecessarily. + * m4/alloca.m4 (gl_FUNC_ALLOCA): Remove work-around. + * m4/dirfd.m4 (gl_FUNC_DIRFD): Likewise. + * m4/mmap-anon.m4 (gl_FUNC_MMAP_ANON): Likewise. + * m4/strtoimax.m4 (gl_FUNC_STRTOIMAX): Likewise. + * m4/strtoumax.m4 (gl_FUNC_STRTOUMAX): Likewise. + Prompted by the report, http://savannah.gnu.org/bugs/?31646 + by Florin Iucha. + 2010-11-13 Eric Blake <ebl...@redhat.com> maintainer-makefile: cover a few more files diff --git a/m4/alloca.m4 b/m4/alloca.m4 index f3ee343..80d67aa 100644 --- a/m4/alloca.m4 +++ b/m4/alloca.m4 @@ -1,4 +1,4 @@ -# alloca.m4 serial 9 +# alloca.m4 serial 10 dnl Copyright (C) 2002-2004, 2006-2007, 2009-2010 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -7,10 +7,6 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_ALLOCA], [ - dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57. - AC_REQUIRE([AC_PROG_CPP]) - AC_REQUIRE([AC_PROG_EGREP]) - AC_REQUIRE([AC_FUNC_ALLOCA]) if test $ac_cv_func_alloca_works = no; then gl_PREREQ_ALLOCA diff --git a/m4/dirfd.m4 b/m4/dirfd.m4 index 48b7bae..bfddeb9 100644 --- a/m4/dirfd.m4 +++ b/m4/dirfd.m4 @@ -1,4 +1,4 @@ -# serial 18 -*- Autoconf -*- +# serial 19 -*- Autoconf -*- dnl Find out how to get the file descriptor associated with an open DIR*. @@ -17,10 +17,6 @@ AC_DEFUN([gl_FUNC_DIRFD], dnl Persuade glibc <dirent.h> to declare dirfd(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57. - AC_REQUIRE([AC_PROG_CPP]) - AC_REQUIRE([AC_PROG_EGREP]) - AC_CHECK_FUNCS([dirfd]) AC_CHECK_DECLS([dirfd], , , [#include <sys/types.h> diff --git a/m4/mmap-anon.m4 b/m4/mmap-anon.m4 index a6b7b9a..e20fc3c 100644 --- a/m4/mmap-anon.m4 +++ b/m4/mmap-anon.m4 @@ -1,4 +1,4 @@ -# mmap-anon.m4 serial 8 +# mmap-anon.m4 serial 9 dnl Copyright (C) 2005, 2007, 2009-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -15,10 +15,6 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_MMAP_ANON], [ - dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57. - AC_REQUIRE([AC_PROG_CPP]) - AC_REQUIRE([AC_PROG_EGREP]) - dnl Persuade glibc <sys/mman.h> to define MAP_ANONYMOUS. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) diff --git a/m4/strtoimax.m4 b/m4/strtoimax.m4 index 8d8298b..5027e26 100644 --- a/m4/strtoimax.m4 +++ b/m4/strtoimax.m4 @@ -1,4 +1,4 @@ -# strtoimax.m4 serial 7 +# strtoimax.m4 serial 8 dnl Copyright (C) 2002, 2003, 2004, 2006, 2009, 2010 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -7,10 +7,6 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRTOIMAX], [ - dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57. - AC_REQUIRE([AC_PROG_CPP]) - AC_REQUIRE([AC_PROG_EGREP]) - AC_CACHE_CHECK([whether <inttypes.h> defines strtoimax as a macro], gl_cv_func_strtoimax_macro, [AC_EGREP_CPP([inttypes_h_defines_strtoimax], [#include <inttypes.h> diff --git a/m4/strtoumax.m4 b/m4/strtoumax.m4 index 684634f..5450037 100644 --- a/m4/strtoumax.m4 +++ b/m4/strtoumax.m4 @@ -1,4 +1,4 @@ -# strtoumax.m4 serial 7 +# strtoumax.m4 serial 8 dnl Copyright (C) 2002, 2003, 2004, 2006, 2009, 2010 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -7,10 +7,6 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRTOUMAX], [ - dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57. - AC_REQUIRE([AC_PROG_CPP]) - AC_REQUIRE([AC_PROG_EGREP]) - AC_CACHE_CHECK([whether <inttypes.h> defines strtoumax as a macro], gl_cv_func_strtoumax_macro, [AC_EGREP_CPP([inttypes_h_defines_strtoumax], [#include <inttypes.h> -- 1.7.3.2.4.g60aa9