diff options
author | Zack Weinberg <zackw@panix.com> | 2020-06-29 19:13:23 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2020-06-29 23:17:15 -0700 |
commit | 0a0a3378866bacf37dd2dcc325cb838b69bdb485 (patch) | |
tree | 8f5a668dcac4783ad6b0c905807ca22b89033474 /NEWS | |
parent | d330dd62730234b1f1eafaf3a946cbebf8c6503a (diff) | |
download | autoconf-0a0a3378866bacf37dd2dcc325cb838b69bdb485.tar.gz |
Consistently expand macros in whitespace-separated lists.
Several of the most commonly used Autoconf macros (starting with
AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list
of symbols as their primary argument. It would abstractly be best if
this list were _not_ subject to M4 macro expansion, in case there’s a
collision between a M4 macro name and something to be looked for.
However, we have historically not been careful about this, and there’s
been reports of configure scripts using ‘dnl’ to write comments inside
the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and
AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre
shell syntax errors.
Also, the macro expansion behavior is not consistent among all of the
macros that take whitespace-separated lists, nor is it consistent
between autoconf and autoheader.
Address this by introducing a new m4sugar macro, currently called
‘m4_validate_w’ (I’m open to suggestions for better names). Here’s
its documentation comment:
| m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])),
| but if that is not the same as just m4_normalize([STRING]),
| issue a warning.
The text of the warning is
| configure.ac:N: warning: whitespace-separated-list contains macros;
| configure.ac:N: in a future version of Autoconf they will not be expanded
If the unexpanded form of the string contains the token ‘dnl’ then
there’s an additional line:
| configure.ac:N: note: ‘dnl’ is a macro
All of the public macros that take a whitespace-separated list of
symbols are changed to pass that argument through m4_validate_w before
doing anything else with it, and the test suite is updated to verify
consistent behavior for every last one of them.
This addresses Savannah issues #110210 and #110211, and the harmless
but annoying autoheader behavior described at
https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html .
In order to avoid expanding relatively expensive m4sugar macros
multiple times per top-level macro invocation, several of the affected
Autoconf macros are restructured along the same lines as I did for
AC_REPLACE_FUNCS in the previous patch.
* lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE)
(AC_REPLACE_FUNCS)
* lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES)
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE)
* lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through
m4_validate_w before use.
* lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers
_AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C.
(AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE.
(AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers
_AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C.
* lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize.
* tests/semantics.at: Add tests for expansion of M4 macros in
whitespace-separated list arguments to all of the above.
Diffstat (limited to 'NEWS')
-rw-r--r-- | NEWS | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -39,6 +39,22 @@ GNU Autoconf NEWS - User visible changes. account. This makes it possible to use AC_DEFINE for secondary headers without duplicating the template in the main config header. +** Macros that take whitespace-separated lists as arguments + now always expand macros within those arguments. (Formerly, these + macros would *usually* expand those arguments, but the behavior was + not reliable nor was it consistent between autoconf and autoheader.) + + Macro expansion within these arguments is deprecated; if expansion + changes the list, a warning in the 'obsolete' category will be + emitted. Note that 'dnl' is a macro. Putting 'dnl' comments + inside any argument to an Autoconf macro is, in general, only + supported when that argument takes more Autoconf code (e.g. the + ACTION-IF-TRUE argument to AC_COMPILE_IFELSE). + + The affected macros are AC_CHECK_FILES, AC_CHECK_FUNCS, + AC_CHECK_FUNCS_ONCE, AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE, + AC_CONFIG_MACRO_DIRS, AC_CONFIG_SUBDIRS, and AC_REPLACE_FUNCS. + ** Macros - New macro AC_C__GENERIC. |