| 1 | # Configure template for GNU M4. -*-Autoconf-*-
|
|---|
| 2 | # Copyright (C) 1991, 1993, 1994, 2004, 2005, 2006 Free Software
|
|---|
| 3 | # Foundation, Inc.
|
|---|
| 4 | #
|
|---|
| 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.
|
|---|
| 9 | #
|
|---|
| 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.
|
|---|
| 14 | #
|
|---|
| 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
|
|---|
| 18 | # 02110-1301 USA
|
|---|
| 19 |
|
|---|
| 20 | AC_PREREQ([2.60])
|
|---|
| 21 | AC_INIT([GNU M4], [1.4.8], [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])
|
|---|
| 25 |
|
|---|
| 26 | m4_pattern_forbid([^M4_[A-Z]])
|
|---|
| 27 |
|
|---|
| 28 | AC_CONFIG_SRCDIR([src/m4.h])
|
|---|
| 29 | AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
|
|---|
| 30 |
|
|---|
| 31 | AC_CANONICAL_BUILD
|
|---|
| 32 | AC_CANONICAL_HOST
|
|---|
| 33 | AC_PROG_CC
|
|---|
| 34 | M4_EARLY
|
|---|
| 35 |
|
|---|
| 36 | AC_CHECK_HEADERS_ONCE([limits.h siginfo.h sys/wait.h])
|
|---|
| 37 | AC_CHECK_TYPES([siginfo_t], [], [],
|
|---|
| 38 | [[#include <signal.h>
|
|---|
| 39 | #if HAVE_SIGINFO_H
|
|---|
| 40 | # include <siginfo.h>
|
|---|
| 41 | #endif
|
|---|
| 42 | ]])
|
|---|
| 43 | AC_CHECK_MEMBERS([struct sigaction.sa_sigaction], [], [],
|
|---|
| 44 | [[#include <signal.h>
|
|---|
| 45 | ]])
|
|---|
| 46 |
|
|---|
| 47 | AC_TYPE_SIGNAL
|
|---|
| 48 | AC_TYPE_SIZE_T
|
|---|
| 49 |
|
|---|
| 50 | AC_CHECK_FUNCS_ONCE([sigaction sigaltstack sigstack sigvec strerror])
|
|---|
| 51 |
|
|---|
| 52 | M4_INIT
|
|---|
| 53 |
|
|---|
| 54 | # Code from Jim Avera <jima@netcom.com>.
|
|---|
| 55 | # stackovf.c requires:
|
|---|
| 56 | # 1. Either sigaction with SA_ONSTACK, or sigvec with SV_ONSTACK
|
|---|
| 57 | # 2. Either sigaltstack or sigstack
|
|---|
| 58 | # 3. getrlimit, including support for RLIMIT_STACK
|
|---|
| 59 | AC_CACHE_CHECK([if stack overflow is detectable], [M4_cv_use_stackovf],
|
|---|
| 60 | [M4_cv_use_stackovf=no
|
|---|
| 61 | if test "$ac_cv_func_sigaction" = yes || test "$ac_cv_func_sigvec" = yes; then
|
|---|
| 62 | if test "$ac_cv_func_sigaltstack" = yes || test "$ac_cv_func_sigstack" = yes; then
|
|---|
| 63 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
|---|
| 64 | #include <sys/time.h>
|
|---|
| 65 | #include <sys/resource.h>
|
|---|
| 66 | #include <signal.h>
|
|---|
| 67 | ]], [[struct rlimit r; getrlimit (RLIMIT_STACK, &r);
|
|---|
| 68 | #if (!defined(HAVE_SIGACTION) || !defined(SA_ONSTACK)) \
|
|---|
| 69 | && (!defined(HAVE_SIGVEC) || !defined(SV_ONSTACK))
|
|---|
| 70 | choke me /* SA_ONSTACK and/or SV_ONSTACK are not defined */
|
|---|
| 71 | #endif
|
|---|
| 72 | ]])], [M4_cv_use_stackovf=yes])
|
|---|
| 73 | fi
|
|---|
| 74 | fi])
|
|---|
| 75 | AM_CONDITIONAL([STACKOVF], [test "$M4_cv_use_stackovf" = yes])
|
|---|
| 76 | if test "$M4_cv_use_stackovf" = yes; then
|
|---|
| 77 | AC_DEFINE([USE_STACKOVF], [1],
|
|---|
| 78 | [Define to 1 if using stack overflow detection])
|
|---|
| 79 | AC_CHECK_TYPES([rlim_t], [],
|
|---|
| 80 | [AC_DEFINE([rlim_t], [int],
|
|---|
| 81 | [Define to int if rlim_t is not defined in sys/resource.h])],
|
|---|
| 82 | [[#include <sys/resource.h>
|
|---|
| 83 | ]])
|
|---|
| 84 | AC_CHECK_TYPES([stack_t], [],
|
|---|
| 85 | [AC_DEFINE([stack_t], [struct sigaltstack],
|
|---|
| 86 | [Define to struct sigaltstack if stack_t is not in signal.h])],
|
|---|
| 87 | [[#include <signal.h>
|
|---|
| 88 | ]])
|
|---|
| 89 | AC_CHECK_TYPES([sigcontext], [], [], [[#include <signal.h>
|
|---|
| 90 | ]])
|
|---|
| 91 | fi
|
|---|
| 92 |
|
|---|
| 93 | AC_CACHE_CHECK([if system() agrees with pclose()],
|
|---|
| 94 | [M4_cv_func_system_consistent],
|
|---|
| 95 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([
|
|---|
| 96 | #include <stdio.h>
|
|---|
| 97 | #include <stdlib.h>
|
|---|
| 98 | #include <errno.h>
|
|---|
| 99 | ], [int i1, i2;
|
|---|
| 100 | FILE *f;
|
|---|
| 101 | i1 = system ("exit 2");
|
|---|
| 102 | if (i1 == -1)
|
|---|
| 103 | return 1;
|
|---|
| 104 | f = popen ("exit 2", "r");
|
|---|
| 105 | if (!f)
|
|---|
| 106 | return 1;
|
|---|
| 107 | i2 = pclose (f);
|
|---|
| 108 | return i1 != i2;])],
|
|---|
| 109 | [M4_cv_func_system_consistent=yes], [M4_cv_func_system_consistent=no],
|
|---|
| 110 | [AC_COMPILE_IFELSE([
|
|---|
| 111 | /* EMX on OS/2 defines WEXITSTATUS to be (x>>8)&0xff, and uses that for
|
|---|
| 112 | pclose(), but for system() it uses x&0xff instead. Otherwise, we assume
|
|---|
| 113 | your system is sane and that pclose() and system() are consistent in their
|
|---|
| 114 | values. If this heuristic is wrong for your platform, report it as a bug
|
|---|
| 115 | to bug-m4@gnu.org. */
|
|---|
| 116 | #ifdef __EMX__
|
|---|
| 117 | choke me
|
|---|
| 118 | #endif
|
|---|
| 119 | ], [M4_cv_func_system_consistent=yes], [M4_cv_func_system_consistent=no])])])
|
|---|
| 120 | if test "$M4_cv_func_system_consistent" = no ; then
|
|---|
| 121 | AC_DEFINE([FUNC_SYSTEM_BROKEN], [1],
|
|---|
| 122 | [Define to 1 if the return value of system() disagrees with pclose().])
|
|---|
| 123 | fi
|
|---|
| 124 |
|
|---|
| 125 | dnl Don't let changeword get in our way, if bootstrapping with a version of
|
|---|
| 126 | dnl m4 that already turned the feature on.
|
|---|
| 127 | m4_ifdef([changeword], [m4_undefine([changeword])])dnl
|
|---|
| 128 |
|
|---|
| 129 | AC_MSG_CHECKING([[if changeword is wanted]])
|
|---|
| 130 | AC_ARG_ENABLE([changeword],
|
|---|
| 131 | [AS_HELP_STRING([--enable-changeword],
|
|---|
| 132 | [enable -W and changeword() builtin])],
|
|---|
| 133 | [if test "$enableval" = yes; then
|
|---|
| 134 | AC_MSG_RESULT([yes])
|
|---|
| 135 | AC_DEFINE([ENABLE_CHANGEWORD], [1],
|
|---|
| 136 | [Define to 1 if the changeword(REGEXP) functionality is wanted])
|
|---|
| 137 | else
|
|---|
| 138 | AC_MSG_RESULT([no])
|
|---|
| 139 | fi], [AC_MSG_RESULT([no])])
|
|---|
| 140 |
|
|---|
| 141 | M4_WITH_DMALLOC
|
|---|
| 142 |
|
|---|
| 143 | AC_CONFIG_COMMANDS([stamp-h], [[test -z "$CONFIG_HEADERS" || date > stamp-h]])
|
|---|
| 144 |
|
|---|
| 145 | AC_CONFIG_FILES([Makefile
|
|---|
| 146 | doc/Makefile
|
|---|
| 147 | lib/Makefile
|
|---|
| 148 | src/Makefile
|
|---|
| 149 | checks/Makefile
|
|---|
| 150 | examples/Makefile
|
|---|
| 151 | ])
|
|---|
| 152 |
|
|---|
| 153 | AC_OUTPUT
|
|---|