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