(AM_SET_CURRENT_AUTOMAKE_VERSION): Call it.
* aclocal.in (trace_used_macros): Trace _AM_AUTOCONF_VERSION.
(write_aclocal): Output a check for Autoconf's version in aclocal.m4.
Doing so ensures that users cannot build configure and Makefiles
with two different autoconf versions. Report from Noah Misch.
* tests/missing4.test: New file.
* tests/Makefile.am (TESTS): Add it.
+2006-04-21 Alexandre Duret-Lutz <adl@gnu.org>
+
+ * m4/amversion.in (_AM_AUTOCONF_VERSION): New macro.
+ (AM_SET_CURRENT_AUTOMAKE_VERSION): Call it.
+ * aclocal.in (trace_used_macros): Trace _AM_AUTOCONF_VERSION.
+ (write_aclocal): Output a check for Autoconf's version in aclocal.m4.
+ Doing so ensures that users cannot build configure and Makefiles
+ with two different autoconf versions. Report from Noah Misch.
+ * tests/missing4.test: New file.
+ * tests/Makefile.am (TESTS): Add it.
+
2006-04-20 Paul Lunau <temp@lunau.me.uk> (tiny change)
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
- `dirlist' entries (for the aclocal search path) may use shell wildcards
such as `*', `?', or `[...]'.
+
+ - aclocal now outputs an autoconf version check in aclocal.m4 in
+ projects using automake.
+
+ For a few years, automake and aclocal have been calling autoconf
+ (or its underlying engine autom4te) to accurately retrieve the
+ data they need from configure.ac and its siblings. Doing so can
+ only work if all autotools use the same version of autoconf. For
+ instance a Makefile.in generated by automake for one version of
+ autoconf may stop working if configure is regenerated with another
+ version of autoconf, and vice versa.
+
+ This new version check ensures that the whole build system has
+ been generated using the same autoconf version.
\f
New in 1.9:
# Match a serial number.
my $serial_line_rx = '^#\s*serial\s+(\S*)';
my $serial_number_rx = '^\d+(?:\.\d+)*$';
+
+# Autoconf version
+# Set by trace_used_macros.
+my $ac_version;
\f
################################################################
$traces .= join (' ', grep { exists $files{$_} } @file_order) . " ";
# All candidate macros.
$traces .= join (' ',
- (map { "--trace='$_:\$f::\$n::\$1'" } ('AC_DEFUN',
- 'AC_DEFUN_ONCE',
- 'AU_DEFUN')),
+ (map { "--trace='$_:\$f::\$n::\$1'" }
+ ('AC_DEFUN',
+ 'AC_DEFUN_ONCE',
+ 'AU_DEFUN',
+ '_AM_AUTOCONF_VERSION')),
# Do not trace $1 for all other macros as we do
# not need it and it might contains harmful
# characters (like newlines).
if ($macro eq 'AC_DEFUN'
|| $macro eq 'AC_DEFUN_ONCE'
|| $macro eq 'AU_DEFUN');
+
+ $ac_version = $arg1 if $macro eq '_AM_AUTOCONF_VERSION';
}
$tracefh->close;
# FIXME: Shouldn't we diagnose this?
return 1 if ! length ($output);
+ if ($ac_version)
+ {
+ # Do not use "$output_file" here for the same reason we do not
+ # use it in the header below. autom4te will output the name of
+ # the file in the diagnostic anyway.
+ $output = "m4_if(m4_PACKAGE_VERSION, [$ac_version],,
+[m4_fatal([this file was generated for autoconf $ac_version], [63])])
+
+$output";
+ }
+
# We used to print `# $output_file generated automatically etc.' But
# this creates spurious differences when using autoreconf. Autoreconf
# creates aclocal.m4t and then rename it to aclocal.m4, but the
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
+m4_if(m4_PACKAGE_VERSION, [2.59c],,
+[m4_fatal([this file was generated for autoconf 2.59c], [63])])
+
m4_include([m4/amversion.m4])
m4_include([m4/auxdir.m4])
m4_include([m4/init.m4])
## -*- Autoconf -*-
## @configure_input@
-# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too. Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
-# Call AM_AUTOMAKE_VERSION so it can be traced.
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
- [AM_AUTOMAKE_VERSION([@VERSION@])])
+[AM_AUTOMAKE_VERSION([@VERSION@])dnl
+_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)])
## -*- Autoconf -*-
## Generated from amversion.in; do not edit by hand.
-# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too. Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
-# Call AM_AUTOMAKE_VERSION so it can be traced.
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
- [AM_AUTOMAKE_VERSION([1.9a])])
+[AM_AUTOMAKE_VERSION([1.9a])dnl
+_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)])
missing.test \
missing2.test \
missing3.test \
+missing4.test \
mkinstall.test \
mkinst2.test \
mkinst3.test \
missing.test \
missing2.test \
missing3.test \
+missing4.test \
mkinstall.test \
mkinst2.test \
mkinst3.test \
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2006 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# See how well the rebuild rule handles an aclocal.m4 that was
+# generated for another version of autoconf.
+
+. ./defs || exit 1
+
+set -e
+
+echo AC_OUTPUT >>configure.in
+
+touch Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+$MAKE
+
+sed '1,20 s/m4_PACKAGE_VERSION,/&9999/' < aclocal.m4 > aclocal.tmp
+cmp aclocal.m4 aclocal.tmp && exit 1
+
+mv aclocal.tmp aclocal.m4
+
+$MAKE 2>stderr
+cat stderr
+grep 'WARNING:.*automake.*probably too old' stderr
+grep 'WARNING:.*autoconf.*probably too old' stderr
+test 2 = `grep -c 'aclocal.m4:.*this file was generated for' stderr`
+
+$MAKE 2>stderr
+cat stderr
+grep 'WARNING:.*automake.*probably too old' stderr && exit 1
+grep 'WARNING:.*autoconf.*probably too old' stderr && exit 1
+grep 'aclocal.m4:.*this file was generated for' stderr && exit 1
+
+: