]> git.ipfire.org Git - thirdparty/squid.git/blame - configure.in
add -std1 for DUNIX cc
[thirdparty/squid.git] / configure.in
CommitLineData
090089c4 1dnl
2877b8a9 2dnl Configuration input file for Squid
090089c4 3dnl
983061ed 4dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9)
090089c4 5dnl
39243c87 6dnl $Id: configure.in,v 1.107 1998/03/19 22:48:52 wessels Exp $
090089c4 7dnl
8dnl
090089c4 9dnl
a26bdc75 10AC_INIT(src/main.c)
090089c4 11AC_CONFIG_HEADER(include/autoconf.h)
39243c87 12AC_REVISION($Revision: 1.107 $)dnl
2877b8a9 13AC_PREFIX_DEFAULT(/usr/local/squid)
da22ac20 14AC_CONFIG_AUX_DIR(aux)
090089c4 15
88d50a22 16AC_CANONICAL_HOST
17
26675bf4 18CRYPTLIB=''
00fa2c12 19REGEXLIB='' # -lregex
20LIBREGEX='' # libregex.a
090089c4 21
983061ed 22dnl use directory structure of cached as default (hack)
23if test "$libexecdir" = '${exec_prefix}/libexec'; then
24 libexecdir='${bindir}'
25 localstatedir='${prefix}'
26
27fi
28
a26bdc75 29if test -z "$CACHE_HTTP_PORT"; then
30 CACHE_HTTP_PORT="3128"
31fi
32if test -z "$CACHE_ICP_PORT"; then
33 CACHE_ICP_PORT="3130"
34fi
a26bdc75 35
090089c4 36dnl Subsitutions
a26bdc75 37AC_SUBST(CACHE_HTTP_PORT)
38AC_SUBST(CACHE_ICP_PORT)
090089c4 39
30a4f2a8 40AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host")
41
42dnl Set default LDFLAGS
43if test -z "$LDFLAGS"; then
44 LDFLAGS="-g"
45fi
46
38fea766 47PRESET_CFLAGS="$CFLAGS"
30a4f2a8 48
090089c4 49dnl Check for GNU cc
50AC_PROG_CC
51
7932a2e0 52case "$host" in
53 alpha-dec-osf*)
54 if test "$ac_cv_prog_CC" = "cc" ; then
39243c87 55 CC="cc -std1";
56 ac_cv_prog_CC="$CC"
7932a2e0 57 fi
58 ;;
59esac
60
090089c4 61dnl Warn if not using GNU cc
c601f22c 62dnl if test $ac_cv_prog_gcc = no; then
63dnl echo '**************************************************************';
64dnl echo '**************************************************************';
65dnl echo '**';
66dnl echo '** WARNING: Squid is only guaranteed to compile with GNU cc.';
67dnl echo "** Currently, you're using $CC";
68dnl echo '**';
69dnl echo '**************************************************************';
70dnl echo '**************************************************************';
71dnl sleep 5
72dnl fi
090089c4 73
6ad85e8a 74dnl Gerben Wierda <Gerben_Wierda@RnA.nl>
75case "$host" in
76 mab-next-nextstep3)
77 CC="$CC -arch m68k -arch i486 -arch hppa -arch sparc"
78 ;;
79esac
80
30a4f2a8 81dnl Set Default CFLAGS
82if test -z "$PRESET_CFLAGS"; then
83 if test "$GCC" = "yes"; then
84 case "$host" in
97b12a5b 85 *-sun-sunos*)
30a4f2a8 86 # sunos has too many warnings for this to be useful
87 # motorola too
88 ;;
97b12a5b 89 *m88k*)
90 # Motorola cc/ld does not like -02 but is ok on -O
91 CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]/-O/'`
92 ;;
30a4f2a8 93 *)
94 CFLAGS="$CFLAGS -Wall"
95 ;;
96 esac
97 fi
30a4f2a8 98fi
99
100dnl Set LDFLAGS
101if test -z "$PRESET_LDFLAGS"; then
102 if test "$GCC" = "yes"; then
103 case "$host" in
104 *)
105 # nothing
106 ;;
107 esac
108 fi
109fi
2060fa9a 110
e5f4e1b0 111dnl Enable optional modules
112AC_ARG_ENABLE(dlmalloc,
113[ --enable-dlmalloc Compile & use the malloc package by Doug Lea],
114[
115 if test "$enableval" = "yes" ; then
116 LIBDLMALLOC="libdlmalloc.a"
117 LIB_MALLOC="-L../lib -ldlmalloc"
118 ac_cv_func_mallinfo="yes"
119 ac_cv_func_mallocblksize="no"
120 ac_cv_func_free="yes"
121 ac_cv_func_realloc="yes"
122 ac_cv_func_memalign="yes"
123 ac_cv_func_valloc="yes"
124 ac_cv_func_pvalloc="yes"
125 ac_cv_func_calloc="yes"
126 ac_cv_func_cfree="yes"
127 ac_cv_func_malloc_trim="yes"
128 ac_cv_func_malloc_usable_size="yes"
129 ac_cv_func_malloc_stats="yes"
130 ac_cv_func_mallinfo="yes"
131 ac_cv_func_mallopt="yes"
132 ac_cv_lib_gnumalloc="no"
133 ac_cv_lib_malloc="no"
134 ac_cv_enabled_dlmalloc="yes"
135 echo "dlmalloc build enabled"
136 elif test "x$ac_cv_enabled_dlmalloc" = "xyes"; then
137 # Ok. dlmalloc was enabled before, but now disabled.
138 # we have to test these again
139 unset ac_cv_func_mallinfo
140 unset ac_cv_func_mallocblksize
141 unset ac_cv_func_free
142 unset ac_cv_func_realloc
143 unset ac_cv_func_memalign
144 unset ac_cv_func_valloc
145 unset ac_cv_func_pvalloc
146 unset ac_cv_func_calloc
147 unset ac_cv_func_cfree
148 unset ac_cv_func_malloc_trim
149 unset ac_cv_func_malloc_usable_size
150 unset ac_cv_func_malloc_stats
151 unset ac_cv_func_mallinfo
152 unset ac_cv_func_mallopt
153 unset ac_cv_lib_gnumalloc
154 unset ac_cv_lib_malloc
155 unset ac_cv_enabled_dlmalloc
156 fi
157 ],[
158 if test "x$ac_cv_enabled_dlmalloc" = "xyes"; then
159 # Ok. dlmalloc was enabled before, but now disabled.
160 # we have to test these again
161 unset ac_cv_func_mallinfo
162 unset ac_cv_func_mallocblksize
163 unset ac_cv_func_free
164 unset ac_cv_func_realloc
165 unset ac_cv_func_memalign
166 unset ac_cv_func_valloc
167 unset ac_cv_func_pvalloc
168 unset ac_cv_func_calloc
169 unset ac_cv_func_cfree
170 unset ac_cv_func_malloc_trim
171 unset ac_cv_func_malloc_usable_size
172 unset ac_cv_func_malloc_stats
173 unset ac_cv_func_mallinfo
174 unset ac_cv_func_mallopt
175 unset ac_cv_lib_gnumalloc
176 unset ac_cv_lib_malloc
177 unset ac_cv_enabled_dlmalloc
178 fi
179 ])
180AC_SUBST(LIBDLMALLOC)
181AC_SUBST(LIB_MALLOC)
182
183AC_ARG_ENABLE(gnuregex,
184[ --enable-gnuregex Compile GNUregex],
185[USE_GNUREGEX=$enableval])
186
e5f4e1b0 187AC_ARG_ENABLE(acltree,
188[ --enable-acltree[=bin|splay]
189 Use tree function to store ACL lists],
190[ case "$enableval" in
191 splay)
be7b1515 192 echo "ACL lists using SPLAY trees"
e5f4e1b0 193 AC_DEFINE(USE_SPLAY_TREE)
194 ;;
195 yes|bin)
be7b1515 196 echo "ACL lists using BIN trees"
e5f4e1b0 197 AC_DEFINE(USE_BIN_TREE)
198 ;;
199 esac
200])
201
36a97e19 202
e5f4e1b0 203AC_ARG_ENABLE(xmalloc_debug,
204[ --enable-xmalloc-debug Do some simple malloc debugging],
205[ if test "$enableval" = "yes" ; then
206 echo "Malloc debugging enabled"
207 AC_DEFINE(XMALLOC_DEBUG)
208 fi
209])
210
027acbaf 211AC_ARG_ENABLE(xmalloc_debug_trace,
212[ --enable-xmalloc-debug-trace
e5f4e1b0 213 Detailed trace of memory allocations],
214[ if test "$enableval" = "yes" ; then
027acbaf 215 echo "Malloc debug trace enabled"
216 AC_DEFINE(XMALLOC_TRACE)
217 AC_DEFINE(XMALLOC_DEBUG)
e5f4e1b0 218 fi
219])
220
221AC_ARG_ENABLE(xmalloc_statistics,
222[ --enable-xmalloc-statistics
223 Show malloc statistics in status page],
224[ if test "$enableval" = "yes" ; then
225 echo "Malloc statistics enabled"
226 AC_DEFINE(XMALLOC_STATISTICS)
227 fi
228])
229
230AC_ARG_ENABLE(async_io,
231[ --enable-async-io Do ASYNC disk I/O using threads],
232[ if test "$enableval" = "yes" ; then
233 echo "Async I/O enabled"
234 AC_DEFINE(USE_ASYNC_IO)
235 ASYNC_OBJS='$(ASYNC_OBJS)'
9fc0b4b8 236 SQUID_PTHREAD_LIB='$(PTHREADLIB)'
237 CFLAGS="$CFLAGS -D_REENTRANT"
e5f4e1b0 238 fi
239])
240AC_SUBST(ASYNC_OBJS)
241AC_SUBST(SQUID_PTHREAD_LIB)
242
243AC_ARG_ENABLE(icmp,
244[ --enable-icmp Enable ICMP pinging],
245[ if test "$enableval" = "yes" ; then
246 echo "ICMP enabled"
247 AC_DEFINE(USE_ICMP)
248 fi
249])
250
251AC_ARG_ENABLE(delay_hack,
252[ --enable-delay-hack Enable delay hack to limit bandwith usage],
253[ if test "$enableval" = "yes" ; then
254 echo "Delay hack enabled"
255 AC_DEFINE(DELAY_HACK)
256 fi
257])
258
36a97e19 259AC_ARG_ENABLE(mem-gen-trace,
260[ --enable-mem-gen-trace Do trace of memory stuff],
261[ if test "$enableval" = "yes" ; then
262 echo "Memory trace (to file) enabled"
263 AC_DEFINE(MEM_GEN_TRACE)
264 fi
265])
266
e5f4e1b0 267AC_ARG_ENABLE(useragent_log,
268[ --enable-useragent-log Enable logging of User-Agent header],
269[ if test "$enableval" = "yes" ; then
270 echo "User-Agent logging enabled"
271 AC_DEFINE(USE_USERAGENT_LOG)
272 fi
273])
274
9fc0b4b8 275AC_ARG_ENABLE(kill_parent_hack,
276[ --enable-kill-parent-hack
277 Kill parent on shutdown],
e5f4e1b0 278[ if test "$enableval" = "yes" ; then
279 echo "Kill parent on shutdown"
280 AC_DEFINE(KILL_PARENT_OPT)
281 fi
282])
283
284AC_ARG_ENABLE(snmp,
285[ --enable-snmp Enable SNMP monitoring],
286[ if test "$enableval" = "yes" ; then
287 echo "SNMP monitoring enabled"
288 AC_DEFINE(SQUID_SNMP)
289 SNMPLIB='-L../snmplib -lsnmp'
290 SNMP_OBJS='$(SNMP_OBJS)'
291 makesnmplib=snmplib
292 fi
293])
294AC_SUBST(SNMPLIB)
295AC_SUBST(SNMP_OBJS)
296AC_SUBST(makesnmplib)
297
298AC_ARG_ENABLE(time_hack,
299[ --enable-time-hack Update internal timestamp only once per second],
300[ if test "$enableval" = "yes" ; then
301 echo "Update internal timestamp only once per second"
302 AC_DEFINE(ALARM_UPDATES_TIME)
303 fi
304])
305
306AC_ARG_ENABLE(cachemgr_hostname,
307[ --enable-cachemgr-hostname[=hostname]
308 Make cachemgr.cgi default to this host],
309[ case $enableval in
310 yes)
311 AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()])
312 echo "Cachemgr default hostname == host where cachemgr runs"
313 ;;
314 no)
315 : # Nothing to do..
316 ;;
317 *)
318 AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
319 echo "Cachemgr default hostname set to ${enableval}"
320 ;;
321 esac
322])
323
324AC_ARG_ENABLE(arp_acl,
325[ --enable-arp-acl Enable use of ARP ACL lists (ether address)],
326[ if test "$enableval" = "yes" ; then
327 echo "ARP ACL lists enabled (ether address)"
328 AC_DEFINE(USE_ARP_ACL)
329 fi
330])
331
090089c4 332dnl Check for programs
333AC_PROG_CPP
334AC_PROG_INSTALL
335AC_PROG_RANLIB
336AC_PROG_LN_S
81280a96 337AC_PATH_PROG(SH, sh, /bin/sh)
d9f67e6f 338AC_PATH_PROG(FALSE, false, /usr/bin/false)
339AC_PATH_PROG(TRUE, true, /usr/bin/true)
340AC_PATH_PROG(RM, rm, $FALSE)
341AC_PATH_PROG(MV, mv, $FALSE)
342AC_PATH_PROG(MKDIR, mkdir, $FALSE)
090089c4 343AC_PATH_PROG(LN, ln, cp)
983061ed 344AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
d9f67e6f 345AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
6ad85e8a 346AC_PATH_PROG(AR, ar, $FALSE)
347
348case "$host" in
349 *-hp-hpux*)
350 echo "Disabling 'ranlib' for HP-UX..."
351 RANLIB=":"
352 ;;
353esac
354
355dnl set $(AR)
356AR_R="$AR r"
357case "$host" in
358 *-next-nextstep3)
359 AR="libtool -o"
360 ;;
361esac
362AC_SUBST(AR_R)
090089c4 363
364dnl Check for headers
365AC_HEADER_DIRENT
366AC_HEADER_STDC
db40ae20 367
368AC_CHECK_HEADERS( \
369 alloca.h \
370 arpa/inet.h \
30a4f2a8 371 arpa/nameser.h \
9441aa34 372 assert.h \
db40ae20 373 bstring.h \
374 config.h \
375 crypt.h \
30a4f2a8 376 ctype.h \
377 errno.h \
db40ae20 378 fcntl.h \
9c1d8929 379 getopt.h \
88738790 380 gnumalloc.h \
30a4f2a8 381 grp.h \
382 libc.h \
6ad85e8a 383 limits.h \
30a4f2a8 384 malloc.h \
e0bddc45 385 math.h \
db40ae20 386 memory.h \
30a4f2a8 387 netdb.h \
db40ae20 388 netinet/in.h \
30a4f2a8 389 netinet/tcp.h \
dcfe6390 390 poll.h \
30a4f2a8 391 pwd.h \
392 regex.h \
393 resolv.h \
394 signal.h \
395 stdarg.h \
396 stddef.h \
397 stdio.h \
db40ae20 398 stdlib.h \
399 string.h \
400 strings.h \
401 sys/file.h \
30a4f2a8 402 sys/param.h \
403 sys/resource.h \
db40ae20 404 sys/select.h\
30a4f2a8 405 sys/socket.h \
406 sys/stat.h \
407 sys/syscall.h \
db40ae20 408 sys/time.h \
409 sys/types.h \
30a4f2a8 410 sys/un.h \
411 sys/wait.h \
db40ae20 412 syslog.h \
30a4f2a8 413 time.h \
414 unistd.h \
415 varargs.h \
db40ae20 416)
417
aee0606f 418AC_C_CONST
d57288d2 419AC_C_BIGENDIAN
aee0606f 420
5c51415d 421AC_CACHE_CHECK(if ANSI prototypes work,ac_cv_have_ansi_prototypes, [
422 AC_TRY_COMPILE([int foo(char *); int foo (char *bar) {return 1;}],
423 [foo("bar")],
424 ac_cv_have_ansi_prototypes="yes",
425 ac_cv_have_ansi_prototypes="no")
426])
427if test $ac_cv_have_ansi_prototypes = "yes" ; then
428 AC_DEFINE(HAVE_ANSI_PROTOTYPES)
429fi
20a50bb9 430
5c51415d 431AC_CACHE_CHECK(for tm->tm_gmtoff,ac_cv_have_tm_gmoff, [
432 AC_TRY_COMPILE([#include <time.h>
46c883ed 433#include <sys/time.h>],
5c51415d 434 [struct tm foo;
435 foo.tm_gmtoff = 0;],
436 ac_cv_have_tm_gmoff="yes",
437 ac_cv_have_tm_gmoff="no")
438])
439if test $ac_cv_have_tm_gmoff = "yes" ; then
440 AC_DEFINE(HAVE_TM_GMTOFF)
441fi
46c883ed 442
5c51415d 443AC_CACHE_CHECK(for extended mallinfo,ac_cv_have_ext_mallinfo, [
444 AC_TRY_COMPILE([#include <sys/types.h>
46c883ed 445#include <malloc.h>],
5c51415d 446 [struct mallinfo foo;
447 foo.mxfast = 0;],
448 ac_cv_have_ext_mallinfo="yes",
449 ac_cv_have_ext_mallinfo="no")
450])
451if test $ac_cv_have_ext_mallinfo = "yes" ; then
452 AC_DEFINE(HAVE_EXT_MALLINFO)
453fi
090089c4 454
b54a6789 455AC_CACHE_CHECK(for struct rusage,ac_cv_have_struct_rusage, [
456 AC_TRY_COMPILE([
8ff51bba 457#if HAVE_SYS_TIME_H
458#include <sys/time.h>
459#endif
b54a6789 460#if HAVE_SYS_RESOURCE_H
461#include <sys/resource.h>
462#endif],
463 [struct rusage R;],
464 ac_cv_have_struct_rusage="yes",
465 ac_cv_have_struct_rusage="no")
466])
467if test $ac_cv_have_struct_rusage = "yes" ; then
468 AC_DEFINE(HAVE_STRUCT_RUSAGE)
469fi
470
5c51415d 471AC_CACHE_CHECK(for ip->ip_hl, ac_cv_have_ip_hl, [
472 AC_TRY_COMPILE([#include <sys/types.h>
a025a745 473#include <netinet/in.h>
474#include <netinet/in_systm.h>
6ad85e8a 475#include <netinet/ip.h>
476#ifdef __linux__
477#define ip_hl ihl
478#endif
479#ifndef __linux__
480#define iphdr ip
481#endif],
5c51415d 482 [struct iphdr ip;
483 ip.ip_hl= 0;],
484 ac_cv_have_ip_hl="yes",
485 ac_cv_have_ip_hl="no")
486])
487if test $ac_cv_have_ip_hl = "yes" ; then
488 AC_DEFINE(HAVE_IP_HL)
489fi
a025a745 490
090089c4 491dnl Check for typedefs
492AC_CHECK_SIZEOF(int)
493AC_CHECK_SIZEOF(long)
494
256cf05b 495dnl Check for special functions
496AC_FUNC_ALLOCA
090089c4 497
3f6fcd8a 498AC_CHECK_TYPE(pid_t, int)
0897af2d 499AC_CHECK_TYPE(size_t, unsigned int)
500AC_CHECK_TYPE(ssize_t, int)
3f6fcd8a 501AC_CHECK_TYPE(off_t, int)
95cf2361 502AC_CHECK_TYPE(mode_t, u_short)
3f6fcd8a 503
090089c4 504dnl Check for needed libraries
30a4f2a8 505AC_CHECK_LIB(nsl, main)
6716b242 506AC_CHECK_LIB(socket, main)
8a15e65e 507AC_CHECK_LIB(gnumalloc, main)
5c51415d 508if test "$ac_cv_lib_gnumalloc_main" = "yes"; then
509 echo "Disabling extended malloc functions when using gnumalloc"
510 ac_cv_func_mallinfo=no
511 ac_cv_func_mallocblksize=no
512 ac_cv_func_mallopt=no
513else
8a15e65e 514 case "$host" in
515 *-sun-solaris*)
516 echo "skipping libmalloc check for $host"
517 ;;
518 i386-*-freebsd*)
519 echo "skipping libmalloc check for $host"
520 ;;
521 *)
522 AC_CHECK_LIB(malloc, main)
523 ;;
524 esac
525fi
6716b242 526AC_CHECK_LIB(bsd, main)
be79ade0 527AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"])
78743365 528case "$host" in
529 i386-*-freebsd*)
530 echo "skipping libresolv checks for $host"
531 ;;
532 *)
533 AC_CHECK_LIB(resolv, inet_aton, AC_CHECK_LIB(44bsd, inet_aton))
534 AC_CHECK_LIB(resolv, main)
535 ;;
536esac
e0bddc45 537AC_CHECK_LIB(m, main)
090089c4 538
539dnl Check for libcrypt
b8de7ebe 540dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
be79ade0 541AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
542AC_SUBST(CRYPTLIB)
77f675ad 543
e5f4e1b0 544dnl Check for pthreads
545dnl We use pthreads when doing ASYNC I/O
71f8abc8 546AC_CHECK_LIB(pthread, main, [PTHREADLIB="-lpthread"])
547AC_SUBST(PTHREADLIB)
548
77f675ad 549dnl System-specific library modifications
550dnl
551case "$host" in
88738790 552 i386-*-solaris2.*)
7149a49f 553 if test "$GCC" = "yes"; then
554 echo "Removing -O for gcc on $host"
80e92d6d 555 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
7149a49f 556 fi
557 ;;
77f675ad 558 *-sgi-irix*)
559 echo "Removing -lsocket for IRIX..."
6716b242 560 LIBS=`echo $LIBS | sed -e s/-lsocket//`
77f675ad 561 echo "Removing -lnsl for IRIX..."
6716b242 562 LIBS=`echo $LIBS | sed -e s/-lnsl//`
b44c0fb4 563 echo "Removing -lbsd for IRIX..."
564 LIBS=`echo $LIBS | sed -e s/-lbsd//`
77f675ad 565 ;;
4ba0bd0e 566dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
567dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
568dnl Please change your configure script. AIX doesn't need -lbsd.
569 *-ibm-aix*)
570 echo "Removing -lbsd for AIX..."
571 LIBS=`echo $LIBS | sed -e s/-lbsd//`
572 ;;
30a4f2a8 573 *m88k*)
574 CFLAGS="$CFLAGS -D_SQUID_MOTOROLA_"
7149a49f 575 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
576 ;;
580ce039 577 [*-*-solaris2.[0-4]])
7149a49f 578 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
30a4f2a8 579 ;;
77f675ad 580esac
090089c4 581
176d10ee 582# Recommended by Balint Nagy Endre <bne@CareNet.hu>
583case "$host" in
584 *-univel-sysv4.2MP)
585 if test `uname -v` = "2.03"; then
586 echo "disabling mallinfo for $host"
587 ac_cv_func_mallinfo=no
588 fi
589 ;;
590esac
591
592
6716b242 593dnl Check for library functions
594AC_CHECK_FUNCS(\
30a4f2a8 595 bcopy \
4ac29a5b 596 fchmod \
6716b242 597 getdtablesize \
8505e57b 598 getpagesize \
30a4f2a8 599 getrusage \
9c1d8929 600 getspnam \
30a4f2a8 601 lrand48 \
6716b242 602 mallinfo \
0f5efab0 603 mallocblksize \
6716b242 604 mallopt \
2ae6b9b0 605 memcpy \
30a4f2a8 606 memmove \
1812b6c7 607 mktime \
88738790 608 mstats \
b1e77ec1 609 random \
6716b242 610 regcomp \
611 regexec \
612 regfree \
30a4f2a8 613 res_init \
234967c9 614 seteuid \
30a4f2a8 615 setpgrp \
6716b242 616 setrlimit \
30a4f2a8 617 setsid \
618 sigaction \
11430c03 619 snprintf \
30a4f2a8 620 srand48 \
b1e77ec1 621 srandom \
6716b242 622 sysconf \
623 syslog \
0a3efad5 624 tempnam \
234967c9 625 timegm \
28da5e0d 626 vsnprintf \
6716b242 627)
628
a03233e7 629case "$host" in
630 [alpha-dec-osf3.*])
631 # John Kay (jkay@nlanr.net) 19970818
bbaf3d23 632 echo "skipping poll() check for $host..."
633 ac_cv_func_poll='no'
634 ;;
635 [*-hp-hpux*.*])
636 # Duane Wessels
637 echo "skipping poll() check for $host..."
638 ac_cv_func_poll='no'
639 ;;
640 *)
641 AC_CHECK_FUNC(poll)
a03233e7 642 ;;
643esac
644
60939927 645dnl Yay! Another Linux brokenness. Its not good enough
646dnl to know that setresuid() exists, because RedHat 5.0 declares
647dnl setresuid() but doesn't implement it.
648dnl
649AC_CACHE_CHECK(if setresuid is implemented, ac_cv_func_setresuid,
5c51415d 650 AC_TRY_RUN([
60939927 651#include <stdlib.h>
5c51415d 652 int main() {
653 if(setresuid(-1,-1,-1)) {
654 perror("setresuid:");
655 exit(1);
60939927 656 }
657 exit(0);
5c51415d 658 }
659 ],ac_cv_func_setresuid="yes",ac_cv_func_setresuid="no")
60939927 660)
5c51415d 661if test "$ac_cv_func_setresuid" = "yes" ; then
662 AC_DEFINE(HAVE_SETRESUID)
663fi
60939927 664
7a081912 665AC_MSG_CHECKING(if GNUregex needs to be compiled)
00fa2c12 666if test "$ac_cv_func_regcomp" = "no" ; then
74946a0f 667 USE_GNUREGEX="yes"
00fa2c12 668else
74946a0f 669 USE_GNUREGEX="no"
00fa2c12 670fi
671case "$host" in
580ce039 672 [*-sun-solaris2.[0-4]])
74946a0f 673 USE_GNUREGEX="yes"
674 ;;
675 [*-next-nextstep*])
676 USE_GNUREGEX="yes"
677 ;;
00fa2c12 678esac
74946a0f 679AC_MSG_RESULT($USE_GNUREGEX)
680if test "$USE_GNUREGEX" = "yes"; then
26675bf4 681 REGEXLIB="-lregex"
7a081912 682 LIBREGEX="libregex.a"
74946a0f 683 AC_DEFINE(USE_GNUREGEX)
7a081912 684fi
26675bf4 685AC_SUBST(REGEXLIB)
00fa2c12 686AC_SUBST(LIBREGEX)
7a081912 687
3f6fcd8a 688AC_REPLACE_FUNCS(\
689 tempnam \
4d38fc7e 690 strerror \
3f6fcd8a 691)
692
5c51415d 693dnl Not cached since people are likely to tune this
e924600d 694AC_MSG_CHECKING(Default FD_SETSIZE value)
695AC_TRY_RUN([
696#if HAVE_STDIO_H
697#include <stdio.h>
698#endif
699#if HAVE_UNISTD_H
700#include <unistd.h>
701#endif
702#if HAVE_SYS_TIME_H
703#include <sys/time.h>
704#endif
705#if HAVE_SYS_SELECT_H
706#include <sys/select.h>
707#endif
708#if HAVE_SYS_TYPES_H
709#include <sys/types.h>
710#endif
711main() {
712 fprintf (fopen("conftestval", "w"), "%d\n", FD_SETSIZE);
713 exit(0);
714}
715],
716DEFAULT_FD_SETSIZE=`cat conftestval`,
717DEFAULT_FD_SETSIZE=256,
718DEFAULT_FD_SETSIZE=256)
719AC_MSG_RESULT($DEFAULT_FD_SETSIZE)
720AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE)
721
5c51415d 722dnl Not cached since people are likely to tune this
234967c9 723AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
724AC_TRY_RUN([
8cca06da 725#include <stdio.h>
234967c9 726#include <unistd.h>
30a4f2a8 727#include <sys/time.h> /* needed on FreeBSD */
234967c9 728#include <sys/param.h>
729#include <sys/resource.h>
730main() {
731 int i,j;
732#if HAVE_SETRLIMIT
733 struct rlimit rl;
734#if defined(RLIMIT_NOFILE)
735 if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
736 perror("getrlimit: RLIMIT_NOFILE");
737 } else {
738 rl.rlim_cur = rl.rlim_max; /* set it to the max */
739 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
740 perror("setrlimit: RLIMIT_NOFILE");
741 }
742 }
743#elif defined(RLIMIT_OFILE)
744 if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
745 perror("getrlimit: RLIMIT_OFILE");
746 } else {
747 rl.rlim_cur = rl.rlim_max; /* set it to the max */
748 if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
749 perror("setrlimit: RLIMIT_OFILE");
750 }
751 }
752#endif /* RLIMIT_NOFILE */
753#endif /* HAVE_SETRLIMIT */
754#if HAVE_SYSCONF && defined(_SC_OPEN_MAX)
755 i = sysconf(_SC_OPEN_MAX);
3f6fcd8a 756#elif HAVE_GETDTABLESIZE && !defined(__linux__)
234967c9 757 i = getdtablesize();
758#elif defined(OPEN_MAX)
759 i = OPEN_MAX;
760#elif defined(NOFILE)
761 i = NOFILE;
762#elif defined(_NFILE)
763 i = _NFILE;
764#else
765 while((j=open("/dev/null", 0)) > 0) i=j;
0a5b9b32 766 close(i); close(i-1);
767 i++;
234967c9 768#endif
769 fprintf (fopen("conftestval", "w"), "%d\n", i);
770 exit(0);
771}
772],
431d84c5 773SQUID_MAXFD=`cat conftestval`,
774SQUID_MAXFD=256,
775SQUID_MAXFD=256)
776AC_MSG_RESULT($SQUID_MAXFD)
777AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD)
234967c9 778
5c51415d 779dnl Not cached since people are likely to tune this
30a4f2a8 780AC_MSG_CHECKING(Default UDP send buffer size)
781AC_TRY_RUN([
8cca06da 782#include <stdlib.h>
783#include <stdio.h>
30a4f2a8 784#include <sys/types.h>
785#include <sys/socket.h>
786#include <netinet/in.h>
787main ()
788{
789 int fd,val=0,len=sizeof(int);
790 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
791 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
792 if (val<=0) exit(1);
793 fprintf (fopen("conftestval", "w"), "%d\n", val);
794 exit(0);
795}
796],
797SQUID_UDP_SO_SNDBUF=`cat conftestval`,
1c481e00 798SQUID_UDP_SO_SNDBUF=16384,
799SQUID_UDP_SO_SNDBUF=16384)
30a4f2a8 800AC_MSG_RESULT($SQUID_UDP_SO_SNDBUF)
801AC_DEFINE_UNQUOTED(SQUID_UDP_SO_SNDBUF, $SQUID_UDP_SO_SNDBUF)
802
5c51415d 803dnl Not cached since people are likely to tune this
30a4f2a8 804AC_MSG_CHECKING(Default UDP receive buffer size)
805AC_TRY_RUN([
8cca06da 806#include <stdlib.h>
807#include <stdio.h>
30a4f2a8 808#include <sys/types.h>
809#include <sys/socket.h>
810#include <netinet/in.h>
811main ()
812{
813 int fd,val=0,len=sizeof(int);
814 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
815 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
816 if (val <= 0) exit(1);
817 fprintf (fopen("conftestval", "w"), "%d\n", val);
818 exit(0);
819}
820],
821SQUID_UDP_SO_RCVBUF=`cat conftestval`,
1c481e00 822SQUID_UDP_SO_RCVBUF=16384,
823SQUID_UDP_SO_RCVBUF=16384)
30a4f2a8 824AC_MSG_RESULT($SQUID_UDP_SO_RCVBUF)
825AC_DEFINE_UNQUOTED(SQUID_UDP_SO_RCVBUF, $SQUID_UDP_SO_RCVBUF)
826
5c51415d 827dnl Not cached since people are likely to tune this
30a4f2a8 828AC_MSG_CHECKING(Default TCP send buffer size)
829AC_TRY_RUN([
8cca06da 830#include <stdlib.h>
831#include <stdio.h>
30a4f2a8 832#include <sys/types.h>
833#include <sys/socket.h>
834#include <netinet/in.h>
835main ()
836{
837 int fd,val=0,len=sizeof(int);
838 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
839 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
840 if (val <= 0) exit(1);
841 fprintf (fopen("conftestval", "w"), "%d\n", val);
842 exit(0);
843}
844],
845SQUID_TCP_SO_SNDBUF=`cat conftestval`,
1c481e00 846SQUID_TCP_SO_SNDBUF=16384,
847SQUID_TCP_SO_SNDBUF=16384)
30a4f2a8 848AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF)
849AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF)
850
5c51415d 851dnl Not cached since people are likely to tune this
30a4f2a8 852AC_MSG_CHECKING(Default TCP receive buffer size)
853AC_TRY_RUN([
8cca06da 854#include <stdlib.h>
855#include <stdio.h>
30a4f2a8 856#include <sys/types.h>
857#include <sys/socket.h>
858#include <netinet/in.h>
859main ()
860{
861 int fd,val=0,len=sizeof(int);
862 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
863 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
864 if (val <= 0) exit(1);
865 fprintf (fopen("conftestval", "w"), "%d\n", val);
866 exit(0);
867}
868],
869SQUID_TCP_SO_RCVBUF=`cat conftestval`,
1c481e00 870SQUID_TCP_SO_RCVBUF=16384,
871SQUID_TCP_SO_RCVBUF=16384)
30a4f2a8 872AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF)
873AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF)
874
5c51415d 875AC_CACHE_CHECK(if sys_errlist is already defined, ac_cv_needs_sys_errlist,
876 AC_TRY_COMPILE([#include <stdio.h>],[char *s = sys_errlist[0];],
877 ac_cv_needs_sys_errlist="no",
878 ac_cv_needs_sys_errlist="yes")
879)
880if test "$ac_cv_needs_sys_errlist" = "yes" ; then
881 AC_DEFINE(NEED_SYS_ERRLIST)
882fi
30a4f2a8 883
5c51415d 884dnl Not cached since people are likely to change this
6bf65235 885AC_MSG_CHECKING(for libresolv _dns_ttl_ hack)
886AC_TRY_LINK(extern int _dns_ttl_;,return _dns_ttl_;,
887[AC_MSG_RESULT(yes)
888AC_DEFINE(LIBRESOLV_DNS_TTL_HACK)],
889AC_MSG_RESULT(no))
890
090089c4 891dnl Need the debugging version of malloc if available
892XTRA_OBJS=''
6509a1a0 893if test "$ac_cv_lib_malloc_main" = "yes" ; then
090089c4 894 if test -r /usr/lib/debug/malloc.o ; then
895 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
896 fi
897 if test -r /usr/lib/debug/mallocmap.o ; then
898 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
899 fi
900fi
2bbd722b 901
090089c4 902AC_SUBST(XTRA_OBJS)
903
38fea766 904if test -z "$XTRA_LIBS"; then
905 XTRA_LIBS="$LIBS"
906 LIBS=''
907fi
090089c4 908AC_SUBST(XTRA_LIBS)
909
090089c4 910dnl Clean up after OSF/1 core dump bug
911rm -f core
912
913AC_OUTPUT(\
0992a350 914 ./makefile \
090089c4 915 ./lib/Makefile \
a26bdc75 916 ./include/config.h \
090089c4 917 ./scripts/Makefile \
918 ./scripts/RunCache \
919 ./scripts/RunAccel \
a26bdc75 920 ./src/Makefile \
e550e8b6 921 ./contrib/Makefile \
2bbd722b 922 ./snmplib/Makefile \
81280a96 923 ./icons/Makefile \
d4fb069d 924 ./errors/Makefile \
090089c4 925)