From 9650b648899f6b9c94528e034ae1d91f564772a0 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Thu, 10 Apr 2008 09:51:23 -0600 Subject: AC_AUTOCONF_VERSION can inadvertently expand to a macro name. * m4/amversion.in (AM_SET_CURRENT_AUTOMAKE_VERSION): Use proper m4 quoting. * aclocal.in (write_aclocal): Likewise. * tests/missing6.test: New test. * tests/Makefile.am (TESTS): Run it. * tests/missing4.test: Adjust. Signed-off-by: Eric Blake (cherry picked from commit 680877cce6a85e0a55a7659048c0431109f964b7) --- ChangeLog | 10 ++++++++++ aclocal.in | 2 +- aclocal.m4 | 2 +- m4/amversion.in | 4 ++-- m4/amversion.m4 | 4 ++-- tests/Makefile.am | 1 + tests/Makefile.in | 1 + tests/missing4.test | 4 ++-- tests/missing6.test | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 71 insertions(+), 8 deletions(-) create mode 100755 tests/missing6.test diff --git a/ChangeLog b/ChangeLog index 382d83a69..78c2d510f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-04-10 Eric Blake + + AC_AUTOCONF_VERSION can inadvertently expand to a macro name. + * m4/amversion.in (AM_SET_CURRENT_AUTOMAKE_VERSION): Use proper + m4 quoting. + * aclocal.in (write_aclocal): Likewise. + * tests/missing6.test: New test. + * tests/Makefile.am (TESTS): Run it. + * tests/missing4.test: Adjust. + 2008-03-20 Ralf Wildenhues * lib/texinfo.tex: Sync from upstream. diff --git a/aclocal.in b/aclocal.in index b95b76be2..e9d04766a 100644 --- a/aclocal.in +++ b/aclocal.in @@ -797,7 +797,7 @@ sub write_aclocal ($@) # the file in the diagnostic anyway. $output = "m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(AC_AUTOCONF_VERSION, [$ac_version],, +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [$ac_version],, [m4_warning([this file was generated for autoconf $ac_version. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. diff --git a/aclocal.m4 b/aclocal.m4 index 44c8caf87..4b6da5120 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -13,7 +13,7 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(AC_AUTOCONF_VERSION, [2.61],, +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.61],, [m4_warning([this file was generated for autoconf 2.61. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. diff --git a/m4/amversion.in b/m4/amversion.in index ab5759061..40a9ed48d 100644 --- a/m4/amversion.in +++ b/m4/amversion.in @@ -1,6 +1,6 @@ ## -*- Autoconf -*- ## @configure_input@ -# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -34,4 +34,4 @@ AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([@VERSION@])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)]) +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) diff --git a/m4/amversion.m4 b/m4/amversion.m4 index d39263369..f2887f222 100644 --- a/m4/amversion.m4 +++ b/m4/amversion.m4 @@ -1,6 +1,6 @@ ## -*- Autoconf -*- ## Generated from amversion.in; do not edit by hand. -# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -34,4 +34,4 @@ AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.10.1a])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)]) +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) diff --git a/tests/Makefile.am b/tests/Makefile.am index 9db9bb385..a2fd0dd39 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -374,6 +374,7 @@ missing2.test \ missing3.test \ missing4.test \ missing5.test \ +missing6.test \ mkinstall.test \ mkinst2.test \ mkinst3.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 91635cb6d..01e42df63 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -506,6 +506,7 @@ missing2.test \ missing3.test \ missing4.test \ missing5.test \ +missing6.test \ mkinstall.test \ mkinst2.test \ mkinst3.test \ diff --git a/tests/missing4.test b/tests/missing4.test index e3120670c..a6c4d13d1 100755 --- a/tests/missing4.test +++ b/tests/missing4.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2006, 2007 Free Software Foundation, Inc. +# Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -35,7 +35,7 @@ $AUTOMAKE ./configure $MAKE -sed '1,20 s/AC_AUTOCONF_VERSION,/&9999/' < aclocal.m4 > aclocal.tmp +sed '1,20 s/m4_defn(\[AC_AUTOCONF_VERSION\]),/9999,/' < aclocal.m4 > aclocal.tmp cmp aclocal.m4 aclocal.tmp && exit 1 mv aclocal.tmp aclocal.m4 diff --git a/tests/missing6.test b/tests/missing6.test new file mode 100755 index 000000000..56c604723 --- /dev/null +++ b/tests/missing6.test @@ -0,0 +1,51 @@ +#! /bin/sh +# Copyright (C) 2008 Free Software Foundation, Inc. +# +# This program 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 3, or (at your option) +# any later version. +# +# This program 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 this program. If not, see . + +# Make sure autoconf version checks in aclocal.m4 are robust. + +. ./defs || exit 1 + +set -e + +{ + echo 'm4_define([AC_AUTOCONF_VERSION], [9999a])' + echo 'm4_define([b], [oops])' + cat configure.in + echo AC_OUTPUT +} >configure.ac +rm configure.in + +touch Makefile.am + +$ACLOCAL +$AUTOCONF 2>stderr +grep 'You have another version of autoconf' stderr +grep 'aclocal.m4:.*this file was generated for' stderr +$AUTOMAKE +./configure +$MAKE + +sed 's/\[b\]/[a]/' < configure.ac > configure.tmp +cmp configure.ac configure.tmp && exit 1 + +mv configure.tmp configure.ac + +$MAKE 2>stderr +cat stderr +grep 'You have another version of autoconf' stderr +grep 'aclocal.m4:.*this file was generated for autoconf 9999a' stderr + +: -- cgit v1.2.3