]> git.ipfire.org Git - thirdparty/squid.git/blob - configure.in
writing --enable-htcp
[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.111 1998/03/28 04:33:38 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.111 $)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 AC_DEFINE(USE_HTCP)
328 fi
329 ])
330
331 # Force some compilers to use ANSI features
332 #
333 case "$host" in
334 alpha-dec-osf*)
335 if test "$ac_cv_prog_CC" = "cc" ; then
336 echo "adding '-std1' to cc args for $host"
337 CC="cc -std1";
338 ac_cv_prog_CC="$CC"
339 fi
340 ;;
341 esac
342
343 dnl Check for programs
344 AC_PROG_CPP
345 AC_PROG_INSTALL
346 AC_PROG_RANLIB
347 AC_PROG_LN_S
348 AC_PATH_PROG(SH, sh, /bin/sh)
349 AC_PATH_PROG(FALSE, false, /usr/bin/false)
350 AC_PATH_PROG(TRUE, true, /usr/bin/true)
351 AC_PATH_PROG(RM, rm, $FALSE)
352 AC_PATH_PROG(MV, mv, $FALSE)
353 AC_PATH_PROG(MKDIR, mkdir, $FALSE)
354 AC_PATH_PROG(LN, ln, cp)
355 AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
356 AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
357 AC_PATH_PROG(AR, ar, $FALSE)
358
359 case "$host" in
360 *-hp-hpux*)
361 echo "Disabling 'ranlib' for HP-UX..."
362 RANLIB=":"
363 ;;
364 esac
365
366 dnl set $(AR)
367 AR_R="$AR r"
368 case "$host" in
369 *-next-nextstep3)
370 AR="libtool -o"
371 ;;
372 esac
373 AC_SUBST(AR_R)
374
375 dnl Check for headers
376 AC_HEADER_DIRENT
377 AC_HEADER_STDC
378
379 AC_CHECK_HEADERS( \
380 alloca.h \
381 arpa/inet.h \
382 arpa/nameser.h \
383 assert.h \
384 bstring.h \
385 config.h \
386 crypt.h \
387 ctype.h \
388 errno.h \
389 fcntl.h \
390 getopt.h \
391 gnumalloc.h \
392 grp.h \
393 libc.h \
394 limits.h \
395 malloc.h \
396 math.h \
397 memory.h \
398 netdb.h \
399 netinet/in.h \
400 netinet/tcp.h \
401 poll.h \
402 pwd.h \
403 regex.h \
404 resolv.h \
405 signal.h \
406 stdarg.h \
407 stddef.h \
408 stdio.h \
409 stdlib.h \
410 string.h \
411 strings.h \
412 sys/file.h \
413 sys/param.h \
414 sys/resource.h \
415 sys/select.h\
416 sys/socket.h \
417 sys/stat.h \
418 sys/syscall.h \
419 sys/time.h \
420 sys/types.h \
421 sys/un.h \
422 sys/wait.h \
423 syslog.h \
424 time.h \
425 unistd.h \
426 varargs.h \
427 )
428
429 AC_C_CONST
430 AC_C_BIGENDIAN
431
432 AC_CACHE_CHECK(if ANSI prototypes work,ac_cv_have_ansi_prototypes, [
433 AC_TRY_COMPILE([int foo(char *); int foo (char *bar) {return 1;}],
434 [foo("bar")],
435 ac_cv_have_ansi_prototypes="yes",
436 ac_cv_have_ansi_prototypes="no")
437 ])
438 if test $ac_cv_have_ansi_prototypes = "yes" ; then
439 AC_DEFINE(HAVE_ANSI_PROTOTYPES)
440 fi
441
442 AC_CACHE_CHECK(for tm->tm_gmtoff,ac_cv_have_tm_gmoff, [
443 AC_TRY_COMPILE([#include <time.h>
444 #include <sys/time.h>],
445 [struct tm foo;
446 foo.tm_gmtoff = 0;],
447 ac_cv_have_tm_gmoff="yes",
448 ac_cv_have_tm_gmoff="no")
449 ])
450 if test $ac_cv_have_tm_gmoff = "yes" ; then
451 AC_DEFINE(HAVE_TM_GMTOFF)
452 fi
453
454 AC_CACHE_CHECK(for extended mallinfo,ac_cv_have_ext_mallinfo, [
455 AC_TRY_COMPILE([#include <sys/types.h>
456 #include <malloc.h>],
457 [struct mallinfo foo;
458 foo.mxfast = 0;],
459 ac_cv_have_ext_mallinfo="yes",
460 ac_cv_have_ext_mallinfo="no")
461 ])
462 if test $ac_cv_have_ext_mallinfo = "yes" ; then
463 AC_DEFINE(HAVE_EXT_MALLINFO)
464 fi
465
466 AC_CACHE_CHECK(for struct rusage,ac_cv_have_struct_rusage, [
467 AC_TRY_COMPILE([
468 #if HAVE_SYS_TIME_H
469 #include <sys/time.h>
470 #endif
471 #if HAVE_SYS_RESOURCE_H
472 #include <sys/resource.h>
473 #endif],
474 [struct rusage R;],
475 ac_cv_have_struct_rusage="yes",
476 ac_cv_have_struct_rusage="no")
477 ])
478 if test $ac_cv_have_struct_rusage = "yes" ; then
479 AC_DEFINE(HAVE_STRUCT_RUSAGE)
480 fi
481
482 AC_CACHE_CHECK(for ip->ip_hl, ac_cv_have_ip_hl, [
483 AC_TRY_COMPILE([#include <sys/types.h>
484 #include <netinet/in.h>
485 #include <netinet/in_systm.h>
486 #include <netinet/ip.h>
487 #ifdef __linux__
488 #define ip_hl ihl
489 #endif
490 #ifndef __linux__
491 #define iphdr ip
492 #endif],
493 [struct iphdr ip;
494 ip.ip_hl= 0;],
495 ac_cv_have_ip_hl="yes",
496 ac_cv_have_ip_hl="no")
497 ])
498 if test $ac_cv_have_ip_hl = "yes" ; then
499 AC_DEFINE(HAVE_IP_HL)
500 fi
501
502 dnl Check for typedefs
503 AC_CHECK_SIZEOF(int)
504 AC_CHECK_SIZEOF(long)
505
506 dnl Check for special functions
507 AC_FUNC_ALLOCA
508
509 AC_CHECK_TYPE(pid_t, int)
510 AC_CHECK_TYPE(size_t, unsigned int)
511 AC_CHECK_TYPE(ssize_t, int)
512 AC_CHECK_TYPE(off_t, int)
513 AC_CHECK_TYPE(mode_t, u_short)
514
515 dnl Check for needed libraries
516 AC_CHECK_LIB(nsl, main)
517 AC_CHECK_LIB(socket, main)
518 AC_CHECK_LIB(gnumalloc, main)
519 if test "$ac_cv_lib_gnumalloc_main" = "yes"; then
520 echo "Disabling extended malloc functions when using gnumalloc"
521 ac_cv_func_mallinfo=no
522 ac_cv_func_mallocblksize=no
523 ac_cv_func_mallopt=no
524 else
525 case "$host" in
526 *-sun-solaris*)
527 echo "skipping libmalloc check for $host"
528 ;;
529 i386-*-freebsd*)
530 echo "skipping libmalloc check for $host"
531 ;;
532 *)
533 AC_CHECK_LIB(malloc, main)
534 ;;
535 esac
536 fi
537 AC_CHECK_LIB(bsd, main)
538 AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"])
539 case "$host" in
540 i386-*-freebsd*)
541 echo "skipping libresolv checks for $host"
542 ;;
543 *)
544 AC_CHECK_LIB(resolv, inet_aton, AC_CHECK_LIB(44bsd, inet_aton))
545 AC_CHECK_LIB(resolv, main)
546 ;;
547 esac
548 AC_CHECK_LIB(m, main)
549
550 dnl Check for libcrypt
551 dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
552 AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
553 AC_SUBST(CRYPTLIB)
554
555 dnl Check for pthreads
556 dnl We use pthreads when doing ASYNC I/O
557 AC_CHECK_LIB(pthread, main, [PTHREADLIB="-lpthread"])
558 AC_SUBST(PTHREADLIB)
559
560 dnl System-specific library modifications
561 dnl
562 case "$host" in
563 i386-*-solaris2.*)
564 if test "$GCC" = "yes"; then
565 echo "Removing -O for gcc on $host"
566 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
567 fi
568 ;;
569 *-sgi-irix*)
570 echo "Removing -lsocket for IRIX..."
571 LIBS=`echo $LIBS | sed -e s/-lsocket//`
572 echo "Removing -lnsl for IRIX..."
573 LIBS=`echo $LIBS | sed -e s/-lnsl//`
574 echo "Removing -lbsd for IRIX..."
575 LIBS=`echo $LIBS | sed -e s/-lbsd//`
576 ;;
577 dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
578 dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
579 dnl Please change your configure script. AIX doesn't need -lbsd.
580 *-ibm-aix*)
581 echo "Removing -lbsd for AIX..."
582 LIBS=`echo $LIBS | sed -e s/-lbsd//`
583 ;;
584 *m88k*)
585 CFLAGS="$CFLAGS -D_SQUID_MOTOROLA_"
586 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
587 ;;
588 [*-*-solaris2.[0-4]])
589 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
590 ;;
591 esac
592
593 # Recommended by Balint Nagy Endre <bne@CareNet.hu>
594 case "$host" in
595 *-univel-sysv4.2MP)
596 if test `uname -v` = "2.03"; then
597 echo "disabling mallinfo for $host"
598 ac_cv_func_mallinfo=no
599 fi
600 ;;
601 esac
602
603
604 dnl Check for library functions
605 AC_CHECK_FUNCS(\
606 bcopy \
607 fchmod \
608 getdtablesize \
609 getpagesize \
610 getrusage \
611 getspnam \
612 lrand48 \
613 mallinfo \
614 mallocblksize \
615 mallopt \
616 memcpy \
617 memmove \
618 mktime \
619 mstats \
620 random \
621 regcomp \
622 regexec \
623 regfree \
624 res_init \
625 seteuid \
626 setpgrp \
627 setrlimit \
628 setsid \
629 sigaction \
630 snprintf \
631 srand48 \
632 srandom \
633 sysconf \
634 syslog \
635 tempnam \
636 timegm \
637 vsnprintf \
638 )
639
640 case "$host" in
641 [alpha-dec-osf3.*])
642 # John Kay (jkay@nlanr.net) 19970818
643 echo "skipping poll() check for $host..."
644 ac_cv_func_poll='no'
645 ;;
646 [*-hp-hpux*.*])
647 # Duane Wessels
648 echo "skipping poll() check for $host..."
649 ac_cv_func_poll='no'
650 ;;
651 *)
652 AC_CHECK_FUNC(poll)
653 ;;
654 esac
655
656 dnl Yay! Another Linux brokenness. Its not good enough
657 dnl to know that setresuid() exists, because RedHat 5.0 declares
658 dnl setresuid() but doesn't implement it.
659 dnl
660 AC_CACHE_CHECK(if setresuid is implemented, ac_cv_func_setresuid,
661 AC_TRY_RUN([
662 #include <stdlib.h>
663 int main() {
664 if(setresuid(-1,-1,-1)) {
665 perror("setresuid:");
666 exit(1);
667 }
668 exit(0);
669 }
670 ],ac_cv_func_setresuid="yes",ac_cv_func_setresuid="no")
671 )
672 if test "$ac_cv_func_setresuid" = "yes" ; then
673 AC_DEFINE(HAVE_SETRESUID)
674 fi
675
676 AC_MSG_CHECKING(if GNUregex needs to be compiled)
677 if test "$ac_cv_func_regcomp" = "no" || test "$USE_GNUREGEX" = "yes" ; then
678 USE_GNUREGEX="yes"
679 else
680 USE_GNUREGEX="no"
681 fi
682 case "$host" in
683 [*-sun-solaris2.[0-4]])
684 USE_GNUREGEX="yes"
685 ;;
686 [*-next-nextstep*])
687 USE_GNUREGEX="yes"
688 ;;
689 esac
690 AC_MSG_RESULT($USE_GNUREGEX)
691 if test "$USE_GNUREGEX" = "yes"; then
692 REGEXLIB="-lregex"
693 LIBREGEX="libregex.a"
694 AC_DEFINE(USE_GNUREGEX)
695 fi
696 AC_SUBST(REGEXLIB)
697 AC_SUBST(LIBREGEX)
698
699 AC_REPLACE_FUNCS(\
700 tempnam \
701 strerror \
702 )
703
704 dnl Not cached since people are likely to tune this
705 AC_MSG_CHECKING(Default FD_SETSIZE value)
706 AC_TRY_RUN([
707 #if HAVE_STDIO_H
708 #include <stdio.h>
709 #endif
710 #if HAVE_UNISTD_H
711 #include <unistd.h>
712 #endif
713 #if HAVE_SYS_TIME_H
714 #include <sys/time.h>
715 #endif
716 #if HAVE_SYS_SELECT_H
717 #include <sys/select.h>
718 #endif
719 #if HAVE_SYS_TYPES_H
720 #include <sys/types.h>
721 #endif
722 main() {
723 fprintf (fopen("conftestval", "w"), "%d\n", FD_SETSIZE);
724 exit(0);
725 }
726 ],
727 DEFAULT_FD_SETSIZE=`cat conftestval`,
728 DEFAULT_FD_SETSIZE=256,
729 DEFAULT_FD_SETSIZE=256)
730 AC_MSG_RESULT($DEFAULT_FD_SETSIZE)
731 AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE)
732
733 dnl Not cached since people are likely to tune this
734 AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
735 AC_TRY_RUN([
736 #include <stdio.h>
737 #include <unistd.h>
738 #include <sys/time.h> /* needed on FreeBSD */
739 #include <sys/param.h>
740 #include <sys/resource.h>
741 main() {
742 int i,j;
743 #if HAVE_SETRLIMIT
744 struct rlimit rl;
745 #if defined(RLIMIT_NOFILE)
746 if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
747 perror("getrlimit: RLIMIT_NOFILE");
748 } else {
749 rl.rlim_cur = rl.rlim_max; /* set it to the max */
750 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
751 perror("setrlimit: RLIMIT_NOFILE");
752 }
753 }
754 #elif defined(RLIMIT_OFILE)
755 if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
756 perror("getrlimit: RLIMIT_OFILE");
757 } else {
758 rl.rlim_cur = rl.rlim_max; /* set it to the max */
759 if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
760 perror("setrlimit: RLIMIT_OFILE");
761 }
762 }
763 #endif /* RLIMIT_NOFILE */
764 #endif /* HAVE_SETRLIMIT */
765 #if HAVE_SYSCONF && defined(_SC_OPEN_MAX)
766 i = sysconf(_SC_OPEN_MAX);
767 #elif HAVE_GETDTABLESIZE && !defined(__linux__)
768 i = getdtablesize();
769 #elif defined(OPEN_MAX)
770 i = OPEN_MAX;
771 #elif defined(NOFILE)
772 i = NOFILE;
773 #elif defined(_NFILE)
774 i = _NFILE;
775 #else
776 while((j=open("/dev/null", 0)) > 0) i=j;
777 close(i); close(i-1);
778 i++;
779 #endif
780 fprintf (fopen("conftestval", "w"), "%d\n", i);
781 exit(0);
782 }
783 ],
784 SQUID_MAXFD=`cat conftestval`,
785 SQUID_MAXFD=256,
786 SQUID_MAXFD=256)
787 AC_MSG_RESULT($SQUID_MAXFD)
788 AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD)
789
790 dnl Not cached since people are likely to tune this
791 AC_MSG_CHECKING(Default UDP send buffer size)
792 AC_TRY_RUN([
793 #include <stdlib.h>
794 #include <stdio.h>
795 #include <sys/types.h>
796 #include <sys/socket.h>
797 #include <netinet/in.h>
798 main ()
799 {
800 int fd,val=0,len=sizeof(int);
801 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
802 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
803 if (val<=0) exit(1);
804 fprintf (fopen("conftestval", "w"), "%d\n", val);
805 exit(0);
806 }
807 ],
808 SQUID_UDP_SO_SNDBUF=`cat conftestval`,
809 SQUID_UDP_SO_SNDBUF=16384,
810 SQUID_UDP_SO_SNDBUF=16384)
811 AC_MSG_RESULT($SQUID_UDP_SO_SNDBUF)
812 AC_DEFINE_UNQUOTED(SQUID_UDP_SO_SNDBUF, $SQUID_UDP_SO_SNDBUF)
813
814 dnl Not cached since people are likely to tune this
815 AC_MSG_CHECKING(Default UDP receive buffer size)
816 AC_TRY_RUN([
817 #include <stdlib.h>
818 #include <stdio.h>
819 #include <sys/types.h>
820 #include <sys/socket.h>
821 #include <netinet/in.h>
822 main ()
823 {
824 int fd,val=0,len=sizeof(int);
825 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
826 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
827 if (val <= 0) exit(1);
828 fprintf (fopen("conftestval", "w"), "%d\n", val);
829 exit(0);
830 }
831 ],
832 SQUID_UDP_SO_RCVBUF=`cat conftestval`,
833 SQUID_UDP_SO_RCVBUF=16384,
834 SQUID_UDP_SO_RCVBUF=16384)
835 AC_MSG_RESULT($SQUID_UDP_SO_RCVBUF)
836 AC_DEFINE_UNQUOTED(SQUID_UDP_SO_RCVBUF, $SQUID_UDP_SO_RCVBUF)
837
838 dnl Not cached since people are likely to tune this
839 AC_MSG_CHECKING(Default TCP send buffer size)
840 AC_TRY_RUN([
841 #include <stdlib.h>
842 #include <stdio.h>
843 #include <sys/types.h>
844 #include <sys/socket.h>
845 #include <netinet/in.h>
846 main ()
847 {
848 int fd,val=0,len=sizeof(int);
849 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
850 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
851 if (val <= 0) exit(1);
852 fprintf (fopen("conftestval", "w"), "%d\n", val);
853 exit(0);
854 }
855 ],
856 SQUID_TCP_SO_SNDBUF=`cat conftestval`,
857 SQUID_TCP_SO_SNDBUF=16384,
858 SQUID_TCP_SO_SNDBUF=16384)
859 AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF)
860 AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF)
861
862 dnl Not cached since people are likely to tune this
863 AC_MSG_CHECKING(Default TCP receive buffer size)
864 AC_TRY_RUN([
865 #include <stdlib.h>
866 #include <stdio.h>
867 #include <sys/types.h>
868 #include <sys/socket.h>
869 #include <netinet/in.h>
870 main ()
871 {
872 int fd,val=0,len=sizeof(int);
873 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
874 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
875 if (val <= 0) exit(1);
876 fprintf (fopen("conftestval", "w"), "%d\n", val);
877 exit(0);
878 }
879 ],
880 SQUID_TCP_SO_RCVBUF=`cat conftestval`,
881 SQUID_TCP_SO_RCVBUF=16384,
882 SQUID_TCP_SO_RCVBUF=16384)
883 AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF)
884 AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF)
885
886 AC_CACHE_CHECK(if sys_errlist is already defined, ac_cv_needs_sys_errlist,
887 AC_TRY_COMPILE([#include <stdio.h>],[char *s = sys_errlist[0];],
888 ac_cv_needs_sys_errlist="no",
889 ac_cv_needs_sys_errlist="yes")
890 )
891 if test "$ac_cv_needs_sys_errlist" = "yes" ; then
892 AC_DEFINE(NEED_SYS_ERRLIST)
893 fi
894
895 dnl Not cached since people are likely to change this
896 AC_MSG_CHECKING(for libresolv _dns_ttl_ hack)
897 AC_TRY_LINK(extern int _dns_ttl_;,return _dns_ttl_;,
898 [AC_MSG_RESULT(yes)
899 AC_DEFINE(LIBRESOLV_DNS_TTL_HACK)],
900 AC_MSG_RESULT(no))
901
902 dnl Need the debugging version of malloc if available
903 XTRA_OBJS=''
904 if test "$ac_cv_lib_malloc_main" = "yes" ; then
905 if test -r /usr/lib/debug/malloc.o ; then
906 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
907 fi
908 if test -r /usr/lib/debug/mallocmap.o ; then
909 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
910 fi
911 fi
912
913 AC_SUBST(XTRA_OBJS)
914
915 if test -z "$XTRA_LIBS"; then
916 XTRA_LIBS="$LIBS"
917 LIBS=''
918 fi
919 AC_SUBST(XTRA_LIBS)
920
921 dnl Clean up after OSF/1 core dump bug
922 rm -f core
923
924 AC_OUTPUT(\
925 ./makefile \
926 ./lib/Makefile \
927 ./include/config.h \
928 ./scripts/Makefile \
929 ./scripts/RunCache \
930 ./scripts/RunAccel \
931 ./src/Makefile \
932 ./contrib/Makefile \
933 ./snmplib/Makefile \
934 ./icons/Makefile \
935 ./errors/Makefile \
936 )