1# m4.m4 serial 2
2dnl Copyright (C) 2000, 2006 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7# AC_PROG_GNU_M4
8# --------------
9# Check for GNU m4, at least 1.3 (supports frozen files).
10# Also, check whether --error-output (through 1.4.x) or --debugfile (2.0)
11# is supported, and AC_SUBST M4_DEBUGFILE accordingly.
12AC_DEFUN([AC_PROG_GNU_M4],
13[AC_PATH_PROGS([M4], [gm4 gnum4 m4], [m4])
14AC_CACHE_CHECK([whether m4 supports frozen files], [ac_cv_prog_gnu_m4],
15[ac_cv_prog_gnu_m4=no
16if test x"$M4" != x; then
17  case `$M4 --help < /dev/null 2>&1` in
18    *reload-state*) ac_cv_prog_gnu_m4=yes ;;
19  esac
20fi])
21if test $ac_cv_prog_gnu_m4 = yes ; then
22  AC_CACHE_CHECK([how m4 supports trace files], [ac_cv_prog_gnu_m4_debugfile],
23  [case `$M4 --help < /dev/null 2>&1` in
24    *debugfile*) ac_cv_prog_gnu_m4_debugfile=--debugfile ;;
25    *) ac_cv_prog_gnu_m4_debugfile=--error-output ;;
26  esac])
27  AC_SUBST([M4_DEBUGFILE], $ac_cv_prog_gnu_m4_debugfile)
28fi
29])
30