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.
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 ## ------------------ ##
74 ## ----------------------- ##
75 ## Libtool initialization. ##
76 ## ----------------------- ##
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
85 save_LDFLAGS="$LDFLAGS"
86 CFLAGS="$CFLAGS $LTDLINCL"
87 LDFLAGS="$LDFLAGS $LIBLTDL"
88 AC_CHECK_LIB([ltdl], [lt_dlhandle_iterate],
90 [AC_MSG_ERROR([installed libltdl is too old])])
91 LDFLAGS="$save_LDFLAGS"
96 # Use gcc's -pipe option if available: for faster compilation.
99 * ) _LT_COMPILER_OPTION([if $compiler supports -pipe],
100 [M4_cv_prog_compiler_pipe],
101 [-pipe -c conftest.$ac_ext], [],
102 [CFLAGS="$CFLAGS -pipe"])
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])
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
127 if test "$use_modules" != yes; then
128 for module in $use_modules; do
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])
136 DLPREOPEN="$DLPREOPEN -dlpreopen $dir/$module.la"
137 PREOPEN_DEPENDENCIES="$PREOPEN_DEPENDENCIES $dir/$module.la"
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])
155 ## --------------- ##
156 ## Gnulib support. ##
157 ## --------------- ##
160 # Gnulib doesn't always do things quite the way M4 would like...
168 ## ------------------------ ##
169 ## Other external programs. ##
170 ## ------------------------ ##
171 AC_PATH_PROG([PERL], [perl])
175 ## --------------------------- ##
176 ## C compiler characteristics. ##
177 ## --------------------------- ##
179 AC_CHECK_SIZEOF([long long int])
183 ## ------------------------- ##
184 ## C headers required by M4. ##
185 ## ------------------------- ##
186 AC_CHECK_HEADERS_ONCE([limits.h])
188 if test $ac_cv_header_stdbool_h = yes; then
189 INCLUDE_STDBOOL_H='#include <stdbool.h>'
191 INCLUDE_STDBOOL_H='#include <gnu/stdbool.h>'
193 AC_SUBST([INCLUDE_STDBOOL_H])
197 ## --------------------------------- ##
198 ## Library functions required by M4. ##
199 ## --------------------------------- ##
200 AC_CHECK_FUNCS_ONCE([calloc strerror])
206 # This is for the modules
209 AC_CHECK_FUNCS_ONCE([getcwd gethostname mktime uname])
210 AC_CHECK_FUNCS_ONCE([setenv unsetenv putenv clearenv])
213 ## ------------------ ##
214 ## Configure options. ##
215 ## ------------------ ##
218 AM_CONDITIONAL([USE_GMP], [test "x$USE_GMP" = xyes])
229 m4/system.h:m4/system_.h