Update to latest gnulib.
[m4/ericb.git] / configure.ac
blob32eb9da36fb1d38f7bf9c4252a38a1284a39680f
1 # Configure template for GNU m4.                        -*-Autoconf-*-
2 # Copyright (C) 1991, 1992, 1993, 1994, 2000, 2001, 2002, 2004, 2005,
3 # 2006, 2007, 2008, 2009 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 dnl We depend on autotest's ./testsuite -C.
21 AC_PREREQ([2.62])
23 ## ------------------------ ##
24 ## Autoconf initialization. ##
25 ## ------------------------ ##
26 m4_define([M4_VERSION],
27           m4_esyscmd([build-aux/git-version-gen .tarball-version]))
28 m4_bmatch(m4_defn([M4_VERSION]), [^[0-9]], [],
29           [m4_define([M4_VERSION], [1.9a])])
30 AC_INIT([GNU M4], m4_defn([M4_VERSION]), [bug-m4@gnu.org])
32 AC_CONFIG_SRCDIR([src/m4.h])
33 AC_CONFIG_AUX_DIR([build-aux])
34 AC_CONFIG_MACRO_DIR([ltdl/m4])
35 AC_CONFIG_LIBOBJ_DIR([gnu])
36 AC_CONFIG_TESTDIR([tests])
37 AC_CONFIG_HEADERS([gnu/config.h:gnu/config.hin])
38 AC_CONFIG_FILES([tests/m4], [chmod +x tests/m4])
41 ## -------------------------- ##
42 ## M4 specific configuration. ##
43 ## -------------------------- ##
44 dnl Autoconf recommends that packages use lowercase for their package-specific
45 dnl prefix for cache variables.  But in the case of m4, that collides with
46 dnl the m4_ namespace provided by m4sugar, so we prefer M4_ as our
47 dnl package-specific prefix.
48 m4_pattern_forbid([^M4_[A-Z]])
50 AC_DEFUN([M4_DEFAULT_PRELOAD], [m4 traditional gnu])
51 M4_default_preload="M4_DEFAULT_PRELOAD"
54 ## ------------------------ ##
55 ## Automake Initialization. ##
56 ## ------------------------ ##
57 AM_INIT_AUTOMAKE([1.10b subdir-objects dist-bzip2 dist-xz
58 color-tests parallel-tests silent-rules]
59 m4_if(m4_index(m4_defn([M4_VERSION]), [-]), [-1], [gnits], [gnu]))
62 ## ------------------ ##
63 ## C compiler checks. ##
64 ## ------------------ ##
65 AC_PROG_CC
66 M4_EARLY
68 AC_SYS_LARGEFILE
69 AC_PROG_CPP
70 AM_PROG_CC_C_O
71 M4_CHECK_DEBUGGING
74 ## ----------------------- ##
75 ## Libtool initialization. ##
76 ## ----------------------- ##
77 LT_PREREQ([2.2])
78 LT_CONFIG_LTDL_DIR([ltdl])
79 LT_INIT([shared dlopen win32-dll])
80 LTDL_INIT([nonrecursive])
82 # The lt_dlhandle_iterate symbol was added with libtool-2.2
83 if test "x$with_included_ltdl" != "xyes"; then
84   save_CFLAGS="$CFLAGS"
85   save_LDFLAGS="$LDFLAGS"
86   CFLAGS="$CFLAGS $LTDLINCL"
87   LDFLAGS="$LDFLAGS $LIBLTDL"
88   AC_CHECK_LIB([ltdl], [lt_dlhandle_iterate],
89              [],
90      [AC_MSG_ERROR([installed libltdl is too old])])
91   LDFLAGS="$save_LDFLAGS"
92   CFLAGS="$save_CFLAGS"
96 # Use gcc's -pipe option if available: for faster compilation.
97 case "$CFLAGS" in
98   *-pipe* ) ;;
99         * ) _LT_COMPILER_OPTION([if $compiler supports -pipe],
100                 [M4_cv_prog_compiler_pipe],
101                 [-pipe -c conftest.$ac_ext], [],
102                 [CFLAGS="$CFLAGS -pipe"])
103               ;;
104 esac
106 ## ------------------------------- ##
107 ## Preloaded module configuration. ##
108 ## ------------------------------- ##
109 AS_IF([test "x$enable_shared" != xno],
110       [DYNAMIC_MODULES=yes], [DYNAMIC_MODULES=no])
111 AC_SUBST([DYNAMIC_MODULES], [$DYNAMIC_MODULES])
113 AC_MSG_CHECKING([for modules to preload])
114   DLPREOPEN=
116   AC_ARG_WITH([modules],
117     [AS_HELP_STRING([--with-modules=MODULES],
118                     [preload MODULES @<:@default: ]M4_DEFAULT_PRELOAD[@:>@])],
119     [use_modules="$withval"],
120     [use_modules="$M4_default_preload"])
122   PREOPEN_DEPENDENCIES=
123   DLPREOPEN="-dlpreopen force"
124   if test -z "$use_modules"; then
125     use_modules=none
126   else
127     if test "$use_modules" != yes; then
128       for module in $use_modules; do
129         case $module in
130           no|none) break ;;
131           m4|traditional|gnu|load|mpeval) dir=modules ;;
132           import|modtest|shadow|stdlib|time) dir=tests ;;
133           *) AC_MSG_ERROR([Unrecognized module `$module' in --with-modules])
134             ;;
135         esac
136         DLPREOPEN="$DLPREOPEN -dlpreopen $dir/$module.la"
137         PREOPEN_DEPENDENCIES="$PREOPEN_DEPENDENCIES $dir/$module.la"
138       done
139     fi
140   fi
141 AC_MSG_RESULT([$use_modules])
142 AC_SUBST([DLPREOPEN])
143 AC_SUBST([PREOPEN_DEPENDENCIES])
146 ## ---------------- ##
147 ## Gettext support. ##
148 ## ---------------- ##
149 AM_GNU_GETTEXT([external], [need-formatstring-macros])
150 AM_GNU_GETTEXT_VERSION([0.16])
151 M4_GNU_GETTEXT
155 ## --------------- ##
156 ## Gnulib support. ##
157 ## --------------- ##
158 M4_INIT
160 gl_VERSION_ETC
162 # Gnulib doesn't always do things quite the way M4 would like...
163 M4_ERROR
164 M4_GETOPT
165 M4_OBSTACK
166 M4_REGEX
167 M4_RENAME
170 ## ------------------------ ##
171 ## Other external programs. ##
172 ## ------------------------ ##
173 AC_PATH_PROG([PERL], [perl])
177 ## --------------------------- ##
178 ## C compiler characteristics. ##
179 ## --------------------------- ##
180 AC_TYPE_SIZE_T
181 AC_CHECK_SIZEOF([long long int])
185 ## ------------------------- ##
186 ## C headers required by M4. ##
187 ## ------------------------- ##
188 AC_CHECK_HEADERS_ONCE([limits.h])
190 if test $ac_cv_header_stdbool_h = yes; then
191   INCLUDE_STDBOOL_H='#include <stdbool.h>'
192 else
193   INCLUDE_STDBOOL_H='#include <gnu/stdbool.h>'
195 AC_SUBST([INCLUDE_STDBOOL_H])
199 ## --------------------------------- ##
200 ## Library functions required by M4. ##
201 ## --------------------------------- ##
202 AC_CHECK_FUNCS_ONCE([calloc strerror])
204 AM_WITH_DMALLOC
206 M4_SYS_STACKOVF
208 # This is for the modules
209 AC_STRUCT_TM
210 AC_FUNC_STRFTIME
211 AC_CHECK_FUNCS_ONCE([getcwd gethostname mktime uname])
214 ## ------------------ ##
215 ## Configure options. ##
216 ## ------------------ ##
218 M4_LIB_GMP
219 AM_CONDITIONAL([USE_GMP], [test "x$USE_GMP" = xyes])
220 M4_SYSCMD
223 ## -------- ##
224 ## Outputs. ##
225 ## -------- ##
226 AC_CONFIG_FILES([
227 Makefile
228 gnu/Makefile
229 doc/Makefile
230 m4/system.h:m4/system_.h
231 tests/atlocal
232 tests/gnu/Makefile
235 AC_OUTPUT