2 dnl Copyright (C) 2000, 2006, 2007, 2008 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
9 # Check for GNU M4, at least 1.4.5 (all earlier versions had a bug in
11 # http://lists.gnu.org/archive/html/bug-gnu-utils/2006-11/msg00096.html)
12 # Also, check whether --error-output (through 1.4.x) or --debugfile (2.0)
13 # is supported, and AC_SUBST M4_DEBUGFILE accordingly.
14 AC_DEFUN([AC_PROG_GNU_M4],
15 [AC_ARG_VAR([M4], [Location of GNU M4 1.4.5 or later. Defaults to the first
16 program of `m4', `gm4', or `gnum4' on PATH that meets Autoconf needs.])
17 AC_CACHE_CHECK([for GNU M4 that supports accurate traces], [ac_cv_path_M4],
19 AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4 gnum4],
20 [dnl Creative quoting here to avoid raw dnl and ifdef in configure.
21 # Root out GNU M4 1.4.4, as well as non-GNU m4 that ignore -t, -F.
22 ac_snippet=change'quote(<,>)in''dir(<if''def>,mac,bug)d'nl
23 test -z "`$ac_path_M4 -F conftest.m4f </dev/null 2>&1`" \
24 && test -z "`echo $ac_snippet | $ac_path_M4 --trace=mac 2>&1`" \
25 && test -f conftest.m4f \
26 && ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:
28 [AC_MSG_ERROR([no acceptable m4 could be found in \$PATH.
29 GNU M4 1.4.5 or later is required; 1.4.11 is recommended])])])
31 AC_CACHE_CHECK([how m4 supports trace files], [ac_cv_prog_gnu_m4_debugfile],
32 [case `$M4 --help < /dev/null 2>&1` in
33 *debugfile*) ac_cv_prog_gnu_m4_debugfile=--debugfile ;;
34 *) ac_cv_prog_gnu_m4_debugfile=--error-output ;;
36 AC_SUBST([M4_DEBUGFILE], [$ac_cv_prog_gnu_m4_debugfile])
39 # Compatibility for bootstrapping with Autoconf 2.61.
40 dnl FIXME - replace this with AC_PREREQ([2.62]) after the release.
41 # AC_PATH_PROGS_FEATURE_CHECK was added the same time the slightly broken,
42 # undocumented _AC_PATH_PROG_FEATURE_CHECK was deleted.
43 m4_ifndef([AC_PATH_PROGS_FEATURE_CHECK],
44 [m4_define([AC_PATH_PROGS_FEATURE_CHECK],
45 [_AC_PATH_PROG_FEATURE_CHECK([$1], [$2], [$3], [$5])