2 dnl configure.ac --- autoconf input file for gawk
4 dnl Copyright (C) 1995-2012 the Free Software Foundation, Inc.
6 dnl This file is part of GAWK, the GNU implementation of the
7 dnl AWK Programming Language.
9 dnl GAWK is free software; you can redistribute it and/or modify
10 dnl it under the terms of the GNU General Public License as published by
11 dnl the Free Software Foundation; either version 3 of the License, or
12 dnl (at your option) any later version.
14 dnl GAWK is distributed in the hope that it will be useful,
15 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
16 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 dnl GNU General Public License for more details.
19 dnl You should have received a copy of the GNU General Public License
20 dnl along with this program; if not, write to the Free Software
21 dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 dnl Process this file with autoconf to produce a configure script.
26 AC_INIT([GNU Awk], 4.0.1, bug-gawk@gnu.org, gawk)
28 # This is a hack. Different versions of install on different systems
29 # are just too different. Chuck it and use install-sh.
31 # If the user supplies $INSTALL, figure they know what they're doing.
33 # With Autoconf 2.5x, this needs to come very early on, but *after*
34 # the INIT macro. Sigh.
36 if test "x$INSTALL" = "x"
38 INSTALL="$srcdir/install-sh -c"
43 AM_INIT_AUTOMAKE([1.11 dist-xz])
45 AC_CONFIG_MACRO_DIR([m4])
47 dnl Additional argument stuff
48 AC_ARG_WITH(whiny-user-strftime, [ --with-whiny-user-strftime Force use of included version of strftime for deficient systems],
49 if test "$withval" = yes
51 AC_DEFINE(USE_INCLUDED_STRFTIME, 1,
52 [force use of our version of strftime])
55 AC_ARG_ENABLE([lint], [ --disable-lint Disable gawk lint checking],
56 if test "$enableval" = no
58 AC_DEFINE(NO_LINT, 1, [disable lint checks])
62 AC_USE_SYSTEM_EXTENSIONS
64 dnl checks for programs
77 # This is mainly for my use during testing and development.
78 # Yes, it's a bit of a hack.
79 AC_MSG_CHECKING([for special development options])
80 if test -f $srcdir/.developing
82 # add other debug flags as appropriate, save GAWKDEBUG for emergencies
83 CFLAGS="$CFLAGS -DARRAYDEBUG -DYYDEBUG"
84 if grep dbug $srcdir/.developing
86 CFLAGS="$CFLAGS -DDBUG"
87 LIBS="$LIBS dbug/libdbug.a"
89 # turn on compiler warnings if we're doing development
90 # enable debugging using macros also
93 CFLAGS="$CFLAGS -Wall -fno-builtin -g3 -gdwarf-2"
102 dnl checks for systems
109 if test "$ISC" = 1 # will be set by test for ISC
111 dnl need -D_SYSV3 for ISC
112 CFLAGS="$CFLAGS -D_SYSV3"
115 dnl Set the programming language for checks. Fortunately,
116 dnl this only needs to be set once, since everything is in C.
119 dnl Cygwin doesn't like to get libs with full paths
120 dnl since that overrides linking against DLLs.
121 case `(uname) 2> /dev/null` in
123 with_libiconv_prefix=no
124 with_libintl_prefix=no
130 dnl initialize GNU gettext
131 AM_GNU_GETTEXT([external])
132 AM_GNU_GETTEXT_VERSION([0.18.1])
136 dnl checks for header files
140 AC_CHECK_HEADERS(arpa/inet.h fcntl.h limits.h locale.h libintl.h mcheck.h \
141 netdb.h netinet/in.h stdarg.h stddef.h string.h \
142 sys/ioctl.h sys/param.h sys/socket.h sys/time.h unistd.h \
143 termios.h stropts.h wchar.h wctype.h)
145 if test "$ac_cv_header_string_h" = yes
147 AC_CHECK_HEADERS(memory.h)
149 AC_CHECK_HEADERS(strings.h)
152 dnl checks for typedefs
158 gl_AC_TYPE_UNSIGNED_LONG_LONG
161 AC_CHECK_TYPE(ssize_t, int)
162 AC_CHECK_SIZEOF(unsigned int)
163 AC_CHECK_SIZEOF(unsigned long)
164 dnl see if time_t is defined in <sys/types.h>
165 AC_TRY_COMPILE([#include <sys/types.h>],[
169 AC_DEFINE(TIME_T_IN_SYS_TYPES_H, 1,
170 [some systems define this type here]))
171 dnl check for wctype_t in <wctype.h>
172 AC_TRY_COMPILE([#include <wctype.h>],[
176 AC_DEFINE(HAVE_WCTYPE_T, 1, [systems should define this type here]))
177 dnl check for wint_t in <wctype.h>
178 AC_TRY_COMPILE([#include <wctype.h>],[
182 AC_DEFINE(HAVE_WINT_T, 1, [systems should define this type here]))
183 dnl check for sockaddr_storage
184 AC_TRY_COMPILE([#include <sys/types.h>
185 #include <sys/socket.h>],[
186 struct sockaddr_storage foo;
188 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [newer systems define this type here]))
190 dnl Borrwed from rsync, thanks to to Jim Meyering.
192 dnl Check for socklen_t: historically on BSD it is an int, and in
193 dnl POSIX 1g it is a type of its own, but some platforms use different
194 dnl types for the argument to getsockopt, getpeername, etc. So we
195 dnl have to test to find something that will work.
197 dnl This is no good, because passing the wrong pointer on C compilers is
198 dnl likely to only generate a warning, not an error.
200 AC_DEFUN([TYPE_SOCKLEN_T],
202 AC_CHECK_TYPE([socklen_t], ,[
203 AC_MSG_CHECKING([for socklen_t equivalent])
204 AC_CACHE_VAL([rsync_cv_socklen_t_equiv],
206 # Systems have either "struct sockaddr *" or
207 # "void *" as the second argument to getpeername
208 rsync_cv_socklen_t_equiv=
209 for arg2 in "struct sockaddr" void; do
210 for t in int size_t unsigned long "unsigned long"; do
212 #include <sys/types.h>
213 #include <sys/socket.h>
215 int getpeername (int, $arg2 *, $t *);
218 getpeername(0,0,&len);
220 rsync_cv_socklen_t_equiv="$t"
226 if test "x$rsync_cv_socklen_t_equiv" = x; then
227 dnl Some systems get this. Default to int. -- ADR
228 dnl AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
229 rsync_cv_socklen_t_equiv=int
232 AC_MSG_RESULT($rsync_cv_socklen_t_equiv)
233 AC_DEFINE_UNQUOTED(socklen_t, $rsync_cv_socklen_t_equiv,
234 [type to use in place of socklen_t if not defined])],
235 [#include <sys/types.h>
236 #include <sys/socket.h>])
240 dnl checks for functions
243 case "$ac_cv_func_working_mktime" in
244 yes) AC_DEFINE(HAVE_MKTIME, 1, [we have the mktime function])
248 AC_CHECK_FUNC(getaddrinfo, [AC_DEFINE(HAVE_GETADDRINFO, 1, [have getaddrinfo])],
249 [AC_CHECK_LIB(socket, getaddrinfo,
250 [AC_DEFINE(HAVE_GETADDRINFO, 1,
251 [have getaddrinfo])])])
253 AC_CHECK_LIB(m, fmod)
254 AC_CHECK_LIB(m, isinf)
255 AC_CHECK_LIB(m, ismod)
256 dnl Don't look for libsigsegv on OSF/1, gives us severe headaches
264 # Need the check for mkstemp and tmpfile for missing_d/snprintf.c.
265 AC_CHECK_FUNCS(atexit btowc fmod getgrent getgroups grantpt \
266 isascii iswctype iswlower iswupper mbrlen \
267 memcmp memcpy memcpy_ulong memmove memset \
268 memset_ulong mkstemp setenv setlocale setsid snprintf strchr \
269 strerror strftime strncasecmp strcoll strtod strtoul \
270 system tmpfile towlower towupper tzset usleep wcrtomb \
272 dnl this check is for both mbrtowc and the mbstate_t type, which is good
275 dnl check for dynamic linking
276 dnl This is known to be very primitive
277 AC_CHECK_HEADER(dlfcn.h,
278 [AC_DEFINE([DYNAMIC], 1, [dynamic loading is possible])
281 # Add others here as appropriate,
282 # one day use GNU libtool.
283 # 3/2010: Used to have cygwin here but removed since
284 # we get complaints that -export-dynamic doesn't work.
285 if uname | $EGREP -i 'linux|freebsd' > /dev/null
287 LDFLAGS="$LDFLAGS -export-dynamic"
291 # Check this separately. Some systems have dlopen
292 # in libc. Notably freebsd and cygwin.
293 # HP-NSK has it in zrldsrl
294 AC_SEARCH_LIBS(dlopen, dl zrldsrl)
297 dnl check for how to use getpgrp
298 dnl have to hardwire it for VMS POSIX. Sigh.
299 dnl ditto for BeOS, OS/2, and MS-DOS.
300 case `(uname) 2> /dev/null` in
301 *VMS*|*BeOS*|*OS/2*|*MS-DOS*)
302 AC_DEFINE(GETPGRP_VOID, 1,
303 [Define to 1 if the getpgrp function requires zero arguments.])
309 dnl check for printf %F format
310 AC_MSG_CHECKING([for printf %F format])
319 sprintf(buf, "%F", 123.45);
321 if (strcmp(buf, "123.450000") == 0)
329 has_f_format=no dnl Cross-compiling, assuming the worst.
331 if test "$has_f_format" = yes; then
332 AC_DEFINE(PRINTF_HAS_F_FORMAT, 1, [Define to 1 if *printf supports %F format])
334 AC_MSG_RESULT($has_f_format)
336 dnl check for sockets
339 dnl check for readline support
342 dnl checks for structure members
348 dnl checks for compiler characteristics
355 AC_CONFIG_HEADERS([config.h:configh.in])
356 AH_BOTTOM([#include "custom.h"])
358 AC_CONFIG_FILES(Makefile