From 01bbecaa0a0596b170f8361a07de69022196adf3 Mon Sep 17 00:00:00 2001
From: Akim Demaille <akim@epita.fr>
Date: Tue, 18 Sep 2001 09:03:18 +0000
Subject: [PATCH] * lib/autoconf/autotest.m4 (AC_CONFIG_TESTDIR): No INIT-CMDS
 in the AC_CONFIG_COMMANDS invocation. This also solves the name clash
 problems. Don't set the package's ID. * lib/m4sugar/Makefile.am (version.m4):
 Revamp. No longer to be shipped. (version.in): Remove. *
 lib/m4sugar/m4sugar.m4, lib/autoconf/general.m4, * lib/autoconf/status.m4:
 Adjust. Use `m4_PACKAGE_STRING'. * lib/autotest/general.m4 (AT_INIT): N-th
 signature change: now the only optional argument is the name of the test
 suite. Expect `package.m4' to define the package signature. * lib/autom4te.in
 (Autotest): Add `package.m4?'. * tests/Makefile.am (package.m4): New. *
 tests/suite.at: ifnames is a victim.

---
 ChangeLog                | 19 ++++++++++++
 lib/autoconf/Makefile.am |  2 +-
 lib/autoconf/Makefile.in |  2 +-
 lib/autoconf/autotest.m4 | 16 ++---------
 lib/autoconf/general.m4  | 20 ++++++-------
 lib/autoconf/status.m4   |  4 +--
 lib/autom4te.in          |  1 +
 lib/autotest/general.m4  | 38 +++++++-----------------
 lib/m4sugar/Makefile.am  | 31 +++++++++-----------
 lib/m4sugar/Makefile.in  | 62 ++++++++++++++++++++++++++--------------
 lib/m4sugar/m4sugar.m4   | 10 +++++--
 lib/m4sugar/version.in   |  5 ----
 tests/Makefile.am        | 20 ++++++++++++-
 tests/Makefile.in        | 15 ++++++++--
 tests/suite.at           | 14 +++------
 15 files changed, 145 insertions(+), 114 deletions(-)
 delete mode 100644 lib/m4sugar/version.in

diff --git a/ChangeLog b/ChangeLog
index c1c6e116..f19cb65b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2001-09-18  Akim Demaille  <akim@epita.fr>
+
+	* lib/autoconf/autotest.m4 (AC_CONFIG_TESTDIR): No INIT-CMDS in
+	the AC_CONFIG_COMMANDS invocation.
+	This also solves the name clash problems.
+	Don't set the package's ID.
+	* lib/m4sugar/Makefile.am (version.m4): Revamp.
+	No longer to be shipped.
+	(version.in): Remove.
+	* lib/m4sugar/m4sugar.m4, lib/autoconf/general.m4,
+	* lib/autoconf/status.m4: Adjust.
+	Use `m4_PACKAGE_STRING'.
+	* lib/autotest/general.m4 (AT_INIT): N-th signature change: now
+	the only optional argument is the name of the test suite.
+	Expect `package.m4' to define the package signature.
+	* lib/autom4te.in (Autotest): Add `package.m4?'.
+	* tests/Makefile.am (package.m4): New.
+	* tests/suite.at: ifnames is a victim.
+
 2001-09-18  Akim Demaille  <akim@epita.fr>
 
 	* lib/autom4te.in (Autoconf): Preselect AM_CONDITIONAL,
diff --git a/lib/autoconf/Makefile.am b/lib/autoconf/Makefile.am
index 688674e5..7b0fad34 100644
--- a/lib/autoconf/Makefile.am
+++ b/lib/autoconf/Makefile.am
@@ -109,7 +109,7 @@ M4_INCLUDES =  --include $(srcdir) \
 # the dependencies...
 srclibdir = $(top_srcdir)/lib
 autoconf.m4f: $(srclibdir)/m4sugar/m4sugar.m4	\
-              $(srclibdir)/m4sugar/version.m4	\
+              ../m4sugar/version.m4	\
               $(srclibdir)/m4sugar/m4sh.m4	\
               $(srclibdir)/autoconf/autoconf.m4	\
               $(srclibdir)/autoconf/general.m4	\
diff --git a/lib/autoconf/Makefile.in b/lib/autoconf/Makefile.in
index 52bff4aa..ebde4693 100644
--- a/lib/autoconf/Makefile.in
+++ b/lib/autoconf/Makefile.in
@@ -329,7 +329,7 @@ check-local:
 	  rm -f freeze.log; \
 	fi
 autoconf.m4f: $(srclibdir)/m4sugar/m4sugar.m4	\
-              $(srclibdir)/m4sugar/version.m4	\
+              ../m4sugar/version.m4	\
               $(srclibdir)/m4sugar/m4sh.m4	\
               $(srclibdir)/autoconf/autoconf.m4	\
               $(srclibdir)/autoconf/general.m4	\
diff --git a/lib/autoconf/autotest.m4 b/lib/autoconf/autotest.m4
index 085fe520..22fda540 100644
--- a/lib/autoconf/autotest.m4
+++ b/lib/autoconf/autotest.m4
@@ -61,17 +61,12 @@
 AC_DEFUN([AC_CONFIG_TESTDIR],
 [AC_CONFIG_COMMANDS([$1/atconfig],
 [# Do not use _ACEOF as we are being dumped into config.status via
-# an _ACEOF-heredoe.
+# an _ACEOF-heredoc.
 cat >$1/atconfig <<ATEOF
 @%:@ Configurable variable values for building test suites.
 @%:@ Generated by $[0]
 @%:@ Copyright 2000, 2001 Free Software Foundation, Inc.
 
-at_package_name='$at_package_name'
-at_package_version='$at_package_version'
-at_package_string='$at_package_string'
-at_bugreport='$at_bugreport'
-
 at_testdir='$1'
 srcdir='$ac_srcdir'
 top_srcdir='$ac_top_srcdir'
@@ -79,15 +74,8 @@ top_builddir='$ac_top_builddir'
 
 AUTOTEST_PATH='m4_default([$2], [$1])'
 
-SHELL=\${CONFIG_SHELL-'$at_shell'}
+SHELL=\${CONFIG_SHELL-'$SHELL'}
 ATEOF
-],
-[at_package_name='$PACKAGE_NAME'
-at_package_version='$PACKAGE_VERSION'
-at_package_string='$PACKAGE_STRING'
-at_bugreport='$PACKAGE_BUGREPORT'
-
-at_shell='$SHELL'
 ])
 
 if test -f $srcdir/$1/atlocal.in; then
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index 07a3df16..bc2728b1 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -386,15 +386,15 @@ m4_define([AC_REVISION],
 # Update this `AC_PREREQ' statement to require the current version of
 # Autoconf.  But fail if ever this autoupdate is too old.
 #
-# Note that `m4_defn([m4_acversion])' below are expanded before calling
-# `AU_DEFUN', i.e., it is hard coded.  Otherwise it would be quite
-# complex for autoupdate to import the value of `m4_acversion'.  We
-# could `AU_DEFUN' `m4_acversion', but this would replace all its
-# occurrences with the current version of Autoconf, which is certainly
-# not what meant the user.
+# Note that `m4_defn([m4_PACKAGE_VERSION])' below are expanded before
+# calling `AU_DEFUN', i.e., it is hard coded.  Otherwise it would be
+# quite complex for autoupdate to import the value of
+# `m4_PACKAGE_VERSION'.  We could `AU_DEFUN' `m4_PACKAGE_VERSION', but
+# this would replace all its occurrences with the current version of
+# Autoconf, which is certainly not what meant the user.
 AU_DEFUN([AC_PREREQ],
 [m4_version_prereq([$1])[]dnl
-[AC_PREREQ(]]m4_defn([m4_acversion])[[)]])
+[AC_PREREQ(]]m4_defn([m4_PACKAGE_VERSION])[[)]])
 
 
 # AC_PREREQ(VERSION)
@@ -422,7 +422,7 @@ m4_copy([m4_version_prereq], [AC_PREREQ])
 m4_define([_AC_INIT_NOTICE],
 [m4_divert_text([HEADER-COMMENT],
 [@%:@ Guess values for system-dependent variables and create Makefiles.
-@%:@ Generated by Autoconf m4_acversion[]dnl
+@%:@ Generated by m4_PACKAGE_STRING[]dnl
 m4_ifset([AC_PACKAGE_STRING], [ for AC_PACKAGE_STRING]).])
 
 m4_ifset([AC_PACKAGE_BUGREPORT],
@@ -1120,7 +1120,7 @@ m4_ifset([AC_PACKAGE_STRING],
                          [dnl
 m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])configure[]dnl
 m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
-generated by GNU Autoconf m4_acversion])])
+generated by m4_PACKAGE_STRING])])
 m4_divert_text([VERSION_END],
 [_ACEOF
   exit 0
@@ -1141,7 +1141,7 @@ running configure, to aid debugging if configure makes a mistake.
 
 It was created by m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])dnl
 $as_me[]m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]), which was
-generated by GNU Autoconf m4_acversion.  Invocation command line was
+generated by m4_PACKAGE_STRING.  Invocation command line was
 
   $ $[0] $[@]
 
diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4
index 321abe1c..08947994 100644
--- a/lib/autoconf/status.m4
+++ b/lib/autoconf/status.m4
@@ -1233,7 +1233,7 @@ cat >&AS_MESSAGE_LOG_FD <<_CSEOF
 
 This file was extended by m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])dnl
 $as_me[]m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]), which was
-generated by GNU Autoconf m4_acversion.  Invocation command line was
+generated by m4_PACKAGE_STRING.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -1311,7 +1311,7 @@ cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
 m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.status[]dnl
 m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
-configured by [$]0, generated by GNU Autoconf m4_acversion,
+configured by $[0], generated by m4_PACKAGE_STRING,
   with options \\"`echo "$ac_configure_args" | sed 's/[[\\""\`\$]]/\\\\&/g'`\\"
 
 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
diff --git a/lib/autom4te.in b/lib/autom4te.in
index 94d93d43..b8277021 100644
--- a/lib/autom4te.in
+++ b/lib/autom4te.in
@@ -113,6 +113,7 @@ begin-language: "Autotest"
 # patterns: *.at
 args: --include @datadir@
 args: autotest/autotest.m4
+args: package.m4?
 args: --mode 777
 args: --warning syntax
 end-language: "Autotest"
diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
index a38a6f78..c7a9bdb2 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -84,12 +84,14 @@ m4_define([AT_LINE],
 [m4_patsubst(__file__, [^\(.*/\)*\(.*\)], [[\2]]):__line__])
 
 
-# AT_INIT([TESTSUITE-NAME], [BUG-REPORT])
-# ---------------------------------------
+# AT_INIT([TESTSUITE-NAME])
+# -------------------------
 # Begin test suite.
 m4_define([AT_INIT],
 [AS_INIT
 m4_pattern_forbid([^_?AT_])
+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])
@@ -103,10 +105,6 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # How were we run?
 at_cli_args=${1+"$[@]"}
 
-# Who are we?
-at_testsuite_name='$1'
-at_bugreport='$2'
-
 # Load the config file.
 for at_file in atconfig atlocal
 do
@@ -149,13 +147,7 @@ while test $[@%:@] -gt 0; do
         ;;
 
     --version)
-        if test -n "$at_package_string"; then
-          echo "$as_me ($at_package_string)"
-          echo "Embedded test suite."
-        else
-          echo "$as_me ($at_testsuite_name)"
-          echo "Stand-alone test suite."
-        fi
+        echo "$as_me (PACKAGE_STRING)"
         exit 0
         ;;
 
@@ -286,7 +278,7 @@ _ATEOF
              if ($[4]) printf "      %s\n", $[4] } ';;
   esac
   echo
-  echo "Report bugs to <$at_bugreport>."
+  echo "Report bugs to <PACKAGE_BUGREPORT>."
   exit 0
 fi
 
@@ -369,17 +361,9 @@ else
 fi
 
 # Banners and logs.
-if test -n "$at_package_string"; then
-  AS_BOX([$at_package_string test suite.])
-else
-  AS_BOX([$at_testsuite_name test suite.])
-fi
+AS_BOX(m4_defn([AT_TESTSUITE_NAME]))
 {
-  if test -n "$at_package_string"; then
-    AS_BOX([Embedded $at_package_string test suite.])
-  else
-    AS_BOX([$at_testsuite_name test suite.])
-  fi
+  AS_BOX(m4_defn([AT_TESTSUITE_NAME]))
   echo
 
   echo "$as_me: command line was:"
@@ -473,7 +457,7 @@ m4_divert([TAIL])[]dnl
         sed "s/^ */$as_me: warning: /" <<_ATEOF
         A failure happened in a test group before any test could be
         run. This means that test suite is improperly designed.  Please
-        report this failure to <$at_bugreport>.
+        report this failure to <PACKAGE_BUGREPORT>.
 _ATEOF
     	echo "$at_setup_line" >at-check-line
       fi
@@ -583,8 +567,8 @@ elif test $at_debug = false; then
   AS_BOX([$as_me.log is created.])
 
   echo
-  echo "Please send \`$as_me.log' to <$at_bugreport>, along with all"
-  echo "information you think might help."
+  echo "Please send \`$as_me.log' to <PACKAGE_BUGREPORT>,"
+  echo "along with all information you think might help."
   exit 1
 fi
 
diff --git a/lib/m4sugar/Makefile.am b/lib/m4sugar/Makefile.am
index 6b9177a5..9ed378c5 100644
--- a/lib/m4sugar/Makefile.am
+++ b/lib/m4sugar/Makefile.am
@@ -1,28 +1,25 @@
 ## Process this file with automake to create Makefile.in
 
 m4sugarlibdir = $(pkgdatadir)/m4sugar
-# We ship version.m4 so that it's in src.  `autoconf' wants all the sources
-# at the same place...
-dist_m4sugarlib_DATA = version.m4 m4sugar.m4 m4sh.m4
-
-EXTRA_DIST = version.in
-
+dist_m4sugarlib_DATA = m4sugar.m4 m4sh.m4
+nodist_m4sugarlib_DATA = version.m4
 
 ## ------------ ##
 ## version.m4.  ##
 ## ------------ ##
 
-# - version.m4 needs to be updated only once, since it depends on
-#   configure.ac, not on the results of a 'configure' run.
-# - It is guaranteed (with GNU Make) that when the version in configure.ac
-#   is changed, version.m4 is built only after the new version number is
-#   propagated to the Makefile.  (Libtool uses the same guarantee.)
-
-$(srcdir)/version.m4: $(srcdir)/version.in $(top_srcdir)/configure.ac
-	sed 's,@VERSION\@,$(VERSION),g' $(srcdir)/version.in >version.tm4
-	mv version.tm4 $(srcdir)/version.m4
-
-
+version.m4: $(top_srcdir)/configure.ac
+	{					\
+	  echo '# This file is part of -*- Autoconf -*-.'; \
+	  echo '# Version of Autoconf.'; \
+	  echo '# Copyright 1999, 2000, 2001 Free Software Foundation, Inc.'; \
+	  echo ;\
+	  echo 'm4_define([m4_PACKAGE_NAME],      [@PACKAGE_NAME@])'; \
+	  echo 'm4_define([m4_PACKAGE_TARNAME],   [@PACKAGE_TARNAME@])'; \
+	  echo 'm4_define([m4_PACKAGE_VERSION],   [@PACKAGE_VERSION@])'; \
+	  echo 'm4_define([m4_PACKAGE_STRING],    [@PACKAGE_STRING@])'; \
+	  echo 'm4_define([m4_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
+	} >version.m4
 
 
 ## --------------- ##
diff --git a/lib/m4sugar/Makefile.in b/lib/m4sugar/Makefile.in
index a6e629d6..83f43749 100644
--- a/lib/m4sugar/Makefile.in
+++ b/lib/m4sugar/Makefile.in
@@ -64,11 +64,8 @@ PERL = @PERL@
 VERSION = @VERSION@
 
 m4sugarlibdir = $(pkgdatadir)/m4sugar
-# We ship version.m4 so that it's in src.  `autoconf' wants all the sources
-# at the same place...
-dist_m4sugarlib_DATA = version.m4 m4sugar.m4 m4sh.m4
-
-EXTRA_DIST = version.in
+dist_m4sugarlib_DATA = m4sugar.m4 m4sh.m4
+nodist_m4sugarlib_DATA = version.m4
 
 TAGS_FILES = $(dist_m4sugarlib_DATA)
 
@@ -79,7 +76,7 @@ subdir = lib/m4sugar
 mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
 CONFIG_CLEAN_FILES =
 DIST_SOURCES =
-DATA = $(dist_m4sugarlib_DATA)
+DATA = $(dist_m4sugarlib_DATA) $(nodist_m4sugarlib_DATA)
 
 DIST_COMMON = $(dist_m4sugarlib_DATA) Makefile.am Makefile.in
 all: all-am
@@ -110,6 +107,23 @@ uninstall-dist_m4sugarlibDATA:
 	  echo " rm -f $(DESTDIR)$(m4sugarlibdir)/$$f"; \
 	  rm -f $(DESTDIR)$(m4sugarlibdir)/$$f; \
 	done
+install-nodist_m4sugarlibDATA: $(nodist_m4sugarlib_DATA)
+	@$(NORMAL_INSTALL)
+	$(mkinstalldirs) $(DESTDIR)$(m4sugarlibdir)
+	@list='$(nodist_m4sugarlib_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f="`echo $$p | sed -e 's|^.*/||'`"; \
+	  echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(m4sugarlibdir)/$$f"; \
+	  $(INSTALL_DATA) $$d$$p $(DESTDIR)$(m4sugarlibdir)/$$f; \
+	done
+
+uninstall-nodist_m4sugarlibDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(nodist_m4sugarlib_DATA)'; for p in $$list; do \
+	  f="`echo $$p | sed -e 's|^.*/||'`"; \
+	  echo " rm -f $(DESTDIR)$(m4sugarlibdir)/$$f"; \
+	  rm -f $(DESTDIR)$(m4sugarlibdir)/$$f; \
+	done
 
 tags: TAGS
 
@@ -170,7 +184,7 @@ check: check-am
 all-am: Makefile $(DATA)
 
 installdirs:
-	$(mkinstalldirs) $(DESTDIR)$(m4sugarlibdir)
+	$(mkinstalldirs) $(DESTDIR)$(m4sugarlibdir) $(DESTDIR)$(m4sugarlibdir)
 
 install: install-am
 install-exec: install-exec-am
@@ -211,7 +225,8 @@ info: info-am
 
 info-am:
 
-install-data-am: install-dist_m4sugarlibDATA
+install-data-am: install-dist_m4sugarlibDATA \
+	install-nodist_m4sugarlibDATA
 
 install-exec-am:
 
@@ -229,28 +244,33 @@ mostlyclean: mostlyclean-am
 
 mostlyclean-am: mostlyclean-generic
 
-uninstall-am: uninstall-dist_m4sugarlibDATA uninstall-info-am
+uninstall-am: uninstall-dist_m4sugarlibDATA uninstall-info-am \
+	uninstall-nodist_m4sugarlibDATA
 
 .PHONY: GTAGS all all-am check check-am check-local clean clean-generic \
 	distclean distclean-generic distclean-tags distdir dvi dvi-am \
 	info info-am install install-am install-data install-data-am \
 	install-dist_m4sugarlibDATA install-exec install-exec-am \
-	install-info install-info-am install-man install-strip \
-	installcheck installcheck-am installdirs maintainer-clean \
+	install-info install-info-am install-man \
+	install-nodist_m4sugarlibDATA install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-generic tags \
 	uninstall uninstall-am uninstall-dist_m4sugarlibDATA \
-	uninstall-info-am
+	uninstall-info-am uninstall-nodist_m4sugarlibDATA
 
 
-# - version.m4 needs to be updated only once, since it depends on
-#   configure.ac, not on the results of a 'configure' run.
-# - It is guaranteed (with GNU Make) that when the version in configure.ac
-#   is changed, version.m4 is built only after the new version number is
-#   propagated to the Makefile.  (Libtool uses the same guarantee.)
-
-$(srcdir)/version.m4: $(srcdir)/version.in $(top_srcdir)/configure.ac
-	sed 's,@VERSION\@,$(VERSION),g' $(srcdir)/version.in >version.tm4
-	mv version.tm4 $(srcdir)/version.m4
+version.m4: $(top_srcdir)/configure.ac
+	{					\
+	  echo '# This file is part of -*- Autoconf -*-.'; \
+	  echo '# Version of Autoconf.'; \
+	  echo '# Copyright 1999, 2000, 2001 Free Software Foundation, Inc.'; \
+	  echo ;\
+	  echo 'm4_define([m4_PACKAGE_NAME],      [@PACKAGE_NAME@])'; \
+	  echo 'm4_define([m4_PACKAGE_TARNAME],   [@PACKAGE_TARNAME@])'; \
+	  echo 'm4_define([m4_PACKAGE_VERSION],   [@PACKAGE_VERSION@])'; \
+	  echo 'm4_define([m4_PACKAGE_STRING],    [@PACKAGE_STRING@])'; \
+	  echo 'm4_define([m4_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
+	} >version.m4
 
 check-local:
 	if (cd $(srcdir) && \
diff --git a/lib/m4sugar/m4sugar.m4 b/lib/m4sugar/m4sugar.m4
index a60cc4c2..18a2d44b 100644
--- a/lib/m4sugar/m4sugar.m4
+++ b/lib/m4sugar/m4sugar.m4
@@ -1706,8 +1706,12 @@ m4_define([m4_version_compare],
              (m4_split(m4_version_unletter([$2]), [\.])))])
 
 
-# m4_acversion
-# ------------
+# m4_PACKAGE_NAME
+# m4_PACKAGE_TARNAME
+# m4_PACKAGE_VERSION
+# m4_PACKAGE_STRING
+# m4_PACKAGE_BUGREPORT
+# --------------------
 m4_include([m4sugar/version.m4])
 
 
@@ -1715,7 +1719,7 @@ m4_include([m4sugar/version.m4])
 # ----------------------------------------------------
 # Check this Autoconf version against VERSION.
 m4_define([m4_version_prereq],
-[m4_if(m4_version_compare(m4_defn([m4_acversion]), [$1]), -1,
+[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]), [$1]), -1,
        [m4_default([$3],
                    [m4_fatal([Autoconf version $1 or higher is required])])],
        [$2])[]dnl
diff --git a/lib/m4sugar/version.in b/lib/m4sugar/version.in
deleted file mode 100644
index 91fbf3c7..00000000
--- a/lib/m4sugar/version.in
+++ /dev/null
@@ -1,5 +0,0 @@
-# This file is part of Autoconf.                             -*- Autoconf -*-
-# Version of Autoconf.
-# Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
-
-m4_define([m4_acversion], [@VERSION@])
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d8ff64ed..83656a9b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -26,7 +26,7 @@ EXTRA_DIST = $(WRAPPERS) $(TESTSUITE_AT) atspecific.m4 aclocal.m4 mktests.sh \
 # Running the uninstalled scripts.
 WRAPPERS = autoconf autoheader autoreconf autom4te autoupdate ifnames
 
-DISTCLEANFILES       = atconfig atlocal $(TESTSUITE)
+DISTCLEANFILES       = atconfig atlocal package.m4 $(TESTSUITE)
 
 TESTSUITE_GENERATED_AT = \
 	aclang.at acc.at acfortran.at \
@@ -53,6 +53,7 @@ testsuite: $(top_srcdir)/lib/m4sugar/m4sugar.m4 \
 	   $(top_srcdir)/lib/m4sugar/m4sh.m4 \
            $(top_srcdir)/lib/autotest/autotest.m4 \
            $(top_srcdir)/lib/autotest/general.m4 \
+	   package.m4 \
 	   atspecific.m4 \
            $(TESTSUITE_AT)
 	$(AUTOTEST) -I $(srcdir) suite.at -o $@.tmp
@@ -77,6 +78,23 @@ installcheck-local:
 
 
 
+## ------------ ##
+## package.m4.  ##
+## ------------ ##
+
+package.m4: $(top_srcdir)/configure.ac
+	{					\
+	  echo '# Signature of the current package.'; \
+	  echo 'm4_define([PACKAGE_NAME],      [@PACKAGE_NAME@])'; \
+	  echo 'm4_define([PACKAGE_TARNAME],   [@PACKAGE_TARNAME@])'; \
+	  echo 'm4_define([PACKAGE_VERSION],   [@PACKAGE_VERSION@])'; \
+	  echo 'm4_define([PACKAGE_STRING],    [@PACKAGE_STRING@])'; \
+	  echo 'm4_define([PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
+	} >package.m4
+
+
+
+
 ## ------------------ ##
 ## Maintainer rules.  ##
 ## ------------------ ##
diff --git a/tests/Makefile.in b/tests/Makefile.in
index aecebef7..9440a78b 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -73,7 +73,7 @@ EXTRA_DIST = $(WRAPPERS) $(TESTSUITE_AT) atspecific.m4 aclocal.m4 mktests.sh \
 # Running the uninstalled scripts.
 WRAPPERS = autoconf autoheader autoreconf autom4te autoupdate ifnames
 
-DISTCLEANFILES = atconfig atlocal $(TESTSUITE)
+DISTCLEANFILES = atconfig atlocal package.m4 $(TESTSUITE)
 
 TESTSUITE_GENERATED_AT = \
 	aclang.at acc.at acfortran.at \
@@ -126,7 +126,7 @@ subdir = tests
 mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
 CONFIG_CLEAN_FILES =
 DIST_SOURCES =
-DIST_COMMON = README Makefile.am Makefile.in configure.ac
+DIST_COMMON = README Makefile.am Makefile.in configure configure.ac
 all: all-am
 
 .SUFFIXES:
@@ -245,6 +245,7 @@ testsuite: $(top_srcdir)/lib/m4sugar/m4sugar.m4 \
 	   $(top_srcdir)/lib/m4sugar/m4sh.m4 \
            $(top_srcdir)/lib/autotest/autotest.m4 \
            $(top_srcdir)/lib/autotest/general.m4 \
+	   package.m4 \
 	   atspecific.m4 \
            $(TESTSUITE_AT)
 	$(AUTOTEST) -I $(srcdir) suite.at -o $@.tmp
@@ -267,6 +268,16 @@ check-local: atconfig atlocal $(TESTSUITE)
 installcheck-local:
 	$(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin
 
+package.m4: $(top_srcdir)/configure.ac
+	{					\
+	  echo '# Signature of the current package.'; \
+	  echo 'm4_define([PACKAGE_NAME],      [@PACKAGE_NAME@])'; \
+	  echo 'm4_define([PACKAGE_TARNAME],   [@PACKAGE_TARNAME@])'; \
+	  echo 'm4_define([PACKAGE_VERSION],   [@PACKAGE_VERSION@])'; \
+	  echo 'm4_define([PACKAGE_STRING],    [@PACKAGE_STRING@])'; \
+	  echo 'm4_define([PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
+	} >package.m4
+
 $(TESTSUITE_GENERATED_AT): mktests.sh $(AUTOCONF_FILES)
 	cd $(srcdir) && ./mktests.sh $(AUTOCONF_FILES)
 
diff --git a/tests/suite.at b/tests/suite.at
index 16bec35e..3b33ef72 100644
--- a/tests/suite.at
+++ b/tests/suite.at
@@ -17,13 +17,14 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 # 02111-1307, USA.
 
-# We need a very up to date version of Autotest, more recent than that
-# needed by configure.ac.
-m4_version_prereq([2.52c])
+# We need a very up to date version of Autotest.
+m4_version_prereq([2.52d])
 
 # Macros specialized for Autoconf testing.
 m4_include([atspecific.m4])
 
+AT_VICTIMS([autom4te autoconf autoheader autoupdate autoreconf ifnames])
+
 # Still many parts of `autoconf' are not exercised by the test suite.  A few
 # FIXME's, below, are used to list tests that we would need.  Do you feel
 # like contributing new tests?  If you do, you may tell your intent to
@@ -31,13 +32,6 @@ m4_include([atspecific.m4])
 
 AT_INIT
 
-AT_VICTIMS([autom4te autoconf autoheader autoupdate
-            autoreconf])
-
-AT_BANNER(
-[Some tests might be skipped if you don't have the software which the
-macros check (e.g., a Fortran compiler).])
-
 # Run the tests from the lowest level to the highest level, and from
 # the most selective to the easiest.