On RHEL 6 (using autoconf 2.63), './gnulib-tool --test crypto/md5' fails with this, ever since commit 3386f398:
executing aclocal -I glm4 glm4/gl-openssl.m4:11: error: m4_defn: undefined macro: _m4_divert_diversion glm4/gl-openssl.m4:11: the top level autom4te: /usr/bin/m4 failed with exit status: 1 aclocal: autom4te failed with exit status: 1 Autoconf 2.63b introduced some bug fixes to m4_divert*, including the ability to use the diversion stack prior to calling m4_init; and aclocal happens to be a use of autom4te where m4_init was not invoked prior to the expansion of gl_CRYPTO_CHECK. The fix is to copy the trick used in newer autoconf - wrap the entire execution of autom4te inside one more layer of diversion stack, where _m4_divert_diversion being defined serves as a nice witness of whether we are already wrapped. This workaround has to live in 00gnulib.m4 in order to come prior to any other m4 file that might be included by virtue of gnulib. * m4/00gnulib.m4 (m4_divert_push): Wrap diversion stack on older autoconf. Reported by Pavel Hrdina. Signed-off-by: Eric Blake <[email protected]> --- Shoot, just realized I'll need a followup for RHEL 5, where autoconf 2.59 does m4_wrap backwards (we need FIFO wrapping, but RHEL 5 predates the autoconf fix included in 2.63 where m4 does LIFO wrapping). ChangeLog | 6 ++++++ m4/00gnulib.m4 | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 805dc53..9841b96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2014-01-06 Eric Blake <[email protected]> + md5, sha1, sha256, sha512: support older autoconf + * m4/00gnulib.m4 (m4_divert_push): Wrap diversion stack + on older autoconf. + +2014-01-06 Eric Blake <[email protected]> + include_next: port to autoconf 2.63 * m4/gnulib-common.m4 (AS_VAR_COPY): Define if missing. diff --git a/m4/00gnulib.m4 b/m4/00gnulib.m4 index b494772..f296376 100644 --- a/m4/00gnulib.m4 +++ b/m4/00gnulib.m4 @@ -6,7 +6,15 @@ dnl with or without modifications, as long as this notice is preserved. dnl This file must be named something that sorts before all other dnl gnulib-provided .m4 files. It is needed until such time as we can -dnl assume Autoconf 2.64, with its improved AC_DEFUN_ONCE semantics. +dnl assume Autoconf 2.64, with its improved AC_DEFUN_ONCE and +dnl m4_divert semantics. + +# Until autoconf 2.63, handling of the diversion stack required m4_init +# to be called first; but this does not happen with aclocal. Wrapping +# the entire execution in another layer of the diversion stack fixes this. +m4_ifndef([_m4_divert_diversion], [m4_divert_push([KILL])m4_wrap( + [m4_divert_pop(m4_defn([_m4_divert_diversion]))])]) + # AC_DEFUN_ONCE([NAME], VALUE) # ---------------------------- -- 1.8.4.2
