[3076] | 1 | dnl
|
---|
| 2 | dnl configure.ac --- autoconf input file for gawk
|
---|
| 3 | dnl
|
---|
| 4 | dnl Copyright (C) 1995-2005 the Free Software Foundation, Inc.
|
---|
| 5 | dnl
|
---|
| 6 | dnl This file is part of GAWK, the GNU implementation of the
|
---|
| 7 | dnl AWK Programming Language.
|
---|
| 8 | dnl
|
---|
| 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 2 of the License, or
|
---|
| 12 | dnl (at your option) any later version.
|
---|
| 13 | dnl
|
---|
| 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.
|
---|
| 18 | dnl
|
---|
| 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
|
---|
| 22 | dnl
|
---|
| 23 |
|
---|
| 24 | dnl Process this file with autoconf to produce a configure script.
|
---|
| 25 |
|
---|
| 26 | AC_INIT([GNU Awk], 3.1.5, bug-gawk@gnu.org, gawk)
|
---|
| 27 |
|
---|
| 28 | # This is a hack. Different versions of install on different systems
|
---|
| 29 | # are just too different. Chuck it and use install-sh.
|
---|
| 30 | #
|
---|
| 31 | # If the user supplies $INSTALL, figure they know what they're doing.
|
---|
| 32 | #
|
---|
| 33 | # With Autoconf 2.5x, this needs to come very early on, but *after*
|
---|
| 34 | # the INIT macro. Sigh.
|
---|
| 35 |
|
---|
| 36 | if test "x$INSTALL" = "x"
|
---|
| 37 | then
|
---|
| 38 | INSTALL="$srcdir/install-sh -c"
|
---|
| 39 | export INSTALL
|
---|
| 40 | fi
|
---|
| 41 |
|
---|
| 42 | AC_PREREQ(2.59)
|
---|
| 43 | AM_INIT_AUTOMAKE
|
---|
| 44 |
|
---|
| 45 | dnl Additional argument stuff
|
---|
| 46 | AC_ARG_ENABLE(portals, [ --enable-portals Enable /p as path prefix for portals],
|
---|
| 47 | if test "$enableval" = yes
|
---|
| 48 | then
|
---|
| 49 | AC_DEFINE(HAVE_PORTALS, 1, [we have portals on /p on this system])
|
---|
| 50 | fi
|
---|
| 51 | )
|
---|
| 52 | AC_ARG_WITH(whiny-user-strftime, [ --with-whiny-user-strftime Force use of included version of strftime for deficient systems],
|
---|
| 53 | if test "$withval" = yes
|
---|
| 54 | then
|
---|
| 55 | AC_DEFINE(USE_INCLUDED_STRFTIME, 1,
|
---|
| 56 | [force use of our version of strftime])
|
---|
| 57 | fi
|
---|
| 58 | )
|
---|
| 59 | AC_ARG_ENABLE([lint], [ --disable-lint Disable gawk lint checking],
|
---|
| 60 | if test "$enableval" = no
|
---|
| 61 | then
|
---|
| 62 | AC_DEFINE(NO_LINT, 1, [disable lint checks])
|
---|
| 63 | fi
|
---|
| 64 | )
|
---|
| 65 | AC_ARG_ENABLE(switch, [ --enable-switch Enable switch statements for awk programs],
|
---|
| 66 | if test "$enableval" = yes
|
---|
| 67 | then
|
---|
| 68 | AC_DEFINE(ALLOW_SWITCH, 1, [switch statements are enabled in awk programs])
|
---|
| 69 | fi
|
---|
| 70 | )
|
---|
| 71 |
|
---|
| 72 | dnl checks for programs
|
---|
| 73 | AC_PROG_EGREP
|
---|
| 74 | AC_PROG_YACC
|
---|
| 75 | AC_PROG_LN_S
|
---|
| 76 | AC_PROG_CC
|
---|
| 77 | AC_PROG_CPP
|
---|
| 78 | AC_PROG_RANLIB
|
---|
| 79 |
|
---|
| 80 | AC_OBJEXT
|
---|
| 81 | AC_EXEEXT
|
---|
| 82 |
|
---|
| 83 | AC_PROG_INSTALL
|
---|
| 84 |
|
---|
| 85 | AC_PROG_MAKE_SET
|
---|
| 86 |
|
---|
| 87 | # This is mainly for my use during testing and development.
|
---|
| 88 | # Yes, it's a bit of a hack.
|
---|
| 89 | AC_MSG_CHECKING([for special development options])
|
---|
| 90 | if test -f $srcdir/.developing
|
---|
| 91 | then
|
---|
| 92 | # add other debug flags as appropriate, save GAWKDEBUG for emergencies
|
---|
| 93 | CFLAGS="$CFLAGS -DARRAYDEBUG"
|
---|
| 94 | if grep dbug $srcdir/.developing
|
---|
| 95 | then
|
---|
| 96 | CFLAGS="$CFLAGS -DDBUG"
|
---|
| 97 | LIBS="$LIBS dbug/libdbug.a"
|
---|
| 98 | fi
|
---|
| 99 | # turn on compiler warnings if we're doing development
|
---|
| 100 | if test "$GCC" = yes
|
---|
| 101 | then
|
---|
| 102 | CFLAGS="$CFLAGS -Wall"
|
---|
| 103 | fi
|
---|
| 104 | AC_MSG_RESULT([yes])
|
---|
| 105 | else
|
---|
| 106 | AC_MSG_RESULT([no])
|
---|
| 107 | fi
|
---|
| 108 |
|
---|
| 109 | AC_SUBST(CFLAGS)
|
---|
| 110 |
|
---|
| 111 | dnl checks for systems
|
---|
| 112 | AC_AIX
|
---|
| 113 | AC_ISC_POSIX
|
---|
| 114 | AC_MINIX
|
---|
| 115 | AC_SYS_LARGEFILE
|
---|
| 116 | GAWK_AC_AIX_TWEAK
|
---|
| 117 | GAWK_AC_LINUX_ALPHA
|
---|
| 118 |
|
---|
| 119 | if test "$ISC" = 1 # will be set by test for ISC
|
---|
| 120 | then
|
---|
| 121 | dnl need -D_SYSV3 for ISC
|
---|
| 122 | CFLAGS="$CFLAGS -D_SYSV3"
|
---|
| 123 | fi
|
---|
| 124 |
|
---|
| 125 | dnl check for C compiler for automake
|
---|
| 126 | AM_PROG_CC_STDC
|
---|
| 127 | AM_C_PROTOTYPES
|
---|
| 128 |
|
---|
| 129 | dnl Cygwin doesn't like to get libs with full paths
|
---|
| 130 | dnl since that overrides linking against DLLs.
|
---|
| 131 | case `(uname) 2> /dev/null` in
|
---|
| 132 | *CYGWIN*)
|
---|
| 133 | with_libiconv_prefix=no
|
---|
| 134 | with_libintl_prefix=no
|
---|
| 135 | ;;
|
---|
| 136 | *)
|
---|
| 137 | ;;
|
---|
| 138 | esac
|
---|
| 139 |
|
---|
| 140 | dnl initialize GNU gettext
|
---|
| 141 | AM_GNU_GETTEXT([external])
|
---|
| 142 | AM_GNU_GETTEXT_VERSION([0.14.4])
|
---|
| 143 |
|
---|
| 144 | dnl checks for header files
|
---|
| 145 | AC_HEADER_STDC
|
---|
| 146 | AC_HEADER_SYS_WAIT
|
---|
| 147 | AC_HEADER_TIME
|
---|
| 148 | AC_CHECK_HEADERS(fcntl.h limits.h locale.h libintl.h mcheck.h \
|
---|
| 149 | netdb.h netinet/in.h signum.h stdarg.h string.h \
|
---|
| 150 | sys/param.h sys/socket.h sys/time.h unistd.h \
|
---|
| 151 | termios.h stropts.h wchar.h wctype.h)
|
---|
| 152 |
|
---|
| 153 | if test "$ac_cv_header_string_h" = yes
|
---|
| 154 | then
|
---|
| 155 | AC_CHECK_HEADERS(memory.h)
|
---|
| 156 | else
|
---|
| 157 | AC_CHECK_HEADERS(strings.h)
|
---|
| 158 | fi
|
---|
| 159 |
|
---|
| 160 | dnl checks for typedefs
|
---|
| 161 | AC_TYPE_PID_T
|
---|
| 162 | AC_TYPE_SIGNAL
|
---|
| 163 | AC_SIZE_T
|
---|
| 164 | AC_TYPE_GETGROUPS
|
---|
| 165 | gl_AC_TYPE_LONG_LONG
|
---|
| 166 | gl_AC_TYPE_UNSIGNED_LONG_LONG
|
---|
| 167 | gl_AC_TYPE_INTMAX_T
|
---|
| 168 | gl_AC_TYPE_UINTMAX_T
|
---|
| 169 | AC_CHECK_TYPE(ssize_t, int)
|
---|
| 170 | AC_CHECK_SIZEOF(unsigned int)
|
---|
| 171 | AC_CHECK_SIZEOF(unsigned long)
|
---|
| 172 | AC_EGREP_HEADER([int.*sprintf], stdio.h,
|
---|
| 173 | AC_DEFINE(SPRINTF_RET, int, [return type of sprintf]),
|
---|
| 174 | AC_DEFINE(SPRINTF_RET, char *))
|
---|
| 175 | dnl see if time_t is defined in <sys/types.h>
|
---|
| 176 | AC_TRY_COMPILE([#include <sys/types.h>],[
|
---|
| 177 | time_t foo;
|
---|
| 178 | foo = 0;
|
---|
| 179 | ],
|
---|
| 180 | AC_DEFINE(TIME_T_IN_SYS_TYPES_H, 1,
|
---|
| 181 | [some systems define this type here]))
|
---|
| 182 | dnl check for wctype_t in <wctype.h>
|
---|
| 183 | AC_TRY_COMPILE([#include <wctype.h>],[
|
---|
| 184 | wctype_t foo;
|
---|
| 185 | foo = 0;
|
---|
| 186 | ],
|
---|
| 187 | AC_DEFINE(HAVE_WCTYPE_T, 1, [systems should define this type here]))
|
---|
| 188 | dnl check for wint_t in <wctype.h>
|
---|
| 189 | AC_TRY_COMPILE([#include <wctype.h>],[
|
---|
| 190 | wint_t foo;
|
---|
| 191 | foo = 0;
|
---|
| 192 | ],
|
---|
| 193 | AC_DEFINE(HAVE_WINT_T, 1, [systems should define this type here]))
|
---|
| 194 |
|
---|
| 195 | dnl Borrwed from rsync, thanks to to Jim Meyering.
|
---|
| 196 |
|
---|
| 197 | dnl Check for socklen_t: historically on BSD it is an int, and in
|
---|
| 198 | dnl POSIX 1g it is a type of its own, but some platforms use different
|
---|
| 199 | dnl types for the argument to getsockopt, getpeername, etc. So we
|
---|
| 200 | dnl have to test to find something that will work.
|
---|
| 201 |
|
---|
| 202 | dnl This is no good, because passing the wrong pointer on C compilers is
|
---|
| 203 | dnl likely to only generate a warning, not an error.
|
---|
| 204 |
|
---|
| 205 | AC_DEFUN([TYPE_SOCKLEN_T],
|
---|
| 206 | [
|
---|
| 207 | AC_CHECK_TYPE([socklen_t], ,[
|
---|
| 208 | AC_MSG_CHECKING([for socklen_t equivalent])
|
---|
| 209 | AC_CACHE_VAL([rsync_cv_socklen_t_equiv],
|
---|
| 210 | [
|
---|
| 211 | # Systems have either "struct sockaddr *" or
|
---|
| 212 | # "void *" as the second argument to getpeername
|
---|
| 213 | rsync_cv_socklen_t_equiv=
|
---|
| 214 | for arg2 in "struct sockaddr" void; do
|
---|
| 215 | for t in int size_t unsigned long "unsigned long"; do
|
---|
| 216 | AC_TRY_COMPILE([
|
---|
| 217 | #include <sys/types.h>
|
---|
| 218 | #include <sys/socket.h>
|
---|
| 219 |
|
---|
| 220 | int getpeername (int, $arg2 *, $t *);
|
---|
| 221 | ],[
|
---|
| 222 | $t len;
|
---|
| 223 | getpeername(0,0,&len);
|
---|
| 224 | ],[
|
---|
| 225 | rsync_cv_socklen_t_equiv="$t"
|
---|
| 226 | break
|
---|
| 227 | ])
|
---|
| 228 | done
|
---|
| 229 | done
|
---|
| 230 |
|
---|
| 231 | if test "x$rsync_cv_socklen_t_equiv" = x; then
|
---|
| 232 | dnl Some systems get this. Default to int. -- ADR
|
---|
| 233 | dnl AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
|
---|
| 234 | rsync_cv_socklen_t_equiv=int
|
---|
| 235 | fi
|
---|
| 236 | ])
|
---|
| 237 | AC_MSG_RESULT($rsync_cv_socklen_t_equiv)
|
---|
| 238 | AC_DEFINE_UNQUOTED(socklen_t, $rsync_cv_socklen_t_equiv,
|
---|
| 239 | [type to use in place of socklen_t if not defined])],
|
---|
| 240 | [#include <sys/types.h>
|
---|
| 241 | #include <sys/socket.h>])
|
---|
| 242 | ])
|
---|
| 243 | TYPE_SOCKLEN_T
|
---|
| 244 |
|
---|
| 245 | dnl checks for functions
|
---|
| 246 | AC_FUNC_VPRINTF
|
---|
| 247 | GAWK_AC_FUNC_STRTOD_C89
|
---|
| 248 | AC_FUNC_MKTIME
|
---|
| 249 | case "$ac_cv_func_working_mktime" in
|
---|
| 250 | yes) AC_DEFINE(HAVE_MKTIME, 1, [we have the mktime function])
|
---|
| 251 | ;;
|
---|
| 252 | esac
|
---|
| 253 |
|
---|
| 254 | AC_CHECK_LIB(m, fmod)
|
---|
| 255 | AC_CHECK_FUNCS(fmod getgrent getgroups grantpt iswctype mbrlen \
|
---|
| 256 | memcmp memcpy memmove memset setlocale snprintf strchr \
|
---|
| 257 | strerror strftime strncasecmp strtod strtoul system tzset \
|
---|
| 258 | isascii btowc \
|
---|
| 259 | iswlower iswupper towlower towupper \
|
---|
| 260 | wcrtomb wcscoll wcscoll wctype)
|
---|
| 261 | dnl this check is for both mbrtowc and the mbstate_t type, which is good
|
---|
| 262 | AC_FUNC_MBRTOWC
|
---|
| 263 |
|
---|
| 264 | dnl check for dynamic linking
|
---|
| 265 | dnl This is known to be very primitive
|
---|
| 266 | AC_CHECK_HEADER(dlfcn.h,
|
---|
| 267 | [AC_DEFINE([DYNAMIC], 1, [dynamic loading is possible])
|
---|
| 268 | if test "$GCC" = yes
|
---|
| 269 | then
|
---|
| 270 | # Add others here as appropriate,
|
---|
| 271 | # one day use GNU libtool.
|
---|
| 272 | if uname | $EGREP -i 'linux|freebsd|cygwin' > /dev/null
|
---|
| 273 | then
|
---|
| 274 | LDFLAGS="$LDFLAGS -export-dynamic"
|
---|
| 275 | fi
|
---|
| 276 | fi
|
---|
| 277 |
|
---|
| 278 | # Check this separately. Some systems have dlopen
|
---|
| 279 | # in libc. Notably freebsd and cygwin.
|
---|
| 280 | AC_CHECK_LIB(dl, dlopen)
|
---|
| 281 | ])
|
---|
| 282 |
|
---|
| 283 | dnl check for how to use getpgrp
|
---|
| 284 | dnl have to hardwire it for VMS POSIX. Sigh.
|
---|
| 285 | dnl ditto for BeOS, OS/2, and MS-DOS.
|
---|
| 286 | case `(uname) 2> /dev/null` in
|
---|
| 287 | *VMS*|*BeOS*|*OS/2*|*MS-DOS*)
|
---|
| 288 | AC_DEFINE(GETPGRP_VOID, 1,
|
---|
| 289 | [Define to 1 if the getpgrp function requires zero arguments.])
|
---|
| 290 | ;;
|
---|
| 291 | *) AC_FUNC_GETPGRP
|
---|
| 292 | ;;
|
---|
| 293 | esac
|
---|
| 294 |
|
---|
| 295 | dnl check for printf %F format
|
---|
| 296 | AC_MSG_CHECKING([for printf %F format])
|
---|
| 297 | AC_RUN_IFELSE([
|
---|
| 298 | #include <stdio.h>
|
---|
| 299 |
|
---|
| 300 | int main()
|
---|
| 301 | {
|
---|
| 302 | char buf[[100]];
|
---|
| 303 |
|
---|
| 304 | sprintf(buf, "%F", 123.45);
|
---|
| 305 |
|
---|
| 306 | if (strcmp(buf, "123.450000") == 0)
|
---|
| 307 | return 0;
|
---|
| 308 | else
|
---|
| 309 | return 1;
|
---|
| 310 | }
|
---|
| 311 | ],
|
---|
| 312 | has_f_format=yes,
|
---|
| 313 | has_f_format=no,
|
---|
| 314 | has_f_format=no dnl Cross-compiling, assuming the worst.
|
---|
| 315 | )
|
---|
| 316 | if test "$has_f_format" = yes; then
|
---|
| 317 | AC_DEFINE(PRINTF_HAS_F_FORMAT, 1, [Define to 1 if *printf supports %F format])
|
---|
| 318 | fi
|
---|
| 319 | AC_MSG_RESULT($has_f_format)
|
---|
| 320 |
|
---|
| 321 | dnl check for sockets
|
---|
| 322 | GAWK_AC_LIB_SOCKETS
|
---|
| 323 |
|
---|
| 324 | dnl checks for structure members
|
---|
| 325 | AC_STRUCT_ST_BLKSIZE
|
---|
| 326 | AC_HEADER_TIME
|
---|
| 327 | AC_STRUCT_TM
|
---|
| 328 | AC_STRUCT_TIMEZONE
|
---|
| 329 |
|
---|
| 330 | dnl checks for compiler characteristics
|
---|
| 331 | AC_C_CHAR_UNSIGNED
|
---|
| 332 | AC_C_CONST
|
---|
| 333 | AC_C_RESTRICT
|
---|
| 334 | AC_C_INLINE
|
---|
| 335 | AC_C_STRINGIZE
|
---|
| 336 |
|
---|
| 337 | AC_CONFIG_HEADERS([config.h:configh.in])
|
---|
| 338 | AH_BOTTOM([#include "custom.h"])
|
---|
| 339 |
|
---|
| 340 | AC_CONFIG_FILES(Makefile
|
---|
| 341 | awklib/Makefile
|
---|
| 342 | doc/Makefile
|
---|
| 343 | po/Makefile.in
|
---|
| 344 | test/Makefile
|
---|
| 345 | [version.c:version.in])
|
---|
| 346 |
|
---|
| 347 | dnl This is a significant and rather ugly hack. We want to keep
|
---|
| 348 | dnl version.c from being removed upon `make distclean'.
|
---|
| 349 | dnl We put the `$$' on the front for old systems with 14-char filenames.
|
---|
| 350 |
|
---|
| 351 | dnl At this point, `configure' has finished creating `config.status' which
|
---|
| 352 | dnl actually does all the checking and configuring. `config.status' is run
|
---|
| 353 | dnl by the AC_OUTPUT macro below. This step comes in between the two: it
|
---|
| 354 | dnl adds code to `config.status'. Doing it there ensures that this step
|
---|
| 355 | dnl happens *every* time `config.status' is run, such as when `make' decides
|
---|
| 356 | dnl to update something. Fun, fun, fun.
|
---|
| 357 |
|
---|
| 358 | dnl Be careful of multiple levels of shell quoting!
|
---|
| 359 |
|
---|
| 360 | dnl The trailing newline in the sed command is needed for Mac OS X. Sigh.
|
---|
| 361 |
|
---|
| 362 | AC_CONFIG_COMMANDS_POST([sed '$i\
|
---|
| 363 | echo $as_me: fixing Makefile to keep version.c\
|
---|
| 364 | sed "/CONFIG_CLEAN_FILES/s/version.c//" < Makefile > $$.Makefile\
|
---|
| 365 | mv $$.Makefile Makefile
|
---|
| 366 | ' < $CONFIG_STATUS > $$.gawk-hack
|
---|
| 367 | mv $$.gawk-hack $CONFIG_STATUS])
|
---|
| 368 |
|
---|
| 369 |
|
---|
| 370 | AC_OUTPUT
|
---|