Stage 1: convert m4_symbol_value** into new object.
[m4.git] / configure.ac
blobd9790e92fba17e387fe46352d559ff13ceba46e7
1 # Configure template for GNU m4.                        -*-Autoconf-*-
2 # Copyright (C) 1991, 1992, 1993, 1994, 2000, 2001, 2002, 2004, 2005, 2006,
3 # 2007 Free Software 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])
22 ## ------------------------ ##
23 ## Autoconf initialization. ##
24 ## ------------------------ ##
25 AC_INIT([GNU M4], [1.9a], [bug-m4@gnu.org])
27 AC_CONFIG_SRCDIR([src/m4.h])
28 AC_CONFIG_AUX_DIR([build-aux])
29 AC_CONFIG_MACRO_DIR([ltdl/m4])
30 AC_CONFIG_LIBOBJ_DIR([gnu])
31 AC_CONFIG_TESTDIR([tests])
32 AC_CONFIG_HEADERS([gnu/config.h:gnu/config.hin])
33 AC_CONFIG_FILES([tests/m4], [chmod +x tests/m4])
36 ## ---------------------------------------- ##
37 ## Display a configure time version banner. ##
38 ## ---------------------------------------- ##
39 TIMESTAMP=
40 case AC_PACKAGE_VERSION in
41   *[[acegikmoqsuwy]])
42     TIMESTAMP=`$CONFIG_SHELL $ac_aux_dir/mkstamp < $srcdir/ChangeLog`
43     test -z "$TIMESTAMP" || TIMESTAMP=" Build:$TIMESTAMP"
44     AS_BOX([Configuring AC_PACKAGE_TARNAME][$TIMESTAMP AC_PACKAGE_VERSION])
45     echo
46     ;;
47 esac
48 AC_DEFINE_UNQUOTED([TIMESTAMP], ["$TIMESTAMP"],
49     [Defined to a CVS timestamp for alpha releases of M4])
50 AB_INIT()
53 ## -------------------------- ##
54 ## M4 specific configuration. ##
55 ## -------------------------- ##
56 dnl Autoconf recommends that packages use lowercase for their package-specific
57 dnl prefix for cache variables.  But in the case of m4, that collides with
58 dnl the m4_ namespace provided by m4sugar, so we prefer M4_ as our
59 dnl package-specific prefix.
60 m4_pattern_forbid([^M4_[A-Z]])
62 AC_DEFUN([M4_DEFAULT_PRELOAD], [m4 traditional gnu])
63 M4_default_preload="M4_DEFAULT_PRELOAD"
66 ## ------------------------ ##
67 ## Automake Initialization. ##
68 ## ------------------------ ##
69 AM_INIT_AUTOMAKE([1.10a subdir-objects dist-bzip2 gnits])
73 ## ------------------ ##
74 ## C compiler checks. ##
75 ## ------------------ ##
76 AC_PROG_CC
77 M4_EARLY
79 AC_SYS_LARGEFILE
80 AC_PROG_CPP
81 AM_PROG_CC_C_O
82 M4_CHECK_DEBUGGING
86 ## ----------------------- ##
87 ## Libtool initialization. ##
88 ## ----------------------- ##
89 LT_PREREQ([2.0])
90 LT_CONFIG_LTDL_DIR([ltdl])
91 LT_INIT([shared dlopen win32-dll])
92 LT_WITH_LTDL([ltdl])
94 # Use gcc's -pipe option if available: for faster compilation.
95 case "$CFLAGS" in
96   *-pipe* ) ;;
97         * ) _LT_COMPILER_OPTION([if $compiler supports -pipe],
98                 [M4_cv_prog_compiler_pipe],
99                 [-pipe -c conftest.$ac_ext], [],
100                 [CFLAGS="$CFLAGS -pipe"])
101               ;;
102 esac
104 ## ------------------------------- ##
105 ## Preloaded module configuration. ##
106 ## ------------------------------- ##
107 AS_IF([test "x$enable_shared" != xno],
108       [DYNAMIC_MODULES=yes], [DYNAMIC_MODULES=no])
109 AC_SUBST([DYNAMIC_MODULES], [$DYNAMIC_MODULES])
111 AC_MSG_CHECKING([for modules to preload])
112   DLPREOPEN=
114   AC_ARG_WITH([modules],
115     [AS_HELP_STRING([--with-modules=MODULES],
116                     [preload MODULES @<:@default: ]M4_DEFAULT_PRELOAD[@:>@])],
117     [use_modules="$withval"],
118     [use_modules="$M4_default_preload"])
120   PREOPEN_DEPENDENCIES=
121   DLPREOPEN="-dlpreopen force"
122   if test -z "$use_modules"; then
123     use_modules=none
124   else
125     if test "$use_modules" != yes; then
126       for module in $use_modules; do
127         case $module in
128           no|none) break ;;
129           m4|traditional|gnu|load|mpeval) dir=modules ;;
130           import|modtest|shadow|stdlib|time) dir=tests ;;
131           *) AC_MSG_ERROR([Unrecognized module `$module' in --with-modules])
132             ;;
133         esac
134         DLPREOPEN="$DLPREOPEN -dlpreopen $dir/$module.la"
135         PREOPEN_DEPENDENCIES="$PREOPEN_DEPENDENCIES $dir/$module.la"
136       done
137     fi
138   fi
139 AC_MSG_RESULT([$use_modules])
140 AC_SUBST([DLPREOPEN])
141 AC_SUBST([PREOPEN_DEPENDENCIES])
144 ## ---------------- ##
145 ## Gettext support. ##
146 ## ---------------- ##
147 dnl M4 1.4.4 and earlier had a bug that tracing a macro made it falsely
148 dnl appear as defined with an empty definition, even though `invoking'
149 dnl the macro resulted in the macro name.  Gettext relies on whether
150 dnl AM_GNU_GETTEXT_INTL_SUBDIR is defined, and automake traces this
151 dnl macro, but we don't want to use an intl subdir, hence this workaround
152 dnl to allow bootstrapping even on systems with old M4.
153 dnl http://lists.gnu.org/archive/html/bug-gnu-utils/2006-11/msg00096.html
154 m4_ifdef([AM_GNU_GETTEXT_INTL_SUBDIR],
155   [m4_if(m4_defn([AM_GNU_GETTEXT_INTL_SUBDIR]),[],
156     [m4_ifval(AM_GNU_GETTEXT_INTL_SUBDIR,
157       [m4_popdef([AM_GNU_GETTEXT_INTL_SUBDIR])])])])
159 AM_GNU_GETTEXT([external], [need-formatstring-macros])
160 AM_GNU_GETTEXT_VERSION([0.16])
161 M4_GNU_GETTEXT
165 ## --------------- ##
166 ## Gnulib support. ##
167 ## --------------- ##
168 M4_INIT
170 # Gnulib doesn't always do things quite the way M4 would like...
171 M4_ERROR
172 M4_GETOPT
173 M4_OBSTACK
174 M4_REGEX
177 ## ------------------------ ##
178 ## Other external programs. ##
179 ## ------------------------ ##
180 AC_PATH_PROG([PERL], [perl])
184 ## --------------------------- ##
185 ## C compiler characteristics. ##
186 ## --------------------------- ##
187 AC_TYPE_SIZE_T
188 AC_CHECK_SIZEOF([long long int])
192 ## ------------------------- ##
193 ## C headers required by M4. ##
194 ## ------------------------- ##
195 AC_CHECK_HEADERS_ONCE([limits.h sys/wait.h])
197 if test $ac_cv_header_stdbool_h = yes; then
198   INCLUDE_STDBOOL_H='#include <stdbool.h>'
199 else
200   INCLUDE_STDBOOL_H='#include <gnu/stdbool.h>'
202 AC_SUBST([INCLUDE_STDBOOL_H])
206 ## --------------------------------- ##
207 ## Library functions required by M4. ##
208 ## --------------------------------- ##
209 AC_CHECK_FUNCS_ONCE([calloc strerror])
211 AM_WITH_DMALLOC
213 M4_SYS_STACKOVF
215 # This is for the modules
216 AC_STRUCT_TM
217 AC_FUNC_STRFTIME
218 AC_CHECK_FUNCS_ONCE([getcwd gethostname mktime uname])
219 AC_CHECK_FUNCS_ONCE([setenv unsetenv putenv clearenv])
221 M4_LIB_GMP
222 AM_CONDITIONAL([USE_GMP], [test "x$USE_GMP" = xyes])
226 ## -------- ##
227 ## Outputs. ##
228 ## -------- ##
229 AC_CONFIG_FILES([
230 Makefile
231 gnu/Makefile
232 m4/system.h:m4/system_.h
233 tests/atlocal
234 tests/gnu/Makefile
237 AC_OUTPUT