source: vendor/gawk/3.1.5/configure.ac@ 3513

Last change on this file since 3513 was 3076, checked in by bird, 18 years ago

gawk 3.1.5

File size: 9.7 KB
Line 
1dnl
2dnl configure.ac --- autoconf input file for gawk
3dnl
4dnl Copyright (C) 1995-2005 the Free Software Foundation, Inc.
5dnl
6dnl This file is part of GAWK, the GNU implementation of the
7dnl AWK Programming Language.
8dnl
9dnl GAWK is free software; you can redistribute it and/or modify
10dnl it under the terms of the GNU General Public License as published by
11dnl the Free Software Foundation; either version 2 of the License, or
12dnl (at your option) any later version.
13dnl
14dnl GAWK is distributed in the hope that it will be useful,
15dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
16dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17dnl GNU General Public License for more details.
18dnl
19dnl You should have received a copy of the GNU General Public License
20dnl along with this program; if not, write to the Free Software
21dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22dnl
23
24dnl Process this file with autoconf to produce a configure script.
25
26AC_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
36if test "x$INSTALL" = "x"
37then
38 INSTALL="$srcdir/install-sh -c"
39 export INSTALL
40fi
41
42AC_PREREQ(2.59)
43AM_INIT_AUTOMAKE
44
45dnl Additional argument stuff
46AC_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)
52AC_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)
59AC_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)
65AC_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
72dnl checks for programs
73AC_PROG_EGREP
74AC_PROG_YACC
75AC_PROG_LN_S
76AC_PROG_CC
77AC_PROG_CPP
78AC_PROG_RANLIB
79
80AC_OBJEXT
81AC_EXEEXT
82
83AC_PROG_INSTALL
84
85AC_PROG_MAKE_SET
86
87# This is mainly for my use during testing and development.
88# Yes, it's a bit of a hack.
89AC_MSG_CHECKING([for special development options])
90if test -f $srcdir/.developing
91then
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])
105else
106 AC_MSG_RESULT([no])
107fi
108
109AC_SUBST(CFLAGS)
110
111dnl checks for systems
112AC_AIX
113AC_ISC_POSIX
114AC_MINIX
115AC_SYS_LARGEFILE
116GAWK_AC_AIX_TWEAK
117GAWK_AC_LINUX_ALPHA
118
119if test "$ISC" = 1 # will be set by test for ISC
120then
121dnl need -D_SYSV3 for ISC
122 CFLAGS="$CFLAGS -D_SYSV3"
123fi
124
125dnl check for C compiler for automake
126AM_PROG_CC_STDC
127AM_C_PROTOTYPES
128
129dnl Cygwin doesn't like to get libs with full paths
130dnl since that overrides linking against DLLs.
131case `(uname) 2> /dev/null` in
132*CYGWIN*)
133 with_libiconv_prefix=no
134 with_libintl_prefix=no
135 ;;
136*)
137 ;;
138esac
139
140dnl initialize GNU gettext
141AM_GNU_GETTEXT([external])
142AM_GNU_GETTEXT_VERSION([0.14.4])
143
144dnl checks for header files
145AC_HEADER_STDC
146AC_HEADER_SYS_WAIT
147AC_HEADER_TIME
148AC_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
153if test "$ac_cv_header_string_h" = yes
154then
155 AC_CHECK_HEADERS(memory.h)
156else
157 AC_CHECK_HEADERS(strings.h)
158fi
159
160dnl checks for typedefs
161AC_TYPE_PID_T
162AC_TYPE_SIGNAL
163AC_SIZE_T
164AC_TYPE_GETGROUPS
165gl_AC_TYPE_LONG_LONG
166gl_AC_TYPE_UNSIGNED_LONG_LONG
167gl_AC_TYPE_INTMAX_T
168gl_AC_TYPE_UINTMAX_T
169AC_CHECK_TYPE(ssize_t, int)
170AC_CHECK_SIZEOF(unsigned int)
171AC_CHECK_SIZEOF(unsigned long)
172AC_EGREP_HEADER([int.*sprintf], stdio.h,
173 AC_DEFINE(SPRINTF_RET, int, [return type of sprintf]),
174 AC_DEFINE(SPRINTF_RET, char *))
175dnl see if time_t is defined in <sys/types.h>
176AC_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]))
182dnl check for wctype_t in <wctype.h>
183AC_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]))
188dnl check for wint_t in <wctype.h>
189AC_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
195dnl Borrwed from rsync, thanks to to Jim Meyering.
196
197dnl Check for socklen_t: historically on BSD it is an int, and in
198dnl POSIX 1g it is a type of its own, but some platforms use different
199dnl types for the argument to getsockopt, getpeername, etc. So we
200dnl have to test to find something that will work.
201
202dnl This is no good, because passing the wrong pointer on C compilers is
203dnl likely to only generate a warning, not an error.
204
205AC_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
232dnl Some systems get this. Default to int. -- ADR
233dnl 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])
243TYPE_SOCKLEN_T
244
245dnl checks for functions
246AC_FUNC_VPRINTF
247GAWK_AC_FUNC_STRTOD_C89
248AC_FUNC_MKTIME
249case "$ac_cv_func_working_mktime" in
250yes) AC_DEFINE(HAVE_MKTIME, 1, [we have the mktime function])
251 ;;
252esac
253
254AC_CHECK_LIB(m, fmod)
255AC_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)
261dnl this check is for both mbrtowc and the mbstate_t type, which is good
262AC_FUNC_MBRTOWC
263
264dnl check for dynamic linking
265dnl This is known to be very primitive
266AC_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
283dnl check for how to use getpgrp
284dnl have to hardwire it for VMS POSIX. Sigh.
285dnl ditto for BeOS, OS/2, and MS-DOS.
286case `(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 ;;
293esac
294
295dnl check for printf %F format
296AC_MSG_CHECKING([for printf %F format])
297AC_RUN_IFELSE([
298#include <stdio.h>
299
300int 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)
316if test "$has_f_format" = yes; then
317 AC_DEFINE(PRINTF_HAS_F_FORMAT, 1, [Define to 1 if *printf supports %F format])
318fi
319AC_MSG_RESULT($has_f_format)
320
321dnl check for sockets
322GAWK_AC_LIB_SOCKETS
323
324dnl checks for structure members
325AC_STRUCT_ST_BLKSIZE
326AC_HEADER_TIME
327AC_STRUCT_TM
328AC_STRUCT_TIMEZONE
329
330dnl checks for compiler characteristics
331AC_C_CHAR_UNSIGNED
332AC_C_CONST
333AC_C_RESTRICT
334AC_C_INLINE
335AC_C_STRINGIZE
336
337AC_CONFIG_HEADERS([config.h:configh.in])
338AH_BOTTOM([#include "custom.h"])
339
340AC_CONFIG_FILES(Makefile
341 awklib/Makefile
342 doc/Makefile
343 po/Makefile.in
344 test/Makefile
345 [version.c:version.in])
346
347dnl This is a significant and rather ugly hack. We want to keep
348dnl version.c from being removed upon `make distclean'.
349dnl We put the `$$' on the front for old systems with 14-char filenames.
350
351dnl At this point, `configure' has finished creating `config.status' which
352dnl actually does all the checking and configuring. `config.status' is run
353dnl by the AC_OUTPUT macro below. This step comes in between the two: it
354dnl adds code to `config.status'. Doing it there ensures that this step
355dnl happens *every* time `config.status' is run, such as when `make' decides
356dnl to update something. Fun, fun, fun.
357
358dnl Be careful of multiple levels of shell quoting!
359
360dnl The trailing newline in the sed command is needed for Mac OS X. Sigh.
361
362AC_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
370AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.