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