autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Also reject ' from AC_INIT strings.


From: Eric Blake
Subject: [PATCH] Also reject ' from AC_INIT strings.
Date: Tue, 20 Jul 2010 07:48:32 -0600

* lib/autoconf/general.m4 (_AC_INIT_LITERAL): Reject '.
* 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.

Signed-off-by: Eric Blake <address@hidden>
---

> Considering Automake does
> 
> AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])

I missed that; Autoconf does it too:

AC_SUBST([PACKAGE_NAME],
         [m4_ifdef([AC_PACKAGE_NAME],      ['AC_PACKAGE_NAME'])])dnl

> I think that's fine, but since you are at it you should also check for single 
> quotes. 

Done.

 ChangeLog               |   11 +++++++++++
 NEWS                    |    8 +++-----
 doc/autoconf.texi       |   14 +++++++++-----
 lib/autoconf/general.m4 |    4 ++--
 tests/base.at           |    2 +-
 5 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1228e9b..0d5906f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2010-07-20  Eric Blake  <address@hidden>
+
+       Also reject ' from AC_INIT strings.
+       * lib/autoconf/general.m4 (_AC_INIT_LITERAL): Reject '.
+       * 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  <address@hidden>

        Let autoreconf pass warning flags to new-enough aclocal.
diff --git a/NEWS b/NEWS
index a1ce558..e8fcd3d 100644
--- a/NEWS
+++ b/NEWS
@@ -14,11 +14,9 @@ GNU Autoconf NEWS - User visible changes.
    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.

diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index cba4b1b..d878f4d 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -1845,11 +1845,15 @@ Initializing configure
 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
address@hidden 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 or quotes, 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
address@hidden 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.,
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index bb18845..0d86539 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -229,8 +229,8 @@ AU_ALIAS([AC_HELP_STRING], [AS_HELP_STRING])
 # Reject STRING if it cannot be used as-is in double-quoted strings,
 # as well as 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])
diff --git a/tests/base.at b/tests/base.at
index 6dc9a17..1e22a1f 100644
--- a/tests/base.at
+++ b/tests/base.at
@@ -259,7 +259,7 @@ AT_CHECK([grep 'AC_INIT: not a literal: ' stderr], [], 
[ignore])

 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
 ]])

-- 
1.7.1.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]