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