diff --git a/ChangeLog b/ChangeLog index ca338772..9d788904 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2010-07-19 Eric Blake + and Ralf Wildenhues + + Relax AC_INIT requirements for PACKAGE and VERSION strings again. + * lib/m4sugar/m4sh.m4 (AS_LITERAL_HEREDOC_IF): New macro. + (_AS_LITERAL_HEREDOC_IF, _AS_LITERAL_HEREDOC_IF_YES) + (_AS_LITERAL_HEREDOC_IF_NO): New helper macros. + * lib/autoconf/general.m4 (_AC_INIT_PACKAGE): Use + AS_LITERAL_HEREDOC_IF for PACKAGE and VERSION strings. + * tests/base.at (AC_INIT with unusual version strings): New test. + * tests/m4sh.at (AS@&t@_LITERAL_IF): Extend test. + * NEWS: Update. + 2010-07-19 Eric Blake Fix testsuite failures from previous patch. diff --git a/NEWS b/NEWS index 97c5495d..bf64a99b 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,14 @@ GNU Autoconf NEWS - User visible changes. ** AC_PREPROC_IFELSE now keeps the preprocessed output in the conftest.i file for inspection by the commands in the ACTION-IF-TRUE argument. +** AC_INIT again allows parentheses and other characters that are literal + in both quoted and unquoted here-documents 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. + + * Major changes in Autoconf 2.66 (2010-07-02) [stable] Released by Eric Blake, based on git versions 2.65.*. diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 5706d695..28736601 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -229,8 +229,10 @@ AU_ALIAS([AC_HELP_STRING], [AS_HELP_STRING]) # _AC_INIT_PACKAGE(PACKAGE-NAME, VERSION, BUG-REPORT, [TARNAME], [URL]) # --------------------------------------------------------------------- m4_define([_AC_INIT_PACKAGE], -[AS_LITERAL_IF([$1], [], [m4_warn([syntax], [AC_INIT: not a literal: $1])]) -AS_LITERAL_IF([$2], [], [m4_warn([syntax], [AC_INIT: not a literal: $2])]) +[AS_LITERAL_HEREDOC_IF([$1], [], + [m4_warn([syntax], [AC_INIT: not a literal: $1])]) +AS_LITERAL_HEREDOC_IF([$2], [], + [m4_warn([syntax], [AC_INIT: not a literal: $2])]) AS_LITERAL_IF([$3], [], [m4_warn([syntax], [AC_INIT: not a literal: $3])]) m4_ifndef([AC_PACKAGE_NAME], [m4_define([AC_PACKAGE_NAME], [$1])]) diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4 index 6fbc9e13..3cc868cf 100644 --- a/lib/m4sugar/m4sh.m4 +++ b/lib/m4sugar/m4sh.m4 @@ -1592,6 +1592,23 @@ m4_define([_AS_LITERAL_IF_NO], [$2]) m4_define([AS_LITERAL_WORD_IF], [_AS_LITERAL_IF(m4_expand([$1]))([$4], [$3], [$2])]) +# AS_LITERAL_HEREDOC_IF(EXPRESSION, IF-LITERAL, IF-NOT-LITERAL) +# ------------------------------------------------------------- +# Like AS_LITERAL_IF, except that a string is considered literal +# if it results in the same output in both quoted and unquoted +# here-documents. +m4_define([AS_LITERAL_HEREDOC_IF], +[_$0(m4_expand([$1]))([$2], [$3])]) + +m4_define([_AS_LITERAL_HEREDOC_IF], +[m4_if(m4_index([$1], [@S|@]), [-1], + [m4_if(m4_index(m4_translit([[$1]], [\`], [$]), [$]), [-1], + [$0_YES], [$0_NO])], + [$0_NO])]) + +m4_define([_AS_LITERAL_HEREDOC_IF_YES], [$1]) +m4_define([_AS_LITERAL_HEREDOC_IF_NO], [$2]) + # AS_TMPDIR(PREFIX, [DIRECTORY = $TMPDIR [= /tmp]]) # ------------------------------------------------- diff --git a/tests/base.at b/tests/base.at index 8f6e30fa..ac4ab27b 100644 --- a/tests/base.at +++ b/tests/base.at @@ -219,6 +219,27 @@ AT_CHECK([grep "^PACKAGE_TARNAME='fu'\$" configure], [], [ignore]) AT_CLEANUP +## ------------------------------------- ## +## AC_INIT with unusual version strings. ## +## ------------------------------------- ## + +AT_SETUP([AC_INIT with unusual version strings]) + +AT_DATA([configure.ac], +[[AC_INIT([GNU String++ with spaces (foo)], + [2.48++ (2010-07-03)], [http://clisp.cons.org/], [clisp]) +AC_OUTPUT +]]) + +AT_CHECK_AUTOCONF([-Werror]) +AT_CHECK_CONFIGURE([-q]) +AT_CHECK_CONFIGURE([--help]) +AT_CHECK_CONFIGURE([--version]) +AT_CHECK([./config.status --version], [], [ignore]) + +AT_CLEANUP + + ## -------------- ## ## AC_COPYRIGHT. ## ## -------------- ## diff --git a/tests/m4sh.at b/tests/m4sh.at index 2f793324..52ab4ee8 100644 --- a/tests/m4sh.at +++ b/tests/m4sh.at @@ -1119,7 +1119,7 @@ AT_CLEANUP ## --------------- ## AT_SETUP([AS@&t@_LITERAL_IF]) -AT_KEYWORDS([m4sh AS@&t@_LITERAL_WORD_IF]) +AT_KEYWORDS([m4sh AS@&t@_LITERAL_WORD_IF AS@&t@_LITERAL_HEREDOC_IF]) AT_DATA_M4SH([script.as], [[dnl AS_INIT @@ -1141,9 +1141,17 @@ m4_define([mac], [l``it]) echo AS_LITERAL_IF([mac], [ERR], [ok]) 13 echo AS_LITERAL_IF([mac], [ERR1], [ok], [ERR2]) 14 echo AS_LITERAL_IF([ a ][ -b], [ok], [ok]) 15 +b], [ok], [ERR]) 15 echo AS_LITERAL_WORD_IF([ a ][ b], [ERR], [ok]) 16 +echo AS_LITERAL_HEREDOC_IF([ a ][ +b], [ok], [ERR]) 17 +echo AS_LITERAL_IF([(a)], [ERR], [ok]) 18 +echo AS_LITERAL_WORD_IF([(a)], [ERR], [ok]) 19 +echo AS_LITERAL_HEREDOC_IF([(a)], [ok], [ERR]) 20 +echo AS_LITERAL_IF([@S|@a], [ERR], [ok]) 21 +echo AS_LITERAL_WORD_IF([@S|@a], [ERR], [ok]) 22 +echo AS_LITERAL_HEREDOC_IF([@S|@a], [ERR], [ok]) 23 ]]) AT_CHECK_M4SH @@ -1164,6 +1172,13 @@ ok 13 ok 14 ok 15 ok 16 +ok 17 +ok 18 +ok 19 +ok 20 +ok 21 +ok 22 +ok 23 ]]) AT_CLEANUP