1 # Configure template for GNU M4. -*-Autoconf-*-
2 # Copyright (C) 1991, 1993, 1994, 2004, 2005, 2006 Free Software
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 AC_INIT([GNU M4], [1.4.5a], [bug-m4@gnu.org])
22 AM_INIT_AUTOMAKE([1.9.6 dist-bzip2 gnu])
23 PACKAGE=$PACKAGE_TARNAME; AC_SUBST([PACKAGE])
24 VERSION=$PACKAGE_VERSION; AC_SUBST([VERSION])
26 m4_pattern_forbid([^M4_])
27 m4_pattern_allow([^M4_cv_])
29 AC_CONFIG_SRCDIR([src/m4.h])
30 AC_CONFIG_HEADERS([config.h:config-h.in])
37 AC_CHECK_HEADERS_ONCE([limits.h siginfo.h sys/wait.h])
38 AC_CHECK_TYPES([siginfo_t], [], [],
44 AC_CHECK_MEMBERS([struct sigaction.sa_sigaction], [], [],
51 AC_CHECK_FUNCS_ONCE([sigaction sigaltstack sigstack sigvec strerror])
55 # Code from Jim Avera <jima@netcom.com>.
56 # stackovf.c requires:
57 # 1. Either sigaction with SA_ONSTACK, or sigvec with SV_ONSTACK
58 # 2. Either sigaltstack or sigstack
59 # 3. getrlimit, including support for RLIMIT_STACK
60 AC_CACHE_CHECK([if stack overflow is detectable], [M4_cv_use_stackovf],
61 [M4_cv_use_stackovf=no
62 if test "$ac_cv_func_sigaction" = yes || test "$ac_cv_func_sigvec" = yes; then
63 if test "$ac_cv_func_sigaltstack" = yes || test "$ac_cv_func_sigstack" = yes; then
64 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
66 #include <sys/resource.h>
68 ]], [[struct rlimit r; getrlimit (RLIMIT_STACK, &r);
69 #if (!defined(HAVE_SIGACTION) || !defined(SA_ONSTACK)) \
70 && (!defined(HAVE_SIGVEC) || !defined(SV_ONSTACK))
71 choke me /* SA_ONSTACK and/or SV_ONSTACK are not defined */
73 ]])], [M4_cv_use_stackovf=yes])
76 AM_CONDITIONAL([STACKOVF], [test "$M4_cv_use_stackovf" = yes])
77 if test "$M4_cv_use_stackovf" = yes; then
78 AC_DEFINE([USE_STACKOVF], [1],
79 [Define to 1 if using stack overflow detection])
80 AC_CHECK_TYPES([rlim_t], [],
81 [AC_DEFINE([rlim_t], [int],
82 [Define to int if rlim_t is not defined in sys/resource.h])],
83 [[#include <sys/resource.h>
85 AC_CHECK_TYPES([stack_t], [],
86 [AC_DEFINE([stack_t], [struct sigaltstack],
87 [Define to struct sigaltstack if stack_t is not in signal.h])],
90 AC_CHECK_TYPES([sigcontext], [], [], [[#include <signal.h>
94 AC_CACHE_CHECK([if system() agrees with pclose()],
95 [M4_cv_func_system_consistent],
96 [AC_RUN_IFELSE([AC_LANG_PROGRAM([
102 i1 = system ("exit 2");
105 f = popen ("exit 2", "r");
110 [M4_cv_func_system_consistent=yes], [M4_cv_func_system_consistent=no],
112 /* EMX on OS/2 defines WEXITSTATUS to be (x>>8)&0xff, and uses that for
113 pclose(), but for system() it uses x&0xff instead. Otherwise, we assume
114 your system is sane and that pclose() and system() are consistent in their
115 values. If this heuristic is wrong for your platform, report it as a bug
116 to bug-m4@gnu.org. */
120 ], [M4_cv_func_system_consistent=yes], [M4_cv_func_system_consistent=no])])])
121 if test "$M4_cv_func_system_consistent" = no ; then
122 AC_DEFINE([FUNC_SYSTEM_BROKEN], [1],
123 [Define to 1 if the return value of system() disagrees with pclose().])
126 dnl Don't let changeword get in our way, if bootstrapping with a version of
127 dnl m4 that already turned the feature on.
128 m4_ifdef([changeword], [m4_undefine([changeword])])dnl
130 AC_MSG_CHECKING([[if changeword is wanted]])
131 AC_ARG_ENABLE([changeword],
132 [AS_HELP_STRING([--enable-changeword],
133 [enable -W and changeword() builtin])],
134 [if test "$enableval" = yes; then
136 AC_DEFINE([ENABLE_CHANGEWORD], [1],
137 [Define to 1 if the changeword(REGEXP) functionality is wanted])
140 fi], [AC_MSG_RESULT([no])])
144 AC_CONFIG_COMMANDS([stamp-h], [[test -z "$CONFIG_HEADERS" || date > stamp-h]])
146 AC_CONFIG_FILES([Makefile