Prefer buffer over byte operations.
[m4.git] / configure.ac
blobd8962cc6e3a66e0f0e6dc1fe6c61ab90f4ecf279
1 # Configure template for GNU m4.                        -*-Autoconf-*-
2 # Copyright (C) 1991, 1992, 1993, 1994, 2000, 2001, 2002, 2004, 2005, 2006,
3 # 2007, 2008 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])
40 ## -------------------------- ##
41 ## M4 specific configuration. ##
42 ## -------------------------- ##
43 dnl Autoconf recommends that packages use lowercase for their package-specific
44 dnl prefix for cache variables.  But in the case of m4, that collides with
45 dnl the m4_ namespace provided by m4sugar, so we prefer M4_ as our
46 dnl package-specific prefix.
47 m4_pattern_forbid([^M4_[A-Z]])
49 AC_DEFUN([M4_DEFAULT_PRELOAD], [m4 traditional gnu])
50 M4_default_preload="M4_DEFAULT_PRELOAD"
53 ## ------------------------ ##
54 ## Automake Initialization. ##
55 ## ------------------------ ##
56 AM_INIT_AUTOMAKE([1.10a subdir-objects dist-bzip2 dist-lzma]
57 m4_bmatch(m4_defn([M4_VERSION]), [-], [gnu], [gnits]))
61 ## ------------------ ##
62 ## C compiler checks. ##
63 ## ------------------ ##
64 AC_PROG_CC
65 M4_EARLY
67 AC_SYS_LARGEFILE
68 AC_PROG_CPP
69 AM_PROG_CC_C_O
70 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 # Gnulib doesn't always do things quite the way M4 would like...
161 M4_ERROR
162 M4_GETOPT
163 M4_OBSTACK
164 M4_REGEX
165 M4_RENAME
168 ## ------------------------ ##
169 ## Other external programs. ##
170 ## ------------------------ ##
171 AC_PATH_PROG([PERL], [perl])
175 ## --------------------------- ##
176 ## C compiler characteristics. ##
177 ## --------------------------- ##
178 AC_TYPE_SIZE_T
179 AC_CHECK_SIZEOF([long long int])
183 ## ------------------------- ##
184 ## C headers required by M4. ##
185 ## ------------------------- ##
186 AC_CHECK_HEADERS_ONCE([limits.h sys/wait.h])
188 if test $ac_cv_header_stdbool_h = yes; then
189   INCLUDE_STDBOOL_H='#include <stdbool.h>'
190 else
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])
202 AM_WITH_DMALLOC
204 M4_SYS_STACKOVF
206 # This is for the modules
207 AC_STRUCT_TM
208 AC_FUNC_STRFTIME
209 AC_CHECK_FUNCS_ONCE([getcwd gethostname mktime uname])
210 AC_CHECK_FUNCS_ONCE([setenv unsetenv putenv clearenv])
212 M4_LIB_GMP
213 AM_CONDITIONAL([USE_GMP], [test "x$USE_GMP" = xyes])
217 ## -------- ##
218 ## Outputs. ##
219 ## -------- ##
220 AC_CONFIG_FILES([
221 Makefile
222 gnu/Makefile
223 m4/system.h:m4/system_.h
224 tests/atlocal
225 tests/gnu/Makefile
228 AC_OUTPUT