]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
AC_AUTOCONF_VERSION can inadvertently expand to a macro name.
authorEric Blake <ebb9@byu.net>
Thu, 10 Apr 2008 15:51:23 +0000 (09:51 -0600)
committerEric Blake <ebb9@byu.net>
Thu, 10 Apr 2008 15:51:23 +0000 (09:51 -0600)
* 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 <ebb9@byu.net>
ChangeLog
aclocal.in
m4/amversion.in
tests/Makefile.am
tests/missing4.test
tests/missing6.test [new file with mode: 0755]

index 2ac33db21baaa70d2569a05973728bc1123e5df3..84df43418c9c39a54534e44cfb6a432092a1f22f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2008-04-10  Eric Blake  <ebb9@byu.net>
+
+       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  <ebb9@byu.net>
 
        Make gnupload friendlier for VPATH usage.
index 0436205c8b460664e2b003aaa83d64b4d8219b06..44d3d1e66d60268a39b91e93cbe4026c9a728975 100644 (file)
@@ -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.
index ab5759061cf7a23707e6f27ff44416d7563933b9..40a9ed48da6d2b219ebb880bf2b3d4166db0115e 100644 (file)
@@ -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]))])
index 00f17852aafd6c2b5af17a7857fed270f0d5500d..8cddc579e9b4dc36ee99b13d8ec8216a19c9cbc2 100644 (file)
@@ -389,6 +389,7 @@ missing2.test \
 missing3.test \
 missing4.test \
 missing5.test \
+missing6.test \
 mkinstall.test \
 mkinst2.test \
 mkinst3.test \
index 7f2fe0dd0b0420c9292cea18eee166c463732779..137b999073189f055419104e18b0ea4ffc26123d 100755 (executable)
@@ -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 (executable)
index 0000000..56c6047
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+
+# 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
+
+: