diff options
author | Zack Weinberg <zackw@panix.com> | 2020-11-30 09:26:37 -0500 |
---|---|---|
committer | Zack Weinberg <zackw@panix.com> | 2020-11-30 11:45:26 -0500 |
commit | 7ee946312e227a07cc20dcb5d3c5645caa1684a0 (patch) | |
tree | 6c12f0bbf7d0a231f4e61239cdffa45f00bff8ee | |
parent | 03f14a90f191c0e77b873e2e6778bc8cccac51b3 (diff) | |
download | autoconf-7ee946312e227a07cc20dcb5d3c5645caa1684a0.tar.gz |
Make “redefining AS_ECHO internals” test more robust.
M4-redefining ‘printf’ as ‘echo’ brings back all the variations in
‘echo’ behavior that we were trying to get away from by switching to
‘printf’ in the first place. This caused a spurious failure on AIX.
* tests/m4sh.at (Redefining AS_ECHO internals): Redefine ‘printf’ as
a shell function with fully predictable output, not as ‘echo’.
-rw-r--r-- | tests/m4sh.at | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/m4sh.at b/tests/m4sh.at index 6504b71a..7de210ac 100644 --- a/tests/m4sh.at +++ b/tests/m4sh.at @@ -706,7 +706,14 @@ rm config.h # the functioning of AS_ECHO. AT_CONFIGURE_AC( -[[m4@&t@_pushdef([printf], [echo]) +[[# At this point in a configure script, defining shell functions is safe. +fn_printf_override () { + for arg; do + printf '+ %s\n' "$arg" + done + AS@&t@_UNSET([arg]) +} +m4@&t@_pushdef([printf], [fn_printf_override]) AC_MSG_NOTICE([checking whether m4sugar echo works... yes]) AC_MSG_CHECKING([whether m4sugar echo_n works]) AC_MSG_RESULT([yes]) @@ -715,9 +722,12 @@ m4@&t@_popdef([printf]) AT_CHECK_AUTOCONF AT_CHECK_CONFIGURE([], [], -[[%s\n configure: checking whether m4sugar echo works... yes -%s checking whether m4sugar echo_n works... @&t@ -%s\n yes +[[+ %s\n ++ configure: checking whether m4sugar echo works... yes ++ %s ++ checking whether m4sugar echo_n works... @&t@ ++ %s\n ++ yes configure: creating ./config.status config.status: creating config.h ]], []) |