From: Akim Demaille Date: Fri, 10 Mar 2000 15:22:13 +0000 (+0000) Subject: Multiple `-e' to egrep are not portable. On IRIX 6.5 and Solaris X-Git-Tag: autoconf-2.50~1067 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=702e183cf6b510cf415a720368c05ae74f1485bb;p=thirdparty%2Fautoconf.git Multiple `-e' to egrep are not portable. On IRIX 6.5 and Solaris 2.5.1 only the last one is honored: > echo "foonbar" | egrep -e 'foo' -e 'bar' bar > echo "foonbar" | egrep -e 'bar' -e 'foo' foo Reported by Nicolas Joly. An alternative would have to use `sed', unfortunately alternation is not portable. * tests/actest.m4 (join): New macro. (AC_ENV_SAVE): Join the egrep patterns into a single big one. * tests/Makefile.am (EGREP_EXCLUDE): Rename as FILTER_MACROS. Join the egrep patterns into a single big one. --- diff --git a/ChangeLog b/ChangeLog index 68a01f77b..5b7c844b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2000-03-10 Akim Demaille + + Multiple `-e' to egrep are not portable. On IRIX 6.5 and Solaris + 2.5.1 only the last one is honored: + > echo "foo\nbar" | egrep -e 'foo' -e 'bar' + bar + > echo "foo\nbar" | egrep -e 'bar' -e 'foo' + foo + Reported by Nicolas Joly. + An alternative would have to use `sed', unfortunately alternation + is not portable. + + * tests/actest.m4 (join): New macro. + (AC_ENV_SAVE): Join the egrep patterns into a single big one. + * tests/Makefile.am (EGREP_EXCLUDE): Rename as FILTER_MACROS. + Join the egrep patterns into a single big one. + 2000-03-10 Jim Meyering * acgeneral.m4 (_AC_CHECK_TOOL_PREFIX): Correct typos in definition: diff --git a/m4/Makefile.in b/m4/Makefile.in index c7758a1c2..6f1d12159 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -57,15 +57,11 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -AT_TESTPATH = @AT_TESTPATH@ AWK = @AWK@ HELP2MAN = @HELP2MAN@ M4 = @M4@ -MAKEINFO = @MAKEINFO@ -PACKAGE = @PACKAGE@ PERL = @PERL@ PERLSCRIPTS = @PERLSCRIPTS@ -VERSION = @VERSION@ standards_texi = @standards_texi@ EXTRA_DIST = init.m4 missing.m4 sanity.m4 atconfig.m4 @@ -74,6 +70,9 @@ CONFIG_CLEAN_FILES = DIST_COMMON = Makefile.am Makefile.in +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar diff --git a/man/Makefile.in b/man/Makefile.in index cf08485c7..f15168deb 100644 --- a/man/Makefile.in +++ b/man/Makefile.in @@ -57,15 +57,11 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -AT_TESTPATH = @AT_TESTPATH@ AWK = @AWK@ HELP2MAN = @HELP2MAN@ M4 = @M4@ -MAKEINFO = @MAKEINFO@ -PACKAGE = @PACKAGE@ PERL = @PERL@ PERLSCRIPTS = @PERLSCRIPTS@ -VERSION = @VERSION@ standards_texi = @standards_texi@ man_MANS = autoconf.1 autoreconf.1 autoheader.1 autoupdate.1 ifnames.1 autoscan.1 @@ -87,6 +83,9 @@ NROFF = nroff DIST_COMMON = Makefile.am Makefile.in +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar diff --git a/tests/Makefile.am b/tests/Makefile.am index 6392fc707..7646950ea 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -40,7 +40,7 @@ testsuite: atgeneral.m4 atspecific.m4 suite.m4 macros.m4 $(SUITE) -# EGREP_EXCLUDE +# FILTER_MACROS # ------------- # The test `syntax.m4' tries to run all the macros of Autoconf to check # for syntax problems, etc. Not all the macros can be run without argument, @@ -63,25 +63,28 @@ testsuite: atgeneral.m4 atspecific.m4 suite.m4 macros.m4 $(SUITE) # Used in many places. # - _AC_ # Internal macros are used elsewhere. -EGREP_EXCLUDE = egrep -v \ - -e '^AC_ARG_VAR$$' \ - -e '^AC_CHECK_(DECL|FILE|FUNC|HEADER|MEMBER|PROG|SIZEOF|TYPE)S?$$' \ - -e '^AC_CONFIG' \ - -e '^AC_INIT' \ - -e '^AC_LINKER_OPTION$$' \ - -e '^AC_LINK_FILES$$' \ - -e '^AC_LIST_MEMBER_OF$$' \ - -e '^AC_PATH_(TOOL|PROG)S?$$' \ - -e '^AC_PROG_(CC|CXX|F77)_(GNU|WORKS)$$' \ - -e '^AC_REPLACE_FUNCS$$' \ - -e '^AC_SEARCH_LIBS$$' \ - -e '^AC_TRY' \ - -e '_AC_' +# +# Multiple `-e' to egrep are not portable, so join all the patterns together. +# We use the fact that automake will replace all the `\\\n' with ` '. +FILTER_MACROS = egrep -v -e \ +`echo '^AC_ARG_VAR$$\ +^AC_CHECK_(DECL|FILE|FUNC|HEADER|MEMBER|PROG|SIZEOF|TYPE)S?$$\ +^AC_CONFIG\ +^AC_INIT\ +^AC_LINKER_OPTION$$\ +^AC_LINK_FILES$$\ +^AC_LIST_MEMBER_OF$$\ +^AC_PATH_(TOOL|PROG)S?$$\ +^AC_PROG_(CC|CXX|F77)_(GNU|WORKS)$$\ +^AC_REPLACE_FUNCS$$\ +^AC_SEARCH_LIBS$$\ +^AC_TRY\ +_AC_' | tr ' ' '|'` macros.m4: $(top_srcdir)/acgeneral.m4 $(top_srcdir)/acspecific.m4 $(srcdir)/Makefile.am cat $(top_srcdir)/acgeneral.m4 $(top_srcdir)/acspecific.m4 | \ sed -ne 's/^A[CU]_DEFUN(\[*\([a-zA-Z0-9_]*\).*$$/\1/p' | \ - sort | uniq | $(EGREP_EXCLUDE) >defuns + sort | uniq | $(FILTER_MACROS) >defuns # Get the list of macros that are required: there is little interest # in testing them since they will be run but the guy who requires # them. diff --git a/tests/Makefile.in b/tests/Makefile.in index 484b919f6..eea52fd7c 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -73,7 +73,7 @@ EXTRA_DIST = atgeneral.m4 atspecific.m4 suite.m4 macros.m4 actest.m4 $(SUITE) PERL = perl -# EGREP_EXCLUDE +# FILTER_MACROS # ------------- # The test `syntax.m4' tries to run all the macros of Autoconf to check # for syntax problems, etc. Not all the macros can be run without argument, @@ -96,7 +96,10 @@ PERL = perl # Used in many places. # - _AC_ # Internal macros are used elsewhere. -EGREP_EXCLUDE = egrep -v -e '^AC_ARG_VAR$$' -e '^AC_CHECK_(DECL|FILE|FUNC|HEADER|MEMBER|PROG|SIZEOF|TYPE)S?$$' -e '^AC_CONFIG' -e '^AC_INIT' -e '^AC_LINKER_OPTION$$' -e '^AC_LINK_FILES$$' -e '^AC_LIST_MEMBER_OF$$' -e '^AC_PATH_(TOOL|PROG)S?$$' -e '^AC_PROG_(CC|CXX|F77)_(GNU|WORKS)$$' -e '^AC_REPLACE_FUNCS$$' -e '^AC_SEARCH_LIBS$$' -e '^AC_TRY' -e '_AC_' +# +# Multiple `-e' to egrep are not portable, so join all the patterns together. +# We use the fact that automake will replace all the `\\\n' with ` '. +FILTER_MACROS = egrep -v -e `echo '^AC_ARG_VAR$$ ^AC_CHECK_(DECL|FILE|FUNC|HEADER|MEMBER|PROG|SIZEOF|TYPE)S?$$ ^AC_CONFIG ^AC_INIT ^AC_LINKER_OPTION$$ ^AC_LINK_FILES$$ ^AC_LIST_MEMBER_OF$$ ^AC_PATH_(TOOL|PROG)S?$$ ^AC_PROG_(CC|CXX|F77)_(GNU|WORKS)$$ ^AC_REPLACE_FUNCS$$ ^AC_SEARCH_LIBS$$ ^AC_TRY _AC_' | tr ' ' '|'` CLEANFILES = debug-*.sh macro configure configure.in config.status config.cache config.log config.h.in config.h @@ -104,7 +107,8 @@ CLEANFILES = debug-*.sh macro configure configure.in config.status config.cache DISTCLEANFILES = atconfig testsuite mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_CLEAN_FILES = atconfig -DIST_COMMON = Makefile.am Makefile.in atconfig.in +DIST_COMMON = Makefile.am Makefile.in atconfig.in configure \ +configure.in PACKAGE = @PACKAGE@ @@ -226,7 +230,7 @@ testsuite: atgeneral.m4 atspecific.m4 suite.m4 macros.m4 $(SUITE) macros.m4: $(top_srcdir)/acgeneral.m4 $(top_srcdir)/acspecific.m4 $(srcdir)/Makefile.am cat $(top_srcdir)/acgeneral.m4 $(top_srcdir)/acspecific.m4 | \ sed -ne 's/^A[CU]_DEFUN(\[*\([a-zA-Z0-9_]*\).*$$/\1/p' | \ - sort | uniq | $(EGREP_EXCLUDE) >defuns + sort | uniq | $(FILTER_MACROS) >defuns # Get the list of macros that are required: there is little interest # in testing them since they will be run but the guy who requires # them. diff --git a/tests/actest.m4 b/tests/actest.m4 index 6e1a03a96..c8f4eb6bb 100644 --- a/tests/actest.m4 +++ b/tests/actest.m4 @@ -1,6 +1,14 @@ dnl actest.m4 -*- autoconf -*- dnl Additional Autoconf macros to ease testing. +# join(SEP, ARG1, ARG2...) +# ------------------------ +# Produce ARG1SEPARG2...SEPARGn. +define(join, +[ifelse([$#], [1], [], + [$#], [2], [[$2]], + [[$2][$1]join([$1], m4_shift(m4_shift($@)))])]) + # AC_ENV_SAVE(FILE) # ------------------ @@ -20,20 +28,21 @@ dnl Additional Autoconf macros to ease testing. AC_DEFUN(AC_ENV_SAVE, [(set) 2>&1 | - egrep -v \ - -e '^ac_' \ - -e '^(CC|CFLAGS|CPP|GCC|CXX|CXXFLAGS|CXXCPP|GXX|F77|FFLAGS|FLIBS|G77)=' \ - -e '^(LIBS|LIBOBJS|LDFLAGS)=' \ - -e '^INSTALL(_(DATA|PROGRAM|SCRIPT))?=' \ - -e '^(CYGWIN|ISC|MINGW32|MINIX|EMXOS2|EXEEXT|OBJEXT)=' \ - -e '^(X_(CFLAGS|(EXTRA_|PRE_)?LIBS)|x_(includes|libraries)|have_x)=' \ - -e '^(host|build|target)(_(alias|cpu|vendor|os))?=' \ - -e '^(cross_compiling)=' \ - -e '^(interpval)=' \ - -e '^(f77_(case|underscore))=' \ - -e '^(ALLOCA|NEED_SETGID|KMEM_GROUP)=' \ - -e '^(AWK|LEX|LEXLIB|LEX_OUTPUT_ROOT|LN_S|M4|RANLIB|SET_MAKE|YACC)=' \ - -e '^(_|OLDPWD|PIPESTATUS|SECONDS)=' | + egrep -v -e \ +'join([|], + [^ac_], + [^(CC|CFLAGS|CPP|GCC|CXX|CXXFLAGS|CXXCPP|GXX|F77|FFLAGS|FLIBS|G77)=], + [^(LIBS|LIBOBJS|LDFLAGS)=], + [^INSTALL(_(DATA|PROGRAM|SCRIPT))?=], + [^(CYGWIN|ISC|MINGW32|MINIX|EMXOS2|EXEEXT|OBJEXT)=], + [^(X_(CFLAGS|(EXTRA_|PRE_)?LIBS)|x_(includes|libraries)|have_x)=], + [^(host|build|target)(_(alias|cpu|vendor|os))?=], + [^(cross_compiling)=], + [^(interpval)=], + [^(f77_(case|underscore))=], + [^(ALLOCA|NEED_SETGID|KMEM_GROUP)=], + [^(AWK|LEX|LEXLIB|LEX_OUTPUT_ROOT|LN_S|M4|RANLIB|SET_MAKE|YACC)=], + [^(_|OLDPWD|PIPESTATUS|SECONDS)=])' | # There maybe variables spread on several lines, eg IFS, remove the dead # lines fgrep = >$1