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