+2010-07-20 Eric Blake <eblake@redhat.com>
+
+ Also reject ' and newline from AC_INIT strings.
+ * lib/autoconf/general.m4 (_AC_INIT_LITERAL): Reject a couple more
+ problematic characters.
+ * tests/base.at (AC_INIT with unusual version strings): Enhance
+ test.
+ * doc/autoconf.texi (Initializing configure) <AC_INIT>: Further
+ clarifications, and clean up wording about use of m4_esyscmd.
+ * NEWS: Update previous news entry.
+ Suggested by Paolo Bonzini.
+
2010-07-20 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Let autoreconf pass warning flags to new-enough aclocal.
file for inspection by the commands in the ACTION-IF-TRUE argument.
** AC_INIT again allows parentheses and other characters that are literal
- in quoted and unquoted here-documents and in double-quoted strings
- in its PACKAGE and VERSION arguments. This is relevant for
- packages not using these strings nor products like PACKAGE_STRING
- in other contexts, e.g., for Automake, and may be subject to
- further restrictions in the future. Regression introduced in 2.66.
+ in single- or double-quoted strings, and in quoted and unquoted
+ here-documents, for its PACKAGE and VERSION arguments. Regression
+ introduced in 2.66.
** autoreconf passes warning flags to new enough versions of aclocal.
provided, @var{url} should be the home page for the package.
The arguments of @code{AC_INIT} must be static, i.e., there should not
-be any shell computation, but they can be computed by M4 (the use of
-@code{m4_esyscmd} is permissible). This is because the package
-information strings are expanded at M4 time into several contexts, and
-must give the same text at shell time whether used in double-quoted
-strings, quoted here-documents, or unquoted here-documents.
+be any shell computation, quotes, or newlines, but they can be computed
+by M4. This is because the package information strings are expanded at
+M4 time into several contexts, and must give the same text at shell time
+whether used in single-quoted strings, double-quoted strings, quoted
+here-documents, or unquoted here-documents. It is permissible to use
+@code{m4_esyscmd} or @code{m4_esyscmd_s} for computing a version string
+that changes with every commit to a version control system (in fact,
+Autoconf does just that, for all builds of the development tree made
+between releases).
The following M4 macros (e.g., @code{AC_PACKAGE_NAME}), output variables
(e.g., @code{PACKAGE_NAME}), and preprocessor symbols (e.g.,
# _AC_INIT_LITERAL(STRING)
# ------------------------
-# Reject STRING if it cannot be used as-is in double-quoted strings,
-# as well as quoted and unquoted here-docs.
+# Reject STRING if it contains newline, or if it cannot be used as-is
+# in single-quoted strings, double-quoted strings, and quoted and
+# unquoted here-docs.
m4_define([_AC_INIT_LITERAL],
-[m4_if(m4_index([$1], dnl font-lock"
-["])AS_LITERAL_HEREDOC_IF([$1], [-]), [-1-], [],
+[m4_if(m4_index(m4_translit([[$1]], [
+""], ['']), ['])AS_LITERAL_HEREDOC_IF([$1], [-]), [-1-], [],
[m4_warn([syntax], [AC_INIT: not a literal: $1])])])
# _AC_INIT_PACKAGE(PACKAGE-NAME, VERSION, BUG-REPORT, [TARNAME], [URL])
AT_DATA([configure.ac],
[[AC_INIT([GNU String++],
- ["codename" 2.48], [http://clisp.cons.org/], [clisp])
+ ['codename' 2.48], [http://clisp.cons.org/], [clisp])
+AC_OUTPUT
+]])
+
+AT_CHECK_AUTOCONF([-Werror], [1], [ignore], [stderr])
+AT_CHECK([grep 'AC_INIT: not a literal: ' stderr], [], [ignore])
+
+AT_DATA([configure.ac],
+[[AC_INIT([GNU
+String++], [2.48], [http://clisp.cons.org/], [clisp])
AC_OUTPUT
]])