From: Akim Demaille Date: Wed, 6 Dec 2000 14:05:46 +0000 (+0000) Subject: The SunOS' egrep fails to process properly the `egrep' invocations X-Git-Tag: autoconf-2.50~344 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9eb6e4e204a22883d11aa7aac2260e931e03c884;p=thirdparty%2Fautoconf.git The SunOS' egrep fails to process properly the `egrep' invocations of the test suite. * tests/aclocal.m4 (AC_STATE_SAVE): If egrep fails, remove the output file. * tests/atspecific.m4 (_AT_CHECK_AC_MACRO): Don't check `state-*' if the files are not present. * m4sugar.m4 (m4_join): Rename as... (m4_smash): this. * tests/aclocal.m4 (join): Move as... * m4sugar.m4 (m4_flatten): this. * autoconf.sh (trace.m4): Rename m4_smash as m4_flatten. --- diff --git a/ChangeLog b/ChangeLog index a689e5f5e..89c3a4e8c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2000-12-06 Akim Demaille + + The SunOS' egrep fails to process properly the `egrep' invocations + of the test suite. + + * tests/aclocal.m4 (AC_STATE_SAVE): If egrep fails, remove the + output file. + * tests/atspecific.m4 (_AT_CHECK_AC_MACRO): Don't check `state-*' + if the files are not present. + + * m4sugar.m4 (m4_join): Rename as... + (m4_smash): this. + * tests/aclocal.m4 (join): Move as... + * m4sugar.m4 (m4_flatten): this. + * autoconf.sh (trace.m4): Rename m4_smash as m4_flatten. + 2000-12-06 Akim Demaille * autoconf.sh (task trace): s/m4/$M4/. diff --git a/acgeneral.m4 b/acgeneral.m4 index 2db9dce2b..8bcf5d1f9 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -511,7 +511,7 @@ m4_define([AC_TR_SH], # ive ], [-Var-])end # => -active--b--active-end m4_define([AC_FOREACH], -[m4_foreach([$1], m4_split(m4_strip(m4_join([$2]))), [$3])]) +[m4_foreach([$1], m4_split(m4_strip(m4_flatten([$2]))), [$3])]) diff --git a/autoconf.in b/autoconf.in index e5817e713..4f8606b19 100644 --- a/autoconf.in +++ b/autoconf.in @@ -434,7 +434,7 @@ EOF # MODE can be: # `at' -- the elements are enclosed in brackets. # `star' -- the elements are listed as are. - # `percent' -- the elements are `smashed': spaces are singled out, + # `percent' -- the elements are `flattened': spaces are singled out, # and no new line remains. define([_at_at], [at_ifelse([$#], [1], [], @@ -442,15 +442,15 @@ EOF [[[$2]][$1]$0([$1], at_shift(at_shift($@)))])]) define([_at_percent], [at_ifelse([$#], [1], [], - [$#], [2], [at_smash([$2])], - [at_smash([$2])[$1]$0([$1], at_shift(at_shift($@)))])]) + [$#], [2], [at_flatten([$2])], + [at_flatten([$2])[$1]$0([$1], at_shift(at_shift($@)))])]) define([_at_star], [at_ifelse([$#], [1], [], [$#], [2], [[$2]], [[$2][$1]$0([$1], at_shift(at_shift($@)))])]) - # Smash quotes its result. - define([at_smash], + # FLATTEN quotes its result. + define([at_flatten], [at_patsubst(at_patsubst(at_patsubst([[[$1]]], [\\ ]), @@ -535,7 +535,7 @@ EOF # $*, list of unquoted effective arguments. if (arg == "*") return "]at_star([" (separator ? separator : ",") "], $@)[" - # $%, list of smashed unquoted effective arguments. + # $%, list of flattened unquoted effective arguments. if (arg == "%") return "]at_percent([" (separator ? separator : ":") "], $@)[" } diff --git a/autoconf.sh b/autoconf.sh index e5817e713..4f8606b19 100644 --- a/autoconf.sh +++ b/autoconf.sh @@ -434,7 +434,7 @@ EOF # MODE can be: # `at' -- the elements are enclosed in brackets. # `star' -- the elements are listed as are. - # `percent' -- the elements are `smashed': spaces are singled out, + # `percent' -- the elements are `flattened': spaces are singled out, # and no new line remains. define([_at_at], [at_ifelse([$#], [1], [], @@ -442,15 +442,15 @@ EOF [[[$2]][$1]$0([$1], at_shift(at_shift($@)))])]) define([_at_percent], [at_ifelse([$#], [1], [], - [$#], [2], [at_smash([$2])], - [at_smash([$2])[$1]$0([$1], at_shift(at_shift($@)))])]) + [$#], [2], [at_flatten([$2])], + [at_flatten([$2])[$1]$0([$1], at_shift(at_shift($@)))])]) define([_at_star], [at_ifelse([$#], [1], [], [$#], [2], [[$2]], [[$2][$1]$0([$1], at_shift(at_shift($@)))])]) - # Smash quotes its result. - define([at_smash], + # FLATTEN quotes its result. + define([at_flatten], [at_patsubst(at_patsubst(at_patsubst([[[$1]]], [\\ ]), @@ -535,7 +535,7 @@ EOF # $*, list of unquoted effective arguments. if (arg == "*") return "]at_star([" (separator ? separator : ",") "], $@)[" - # $%, list of smashed unquoted effective arguments. + # $%, list of flattened unquoted effective arguments. if (arg == "%") return "]at_percent([" (separator ? separator : ":") "], $@)[" } diff --git a/bin/autoconf.in b/bin/autoconf.in index e5817e713..4f8606b19 100644 --- a/bin/autoconf.in +++ b/bin/autoconf.in @@ -434,7 +434,7 @@ EOF # MODE can be: # `at' -- the elements are enclosed in brackets. # `star' -- the elements are listed as are. - # `percent' -- the elements are `smashed': spaces are singled out, + # `percent' -- the elements are `flattened': spaces are singled out, # and no new line remains. define([_at_at], [at_ifelse([$#], [1], [], @@ -442,15 +442,15 @@ EOF [[[$2]][$1]$0([$1], at_shift(at_shift($@)))])]) define([_at_percent], [at_ifelse([$#], [1], [], - [$#], [2], [at_smash([$2])], - [at_smash([$2])[$1]$0([$1], at_shift(at_shift($@)))])]) + [$#], [2], [at_flatten([$2])], + [at_flatten([$2])[$1]$0([$1], at_shift(at_shift($@)))])]) define([_at_star], [at_ifelse([$#], [1], [], [$#], [2], [[$2]], [[$2][$1]$0([$1], at_shift(at_shift($@)))])]) - # Smash quotes its result. - define([at_smash], + # FLATTEN quotes its result. + define([at_flatten], [at_patsubst(at_patsubst(at_patsubst([[[$1]]], [\\ ]), @@ -535,7 +535,7 @@ EOF # $*, list of unquoted effective arguments. if (arg == "*") return "]at_star([" (separator ? separator : ",") "], $@)[" - # $%, list of smashed unquoted effective arguments. + # $%, list of flattened unquoted effective arguments. if (arg == "%") return "]at_percent([" (separator ? separator : ":") "], $@)[" } diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 2db9dce2b..8bcf5d1f9 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -511,7 +511,7 @@ m4_define([AC_TR_SH], # ive ], [-Var-])end # => -active--b--active-end m4_define([AC_FOREACH], -[m4_foreach([$1], m4_split(m4_strip(m4_join([$2]))), [$3])]) +[m4_foreach([$1], m4_split(m4_strip(m4_flatten([$2]))), [$3])]) diff --git a/lib/m4sugar/m4sugar.m4 b/lib/m4sugar/m4sugar.m4 index 1622e3086..4c65460ad 100644 --- a/lib/m4sugar/m4sugar.m4 +++ b/lib/m4sugar/m4sugar.m4 @@ -1333,17 +1333,17 @@ m4_changequote([, ]) -# m4_join(STRING) -# --------------- +# m4_flatten(STRING) +# ------------------ # If STRING contains end of lines, replace them with spaces. If there # are backslashed end of lines, remove them. This macro is safe with # active symbols. # m4_define(active, ACTIVE) -# m4_join([active +# m4_flatten([active # act\ # ive])end # => active activeend -m4_define([m4_join], +m4_define([m4_flatten], [m4_translit(m4_patsubst([[[$1]]], [\\ ]), [ ], [ ])]) @@ -1378,6 +1378,17 @@ m4_define([m4_strip], +# m4_join(SEP, ARG1, ARG2...) +# --------------------------- +# Produce ARG1SEPARG2...SEPARGn. +m4_defun([m4_join], +[m4_case([$#], + [1], [], + [2], [[$2]], + [[$2][$1]m4_join([$1], m4_shift(m4_shift($@)))])]) + + + # m4_append(MACRO-NAME, STRING) # ----------------------------- # Redefine MACRO-NAME to hold its former content plus STRING at the @@ -1484,7 +1495,7 @@ m4_Prefix1[]dnl m4_if(m4_eval(m4_Cursor > m4_len(m4_Prefix)), 1, [m4_define([m4_Cursor], m4_len(m4_Prefix)) m4_Prefix])[]dnl -m4_foreach_quoted([m4_Word], (m4_split(m4_strip(m4_join([$1])))), +m4_foreach_quoted([m4_Word], (m4_split(m4_strip(m4_flatten([$1])))), [m4_define([m4_Cursor], m4_eval(m4_Cursor + len(m4_Word) + 1))dnl dnl New line if too long, else insert a space unless it is the first dnl of the words. diff --git a/m4sugar.m4 b/m4sugar.m4 index 1622e3086..4c65460ad 100644 --- a/m4sugar.m4 +++ b/m4sugar.m4 @@ -1333,17 +1333,17 @@ m4_changequote([, ]) -# m4_join(STRING) -# --------------- +# m4_flatten(STRING) +# ------------------ # If STRING contains end of lines, replace them with spaces. If there # are backslashed end of lines, remove them. This macro is safe with # active symbols. # m4_define(active, ACTIVE) -# m4_join([active +# m4_flatten([active # act\ # ive])end # => active activeend -m4_define([m4_join], +m4_define([m4_flatten], [m4_translit(m4_patsubst([[[$1]]], [\\ ]), [ ], [ ])]) @@ -1378,6 +1378,17 @@ m4_define([m4_strip], +# m4_join(SEP, ARG1, ARG2...) +# --------------------------- +# Produce ARG1SEPARG2...SEPARGn. +m4_defun([m4_join], +[m4_case([$#], + [1], [], + [2], [[$2]], + [[$2][$1]m4_join([$1], m4_shift(m4_shift($@)))])]) + + + # m4_append(MACRO-NAME, STRING) # ----------------------------- # Redefine MACRO-NAME to hold its former content plus STRING at the @@ -1484,7 +1495,7 @@ m4_Prefix1[]dnl m4_if(m4_eval(m4_Cursor > m4_len(m4_Prefix)), 1, [m4_define([m4_Cursor], m4_len(m4_Prefix)) m4_Prefix])[]dnl -m4_foreach_quoted([m4_Word], (m4_split(m4_strip(m4_join([$1])))), +m4_foreach_quoted([m4_Word], (m4_split(m4_strip(m4_flatten([$1])))), [m4_define([m4_Cursor], m4_eval(m4_Cursor + len(m4_Word) + 1))dnl dnl New line if too long, else insert a space unless it is the first dnl of the words. diff --git a/tests/aclocal.m4 b/tests/aclocal.m4 index c4087ce85..c27fcc7dc 100644 --- a/tests/aclocal.m4 +++ b/tests/aclocal.m4 @@ -1,16 +1,6 @@ # actest.m4 -*- autoconf -*- # Additional Autoconf macros to ease testing. -# join(SEP, ARG1, ARG2...) -# ------------------------ -# Produce ARG1SEPARG2...SEPARGn. -define([join], -[m4_case([$#], - [1], [], - [2], [[$2]], - [[$2][$1]join([$1], m4_shift(m4_shift($@)))])]) - - # AC_STATE_SAVE(FILE) # ------------------ # Save the environment, but the variables we are allowed to touch. @@ -28,10 +18,9 @@ define([join], # Some variables some shells use and change # - POW_LIB # From acfunctions.m4. -AC_DEFUN([AC_STATE_SAVE], +m4_defun([AC_STATE_SAVE], [(set) 2>&1 | - egrep -v -e \ -'join([|], + egrep -v -e 'm4_join([|], [^ac_], [^(CC|CFLAGS|CPP|GCC|CXX|CXXFLAGS|CXXCPP|GXX|F77|FFLAGS|FLIBS|G77)=], [^(LIBS|LIBOBJS|LDFLAGS)=], @@ -46,11 +35,14 @@ AC_DEFUN([AC_STATE_SAVE], [^(AWK|LEX|LEXLIB|LEX_OUTPUT_ROOT|LN_S|M4|RANLIB|SET_MAKE|YACC)=], [^(_|@|.[*#?].|LINENO|OLDPWD|PIPESTATUS|RANDOM|SECONDS)=])' | # There maybe variables spread on several lines, eg IFS, remove the dead - # lines + # lines. fgrep = >state-env.$1 - rm -f state-ls.$1 - ls -1 | grep -v '^state' | sort > state-ls.$1 -]) +# Some `egrep' choke on such a big regex (e.g., SunOS 4.1.3). In this +# case just don't pay attention to the env. +test $? = 0 || rm -f state-env.$1 + +ls -1 | grep -v '^state' | sort >state-ls.$1 +])# AC_STATE_SAVE @@ -58,7 +50,7 @@ AC_DEFUN([AC_STATE_SAVE], # ---------------- # Related VALUE to NAME both with AC_SUBST and AC_DEFINE. This is # used in the torture tests. -AC_DEFUN([AC_DEFUBST], +m4_defun([AC_DEFUBST], [AC_DUMMY_VAR($1)="AC_DEFUBST_VALUE" AC_DEFINE_UNQUOTED(AC_DUMMY_VAR($1), "$AC_DUMMY_VAR($1)", diff --git a/tests/atspecific.m4 b/tests/atspecific.m4 index ccba2dad6..d9545faf2 100644 --- a/tests/atspecific.m4 +++ b/tests/atspecific.m4 @@ -72,9 +72,11 @@ AT_CHECK_CONFIGURE dnl Some tests might exit prematurely when they find a problem, in dnl which case `env-after' is probably missing. Don't check it then. -if test -f state-env.after; then +if test -f state-env.before -a -f state-env.after; then mv -f state-env.before expout AT_CHECK([cat state-env.after], 0, expout) +fi +if test -f state-ls.before -a -f state-ls.after; then mv -f state-ls.before expout AT_CHECK([cat state-ls.after], 0, expout) fi