From: Akim Demaille Date: Thu, 5 Oct 2000 13:52:41 +0000 (+0000) Subject: Check that updated scripts are valid scripts. X-Git-Tag: autoconf-2.50~592 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=aed9b5dee4bbe0913bb3112197cfc3e1799b7b13;p=thirdparty%2Fautoconf.git Check that updated scripts are valid scripts. * tests/mktests.sh: Generate `syntax.m4' directly. * tests/macros.m4: Remove. Adjust dependencies. * tests/mktests.sh: Generate `update.m4' too. * tests/update.m4: New generated file. Adjust dependencies. * tests/atspecific.m4 (AT_CHECK_UPDATE): New macro. --- diff --git a/ChangeLog b/ChangeLog index 297f5e89e..2a40f252b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2000-10-05 Akim Demaille + + Check that updated scripts are valid scripts. + + * tests/mktests.sh: Generate `syntax.m4' directly. + * tests/macros.m4: Remove. + Adjust dependencies. + * tests/mktests.sh: Generate `update.m4' too. + * tests/update.m4: New generated file. + Adjust dependencies. + * tests/atspecific.m4 (AT_CHECK_UPDATE): New macro. + 2000-10-05 Akim Demaille * tests/mktests.sh: New file, which replaces the code inlined in diff --git a/tests/Makefile.am b/tests/Makefile.am index 6e924ee2a..a81cbf2af 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -20,18 +20,17 @@ AUTOMAKE_OPTIONS = gnits -SUITE = torture.m4 semantics.m4 syntax.m4 base.m4 tools.m4 +SUITE = base.m4 tools.m4 semantics.m4 torture.m4 syntax.m4 update.m4 # We don't actually distribute the testsuite, since one only # needs m4 to build it, m4 being required anyway to install Autoconf. -EXTRA_DIST = atgeneral.m4 atspecific.m4 suite.m4 macros.m4 aclocal.m4 \ - $(SUITE) \ - mktests.sh +EXTRA_DIST = atgeneral.m4 atspecific.m4 suite.m4 aclocal.m4 \ + $(SUITE) mktests.sh check-local: atconfig testsuite $(SHELL) testsuite -testsuite: atgeneral.m4 atspecific.m4 suite.m4 macros.m4 $(SUITE) +testsuite: atgeneral.m4 atspecific.m4 suite.m4 $(SUITE) $(M4) -I $(srcdir) atspecific.m4 suite.m4 | \ sed -e 's/[ ]*$$//' | \ sed -e '/^$$/N;/\n$$/D' > $@-tmp @@ -43,8 +42,11 @@ testsuite: atgeneral.m4 atspecific.m4 suite.m4 macros.m4 $(SUITE) MACRO_FILES = $(top_srcdir)/acgeneral.m4 $(top_srcdir)/acspecific.m4 \ $(top_srcdir)/acfunctions.m4 $(top_srcdir)/aclang.m4 -macros.m4: $(MACRO_FILES) $(srcdir)/Makefile.am - ./mktests.sh $@ $(MACRO_FILES) +syntax.m4: mktests.sh $(MACRO_FILES) + ./mktests.sh $(MACRO_FILES) + +update.m4: mktests.sh $(MACRO_FILES) + ./mktests.sh $(MACRO_FILES) CLEANFILES = debug-*.sh macro configure configure.in config.status \ config.cache config.log config.h.in config.h diff --git a/tests/Makefile.in b/tests/Makefile.in index 82d1571e9..af5760d2d 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -60,20 +60,19 @@ POST_UNINSTALL = : AWK = @AWK@ HELP2MAN = @HELP2MAN@ M4 = @M4@ +PERL = @PERL@ PERLSCRIPTS = @PERLSCRIPTS@ standards_texi = @standards_texi@ AUTOMAKE_OPTIONS = gnits -SUITE = torture.m4 semantics.m4 syntax.m4 base.m4 tools.m4 +SUITE = base.m4 tools.m4 semantics.m4 torture.m4 syntax.m4 update.m4 # We don't actually distribute the testsuite, since one only # needs m4 to build it, m4 being required anyway to install Autoconf. -EXTRA_DIST = atgeneral.m4 atspecific.m4 suite.m4 macros.m4 aclocal.m4 $(SUITE) mktests.sh +EXTRA_DIST = atgeneral.m4 atspecific.m4 suite.m4 aclocal.m4 $(SUITE) mktests.sh -PERL = perl - # The files which contains macro we check for syntax. MACRO_FILES = $(top_srcdir)/acgeneral.m4 $(top_srcdir)/acspecific.m4 $(top_srcdir)/acfunctions.m4 $(top_srcdir)/aclang.m4 @@ -83,7 +82,7 @@ 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.in PACKAGE = @PACKAGE@ @@ -195,15 +194,18 @@ mostlyclean distclean maintainer-clean check-local: atconfig testsuite $(SHELL) testsuite -testsuite: atgeneral.m4 atspecific.m4 suite.m4 macros.m4 $(SUITE) +testsuite: atgeneral.m4 atspecific.m4 suite.m4 $(SUITE) $(M4) -I $(srcdir) atspecific.m4 suite.m4 | \ sed -e 's/[ ]*$$//' | \ sed -e '/^$$/N;/\n$$/D' > $@-tmp chmod +x $@-tmp mv $@-tmp $@ -macros.m4: $(MACRO_FILES) $(srcdir)/Makefile.am - ./mktests.sh $@ $(MACRO_FILES) +syntax.m4: mktests.sh $(MACRO_FILES) + ./mktests.sh $(MACRO_FILES) + +update.m4: mktests.sh $(MACRO_FILES) + ./mktests.sh $(MACRO_FILES) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/tests/atspecific.m4 b/tests/atspecific.m4 index 090312bad..39be8c07b 100644 --- a/tests/atspecific.m4 +++ b/tests/atspecific.m4 @@ -72,8 +72,8 @@ define(_m4_foreach, ## ---------------------------------------- ## -# _AT_CHECK_AC_MACRO(AC-BODY) -# --------------------------- +# _AT_CHECK_AC_MACRO(AC-BODY, PRE-TESTS) +# -------------------------------------- # Create a minimalist configure.in running the macro named # NAME-OF-THE-MACRO, check that autoconf runs on that script, # and that the shell runs correctly the configure. @@ -90,7 +90,7 @@ $1 AC_ENV_SAVE(env-after) AC_OUTPUT ]) - +$2 AT_CHECK([autoconf -W none --autoconf-dir .. -l $at_srcdir], 0, [], []) AT_CHECK([autoheader --autoconf-dir .. -l $at_srcdir], 0, [], []) AT_CHECK([top_srcdir=$top_srcdir ./configure], 0, ignore, []) @@ -120,6 +120,25 @@ AT_CLEANUP(configure config.status config.log config.cache config.hin config.h e ])# AT_CHECK_MACRO +# AT_CHECK_UPDATE(NAME-OF-THE-MACRO) +# ---------------------------------- +# Create a minimalist configure.in running the macro named +# NAME-OF-THE-MACRO, autoupdate this script, check that autoconf runs +# on that script, and that the shell runs correctly the configure. +# TOP_SRCDIR is needed to set the auxdir (some macros need +# `install-sh', `config.guess' etc.). +AT_DEFINE([AT_CHECK_UPDATE], +[AT_SETUP([$1]) + +_AT_CHECK_AC_MACRO([$1], +[AT_CHECK([autoupdate --autoconf-dir ..], 0, + [], [autoupdate: `configure.in' is updated +])]) + +AT_CLEANUP(configure config.status config.log config.cache config.hin config.h env-after)dnl +])# AT_CHECK_UPDATE + + # AT_CHECK_DEFINES(CONTENT) # ------------------------- # Verify that config.h, once stripped is CONTENT. diff --git a/tests/mktests.sh b/tests/mktests.sh index 9164958ae..d1105cfd6 100755 --- a/tests/mktests.sh +++ b/tests/mktests.sh @@ -1,7 +1,6 @@ #! /bin/sh # Build some of the Autoconf test files. - # Copyright (C) 2000 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -19,12 +18,15 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -dst=$1 -shift src="$@" -# filter_macros_list -# ------------------ + +# --------- # +# syntax.m4 # +# --------- # + +# syntax_exclude_list +# ------------------- # 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, # and some are already tested elsewhere. EGREP_EXCLUDE must filter out @@ -56,7 +58,7 @@ src="$@" # Checked in semantics. # - AC_CYGWIN, AC_CYGWIN32, AC_EMXOS2, AC_MING32, AC_EXEEXT, AC_OBJEXT # AU defined to nothing. -filter_macros_list='^AC_ARG_VAR$ +syntax_exclude_list='^AC_ARG_VAR$ ^AC_CANONICALIZE$ ^AC_CHECK_(DECL|FILE|FUNC|HEADER|LIB|MEMBER|PROG|SIZEOF|TOOL|TYPE)S?$ ^AC_CONFIG @@ -78,43 +80,93 @@ filter_macros_list='^AC_ARG_VAR$ ^AC_(CYGWIN|CYGWIN32|EMXOS2|MING32|EXEEXT|OBJEXT)$ _AC_' -# filter_macros_egrep -- +# syntax_exclude_egrep -- +# Build a single egrep pattern out of filter_macros_list. +# Sed is used to get rid of the trailing `|' coming from the trailing +# `\n' from `echo'. +syntax_exclude_egrep=`echo "$syntax_exclude_list" | tr ' +' '|' | sed 's/.$//'` + +sed 's/^ *//' >syntax.tm4 <acdefuns + +# 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. +cat $src | + sed -ne 's/dnl.*//;s/.*AC_REQUIRE(\[*\([a-zA-Z0-9_]*\).*$/\1/p' | + sort | + uniq >requires + +# Filter out. +for macro in `cat acdefuns`; do + if fgrep "$macro" requires >/dev/null 2>&1; then :; else + echo "AT_CHECK_MACRO([$macro])" >>syntax.tm4 + fi +done + +mv syntax.tm4 syntax.m4 + + +# --------- # +# update.m4 # +# --------- # + +# update_exclude_list +# ------------------- +# AC_LANG_RESTORE alone cannot be used. + +update_exclude_list='^AC_LANG_RESTORE$' + +# syntax_exclude_egrep -- # Build a single egrep pattern out of filter_macros_list. # Sed is used to get rid of the trailing `|' coming from the trailing # `\n' from `echo'. -filter_macros_egrep=`echo "$filter_macros_list" | tr ' +update_exclude_egrep=`echo "$update_exclude_list" | tr ' ' '|' | sed 's/.$//'` -case $dst in - *macros.m4) - # Get the list of macros which are defined in Autoconf level. - # Get rid of the macros we are not interested in. - cat $src | \ - sed -ne 's/^A[CU]_DEFUN\(_ONCE\)\?(\[*\([a-zA-Z0-9_]*\).*$/\2/p' | \ - sort | uniq | egrep -v "$filter_macros_egrep" >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. - cat $src | \ - sed -ne 's/dnl.*//;s/.*AC_REQUIRE(\[*\([a-zA-Z0-9_]*\).*$/\1/p' | \ - sort | uniq >requires - - # Filter out. - for macro in `cat defuns`; do \ - if fgrep "$macro" requires >/dev/null 2>&1; then :; else \ - echo "AT_CHECK_MACRO([$macro])" >>$dst-t; \ - fi; \ - done - - rm defuns requires - mv $dst-t $dst - ;; - - *) - echo "$0: don't know how to do $src" >&2 - exit 1 -esac +sed 's/^ *//' >update.tm4 <>update.tm4 + +mv update.tm4 update.m4 +# rm -f acdefuns audefuns requires exit 0 diff --git a/tests/suite.m4 b/tests/suite.m4 index 0debd03b8..4fb1d8ea6 100644 --- a/tests/suite.m4 +++ b/tests/suite.m4 @@ -31,3 +31,6 @@ AT_INCLUDE(torture.m4) # Checking all the AC_DEFUN'd macros. AT_INCLUDE(syntax.m4) + +# Checking that updatiing an obsolete macro produces a valid configure.in +AT_INCLUDE(update.m4) diff --git a/tests/syntax.m4 b/tests/syntax.m4 index 2191e45d4..d934966ed 100644 --- a/tests/syntax.m4 +++ b/tests/syntax.m4 @@ -1,4 +1,4 @@ -# -*- autoconf -*- +# Generated by mktests.sh, do not edit by hand. -*- autoconf -*- cat <