* tests/atgeneral.m4: Import M4sh.
Adjust the differences on the names of the builtins (define etc.).
(AT_CASE): Remove, use m4_case.
(AT_SETUP): Don't use `AT_group_description', `$1' is OK.
* tests/atspecific.m4 (m4_for, m4_foreach): Remove, use those of
M4sugar.
* tests/m4sugar.at: Strengthen the quotation and adjust to the new
macro names.
* tests/m4sh.at: Ditto.
* tests/torture.at: Ditto.
* tests/base.at: Ditto.
* m4sh.m4: Import M4sugar.
* autoconf.m4: Don't import M4sugar, M4sh does.
+2000-11-23 Akim Demaille <akim@epita.fr>
+
+ Move Autotest on top of M4sh.
+
+ * tests/atgeneral.m4: Import M4sh.
+ Adjust the differences on the names of the builtins (define etc.).
+ (AT_CASE): Remove, use m4_case.
+ (AT_SETUP): Don't use `AT_group_description', `$1' is OK.
+ * tests/atspecific.m4 (m4_for, m4_foreach): Remove, use those of
+ M4sugar.
+ * tests/m4sugar.at: Strengthen the quotation and adjust to the new
+ macro names.
+ * tests/m4sh.at: Ditto.
+ * tests/torture.at: Ditto.
+ * tests/base.at: Ditto.
+ * m4sh.m4: Import M4sugar.
+ * autoconf.m4: Don't import M4sugar, M4sh does.
+
2000-11-20 Pavel Roskin <proski@gnu.org>
* acgeneral.m4 (_AC_RUN_IFELSE): `==' in test is not portable,
-include(m4sugar.m4)# -*- Autoconf -*-
+include(m4sh.m4)# -*- Autoconf -*-
# This file is part of Autoconf.
# Driver that loads the Autoconf macro files.
# Copyright 1994, 1999, 2000 Free Software Foundation, Inc.
# yet when Autoconf is frozen.
# Do not sinclude ./aclocal.m4 here, to prevent it from being frozen.
-m4_include([m4sh.m4])
-
m4_include([acversion.m4])
m4_include([acgeneral.m4])
m4_include([aclang.m4])
-include(m4sugar.m4)# -*- Autoconf -*-
+include(m4sh.m4)# -*- Autoconf -*-
# This file is part of Autoconf.
# Driver that loads the Autoconf macro files.
# Copyright 1994, 1999, 2000 Free Software Foundation, Inc.
# yet when Autoconf is frozen.
# Do not sinclude ./aclocal.m4 here, to prevent it from being frozen.
-m4_include([m4sh.m4])
-
m4_include([acversion.m4])
m4_include([acgeneral.m4])
m4_include([aclang.m4])
-divert(-1) -*- Autoconf -*-
+include(m4sh.m4) -*- Autoconf -*-
# `m4' macros used in building test suites.
-# Copyright (C) 2000 Free Software Foundation, Inc.
+# Copyright 2000 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# any notice of this special exception to the GPL from your modified
# version.
-changequote()
-changequote([, ])
-
-define([AT_DEFINE], defn([define]))
-define([AT_EVAL], defn([eval]))
-define([AT_FORMAT], defn([format]))
-define([AT_INCLUDE], defn([include]))
-define([AT_SHIFT], defn([shift]))
-define([AT_UNDEFINE], defn([undefine]))
-
-undefine([define])
-undefine([eval])
-undefine([format])
-undefine([include])
-undefine([shift])
-undefine([undefine])
-
-
-# AT_CASE(SWITCH, VAL1, IF-VAL1, VAL2, IF-VAL2, ..., DEFAULT)
-# -----------------------------------------------------------
-# m4 equivalent of
-# switch (SWITCH)
-# {
-# case VAL1:
-# IF-VAL1;
-# break;
-# case VAL2:
-# IF-VAL2;
-# break;
-# ...
-# default:
-# DEFAULT;
-# break;
-# }.
-# All the values are optional, and the macro is robust to active
-# symbols properly quoted.
-AT_DEFINE([AT_CASE],
-[ifelse([$#], 0, [],
- [$#], 1, [],
- [$#], 2, [$2],
- [$1], [$2], [$3],
- [AT_CASE([$1], AT_SHIFT(AT_SHIFT(AT_SHIFT($@))))])])
+
+m4_define([AT_DEFINE], m4_defn([m4_define]))
+m4_define([AT_INCLUDE], m4_defn([m4_include]))
+m4_define([AT_SHIFT], m4_defn([m4_shift]))
+m4_define([AT_UNDEFINE], m4_defn([m4_undefine]))
+
# Use of diversions:
# -------
# Return the current file sans directory, a colon, and the current line.
AT_DEFINE([AT_LINE],
-[patsubst(__file__, ^.*/\(.*\), \1):__line__])
+[m4_patsubst(__file__, ^.*/\(.*\), \1):__line__])
# AT_INIT(PROGRAM)
# Start a group of related tests, all to be executed in the same subshell.
# The group is testing what DESCRIPTION says.
AT_DEFINE([AT_SETUP],
-[AT_DEFINE([AT_ordinal], AT_EVAL(AT_ordinal + 1))
-pushdef([AT_group_description], [$1])
-pushdef([AT_data_files], )
-pushdef([AT_data_expout], )
-pushdef([AT_data_experr], )
+[AT_DEFINE([AT_ordinal], m4_eval(AT_ordinal + 1))
+m4_pushdef([AT_data_files], )
+m4_pushdef([AT_data_expout], )
+m4_pushdef([AT_data_experr], )
if $at_stop_on_error && test -n "$at_failed_list"; then :; else
divert(1)[]dnl
echo AT_LINE > at-check-line
echo AT_LINE > at-setup-line
if $at_verbose; then
- echo 'testing AT_group_description'
+ echo 'testing $1'
echo $at_n " $at_c"
fi
if $at_verbose; then
echo "AT_ordinal. $srcdir/AT_LINE..."
else
- echo $at_n "substr(AT_ordinal. $srcdir/AT_LINE , 0, 30)[]$at_c"
+ echo $at_n "m4_substr(AT_ordinal. $srcdir/AT_LINE , 0, 30)[]$at_c"
fi
if test -z "$at_skip_mode"; then
(
[#] Snippet (d[]AT_ordinal[](
-[#] Testing AT_group_description
+[#] Testing $1
[#] Snippet )d[]AT_ordinal[])
[#] Snippet (s[]AT_ordinal[](
[#] starting from `AT_LINE'.
rm ifelse([AT_data_files$1], , [-f], [-rf[]AT_data_files[]ifelse($1, , , [ $1])]) stdout stderr[]AT_data_expout[]AT_data_experr
fi
fi
-popdef([AT_data_experr])
-popdef([AT_data_expout])
-popdef([AT_data_files])
-popdef([AT_group_description])[]dnl
+m4_popdef([AT_data_experr])
+m4_popdef([AT_data_expout])
+m4_popdef([AT_data_files])
+m4_popdef([AT_group_description])[]dnl
])# AT_CLEANUP
# their content is not checked.
AT_DEFINE([AT_CHECK],
[$at_traceoff
-$at_verbose && echo "$srcdir/AT_LINE: patsubst([$1], [\([\"`$]\)], \\\1)"
+$at_verbose && echo "$srcdir/AT_LINE: m4_patsubst([$1], [\([\"`$]\)], \\\1)"
echo AT_LINE > at-check-line
$at_check_stds && exec 5>&1 6>&2 1>stdout 2>stderr
$at_traceon
dnl If not verbose, neutralize the output of diff.
$at_verbose || exec 1>/dev/null 2>/dev/null
at_failed=false;
- AT_CASE([$4],
+ m4_case([$4],
ignore, [$at_verbose && cat stderr;:],
experr, [AT_DEFINE([AT_data_experr], [ experr])dnl
$at_diff experr stderr || at_failed=:],
[], [$at_diff empty stderr || at_failed=:],
- [echo $at_n "patsubst([$4], [\([\"`$]\)], \\\1)$at_c" | $at_diff - stderr || at_failed=:])
- AT_CASE([$3],
+ [echo $at_n "m4_patsubst([$4], [\([\"`$]\)], \\\1)$at_c" | $at_diff - stderr || at_failed=:])
+ m4_case([$3],
ignore, [$at_verbose && cat stdout;:],
expout, [AT_DEFINE([AT_data_expout], [ expout])dnl
$at_diff expout stdout || at_failed=:],
[], [$at_diff empty stdout || at_failed=:],
- [echo $at_n "patsubst([$3], [\([\"`$]\)], \\\1)$at_c" | $at_diff - stdout || at_failed=:])
+ [echo $at_n "m4_patsubst([$3], [\([\"`$]\)], \\\1)$at_c" | $at_diff - stdout || at_failed=:])
if $at_failed; then
exit 1
else
-divert(-1)# -*- Autoconf -*-
+include(m4sugar.m4)# -*- Autoconf -*-
# This file is part of Autoconf.
# M4 sugar for common shell constructs.
# Requires GNU M4 and M4sugar.
-divert(-1)# -*- Autoconf -*-
+include(m4sugar.m4)# -*- Autoconf -*-
# This file is part of Autoconf.
# M4 sugar for common shell constructs.
# Requires GNU M4 and M4sugar.
$(SHELL) testsuite
testsuite: atgeneral.m4 atspecific.m4 $(SUITE)
- $(M4) -I $(srcdir) atspecific.m4 suite.at | \
+ $(M4) -I $(srcdir) -I $(top_srcdir) atspecific.m4 suite.at | \
sed -e 's/[ ]*$$//' | \
sed -e '/^$$/N;/\n$$/D' > $@-tmp
chmod +x $@-tmp
$(SHELL) testsuite
testsuite: atgeneral.m4 atspecific.m4 $(SUITE)
- $(M4) -I $(srcdir) atspecific.m4 suite.at | \
+ $(M4) -I $(srcdir) -I $(top_srcdir) atspecific.m4 suite.at | \
sed -e 's/[ ]*$$//' | \
sed -e '/^$$/N;/\n$$/D' > $@-tmp
chmod +x $@-tmp
-divert(-1) -*- Autoconf -*-
+include(m4sh.m4) -*- Autoconf -*-
# `m4' macros used in building test suites.
-# Copyright (C) 2000 Free Software Foundation, Inc.
+# Copyright 2000 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# any notice of this special exception to the GPL from your modified
# version.
-changequote()
-changequote([, ])
-
-define([AT_DEFINE], defn([define]))
-define([AT_EVAL], defn([eval]))
-define([AT_FORMAT], defn([format]))
-define([AT_INCLUDE], defn([include]))
-define([AT_SHIFT], defn([shift]))
-define([AT_UNDEFINE], defn([undefine]))
-
-undefine([define])
-undefine([eval])
-undefine([format])
-undefine([include])
-undefine([shift])
-undefine([undefine])
-
-
-# AT_CASE(SWITCH, VAL1, IF-VAL1, VAL2, IF-VAL2, ..., DEFAULT)
-# -----------------------------------------------------------
-# m4 equivalent of
-# switch (SWITCH)
-# {
-# case VAL1:
-# IF-VAL1;
-# break;
-# case VAL2:
-# IF-VAL2;
-# break;
-# ...
-# default:
-# DEFAULT;
-# break;
-# }.
-# All the values are optional, and the macro is robust to active
-# symbols properly quoted.
-AT_DEFINE([AT_CASE],
-[ifelse([$#], 0, [],
- [$#], 1, [],
- [$#], 2, [$2],
- [$1], [$2], [$3],
- [AT_CASE([$1], AT_SHIFT(AT_SHIFT(AT_SHIFT($@))))])])
+
+m4_define([AT_DEFINE], m4_defn([m4_define]))
+m4_define([AT_INCLUDE], m4_defn([m4_include]))
+m4_define([AT_SHIFT], m4_defn([m4_shift]))
+m4_define([AT_UNDEFINE], m4_defn([m4_undefine]))
+
# Use of diversions:
# -------
# Return the current file sans directory, a colon, and the current line.
AT_DEFINE([AT_LINE],
-[patsubst(__file__, ^.*/\(.*\), \1):__line__])
+[m4_patsubst(__file__, ^.*/\(.*\), \1):__line__])
# AT_INIT(PROGRAM)
# Start a group of related tests, all to be executed in the same subshell.
# The group is testing what DESCRIPTION says.
AT_DEFINE([AT_SETUP],
-[AT_DEFINE([AT_ordinal], AT_EVAL(AT_ordinal + 1))
-pushdef([AT_group_description], [$1])
-pushdef([AT_data_files], )
-pushdef([AT_data_expout], )
-pushdef([AT_data_experr], )
+[AT_DEFINE([AT_ordinal], m4_eval(AT_ordinal + 1))
+m4_pushdef([AT_data_files], )
+m4_pushdef([AT_data_expout], )
+m4_pushdef([AT_data_experr], )
if $at_stop_on_error && test -n "$at_failed_list"; then :; else
divert(1)[]dnl
echo AT_LINE > at-check-line
echo AT_LINE > at-setup-line
if $at_verbose; then
- echo 'testing AT_group_description'
+ echo 'testing $1'
echo $at_n " $at_c"
fi
if $at_verbose; then
echo "AT_ordinal. $srcdir/AT_LINE..."
else
- echo $at_n "substr(AT_ordinal. $srcdir/AT_LINE , 0, 30)[]$at_c"
+ echo $at_n "m4_substr(AT_ordinal. $srcdir/AT_LINE , 0, 30)[]$at_c"
fi
if test -z "$at_skip_mode"; then
(
[#] Snippet (d[]AT_ordinal[](
-[#] Testing AT_group_description
+[#] Testing $1
[#] Snippet )d[]AT_ordinal[])
[#] Snippet (s[]AT_ordinal[](
[#] starting from `AT_LINE'.
rm ifelse([AT_data_files$1], , [-f], [-rf[]AT_data_files[]ifelse($1, , , [ $1])]) stdout stderr[]AT_data_expout[]AT_data_experr
fi
fi
-popdef([AT_data_experr])
-popdef([AT_data_expout])
-popdef([AT_data_files])
-popdef([AT_group_description])[]dnl
+m4_popdef([AT_data_experr])
+m4_popdef([AT_data_expout])
+m4_popdef([AT_data_files])
+m4_popdef([AT_group_description])[]dnl
])# AT_CLEANUP
# their content is not checked.
AT_DEFINE([AT_CHECK],
[$at_traceoff
-$at_verbose && echo "$srcdir/AT_LINE: patsubst([$1], [\([\"`$]\)], \\\1)"
+$at_verbose && echo "$srcdir/AT_LINE: m4_patsubst([$1], [\([\"`$]\)], \\\1)"
echo AT_LINE > at-check-line
$at_check_stds && exec 5>&1 6>&2 1>stdout 2>stderr
$at_traceon
dnl If not verbose, neutralize the output of diff.
$at_verbose || exec 1>/dev/null 2>/dev/null
at_failed=false;
- AT_CASE([$4],
+ m4_case([$4],
ignore, [$at_verbose && cat stderr;:],
experr, [AT_DEFINE([AT_data_experr], [ experr])dnl
$at_diff experr stderr || at_failed=:],
[], [$at_diff empty stderr || at_failed=:],
- [echo $at_n "patsubst([$4], [\([\"`$]\)], \\\1)$at_c" | $at_diff - stderr || at_failed=:])
- AT_CASE([$3],
+ [echo $at_n "m4_patsubst([$4], [\([\"`$]\)], \\\1)$at_c" | $at_diff - stderr || at_failed=:])
+ m4_case([$3],
ignore, [$at_verbose && cat stdout;:],
expout, [AT_DEFINE([AT_data_expout], [ expout])dnl
$at_diff expout stdout || at_failed=:],
[], [$at_diff empty stdout || at_failed=:],
- [echo $at_n "patsubst([$3], [\([\"`$]\)], \\\1)$at_c" | $at_diff - stdout || at_failed=:])
+ [echo $at_n "m4_patsubst([$3], [\([\"`$]\)], \\\1)$at_c" | $at_diff - stdout || at_failed=:])
if $at_failed; then
exit 1
else
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
-## ------------------------------ ##
-## Setting up base layer macros. ##
-## ------------------------------ ##
-
include(atgeneral.m4)divert(-1)
-# Until the day Autotest, Ad'HoC and Autoconf share the same M4sugar, we
-# have to reinstall some m4 builtins that atgeneral.m4 undefined.
-AT_DEFINE([m4_shift],
-[builtin([shift], $@)])
-AT_DEFINE([m4_patsubst],
-[builtin([patsubst], $@)])
-AT_DEFINE([define],
-[builtin([define], $@)])
-
-
-# m4_for(VARIABLE, FROM, TO, EXPRESSION)
-# --------------------------------------
-# Expand EXPRESSION defining VARIABLE to FROM, FROM + 1, ..., TO.
-# Both limits are included.
-AT_DEFINE([m4_for],
-[pushdef([$1], [$2])_m4_for([$1], [$2], [$3], [$4])popdef([$1])])
-
-AT_DEFINE([_m4_for],
-[$4[]ifelse($1, [$3], [],
- [define([$1], incr($1))_m4_for([$1], [$2], [$3], [$4])])])
-
-
-
-# m4_foreach(VARIABLE, LIST, EXPRESSION)
-# --------------------------------------
-# Expand EXPRESSION assigning to VARIABLE each value of the LIST
-# (LIST should have the form `[(item_1, item_2, ..., item_n)]'),
-# i.e. the whole list should be *quoted*. Quote members too if
-# you don't want them to be expanded.
-#
-# This macro is robust to active symbols:
-# define(active, ACTIVE)
-# m4_foreach([Var], [([active], [b], [active])], [-Var-])end
-# => -active--b--active-end
-define(m4_foreach,
-[pushdef([$1], [])_m4_foreach($@)popdef([$1])])
-
-dnl Low level macros used to define m4_foreach
-define(m4_car, [[$1]])
-define(_m4_foreach,
-[ifelse($2, [()], ,
- [define([$1], [m4_car$2])$3[]_m4_foreach([$1],
- [(m4_shift$2)],
- [$3])])])
-
## ---------------------------------------- ##
AT_DATA(configure.in,
[[define([REQUIRE_AND_CHECK],
[AC_REQUIRE([$1])dnl
-test -z "$translit([$1], [A-Z], [a-z])" && AS_EXIT(1)])
+test -z "$m4_translit([$1], [A-Z], [a-z])" && AS_EXIT(1)])
AC_DEFUN([TEST1],
[REQUIRE_AND_CHECK([TEST2a])
# Build nested dirs.
-AT_SETUP([AS_DIRNAME & AS_DIRNAME_SED])
+AT_SETUP([[AS_DIRNAME & AS_DIRNAME_SED]])
AT_DATA(configure.in,
[[define([AS_DIRNAME_TEST],
# Build nested dirs.
-AT_SETUP([AS_MKDIR_P])
+AT_SETUP([[AS_MKDIR_P]])
-AT_DATA(configure.in,
+AT_DATA([configure.in],
[[AC_PLAIN_SCRIPT
pwd=`pwd`
set -e
AT_SETUP([Negated classes in globbing])
-AT_DATA(configure.in,
+AT_DATA([configure.in],
[[AC_PLAIN_SCRIPT
case 'with!two!bangs' in
*[[!a-z]]*) ;;
## m4_text_wrap. ##
## -------------- ##
-AT_SETUP(m4_text_wrap)
+AT_SETUP([[m4_text_wrap]])
# m4_text_wrap is used to display the help strings. Also, check that
# commas are not swallowed. This can easily happen because of
## m4_warn. ##
## --------- ##
-AT_SETUP([m4_warn])
+AT_SETUP([[m4_warn]])
# m4_text_wrap is used to display the help strings. Also, check that
# commas are not swallowed. This can easily happen because of
dnl The value used as a big value for AC_DEFINE.
dnl Don't use sh active chars here, below it is also used in a sh
dnl assignment.
-define([Big_Value],
+m4_define([Big_Value],
[This value should be long enough to torture the various limits of sed and other tools used by Autoconf.])
-define([DEFINE_Description],
+m4_define([DEFINE_Description],
[Define to a long string if your `Autoconf' works properly.])
# turned into ac_uummy during the construction of config.status. Yes,
# this is admittedly a bug, but it would be too hard to fix this.
# There is really no point in AC_DEFINE a var named ac_d.*.
-define([AT_DUMMY_VAR],
+m4_define([AT_DUMMY_VAR],
[ac_Dummy_[]m4_patsubst([000$1], [.*\(...\)$], [\1])])
dnl This call was quite delicate to write because we didn't want to
AT_SETUP([Torturing config.status])
-AT_DATA(dummy.in,
-[m4_for(AT_Count, 1, 100,
+AT_DATA([dummy.in],
+[m4_for([AT_Count], 1, 100, 1,
[@AT_DUMMY_VAR(AT_Count)@
])])
AT_DATA(configure.in,
-[AC_INIT
+[[AC_INIT
AC_CONFIG_HEADERS(config.h:config.hin)
AC_CONFIG_FILES(dummy)
-[define]([AC_DEFUBST_VALUE], Big_Value)
+m4_define]([AC_DEFUBST_VALUE], Big_Value)
dnl The following 4 lines are a transfert from AT_DUMMY_VAR in Autotest
dnl to AC_DUMMY_VAR in Autoconf.
-[define]([AC_DUMMY_VAR],
-changequote({{, }})dnl
-[defn({{AT_DUMMY_VAR}})]dnl
-changequote([, ]))
-m4_for(AT_Count, 1, 100,
+[m4_define]([AC_DUMMY_VAR],
+m4_changequote({{, }})dnl
+[m4_defn({{AT_DUMMY_VAR}})]dnl
+m4_changequote([, ]))
+m4_for(AT_Count, 1, 100, 1,
[AC_DEFUBST(AT_Count)
])
AC_OUTPUT
# Checking that AC_DEFINE worked properly.
AT_DATA(expout,
-[m4_for(AT_Count, 1, 100,
+[m4_for(AT_Count, 1, 100, 1,
[
/* DEFINE_Description */
[#define] AT_DUMMY_VAR(AT_Count) "Big_Value"
# Checking that AC_SUBST worked properly.
AT_DATA(expout,
-[m4_for(AT_Count, 1, 100,
+[m4_for(AT_Count, 1, 100, 1,
[Big_Value
])])