Make sure AM_INIT_AUTOMAKE has a trailing newline
authorStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 19 Dec 2014 10:44:12 +0000 (11:44 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 19 Dec 2014 11:23:46 +0000 (12:23 +0100)
This used to be the case until Automke 1.13, but we broke it in
Automake 1.14 (see commit v1.13.1-71-gf78b0f0).  This caused
issues like http://debbugs.gnu.org/16841

* m4/init.m4 (AM_INIT_AUTOMAKE): Adjust.
* t/aminit-trailing-dnl-comment-pr16841.sh: New test.
* t/list-of-tests.mk: Add it.
* NEWS, THANKS: Update.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
NEWS
THANKS
m4/init.m4
t/aminit-trailing-dnl-comment-pr16841.sh [new file with mode: 0644]
t/list-of-tests.mk

diff --git a/NEWS b/NEWS
index 614eba64d8a9417e9d84fa674b2000c0b472b682..626d295ac6537885856fafd6a8fd88cf89f255c1 100644 (file)
--- a/NEWS
+++ b/NEWS
 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+New in 1.14.2:
+
+* Bugs fixed:
+
+  - The expansion of AM_INIT_AUTOMAKE ends once again with a trailing
+    newline (bug#16841). Regression introduced in Automake 1.14.
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
 New in 1.14.1:
 
 * Bugs fixed:
diff --git a/THANKS b/THANKS
index 7f8485070f045681d3cdd1a1e1e0ef8bdadfd600..9ace719e5384c7bfc18bebb1c27f73b45f8115ca 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -152,6 +152,7 @@ Harlan Stenn                    Harlan.Stenn@pfcs.com
 He Li                           tippa000@yahoo.com
 Henrik Frystyk Nielsen          frystyk@w3.org
 Hib Eris                        hib@hiberis.nl
+Hilko Bengen                    bengen@debian.org
 Ian Lance Taylor                ian@cygnus.com
 Ignacy Gawedzki                 i@lri.fr
 Илья Н. Голубев                 gin@mo.msk.ru
index 432ff200c9861590c5f0d8506cc63572ab248773..d8350fe444cc1d3cd0bf51abcd3f998327118a14 100644 (file)
@@ -164,7 +164,11 @@ to "yes", and re-run configure.
 END
     AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
   fi
-fi])
+fi
+dnl The trailing newline in this macro's definition is deliberate, for
+dnl backward compatibility and to allow trailing 'dnl'-style comments
+dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
+])
 
 dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
 dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
diff --git a/t/aminit-trailing-dnl-comment-pr16841.sh b/t/aminit-trailing-dnl-comment-pr16841.sh
new file mode 100644 (file)
index 0000000..0f47f16
--- /dev/null
@@ -0,0 +1,44 @@
+#! /bin/sh
+# Copyright (C) 2014 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 2, 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/>.
+
+# Check that a trailing 'dnl' m4 comment automake after the
+# AM_INIT_AUTOMAKE invocation doesn't produce a syntactically
+# invalid configure script.  This used to be the case until
+# automake 1.13, but we broke that in automake 1.14. See
+# automake bug#16841.
+
+am_create_testdir=empty
+. test-init.sh
+
+cat > configure.ac <<END
+AC_INIT([test-pr16841], [1.0])
+AM_INIT_AUTOMAKE([1.14 -Werror]) dnl Some comment
+echo "OK OK OK"
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+: > Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure >stdout || { cat stdout; exit 1; }
+cat stdout
+greop '^OK OK OK$' stdout
+
+:
index 462497ee3d9ff40eae03a8282724f7c8ee6cf7d3..c98d69e1176642b722dcea08034257ba061be412 100644 (file)
@@ -132,6 +132,7 @@ t/amhello-cflags.sh \
 t/amhello-cross-compile.sh \
 t/amhello-binpkg.sh \
 t/aminit-moreargs-deprecation.sh \
+t/aminit-trailing-dnl-comment-pr16841.sh \
 t/amassign.sh \
 t/am-config-header.sh \
 t/am-prog-cc-stdc.sh \