Stage 7: add chained token support to input parser.
[m4/ericb.git] / configure.ac
blob630c40b5be23fc415e61f83056c16d76aea73c2f
1 # Configure template for GNU M4.                        -*-Autoconf-*-
2 # Copyright (C) 1991, 1993, 1994, 2004, 2005, 2006, 2007 Free Software
3 # Foundation, Inc.
5 # This file is part of GNU M4.
7 # GNU M4 is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # GNU M4 is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 AC_PREREQ([2.60])
21 AC_INIT([GNU M4], [1.4.10a], [bug-m4@gnu.org])
22 AC_CONFIG_AUX_DIR([build-aux])
24 AM_INIT_AUTOMAKE([1.9.6 dist-bzip2 gnu])
26 m4_pattern_forbid([^M4_[A-Z]])
28 AC_CONFIG_SRCDIR([src/m4.h])
29 AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
31 AC_CANONICAL_BUILD
32 AC_CANONICAL_HOST
33 AC_PROG_CC
34 M4_EARLY
36 AC_SYS_LARGEFILE
37 AC_CHECK_HEADERS_ONCE([limits.h siginfo.h sys/wait.h])
38 AC_CHECK_TYPES([siginfo_t], [], [],
39 [[#include <signal.h>
40 #if HAVE_SIGINFO_H
41 # include <siginfo.h>
42 #endif
43 ]])
44 AC_CHECK_MEMBERS([struct sigaction.sa_sigaction], [], [],
45 [[#include <signal.h>
46 ]])
47 AC_CHECK_MEMBERS([stack_t.ss_sp], [], [],
48 [[#include <signal.h>
49 #if HAVE_SIGINFO_H
50 # include <siginfo.h>
51 #endif
52 ]])
54 AC_TYPE_SIGNAL
55 AC_TYPE_SIZE_T
57 AC_CHECK_FUNCS_ONCE([sigaction sigaltstack sigstack sigvec strerror])
59 # Tandem/NSK is broken - it has 'long long int' but not
60 # 'unsigned long long int', which confuses assumptions made by gnulib.
61 # Simply pretend that neither type exists if both do not work.
62 AC_TYPE_LONG_LONG_INT
63 AC_TYPE_UNSIGNED_LONG_LONG_INT
64 if test $ac_cv_type_long_long_int:$ac_cv_type_unsigned_long_long_int = yes:no
65 then
66   ac_cv_type_long_long_int=no
67   AC_DEFINE([HAVE_LONG_LONG_INT], 0,
68     [Define to 1 if the system has the type `long long int'.])
71 M4_INIT
73 # Code from Jim Avera <jima@netcom.com>.
74 # stackovf.c requires:
75 #  1. Either sigaction with SA_ONSTACK, or sigvec with SV_ONSTACK
76 #  2. Either sigaltstack or sigstack
77 #  3. getrlimit, including support for RLIMIT_STACK
78 AC_CACHE_CHECK([if stack overflow is detectable], [M4_cv_use_stackovf],
79 [M4_cv_use_stackovf=no
80 if test "$ac_cv_func_sigaction" = yes || test "$ac_cv_func_sigvec" = yes; then
81   if test "$ac_cv_func_sigaltstack" = yes || test "$ac_cv_func_sigstack" = yes; then
82     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
83 #include <sys/time.h>
84 #include <sys/resource.h>
85 #include <signal.h>
86 ]], [[struct rlimit r; getrlimit (RLIMIT_STACK, &r);
87 #if (!defined(HAVE_SIGACTION) || !defined(SA_ONSTACK)) \
88     && (!defined(HAVE_SIGVEC) || !defined(SV_ONSTACK))
89 choke me                /* SA_ONSTACK and/or SV_ONSTACK are not defined */
90 #endif
91 ]])], [M4_cv_use_stackovf=yes])
92   fi
93 fi])
94 AM_CONDITIONAL([STACKOVF], [test "$M4_cv_use_stackovf" = yes])
95 if test "$M4_cv_use_stackovf" = yes; then
96   AC_DEFINE([USE_STACKOVF], [1],
97     [Define to 1 if using stack overflow detection])
98   AC_CHECK_TYPES([rlim_t], [],
99     [AC_DEFINE([rlim_t], [int],
100       [Define to int if rlim_t is not defined in sys/resource.h])],
101     [[#include <sys/resource.h>
102   ]])
103   AC_CHECK_TYPES([stack_t], [],
104     [AC_DEFINE([stack_t], [struct sigaltstack],
105       [Define to struct sigaltstack if stack_t is not in signal.h])],
106     [[#include <signal.h>
107   ]])
108   AC_CHECK_TYPES([sigcontext], [], [], [[#include <signal.h>
109   ]])
112 AC_CACHE_CHECK([if system() agrees with pclose()],
113   [M4_cv_func_system_consistent],
114   [AC_RUN_IFELSE([AC_LANG_PROGRAM([
115 #include <stdio.h>
116 #include <stdlib.h>
117 #include <errno.h>
118 ], [int i1, i2;
119   FILE *f;
120   i1 = system ("exit 2");
121   if (i1 == -1)
122     return 1;
123   f = popen ("exit 2", "r");
124   if (!f)
125     return 1;
126   i2 = pclose (f);
127   return i1 != i2;])],
128   [M4_cv_func_system_consistent=yes], [M4_cv_func_system_consistent=no],
129   [AC_COMPILE_IFELSE([
130 /* EMX on OS/2 defines WEXITSTATUS to be (x>>8)&0xff, and uses that for
131    pclose(), but for system() it uses x&0xff instead.  Otherwise, we assume
132    your system is sane and that pclose() and system() are consistent in their
133    values.  If this heuristic is wrong for your platform, report it as a bug
134    to bug-m4@gnu.org.  */
135 #ifdef __EMX__
136 choke me
137 #endif
138 ], [M4_cv_func_system_consistent=yes], [M4_cv_func_system_consistent=no])])])
139 if test "$M4_cv_func_system_consistent" = no ; then
140   AC_DEFINE([FUNC_SYSTEM_BROKEN], [1],
141     [Define to 1 if the return value of system() disagrees with pclose().])
144 dnl Don't let changeword get in our way, if bootstrapping with a version of
145 dnl m4 that already turned the feature on.
146 m4_ifdef([changeword], [m4_undefine([changeword])])dnl
148 AC_MSG_CHECKING([[if changeword is wanted]])
149 AC_ARG_ENABLE([changeword],
150   [AS_HELP_STRING([--enable-changeword],
151      [enable -W and changeword() builtin])],
152   [if test "$enableval" = yes; then
153     AC_MSG_RESULT([yes])
154     AC_DEFINE([ENABLE_CHANGEWORD], [1],
155       [Define to 1 if the changeword(REGEXP) functionality is wanted])
156   else
157     AC_MSG_RESULT([no])
158   fi], [AC_MSG_RESULT([no])])
160 M4_WITH_DMALLOC
162 AC_CONFIG_COMMANDS([stamp-h], [[test -z "$CONFIG_HEADERS" || date > stamp-h]])
164 AC_CONFIG_FILES([Makefile
165                  doc/Makefile
166                  lib/Makefile
167                  src/Makefile
168                  tests/Makefile
169                  checks/Makefile
170                  examples/Makefile
173 AC_OUTPUT