* lib/autoconf/general.m4 (_m4_divert(BODY)): Move to...

* lib/m4sugar/m4sh.m4: here.
(AS_INIT): Push the BODY diversion, set the #! /bin/sh line.
* lib/autoconf/general.m4 (AC_PLAIN_SCRIPT) : Remove.
(AT_INIT): Replace AC_PLAIN_SCRIPT with AS_INIT invocation,
include handle the m4_pattern_*, no longer push the
BODY diversion nor set the /bin/sh line, AS_INIT does it.
* lib/autotest/general.m4 (AT_INIT): Likewise.
* tests/base.at: Adjust the tests to use AS_INIT.
* tests/tools.at (AT_DATA_FORBIDDEN): New.
(autoconf: forbidden tokens): Adjust to work on M4sh instead of
Autoconf.
This commit is contained in:
Akim Demaille 2001-10-08 08:20:59 +00:00
parent 254aedfa6a
commit 8e048c0492
8 changed files with 86 additions and 79 deletions

View File

@ -1,3 +1,18 @@
2001-10-08 Akim Demaille <akim@epita.fr>
* lib/autoconf/general.m4 (_m4_divert(BODY)): Move to...
* lib/m4sugar/m4sh.m4: here.
(AS_INIT): Push the BODY diversion, set the #! /bin/sh line.
* lib/autoconf/general.m4 (AC_PLAIN_SCRIPT) : Remove.
(AT_INIT): Replace AC_PLAIN_SCRIPT with AS_INIT invocation,
include handle the m4_pattern_*, no longer push the
BODY diversion nor set the /bin/sh line, AS_INIT does it.
* lib/autotest/general.m4 (AT_INIT): Likewise.
* tests/base.at: Adjust the tests to use AS_INIT.
* tests/tools.at (AT_DATA_FORBIDDEN): New.
(autoconf: forbidden tokens): Adjust to work on M4sh instead of
Autoconf.
2001-10-07 Paul Eggert <eggert@twinsun.com>
* doc/autoconf.texi (config.status Invocation):

View File

@ -120,15 +120,16 @@
# of little macros, but it then takes twice longer to run `autoconf'!
#
# From M4sugar:
# -1. KILL
# -1. KILL
# 10000. GROW
#
# From M4sh:
# 0. BINSH
# 1. HEADER-REVISION
# 2. HEADER-COMMENT
# 3. HEADER-COPYRIGHT
# 4. M4SH-INIT
# 0. BINSH
# 1. HEADER-REVISION
# 2. HEADER-COMMENT
# 3. HEADER-COPYRIGHT
# 4. M4SH-INIT
# 1000. BODY
m4_define([_m4_divert(DEFAULTS)], 10)
m4_define([_m4_divert(PARSE_ARGS)], 20)
@ -147,8 +148,6 @@ m4_define([_m4_divert(VERSION_END)], 203)
m4_define([_m4_divert(INIT_PREPARE)], 300)
m4_define([_m4_divert(BODY)], 400)
# AC_DIVERT_PUSH(DIVERSION-NAME)
@ -1263,26 +1262,6 @@ AC_CONFIG_SRCDIR([$1])], [[AC_INIT]])])[]dnl
])
# AC_PLAIN_SCRIPT
# ---------------
# Simulate AC_INIT, i.e., pretend this is the beginning of the `configure'
# generation. This is used by some tests, and lets `autoconf' be used to
# generate other scripts than `configure'.
m4_define([AC_PLAIN_SCRIPT],
[AS_INIT
# Forbidden tokens and exceptions.
m4_pattern_forbid([^_?A[CHUM]_])
m4_pattern_forbid([_AC_])
# Actually reserved by M4sh.
m4_pattern_allow([^AS_FLAGS$])
m4_divert_push([BODY])dnl
m4_wrap([m4_divert_pop([BODY])[]])dnl
])
# AC_INIT([PACKAGE, VERSION, [BUG-REPORT])
# ----------------------------------------
# Include the user macro files, prepare the diversions, and output the
@ -1290,9 +1269,13 @@ m4_wrap([m4_divert_pop([BODY])[]])dnl
# Note that the order is important: first initialize, then set the
# AC_CONFIG_SRCDIR.
m4_define([AC_INIT],
[AC_PLAIN_SCRIPT
[# Forbidden tokens and exceptions.
m4_pattern_forbid([^_?A[CHUM]_])
m4_pattern_forbid([_AC_])
# Actually reserved by M4sh.
m4_pattern_allow([^AS_FLAGS$])
AS_INIT
m4_ifval([$2], [_AC_INIT_PACKAGE($@)])
m4_divert_text([BINSH], [@%:@! /bin/sh])
_AC_INIT_DEFAULTS
_AC_INIT_PARSE_ARGS
_AC_INIT_SRCDIR

View File

@ -88,15 +88,14 @@ m4_define([AT_LINE],
# -------------------------
# Begin test suite.
m4_define([AT_INIT],
[AS_INIT
m4_pattern_forbid([^_?AT_])
[m4_pattern_forbid([^_?AT_])
m4_pattern_forbid([PACKAGE_(BUGREPORT|STRING)$])
m4_define([AT_TESTSUITE_NAME],
m4_defn([PACKAGE_STRING])[ test suite]m4_ifval([$1], [: $1]))
m4_define([AT_ordinal], 0)
m4_define([AT_banner_ordinal], 0)
m4_define([AT_data_files], [stdout expout at-* stderr experr])
m4_divert_text([BINSH], [@%:@! /bin/sh])
AS_INIT
m4_divert_push([DEFAULT])dnl
AS_SHELL_SANITIZE

View File

@ -66,7 +66,9 @@ changequote()changequote([, ])include(m4sugar/m4sugar.m4)# -*- Autoconf -*-
# Copyright notice(s)
# - M4SH-INIT
# M4sh's initializations
#
# - BODY
# The body of the script.
# _m4_divert(DIVERSION-NAME)
@ -80,6 +82,7 @@ m4_define([_m4_divert(HEADER-REVISION)], 1)
m4_define([_m4_divert(HEADER-COMMENT)], 2)
m4_define([_m4_divert(HEADER-COPYRIGHT)], 3)
m4_define([_m4_divert(M4SH-INIT)], 4)
m4_define([_m4_divert(BODY)], 1000)
# Aaarg. Yet it starts with compatibility issues... Libtool wants to
# use NOTICE to insert its own LIBTOOL-INIT stuff. People should ask
@ -924,4 +927,11 @@ m4_define([AS_INIT],
# Forbidden tokens and exceptions.
m4_pattern_forbid([^_?AS_])
# Bangshe.
m4_divert_text([BINSH], [@%:@! /bin/sh])
# Let's go!
m4_wrap([m4_divert_pop([BODY])[]])
m4_divert_push([BODY])[]dnl
])

View File

@ -275,7 +275,8 @@ atlocal: $(srcdir)/atlocal.in $(top_builddir)/config.status
cd $(top_builddir) && ./config.status tests/$@
clean-local:
$(SHELL) $(TESTSUITE) --clean
test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean
rm -f *.tmp
rm -rf autom4te.cache
check-local: atconfig atlocal $(TESTSUITE)

View File

@ -49,7 +49,7 @@ AC_DEFUN([TEST3],
[REQUIRE_AND_CHECK([TEST2a])
test3=set])
AC_PLAIN_SCRIPT()#! /bin/sh
AS@&t@_INIT
TEST1
test -z "$test1" &&
@ -81,7 +81,7 @@ AC_DEFUN([MULTI_TEST],
AC_DEFUN_ONCE([SINGLE_TEST],
[single_test=".$single_test"])
AC_PLAIN_SCRIPT()#! /bin/sh
AS@&t@_INIT
TEST
TEST
@ -125,7 +125,7 @@ AC_DEFUN([MULTI_TEST],
AC_DEFUN_ONCE([SINGLE_TEST],
[single_test=".$single_test"])
AC_PLAIN_SCRIPT()#! /bin/sh
AS@&t@_INIT
MULTI_TEST
MULTI_TEST
@ -164,7 +164,7 @@ AT_DATA([configure.ac],
AC_DEFUN([INNER_TEST],
[inner_test=".$inner_test"])
AC_PLAIN_SCRIPT()#! /bin/sh
AS@&t@_INIT
AC_PROVIDE([INNER_TEST])
TEST

View File

@ -98,7 +98,7 @@ m4_pattern_allow([^AS_DIRNAME(_SED)?$])
AT_SETUP([[AS_DIRNAME & AS_DIRNAME_SED]])
AT_DATA([configure.ac],
[[AC_PLAIN_SCRIPT()#! /bin/sh
[[AS@&t@_INIT
_AS@&t@_EXPR_PREPARE
@ -153,7 +153,7 @@ m4_pattern_allow([^AS_BASENAME(_SED)?$])
AT_SETUP([[AS_BASENAME & AS_BASENAME_SED]])
AT_DATA([configure.ac],
[[AC_PLAIN_SCRIPT()#! /bin/sh
[[AS@&t@_INIT
_AS@&t@_EXPR_PREPARE
@ -213,7 +213,7 @@ m4_pattern_allow([^AS_MKDIR_P$])
AT_SETUP([[AS_MKDIR_P]])
AT_DATA([configure.ac],
[[AC_PLAIN_SCRIPT()#! /bin/sh
[[AS@&t@_INIT
pwd=`pwd`
set -e
@ -246,7 +246,7 @@ AT_CLEANUP(configure 1 a)
AT_SETUP([Negated classes in globbing])
AT_DATA([configure.ac],
[[AC_PLAIN_SCRIPT()#! /bin/sh
[[AS@&t@_INIT
case 'with!two!bangs' in
*[[!a-z]]*) ;;

View File

@ -232,40 +232,39 @@ AT_CLEANUP
## ---------------------------- ##
## autoconf: forbidden tokens. ##
## ---------------------------- ##
# AT_DATA_FORBIDDEN(FILENAME, CONTENTS)
# -------------------------------------
# Escape the invalid tokens with @&t@.
m4_define([AT_DATA_FORBIDDEN],
[AT_DATA([$1], [m4_patsubst([$2], [\(m4\|AS\)_], [\1@&t@_])])])
# autoconf: forbidden tokens, basic
# ---------------------------------
AT_SETUP([autoconf: forbidden tokens, basic])
m4_pattern_allow([^(m4_foo|_m4_bar|AS_FOO|_AS_BAR)$])
AT_DATA([configure.ac],
[[AC_PLAIN_SCRIPT()
AC_FOO
_AC_BAR
AT_DATA_FORBIDDEN([configure.ac],
[[AS_INIT
m4_foo
_m4_bar
BAC_FOO
B_AC_FOO
AS_FOO
_AS_BAR
[d@&t@nl]
]])
AT_CHECK_AUTOCONF([], 1, [],
[[configure.ac:2: error: possibly undefined macro: AC_FOO
configure.ac:3: error: possibly undefined macro: _AC_BAR
configure.ac:4: error: possibly undefined macro: m4_foo
configure.ac:5: error: possibly undefined macro: _m4_bar
configure.ac:7: error: possibly undefined macro: B_AC_FOO
configure.ac:8: error: possibly undefined macro: AS_FOO
configure.ac:9: error: possibly undefined macro: _AS_BAR
configure.ac:10: error: possibly undefined macro: d@&t@nl
AT_DATA_FORBIDDEN([experr],
[[configure.ac:2: error: possibly undefined macro: m4_foo
configure.ac:3: error: possibly undefined macro: _m4_bar
configure.ac:4: error: possibly undefined macro: AS_FOO
configure.ac:5: error: possibly undefined macro: _AS_BAR
configure.ac:6: error: possibly undefined macro: d@&t@nl
]])
AT_CHECK_AUTOCONF([], 1, [], experr)
AT_CLEANUP
@ -273,38 +272,38 @@ AT_CLEANUP
# --------------------------------------
AT_SETUP([autoconf: forbidden tokens, exceptions])
AT_DATA([configure.ac],
[[AC_PLAIN_SCRIPT
AT_DATA_FORBIDDEN([configure.ac],
[[AS_INIT
# This is allowed in spite of the name.
# It is on purpose that we check the case where there are several
# tokens on the same line.
m4@&t@_pattern_allow([^AC_ALLOWED$])
NOT_AC_ALLOWED AC_ALLOWED AC_ALLOWED_NOT
m4_pattern_allow([^AS_ALLOWED$])
NOT_AS_ALLOWED AS_ALLOWED AS_ALLOWED_NOT
# Test forbidding.
m4@&t@_pattern_forbid([^FORBIDDEN$])
m4_pattern_forbid([^FORBIDDEN$])
NOT_FORBIDDEN FORBIDDEN FORBIDDEN_NOT
# Test Autoconf's patterns.
AC_THIS_IS_INVALID and _AC_THIS_IS_INVALID_TOO
BUT_AZ_THIS_IS_NOT ALTHOUGH_AC_THIS_IS
# This is legal, although there is `AC_DEFINE' in there.
BAC_DEFINE
# AC_THIS_IS_A_COMMENT so just shut up.
It would be very bad if Autoconf forgot to expand [AC_]OUTPUT!
AS_THIS_IS_INVALID and _AS_THIS_IS_INVALID_TOO
BUT_AZ_THIS_IS_NOT ALTHOUGH_AS_THIS_IS
# This is legal, although there is `AS_DEFINE' in there.
BAS_DEFINE
# AS_THIS_IS_A_COMMENT so just shut up.
It would be very bad if Autoconf forgot to expand [AS_]INIT!
]])
AT_CHECK_AUTOCONF([], 1, [],
[[configure.ac:7: error: possibly undefined macro: NOT_AC_ALLOWED
configure.ac:7: error: possibly undefined macro: AC_ALLOWED_NOT
AT_DATA_FORBIDDEN([experr],
[[configure.ac:1: error: possibly undefined macro: AS_INIT
configure.ac:7: error: possibly undefined macro: AS_ALLOWED_NOT
configure.ac:10: error: possibly undefined macro: FORBIDDEN
configure.ac:14: error: possibly undefined macro: AC_THIS_IS_INVALID
configure.ac:14: error: possibly undefined macro: _AC_THIS_IS_INVALID_TOO
configure.ac:15: error: possibly undefined macro: ALTHOUGH_AC_THIS_IS
configure:18: error: possibly undefined macro: AC_OUTPUT
configure.ac:14: error: possibly undefined macro: AS_THIS_IS_INVALID
configure.ac:14: error: possibly undefined macro: _AS_THIS_IS_INVALID_TOO
]])
AT_CHECK_AUTOCONF([], 1, [], [experr])
AT_CLEANUP