1 # Configure template for GNU M4. -*-Autoconf-*-
2 # Copyright (C) 1991, 1993, 1994, 2004, 2005, 2006, 2007 Free Software
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/>.
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])
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], [], [],
47 AC_CHECK_MEMBERS([stack_t.ss_sp], [], [],
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.
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
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'.])
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([[
84 #include <sys/resource.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 */
91 ]])], [M4_cv_use_stackovf=yes])
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>
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>
108 AC_CHECK_TYPES([sigcontext], [], [], [[#include <signal.h>
112 AC_CACHE_CHECK([if system() agrees with pclose()],
113 [M4_cv_func_system_consistent],
114 [AC_RUN_IFELSE([AC_LANG_PROGRAM([
120 i1 = system ("exit 2");
123 f = popen ("exit 2", "r");
128 [M4_cv_func_system_consistent=yes], [M4_cv_func_system_consistent=no],
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. */
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
154 AC_DEFINE([ENABLE_CHANGEWORD], [1],
155 [Define to 1 if the changeword(REGEXP) functionality is wanted])
158 fi], [AC_MSG_RESULT([no])])
162 AC_CONFIG_COMMANDS([stamp-h], [[test -z "$CONFIG_HEADERS" || date > stamp-h]])
164 AC_CONFIG_FILES([Makefile