Provide a mean to ``AC_PREREQ'' for M4sugar, M4sh and Autotest.

* lib/autoconf/version.in: Remove.
* lib/m4sugar/version.in: New.
* lib/m4sugar/m4sugar.m4 (m4_acversion, m4_version_prereq): New.
Adjust callers.
* bin/autoupdate.in: Distinguish M4sugar vs. Autoconf macros by
the name of the directory they're in, instead of the filename,
since version.m4 is now in m4sugar, but m4_acversion must not be
classified as an Autoconf macro.
($input_m4): Don't qualify the path to m4sugar.
Rather, pass autoconf_dir to m4.
* tests/Makefile.am (testsuite): Remove -I top_srcdir, unneeded.
* tests/suite.at: Require 2.52c.
This commit is contained in:
Akim Demaille 2001-08-27 07:08:56 +00:00
parent d5c038a64b
commit f827e95708
17 changed files with 130 additions and 86 deletions

View File

@ -1,3 +1,21 @@
2001-08-27 Akim Demaille <akim@epita.fr>
Provide a mean to ``AC_PREREQ'' for M4sugar, M4sh and Autotest.
* lib/autoconf/version.in: Remove.
* lib/m4sugar/version.in: New.
* lib/m4sugar/m4sugar.m4 (m4_acversion, m4_version_prereq): New.
Adjust callers.
* bin/autoupdate.in: Distinguish M4sugar vs. Autoconf macros by
the name of the directory they're in, instead of the filename,
since version.m4 is now in m4sugar, but m4_acversion must not be
classified as an Autoconf macro.
($input_m4): Don't qualify the path to m4sugar.
Rather, pass autoconf_dir to m4.
* tests/Makefile.am (testsuite): Remove -I top_srcdir, unneeded.
* tests/suite.at: Require 2.52c.
2001-08-27 Akim Demaille <akim@epita.fr>
testsuite.log should include config.log.

View File

@ -123,7 +123,7 @@ sub parse_args ()
if (! @ARGV)
{
my $configure_ac = find_configure_ac;
die 'no input file'
die "$me: no input file\n"
unless $configure_ac;
push @ARGV, $configure_ac;
}
@ -177,14 +177,16 @@ while (<MACROS>)
{
chomp;
/^(AC|AU):(.*):([^:]*)$/ or next;
my $filename = basename ($2);
# ../lib/m4sugar/m4sugar.m4 -> m4sugar
# ../lib/autoconf/general.m4 -> autoconf
my $set = basename (dirname ($2));
if ($1 eq "AC")
{
$ac_macros{$3} = $filename;
$ac_macros{$3} = $set;
}
else
{
$au_macros{$3} = $filename;
$au_macros{$3} = $set;
}
}
close MACROS
@ -219,7 +221,7 @@ open DISABLE_M4, ">$tmp/disable.m4"
foreach (sort keys %ac_macros)
{
print AC_M4 "_au_define([$_], [[\$0(\$\@)]])\n"
unless $ac_macros{$_} eq "m4sugar.m4";
unless $ac_macros{$_} eq 'm4sugar';
print DISABLE_M4 "_au_undefine([$_])\n";
}
close DISABLE_M4
@ -293,7 +295,7 @@ foreach my $file (@ARGV)
# Enable the m4 builtins, m4sugar and the autoquoting AC macros.
_au_include([$tmp/m4.m4])
_au_include([$autoconf_dir/m4sugar/m4sugar.m4])
_au_include([m4sugar/m4sugar.m4])
_au_include([$tmp/ac.m4])
_au_divert(0)])
@ -362,11 +364,11 @@ EOF
# Now ask m4 to perform the update.
if ("$file" eq "$tmp/stdin")
{
xsystem ("$m4 $tmp/input.m4");
xsystem ("$m4 -I $autoconf_dir $tmp/input.m4");
}
else
{
xsystem ("$m4 $tmp/input.m4 >$tmp/updated");
xsystem ("$m4 -I $autoconf_dir $tmp/input.m4 >$tmp/updated");
if (compare ("$tmp/updated", "$file") == 0)
{
# File didn't change, so don't update its mod time.

View File

@ -1,3 +1,2 @@
Makefile
version.m4
*.m4f

View File

@ -23,22 +23,10 @@ distautoconflib_DATA = autoconf.m4 \
lang.m4 c.m4 fortran.m4 \
functions.m4 headers.m4 types.m4 libs.m4 programs.m4
nodistautoconflibdir = $(pkgdatadir)/autoconf
# The order matters: we need version.m4 to build autoconf.m4f.
nodistautoconflib_DATA = version.m4 autoconf.m4f
nodistautoconflib_DATA = autoconf.m4f
EXTRA_DIST = $(distautoconflib_DATA) version.in version.m4
EXTRA_DIST = $(distautoconflib_DATA)
## 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
## --------------- ##

View File

@ -70,10 +70,9 @@ distautoconflibdir = $(pkgdatadir)/autoconf
distautoconflib_DATA = autoconf.m4 general.m4 oldnames.m4 specific.m4 lang.m4 c.m4 fortran.m4 functions.m4 headers.m4 types.m4 libs.m4 programs.m4
nodistautoconflibdir = $(pkgdatadir)/autoconf
# The order matters: we need version.m4 to build autoconf.m4f.
nodistautoconflib_DATA = version.m4 autoconf.m4f
nodistautoconflib_DATA = autoconf.m4f
EXTRA_DIST = $(distautoconflib_DATA) version.in version.m4
EXTRA_DIST = $(distautoconflib_DATA)
TAGS_FILES = $(distautoconflib_DATA)
@ -270,16 +269,6 @@ distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
# - 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
check-local:
if (cd $(srcdir) && \
egrep '^_?EOF' $(distautoconflib_DATA)) >eof.log; then \

View File

@ -1,4 +1,4 @@
changequote()changequote([, ])include(m4sugar/m4sh.m4)# -*- Autoconf -*-
divert(-1)# -*- Autoconf -*-
# This file is part of Autoconf.
# Driver that loads the Autoconf macro files.
# Copyright 1994, 1999, 2000, 2001 Free Software Foundation, Inc.
@ -51,7 +51,9 @@ changequote()changequote([, ])include(m4sugar/m4sh.m4)# -*- Autoconf -*-
# yet when Autoconf is frozen.
# Do not sinclude ./aclocal.m4 here, to prevent it from being frozen.
m4_include([autoconf/version.m4])
changequote()
changequote([, ])
include([m4sugar/m4sh.m4])
m4_include([autoconf/general.m4])
m4_include([autoconf/programs.m4])
m4_include([autoconf/lang.m4])

View File

@ -509,24 +509,21 @@ 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([AC_ACVERSION])' below are expanded before calling
# 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 `AC_ACVERSION'. We
# could `AU_DEFUN' `AC_ACVERSION', but this would replace all its
# 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 mean the user.
# not what meant the user.
AU_DEFUN([AC_PREREQ],
[m4_if(m4_version_compare(]m4_defn([AC_ACVERSION])[, [$1]), -1,
[m4_fatal([Autoconf version $1 or higher is required for this script])])dnl
[AC_PREREQ(]]m4_defn([AC_ACVERSION])[[)]])
[m4_version_prereq([$1])[]dnl
[AC_PREREQ(]]m4_defn([m4_acversion])[[)]])
# AC_PREREQ(VERSION)
# ------------------
# Complain and exit if the Autoconf version is less than VERSION.
m4_define([AC_PREREQ],
[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1,
[AC_FATAL([Autoconf version $1 or higher is required for this script])])])
m4_copy([m4_version_prereq], [AC_PREREQ])
@ -548,7 +545,7 @@ m4_define([AC_PREREQ],
m4_define([_AC_INIT_NOTICE],
[m4_divert_text([HEADER-COMMENT],
[@%:@ Guess values for system-dependent variables and create Makefiles.
@%:@ Generated by Autoconf AC_ACVERSION[]dnl
@%:@ Generated by Autoconf m4_acversion[]dnl
m4_ifset([AC_PACKAGE_STRING], [ for AC_PACKAGE_STRING]).])
m4_ifset([AC_PACKAGE_BUGREPORT],
@ -1256,7 +1253,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 AC_ACVERSION])])
generated by GNU Autoconf m4_acversion])])
m4_divert_text([VERSION_END],
[_ACEOF
exit 0
@ -1277,7 +1274,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 AC_ACVERSION. Invocation command line was
generated by GNU Autoconf m4_acversion. Invocation command line was
$ $[0] $[@]
@ -3225,7 +3222,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 AC_ACVERSION. Invocation command line was
generated by GNU Autoconf m4_acversion. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@ -3302,7 +3299,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 AC_ACVERSION,
configured by [$]0, generated by GNU Autoconf m4_acversion,
with options \\"`echo "$ac_configure_args" | sed 's/[[\\""\`\$]]/\\\\&/g'`\\"
Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001

View File

@ -68,7 +68,7 @@ VERSION = @VERSION@
autotestlibdir = $(pkgdatadir)/autotest
autotestlib_DATA = general.m4
autotestlib_DATA = autotest.m4 general.m4
EXTRA_DIST = $(autotestlib_DATA)

View File

@ -47,5 +47,5 @@ divert(-1)# -*- Autoconf -*-
changequote()
changequote([, ])
include(m4sugar/m4sh.m4)
m4_include(autotest/general.m4)
include([m4sugar/m4sh.m4])
m4_include([autotest/general.m4])

View File

@ -1 +1,2 @@
Makefile
version.m4

View File

@ -1,10 +1,28 @@
## Process this file with automake to create Makefile.in
m4sugarlibdir = $(pkgdatadir)/m4sugar
distm4sugarlibdir = $(pkgdatadir)/m4sugar
# We ship version.m4 so that it's in src. `autoconf' wants all the sources
# at the same place...
distm4sugarlib_DATA = version.m4 m4sugar.m4 m4sh.m4
EXTRA_DIST = $(distm4sugarlib_DATA) version.in
## ------------ ##
## 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
m4sugarlib_DATA = m4sugar.m4 m4sh.m4
EXTRA_DIST = $(m4sugarlib_DATA)
## --------------- ##
@ -23,7 +41,7 @@ ETAGS_ARGS = --lang=none \
check-local:
if (cd $(srcdir) && \
egrep '^_?EOF' $(m4sugarlib_DATA)) >eof.log; then \
egrep '^_?EOF' $(distm4sugarlib_DATA)) >eof.log; then \
echo "ERROR: user EOF tags were used:" >&2; \
sed "s,^,$*.m4: ," <eof.log >&2; \
echo >&2; \

View File

@ -66,11 +66,12 @@ PACKAGE_NAME = @PACKAGE_NAME@
PERL = @PERL@
VERSION = @VERSION@
m4sugarlibdir = $(pkgdatadir)/m4sugar
distm4sugarlibdir = $(pkgdatadir)/m4sugar
# We ship version.m4 so that it's in src. `autoconf' wants all the sources
# at the same place...
distm4sugarlib_DATA = version.m4 m4sugar.m4 m4sh.m4
m4sugarlib_DATA = m4sugar.m4 m4sh.m4
EXTRA_DIST = $(m4sugarlib_DATA)
EXTRA_DIST = $(distm4sugarlib_DATA) version.in
TAGS_FILES = $(m4sugarlib_DATA)
@ -78,7 +79,7 @@ ETAGS_ARGS = --lang=none --regex='/\(A[CU]_DEFUN\|m4_\(defun\|define\)\|define
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
CONFIG_CLEAN_FILES =
DATA = $(m4sugarlib_DATA)
DATA = $(distm4sugarlib_DATA)
DIST_COMMON = Makefile.am Makefile.in
@ -97,23 +98,23 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
install-m4sugarlibDATA: $(m4sugarlib_DATA)
install-distm4sugarlibDATA: $(distm4sugarlib_DATA)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(m4sugarlibdir)
@list='$(m4sugarlib_DATA)'; for p in $$list; do \
$(mkinstalldirs) $(DESTDIR)$(distm4sugarlibdir)
@list='$(distm4sugarlib_DATA)'; for p in $$list; do \
if test -f $(srcdir)/$$p; then \
echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(m4sugarlibdir)/$$p"; \
$(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(m4sugarlibdir)/$$p; \
echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(distm4sugarlibdir)/$$p"; \
$(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(distm4sugarlibdir)/$$p; \
else if test -f $$p; then \
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(m4sugarlibdir)/$$p"; \
$(INSTALL_DATA) $$p $(DESTDIR)$(m4sugarlibdir)/$$p; \
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(distm4sugarlibdir)/$$p"; \
$(INSTALL_DATA) $$p $(DESTDIR)$(distm4sugarlibdir)/$$p; \
fi; fi; \
done
uninstall-m4sugarlibDATA:
uninstall-distm4sugarlibDATA:
@$(NORMAL_UNINSTALL)
list='$(m4sugarlib_DATA)'; for p in $$list; do \
rm -f $(DESTDIR)$(m4sugarlibdir)/$$p; \
list='$(distm4sugarlib_DATA)'; for p in $$list; do \
rm -f $(DESTDIR)$(distm4sugarlibdir)/$$p; \
done
tags: TAGS
@ -177,20 +178,20 @@ installcheck: installcheck-am
install-exec-am:
install-exec: install-exec-am
install-data-am: install-m4sugarlibDATA
install-data-am: install-distm4sugarlibDATA
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-m4sugarlibDATA
uninstall-am: uninstall-distm4sugarlibDATA
uninstall: uninstall-am
all-am: Makefile $(DATA)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(m4sugarlibdir)
$(mkinstalldirs) $(DESTDIR)$(distm4sugarlibdir)
mostlyclean-generic:
@ -221,7 +222,7 @@ maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \
maintainer-clean: maintainer-clean-am
.PHONY: uninstall-m4sugarlibDATA install-m4sugarlibDATA tags \
.PHONY: uninstall-distm4sugarlibDATA install-distm4sugarlibDATA tags \
mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \
distdir info-am info dvi-am dvi check-local check check-am \
installcheck-am installcheck install-exec-am install-exec \
@ -231,9 +232,19 @@ distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
# - 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
check-local:
if (cd $(srcdir) && \
egrep '^_?EOF' $(m4sugarlib_DATA)) >eof.log; then \
egrep '^_?EOF' $(distm4sugarlib_DATA)) >eof.log; then \
echo "ERROR: user EOF tags were used:" >&2; \
sed "s,^,$*.m4: ," <eof.log >&2; \
echo >&2; \

View File

@ -1696,6 +1696,22 @@ m4_define([m4_version_compare],
(m4_split(m4_version_unletter([$2]), [\.])))])
# m4_acversion
# ------------
m4_include([m4sugar/version.m4])
# m4_version_prereq(VERSION, [IF-OK], [IF-NOT = FAIL])
# ----------------------------------------------------
# Check this Autoconf version against VERSION.
m4_define([m4_version_prereq],
[m4_if(m4_version_compare(m4_defn([m4_acversion]), [$1]), -1,
[m4_default([$3],
[m4_fatal([Autoconf version $1 or higher is required])])],
[$2])[]dnl
])
## ------------------- ##
## 12. File handling. ##

View File

@ -2,4 +2,4 @@
# Version of Autoconf.
# Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
m4_define([AC_ACVERSION], [@VERSION@])
m4_define([m4_acversion], [@VERSION@])

View File

@ -50,8 +50,7 @@ testsuite: $(top_srcdir)/lib/m4sugar/m4sugar.m4 \
$(top_srcdir)/lib/autotest/general.m4 \
atspecific.m4 \
$(SUITE)
$(AUTOM4TE) \
-I $(srcdir) -I $(top_srcdir) -I $(top_srcdir)/lib \
$(AUTOM4TE) -I $(srcdir) -I $(top_srcdir)/lib \
autotest/autotest.m4 suite.at -o $@.tmp
chmod +x $@.tmp
mv $@.tmp $@

View File

@ -202,12 +202,12 @@ check-local: atconfig atlocal testsuite
$(SHELL) testsuite
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 \
atspecific.m4 \
$(SUITE)
$(AUTOM4TE) \
-I $(srcdir) -I $(top_srcdir) -I $(top_srcdir)/lib \
atspecific.m4 suite.at -o $@.tmp
$(AUTOM4TE) -I $(srcdir) -I $(top_srcdir)/lib \
autotest/autotest.m4 suite.at -o $@.tmp
chmod +x $@.tmp
mv $@.tmp $@

View File

@ -17,6 +17,10 @@
# 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])
# Macros specialized for Autoconf testing.
m4_include([atspecific.m4])