2
2
dnl configure.ac --- autoconf input file for gawk
4
dnl Copyright (C) 1995-2024 the Free Software Foundation, Inc.
4
dnl Copyright (C) 1995-2014 the Free Software Foundation, Inc.
6
6
dnl This file is part of GAWK, the GNU implementation of the
7
7
dnl AWK Programming Language.
24
24
dnl Process this file with autoconf to produce a configure script.
26
AC_INIT([GNU Awk],[5.3.0c],[bug-gawk@gnu.org],[gawk])
26
AC_INIT([GNU Awk], 4.1.60, bug-gawk@gnu.org, gawk)
28
28
# This is a hack. Different versions of install on different systems
29
29
# are just too different. Chuck it and use install-sh.
33
33
# With Autoconf 2.5x, this needs to come very early on, but *after*
34
34
# the INIT macro. Sigh.
36
if test "$INSTALL" = ""
36
if test "x$INSTALL" = "x"
38
INSTALL="$srcdir/build-aux/install-sh -c"
38
INSTALL="$srcdir/install-sh -c"
43
AM_INIT_AUTOMAKE([1.13 dist-xz dist-lzip])
44
45
AC_CONFIG_MACRO_DIR([m4])
45
AC_CONFIG_AUX_DIR([build-aux])
47
AM_INIT_AUTOMAKE([1.16 dist-xz dist-lzip subdir-objects])
50
[AS_HELP_STRING([--disable-lint],[do not compile in gawk lint checking])],
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],
51
56
if test "$enableval" = no
53
58
AC_DEFINE(NO_LINT, 1, [disable lint checks])
56
AC_ARG_ENABLE([builtin-intdiv0],
57
[AS_HELP_STRING([--enable-builtin-intdiv0],[enable built-in intdiv0 function])],
58
if test "$enableval" = yes
60
AC_DEFINE(SUPPLY_INTDIV, 1, [enable built-in intdiv0 function])
61
sed '/^@set PATCHLEVEL/a\
62
@set INTDIV' < "$srcdir"/doc/gawktexi.in > foo
63
cp foo "$srcdir"/doc/gawktexi.in
70
[AS_HELP_STRING([--disable-mpfr],[do not check for MPFR])],
71
if test "$enableval" = no
77
SKIP_PERSIST_MALLOC=no
79
[AS_HELP_STRING([--disable-pma],[do not build gawk with the persistent memory allocator])],
80
if test "$enableval" = no
82
SKIP_PERSIST_MALLOC=yes
87
AC_ARG_ENABLE([versioned-extension-dir],
88
[AS_HELP_STRING([--enable-versioned-extension-dir], [use a versioned directory for extensions])],
89
if test "$enableval" = yes
91
MAJOR=`awk '/define gawk_api_major_version/ { print $3 }' < $srcdir/gawkapi.h`
92
MINOR=`awk '/define gawk_api_minor_version/ { print $3 }' < $srcdir/gawkapi.h`
94
# note leading slash on the value
95
export EXTENSIONDIR=/ext-$MAJOR.$MINOR
99
# set default shared library location
100
AC_SUBST([pkgextensiondir], ['${pkglibdir}'${EXTENSIONDIR}])
103
63
AC_USE_SYSTEM_EXTENSIONS
105
65
dnl checks for programs
120
# support/ builds libsupport.a, allow for cross version of ar
123
ARFLAGS=cru # set default
126
78
# This is mainly for my use during testing and development.
127
79
# Yes, it's a bit of a hack.
128
# Keep in sync with same code in extension/configure.ac
129
80
AC_MSG_CHECKING([for special development options])
130
81
if test -f $srcdir/.developing
132
83
# add other debug flags as appropriate, save GAWKDEBUG for emergencies
133
CFLAGS="$CFLAGS -DARRAYDEBUG -DYYDEBUG -DLOCALEDEBUG -DMEMDEBUG"
84
CFLAGS="$CFLAGS -DARRAYDEBUG -DYYDEBUG"
85
if grep dbug $srcdir/.developing
87
CFLAGS="$CFLAGS -DDBUG"
88
LIBS="$LIBS dbug/libdbug.a"
135
90
# turn on compiler warnings if we're doing development
136
91
# enable debugging using macros also
137
92
if test "$GCC" = yes
139
CFLAGS="$CFLAGS -Wall -fno-builtin"
142
if grep -i '^mallocdebug$' $srcdir/.developing > /dev/null
144
CFLAGS="$CFLAGS -DUSE_REAL_MALLOC"
94
CFLAGS="$CFLAGS -Wall -fno-builtin -g3 -gdwarf-2"
146
96
AC_MSG_RESULT([yes])
154
104
# shared library suffix for dynamic loading:
155
105
AC_SUBST(acl_shlibext)
106
# default shared library location
107
AC_SUBST([pkgextensiondir], ['${pkglibdir}'])
157
109
dnl checks for systems
159
AC_SEARCH_LIBS([strerror],[cposix])
162
AC_MSG_CHECKING([if we are using EBCDIC])
163
AC_EGREP_CPP([gnu_gawk_in_ebcdic],
167
[AC_DEFINE(USE_EBCDIC, 1, Define to 1 if the character set is EBCDIC)
170
AC_MSG_RESULT([$use_ebcdic])
171
if test "$use_ebcdic" = yes
116
if test "$ISC" = 1 # will be set by test for ISC
173
ZOS_FAIL='; echo Expect $@ to fail on z/OS.'
118
dnl need -D_SYSV3 for ISC
119
CFLAGS="$CFLAGS -D_SYSV3"
122
dnl check for systems where libc is borked for regex handling
125
AC_DEFINE([LIBC_IS_BORKED], 1, [libc is broken for regex handling])
177
129
dnl Set the programming language for checks. Fortunately,
178
130
dnl this only needs to be set once, since everything is in C.
181
133
dnl initialize GNU gettext
182
134
AM_GNU_GETTEXT([external])
183
AM_GNU_GETTEXT_VERSION([0.20.2])
135
AM_GNU_GETTEXT_VERSION([0.18.1])
184
136
AM_LANGINFO_CODESET
187
139
dnl checks for header files
188
AC_CHECK_HEADERS(arpa/inet.h fcntl.h locale.h libintl.h mcheck.h \
189
netdb.h netinet/in.h stddef.h string.h \
190
sys/ioctl.h sys/param.h sys/select.h sys/socket.h sys/time.h unistd.h \
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 \
191
143
termios.h stropts.h wchar.h wctype.h)
194
146
AC_HEADER_SYS_WAIT
195
AC_CHECK_HEADERS_ONCE([sys/time.h])
198
149
if test "$ac_cv_header_string_h" = yes
217
169
AC_CHECK_SIZEOF(unsigned int)
218
170
AC_CHECK_SIZEOF(unsigned long)
219
171
dnl see if time_t is defined in <sys/types.h>
220
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]], [[
172
AC_TRY_COMPILE([#include <sys/types.h>],[
223
]])],[AC_DEFINE(TIME_T_IN_SYS_TYPES_H, 1,
224
some systems define this type here)],[])
176
AC_DEFINE(TIME_T_IN_SYS_TYPES_H, 1,
177
[some systems define this type here]))
225
178
dnl check for wctype_t in <wctype.h>
226
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <wctype.h>]], [[
179
AC_TRY_COMPILE([#include <wctype.h>],[
229
]])],[AC_DEFINE(HAVE_WCTYPE_T, 1, systems should define this type here)],[])
183
AC_DEFINE(HAVE_WCTYPE_T, 1, [systems should define this type here]))
230
184
dnl check for wint_t in <wctype.h>
231
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <wctype.h>]], [[
185
AC_TRY_COMPILE([#include <wctype.h>],[
234
]])],[AC_DEFINE(HAVE_WINT_T, 1, systems should define this type here)],[])
189
AC_DEFINE(HAVE_WINT_T, 1, [systems should define this type here]))
235
190
dnl check for sockaddr_storage
236
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
237
#include <sys/socket.h>]], [[
191
AC_TRY_COMPILE([#include <sys/types.h>
192
#include <sys/socket.h>],[
238
193
struct sockaddr_storage foo;
239
]])],[AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, newer systems define this type here)],[])
195
AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [newer systems define this type here]))
241
197
dnl Borrwed from rsync, thanks to to Jim Meyering.
257
213
# Systems have either "struct sockaddr *" or
258
214
# "void *" as the second argument to getpeername
259
215
rsync_cv_socklen_t_equiv=
260
for arg2 in "struct sockaddr" void
262
for t in int size_t unsigned long "unsigned long"
264
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
216
for arg2 in "struct sockaddr" void; do
217
for t in int size_t unsigned long "unsigned long"; do
265
219
#include <sys/types.h>
266
220
#include <sys/socket.h>
268
222
int getpeername (int, $arg2 *, $t *);
271
225
getpeername(0,0,&len);
273
227
rsync_cv_socklen_t_equiv="$t"
279
if test "$rsync_cv_socklen_t_equiv" = ""
233
if test "x$rsync_cv_socklen_t_equiv" = x; then
281
234
dnl Some systems get this. Default to int. -- ADR
282
235
dnl AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
283
236
rsync_cv_socklen_t_equiv=int
306
259
[AC_DEFINE(HAVE_GETADDRINFO, 1,
307
260
[have getaddrinfo])])])
309
AC_SEARCH_LIBS(fmod, m)
310
AC_SEARCH_LIBS(isinf, m)
311
AC_SEARCH_LIBS(ismod, m)
312
AC_SEARCH_LIBS(isnan, m)
262
AC_CHECK_LIB(m, fmod)
263
AC_CHECK_LIB(m, isinf)
264
AC_CHECK_LIB(m, ismod)
265
dnl Don't look for libsigsegv on OSF/1, gives us severe headaches
314
273
# Need the check for mkstemp and tmpfile for missing_d/snprintf.c.
315
AC_CHECK_FUNCS(__etoa_l atexit btowc fmod fwrite_unlocked gai_strerror \
316
getgrent getgroups grantpt isascii isblank iswctype iswlower iswupper \
317
gettimeofday clock_gettime lstat \
319
mbrlen memcmp memcpy memmove memset \
320
mkstemp mtrace posix_openpt setenv setlocale setsid sigprocmask \
321
snprintf strcasecmp strchr strcoll strerror strftime strncasecmp \
322
strsignal strtod strtoul system timegm tmpfile towlower towupper \
323
tzset usleep waitpid wcrtomb wcscoll wctype)
274
AC_CHECK_FUNCS(atexit btowc fmod getgrent getgroups grantpt \
275
isascii iswctype iswlower iswupper mbrlen \
276
memcmp memcpy memcpy_ulong memmove memset \
277
memset_ulong mkstemp posix_openpt setenv setlocale setsid snprintf strchr \
278
strerror strftime strncasecmp strcoll strtod strtoul \
279
system tmpfile towlower towupper tzset usleep wcrtomb \
324
281
dnl this check is for both mbrtowc and the mbstate_t type, which is good
327
dnl check if we can use the persistent memory allocator
328
GAWK_USE_PERSISTENT_MALLOC
330
284
dnl check for dynamic linking
331
285
dnl This is known to be very primitive
332
286
AC_ARG_ENABLE([extensions],
333
287
[AS_HELP_STRING([--disable-extensions], [disable dynamic extensions (default is detect)])])
334
if test "$enable_extensions" != "no"
288
if test "x$enable_extensions" != "xno"; then
336
289
extensions_supported=no
338
291
dnl On MirBSD (and probably other systems), don't even try.
340
293
mirbsd* | openedition*) # OS/390 z/OS POSIX layer
294
cat << \EOF > extension/Makefile
295
all dist check clean distclean install uninstall distcheck:
343
300
AC_CHECK_HEADER(dlfcn.h,
353
310
extensions_supported=yes
354
311
AC_DEFINE([DYNAMIC], 1, [dynamic loading is possible])
312
# Add -export-dynamic for old extensions. Only works for GCC
313
if test "$GCC" = yes; then
316
LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
360
if test "$enable_extensions$extensions_supported" = "yesno"
325
if test "x$enable_extensions$extensions_supported" = "xyesno"; then
362
326
AC_MSG_ERROR([extension support requested, but unavailable])
364
328
enable_extensions=$extensions_supported
366
AM_CONDITIONAL([ENABLE_EXTENSIONS], [test "$enable_extensions" = "yes"])
368
331
dnl check for how to use getpgrp
369
332
dnl have to hardwire it for VMS POSIX. Sigh.
401
363
has_f_format=no dnl Cross-compiling, assuming the worst.
403
if test "$has_f_format" = yes
365
if test "$has_f_format" = yes; then
405
366
AC_DEFINE(PRINTF_HAS_F_FORMAT, 1, [Define to 1 if *printf supports %F format])
407
368
AC_MSG_RESULT($has_f_format)
409
dnl check for printf %a format
410
AC_MSG_CHECKING([for printf %a format])
420
sprintf(buf, "%a", 8.0);
422
if (strncmp(buf, "0x", 2) == 0)
430
has_a_format=no dnl Cross-compiling, assuming the worst.
432
if test "$has_a_format" = yes
434
AC_DEFINE(PRINTF_HAS_A_FORMAT, 1, [Define to 1 if *printf supports %a format])
436
AC_MSG_RESULT($has_a_format)
438
370
dnl check for sockets
439
371
GAWK_AC_LIB_SOCKETS
442
374
GAWK_CHECK_READLINE
444
376
dnl check for mpfr support
450
379
dnl checks for structure members
451
380
AC_CHECK_MEMBERS([struct stat.st_blksize])
452
AC_CHECK_MEMBERS([struct passwd.pw_passwd],,,[
453
#include <sys/types.h>
456
AC_CHECK_MEMBERS([struct group.gr_passwd],,,[
457
#include <sys/types.h>
461
382
AC_STRUCT_TIMEZONE
480
401
AC_SUBST(GAWKLIBEXT)
482
AC_CONFIG_FILES([Makefile
403
AC_CONFIG_FILES(Makefile
489
AC_CONFIG_FILES([gawkbug], [chmod +x gawkbug])
490
if test "$enable_extensions" = "yes"
408
if test "x$enable_extensions" = "xyes"; then
492
409
AC_CONFIG_SUBDIRS(extension)
495
if test "$GCC" = yes &&
496
test -f $srcdir/.developing &&
497
grep -i '^debug$' $srcdir/.developing > /dev/null
499
if grep -i '^yaccdebug$' $srcdir/.developing > /dev/null
501
for i in awkgram command
514
sed -e '/-O2/s///' -e '/^CFLAGS = /s//&${DEBUG} /' $i/Makefile > foo