maint: fix gnulib path in .gitmodules.
[m4/ericb.git] / configure.ac
blob2fe6d9e8189d4083b58ba10bfbbe558da15f393b
1 # Configure template for GNU m4.           -*-Autoconf-*-
2 # Copyright (C) 1991-1994, 2000-2002, 2004-2013 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
167 ## ------------------------------- ##
168 ## Preloaded module configuration. ##
169 ## ------------------------------- ##
170 AS_IF([test "x$enable_shared" != xno],
171       [DYNAMIC_MODULES=yes], [DYNAMIC_MODULES=no])
172 AC_SUBST([DYNAMIC_MODULES], [$DYNAMIC_MODULES])
174 AC_MSG_CHECKING([for modules to preload])
175   DLPREOPEN=
177   AC_ARG_WITH([modules],
178     [AS_HELP_STRING([--with-modules=MODULES],
179                     [preload MODULES @<:@default: ]M4_DEFAULT_PRELOAD[@:>@])],
180     [use_modules="$withval"],
181     [use_modules="$M4_default_preload"])
183   PREOPEN_DEPENDENCIES=
184   DLPREOPEN="-dlpreopen force"
185   if test -z "$use_modules"; then
186     use_modules=none
187   else
188     if test "$use_modules" != yes; then
189       for module in $use_modules; do
190         case $module in
191           no|none) break ;;
192           m4|traditional|gnu|load|mpeval) dir=modules ;;
193           import|modtest|shadow|stdlib|time) dir=tests ;;
194           *) AC_MSG_ERROR([Unrecognized module `$module' in --with-modules])
195             ;;
196         esac
197         DLPREOPEN="$DLPREOPEN -dlpreopen $dir/$module.la"
198         PREOPEN_DEPENDENCIES="$PREOPEN_DEPENDENCIES $dir/$module.la"
199       done
200     fi
201   fi
202 AC_MSG_RESULT([$use_modules])
203 AC_SUBST([DLPREOPEN])
204 AC_SUBST([PREOPEN_DEPENDENCIES])
207 ## ---------------- ##
208 ## Gettext support. ##
209 ## ---------------- ##
210 AM_GNU_GETTEXT([external])
211 AM_GNU_GETTEXT_NEED([need-formatstring-macros])
212 AM_GNU_GETTEXT_VERSION([0.16])
213 M4_GNU_GETTEXT
217 ## --------------- ##
218 ## Gnulib support. ##
219 ## --------------- ##
220 M4_INIT
222 gl_VERSION_ETC
224 # Gnulib doesn't always do things quite the way M4 would like...
225 M4_ERROR
226 M4_GETOPT
227 M4_OBSTACK
228 M4_REGEX
229 M4_RENAME
232 ## --------------------------- ##
233 ## C compiler characteristics. ##
234 ## --------------------------- ##
235 AC_TYPE_SIZE_T
236 AC_CHECK_SIZEOF([long long int])
240 ## ------------------------- ##
241 ## C headers required by M4. ##
242 ## ------------------------- ##
243 AC_CHECK_HEADERS_ONCE([limits.h])
245 if test $ac_cv_header_stdbool_h = yes; then
246   INCLUDE_STDBOOL_H='#include <stdbool.h>'
247 else
248   INCLUDE_STDBOOL_H='#include <gnu/stdbool.h>'
250 AC_SUBST([INCLUDE_STDBOOL_H])
254 ## --------------------------------- ##
255 ## Library functions required by M4. ##
256 ## --------------------------------- ##
257 AC_CHECK_FUNCS_ONCE([calloc strerror])
259 AM_WITH_DMALLOC
261 M4_SYS_STACKOVF
263 # This is for the modules
264 AC_STRUCT_TM
265 AC_FUNC_STRFTIME
266 AC_CHECK_FUNCS_ONCE([getcwd gethostname mktime uname])
269 ## ------------------ ##
270 ## Configure options. ##
271 ## ------------------ ##
273 M4_LIB_GMP
274 AM_CONDITIONAL([USE_GMP], [test "x$USE_GMP" = xyes])
275 M4_SYSCMD
278 ## -------- ##
279 ## Outputs. ##
280 ## -------- ##
281 AC_CONFIG_FILES([
282 Makefile
283 m4/gnu/Makefile
284 m4/system.h:m4/system_.h
285 tests/atlocal
286 tests/gnu/Makefile
289 AC_OUTPUT