configury: remove vestigial libltdl references.
[m4/ericb.git] / configure.ac
blobc32d0cf73324ccad803e33ff77f0cf9b3c5366a8
1 # Configure template for GNU m4.           -*-Autoconf-*-
2 # Copyright (C) 1991-1994, 2000-2002, 2004-2014 Free Software
3 # 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([build-aux/m4])
35 AC_CONFIG_LIBOBJ_DIR([m4/gnu])
36 AC_CONFIG_TESTDIR([tests])
37 AC_CONFIG_HEADERS([config.h])
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], [])
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]))
60 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
63 ## ------------------ ##
64 ## C compiler checks. ##
65 ## ------------------ ##
66 AC_PROG_CC
67 AC_DEFUN([gl_CXX_CHOICE_DEFAULT_NO])
68 M4_EARLY
70 # Maintainer note - comment this line out if you plan to rerun
71 # GNULIB_POSIXCHECK testing to see if M4 should be using more modules.
72 # Leave it uncommented for normal releases, for faster ./configure.
73 gl_ASSERT_NO_GNULIB_POSIXCHECK
75 AC_SYS_LARGEFILE
76 AC_PROG_CPP
77 AM_PROG_CC_C_O
78 M4_CHECK_DEBUGGING
81 ## ----------------------- ##
82 ## Libtool initialization. ##
83 ## ----------------------- ##
84 LT_PREREQ([2.2])
85 LT_INIT([shared dlopen win32-dll])
87 AC_ARG_ENABLE([gcc-warnings],
88   [AS_HELP_STRING([--enable-gcc-warnings],
89                   [turn on lots of GCC warnings (for developers)])],
90   [case $enableval in
91      yes|no) ;;
92      *)      AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
93    esac
94    gl_gcc_warnings=$enableval],
95   [gl_gcc_warnings=no]
98 if test "$gl_gcc_warnings" = yes; then
99   gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
100   AC_SUBST([WERROR_CFLAGS])
102   # This, $nw, is the list of warnings we disable.
103   nw=
104   nw="$nw -Waggregate-return"       # K&R is anachronistic
105   nw="$nw -Wtraditional-conversion" # K&R is anachronistic
106   nw="$nw -Wundef"                  # K&R is anachronistic
107   nw="$nw -Wlong-long"              # C90 is anachronistic
108   nw="$nw -Wsystem-headers"         # Don't let system headers trigger warnings
109   nw="$nw -Wpadded"                 # Our structs are not packed
110   nw="$nw -Wformat-nonliteral"      # Needed in builtin.c
111   nw="$nw -Wconversion"             # Too many warnings for now
112   nw="$nw -Wsign-conversion"        # Too many warnings for now
113   nw="$nw -Wcast-qual"              # Too many warnings for now
114   nw="$nw -Wswitch-enum"            # Too many warnings for now
115   # gcc 4.4.6 complains enum-compare is C++ only; gcc 4.7.0 implies it in -Wall
116   nw="$nw -Wenum-compare"
118   # Gnulib uses '#pragma GCC diagnostic push' to silence some
119   # warnings, but older gcc doesn't support this.
120   AC_CACHE_CHECK([whether pragma GCC diagnostic push works],
121     [M4_cv_gcc_pragma_push_works], [
122     save_CFLAGS=$CFLAGS
123     CFLAGS='-Wunknown-pragmas -Werror'
124     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
125       #pragma GCC diagnostic push
126       #pragma GCC diagnostic pop
127     ]])],
128     [M4_cv_gcc_pragma_push_works=yes],
129     [M4_cv_gcc_pragma_push_works=no])
130     CFLAGS=$save_CFLAGS])
131   if test $M4_cv_gcc_pragma_push_works = no; then
132     nw="$nw -Wmissing-prototypes"
133     nw="$nw -Wmissing-declarations"
134     nw="$nw -Wunreachable-code"
135   fi
137   gl_MANYWARN_ALL_GCC([ws])
138   gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
139   for w in $ws; do
140     gl_WARN_ADD([$w])
141   done
143   gl_WARN_ADD([-fdiagnostics-show-option])
144   gl_WARN_ADD([-funit-at-a-time])
146   AC_SUBST([WARN_CFLAGS])
148   AH_VERBATIM([FORTIFY_SOURCE],
149   [/* Enable compile-time and run-time bounds-checking, and some warnings,
150       without upsetting newer glibc. */
151    #if defined __OPTIMIZE__ && __OPTIMIZE__
152    # define _FORTIFY_SOURCE 2
153    #endif
154   ])
157 # Use gcc's -pipe option if available: for faster compilation.
158 case "$CFLAGS" in
159   *-pipe* ) ;;
160         * ) _LT_COMPILER_OPTION([if $compiler supports -pipe],
161                 [M4_cv_prog_compiler_pipe],
162                 [-pipe -c conftest.$ac_ext], [],
163                 [CFLAGS="$CFLAGS -pipe"])
164               ;;
165 esac
168 ## ------------------------------- ##
169 ## Preloaded module configuration. ##
170 ## ------------------------------- ##
171 AS_IF([test "x$enable_shared" != xno],
172       [DYNAMIC_MODULES=yes], [DYNAMIC_MODULES=no])
173 AC_SUBST([DYNAMIC_MODULES], [$DYNAMIC_MODULES])
175 AC_MSG_CHECKING([for modules to preload])
176   DLPREOPEN=
178   AC_ARG_WITH([modules],
179     [AS_HELP_STRING([--with-modules=MODULES],
180                     [preload MODULES @<:@default: ]M4_DEFAULT_PRELOAD[@:>@])],
181     [use_modules="$withval"],
182     [use_modules="$M4_default_preload"])
184   PREOPEN_DEPENDENCIES=
185   DLPREOPEN="-dlpreopen force"
186   if test -z "$use_modules"; then
187     use_modules=none
188   else
189     if test "$use_modules" != yes; then
190       for module in $use_modules; do
191         case $module in
192           no|none) break ;;
193           m4|traditional|gnu|load|mpeval) dir=modules ;;
194           import|modtest|shadow|stdlib|time) dir=tests ;;
195           *) AC_MSG_ERROR([Unrecognized module `$module' in --with-modules])
196             ;;
197         esac
198         DLPREOPEN="$DLPREOPEN -dlpreopen $dir/$module.la"
199         PREOPEN_DEPENDENCIES="$PREOPEN_DEPENDENCIES $dir/$module.la"
200       done
201     fi
202   fi
203 AC_MSG_RESULT([$use_modules])
204 AC_SUBST([DLPREOPEN])
205 AC_SUBST([PREOPEN_DEPENDENCIES])
208 ## ------------------------------- ##
209 ## Dynamic Loader Characteristics. ##
210 ## ------------------------------- ##
212 LT_LIB_DLLOAD
213 LT_FUNC_DLSYM_USCORE
214 AC_DEFINE_UNQUOTED([PATH_SEPARATOR], ['$PATH_SEPARATOR'],
215                    [Define this to system search path delimiter])
218 ## ---------------- ##
219 ## Gettext support. ##
220 ## ---------------- ##
221 AM_GNU_GETTEXT([external])
222 AM_GNU_GETTEXT_NEED([need-formatstring-macros])
223 AM_GNU_GETTEXT_VERSION([0.16])
224 M4_GNU_GETTEXT
227 ## --------------- ##
228 ## Gnulib support. ##
229 ## --------------- ##
230 M4_INIT
232 gl_VERSION_ETC
234 # Gnulib doesn't always do things quite the way M4 would like...
235 M4_ERROR
236 M4_GETOPT
237 M4_OBSTACK
238 M4_REGEX
239 M4_RENAME
242 ## --------------------------- ##
243 ## C compiler characteristics. ##
244 ## --------------------------- ##
245 AC_TYPE_SIZE_T
246 AC_CHECK_SIZEOF([long long int])
248 AS_CASE([$host], [*-*-os2*], [OS2_LDFLAGS=-Zargs-resp])
249 AC_SUBST([OS2_LDFLAGS])
252 ## ------------------------- ##
253 ## C headers required by M4. ##
254 ## ------------------------- ##
255 AC_CHECK_HEADERS_ONCE([limits.h])
257 if test $ac_cv_header_stdbool_h = yes; then
258   INCLUDE_STDBOOL_H='#include <stdbool.h>'
259 else
260   INCLUDE_STDBOOL_H='#include <gnu/stdbool.h>'
262 AC_SUBST([INCLUDE_STDBOOL_H])
265 ## --------------------------------- ##
266 ## Library functions required by M4. ##
267 ## --------------------------------- ##
268 AC_CHECK_FUNCS_ONCE([calloc strerror])
270 AM_WITH_DMALLOC
272 M4_SYS_STACKOVF
274 # This is for the modules
275 AC_STRUCT_TM
276 AC_FUNC_STRFTIME
277 AC_CHECK_FUNCS_ONCE([getcwd gethostname mktime uname])
280 ## ------------------ ##
281 ## Configure options. ##
282 ## ------------------ ##
284 M4_LIB_GMP
285 AM_CONDITIONAL([USE_GMP], [test "x$USE_GMP" = xyes])
286 M4_SYSCMD
289 ## -------- ##
290 ## Outputs. ##
291 ## -------- ##
292 AC_CONFIG_FILES([
293 Makefile
294 m4/gnu/Makefile
295 m4/system.h:m4/system_.h
296 tests/atlocal
297 tests/gnu/Makefile
300 AC_OUTPUT