From: Eric Blake Date: Thu, 10 Apr 2008 15:51:23 +0000 (-0600) Subject: AC_AUTOCONF_VERSION can inadvertently expand to a macro name. X-Git-Tag: v1.10b~141 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=680877cce6a85e0a55a7659048c0431109f964b7;p=thirdparty%2Fautomake.git 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 --- diff --git a/ChangeLog b/ChangeLog index 2ac33db21..84df43418 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-04-02 Eric Blake Make gnupload friendlier for VPATH usage. diff --git a/aclocal.in b/aclocal.in index 0436205c8..44d3d1e66 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/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/tests/Makefile.am b/tests/Makefile.am index 00f17852a..8cddc579e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -389,6 +389,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 7f2fe0dd0..137b99907 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 program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -31,7 +31,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 + +: