]> git.ipfire.org Git - thirdparty/squid.git/blob - configure.in
merge changes from SQUID_2_3 branch
[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.182 1999/12/30 17:35:50 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.182 $)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 dnl use .exe suffix for executables on cygwin32 platform
30 case "$host_os" in
31 cygwin32|os2)
32 exec_suffix=".exe"
33 cgi_suffix=".exe"
34 ;;
35 *)
36 exec_suffix=""
37 cgi_suffix=".cgi"
38 ;;
39 esac
40 AC_SUBST(exec_suffix)
41 AC_SUBST(cgi_suffix)
42
43 if test -z "$CACHE_HTTP_PORT"; then
44 CACHE_HTTP_PORT="3128"
45 fi
46 if test -z "$CACHE_ICP_PORT"; then
47 CACHE_ICP_PORT="3130"
48 fi
49
50 dnl Subsitutions
51 AC_SUBST(CACHE_HTTP_PORT)
52 AC_SUBST(CACHE_ICP_PORT)
53
54 AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host")
55
56 dnl Set default LDFLAGS
57 if test -z "$LDFLAGS"; then
58 LDFLAGS="-g"
59 fi
60
61 PRESET_CFLAGS="$CFLAGS"
62
63 dnl Check for GNU cc
64 AC_PROG_CC
65
66 dnl Gerben Wierda <Gerben_Wierda@RnA.nl>
67 case "$host" in
68 mab-next-nextstep3)
69 CC="$CC -arch m68k -arch i486 -arch hppa -arch sparc"
70 ;;
71 esac
72
73 dnl Set Default CFLAGS
74 if 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 else
90 case "$host" in
91 *mips-sgi-irix6.4*)
92 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
93 CFLAGS="$CFLAGS -n32 -mips4 -O3 -OPT:Olimit=0:space=OFF \
94 -woff 1009,1014,1048,1110,1116,1185,1188,1204,1230,1233 \
95 -Wl,-woff,85,-woff,84,-woff,134 \
96 -nostdinc -I/usr/include -D_BSD_SIGNALS"
97 ;;
98 alpha-dec-osf4.*)
99 # Mogul says DEC compilers take both -g and -O2
100 CFLAGS=`echo $CFLAGS | sed -e 's/-g/-g3/'`
101 CFLAGS="$CFLAGS -O2"
102 ;;
103 *)
104 ;;
105 esac
106 fi
107 fi
108
109 dnl Set LDFLAGS
110 if test -z "$PRESET_LDFLAGS"; then
111 if test "$GCC" = "yes"; then
112 case "$host" in
113 *)
114 # nothing
115 ;;
116 esac
117 else
118 case "$host" in
119 *mips-sgi-irix6.4*)
120 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
121 LDFLAGS="-n32 -mips4 -nostdlib -L/usr/lib32"
122 ;;
123 esac
124 fi
125 fi
126
127 dnl Enable optional modules
128 AC_ARG_ENABLE(dlmalloc,
129 [ --enable-dlmalloc[=LIB] Compile & use the malloc package by Doug Lea],
130 [
131 case "$enableval" in
132 'yes')
133 use_dlmalloc="yes"
134 LIBDLMALLOC="libdlmalloc.a"
135 LIB_MALLOC="-L../lib -ldlmalloc"
136 echo "dlmalloc enabled"
137 ;;
138 'no')
139 use_dlmalloc="no"
140 echo "dlmalloc disabled"
141 ;;
142 *) use_dlmalloc="yes"
143 LIB_MALLOC="$enableval"
144 echo "dlmalloc enabled with $LIB_MALLOC"
145 esac
146 ])
147 if test "${use_dlmalloc-unset}" = unset; then
148 case "$host" in
149 i386-*-solaris2.*)
150 echo "Enabling dlmalloc for $host"
151 use_dlmalloc="yes"
152 ;;
153 esac
154 fi
155 if test "x$ac_cv_enabled_dlmalloc" = "xyes"; then
156 # Ok. dlmalloc was enabled before, but state may be changed.
157 # we have to test these again
158 unset ac_cv_func_mallinfo
159 unset ac_cv_func_mallocblksize
160 unset ac_cv_func_free
161 unset ac_cv_func_realloc
162 unset ac_cv_func_memalign
163 unset ac_cv_func_valloc
164 unset ac_cv_func_pvalloc
165 unset ac_cv_func_calloc
166 unset ac_cv_func_cfree
167 unset ac_cv_func_malloc_trim
168 unset ac_cv_func_malloc_usable_size
169 unset ac_cv_func_malloc_stats
170 unset ac_cv_func_mallinfo
171 unset ac_cv_func_mallopt
172 unset ac_cv_lib_gnumalloc
173 unset ac_cv_header_gnumalloc_h
174 unset ac_cv_lib_malloc
175 unset ac_cv_enabled_dlmalloc
176 fi
177 if test "$use_dlmalloc" = yes; then
178 ac_cv_func_mallinfo="yes"
179 ac_cv_func_mallocblksize="no"
180 ac_cv_func_free="yes"
181 ac_cv_func_realloc="yes"
182 ac_cv_func_memalign="yes"
183 ac_cv_func_valloc="yes"
184 ac_cv_func_pvalloc="yes"
185 ac_cv_func_calloc="yes"
186 ac_cv_func_cfree="yes"
187 ac_cv_func_malloc_trim="yes"
188 ac_cv_func_malloc_usable_size="yes"
189 ac_cv_func_malloc_stats="yes"
190 ac_cv_func_mallopt="yes"
191 ac_cv_lib_gnumalloc="no"
192 ac_cv_header_gnumalloc_h="no"
193 ac_cv_lib_malloc="no"
194 ac_cv_enabled_dlmalloc="yes"
195 fi
196
197 AC_SUBST(LIBDLMALLOC)
198 AC_SUBST(LIB_MALLOC)
199
200 AC_ARG_ENABLE(gnuregex,
201 [ --enable-gnuregex Compile GNUregex],
202 [USE_GNUREGEX=$enableval])
203
204 AC_ARG_ENABLE(xmalloc_debug,
205 [ --enable-xmalloc-debug Do some simple malloc debugging],
206 [ if test "$enableval" = "yes" ; then
207 echo "Malloc debugging enabled"
208 AC_DEFINE(XMALLOC_DEBUG)
209 fi
210 ])
211
212 AC_ARG_ENABLE(xmalloc_debug_trace,
213 [ --enable-xmalloc-debug-trace
214 Detailed trace of memory allocations],
215 [ if test "$enableval" = "yes" ; then
216 echo "Malloc debug trace enabled"
217 AC_DEFINE(XMALLOC_TRACE)
218 AC_DEFINE(XMALLOC_DEBUG)
219 fi
220 ])
221
222 AC_ARG_ENABLE(xmalloc_statistics,
223 [ --enable-xmalloc-statistics
224 Show malloc statistics in status page],
225 [ if test "$enableval" = "yes" ; then
226 echo "Malloc statistics enabled"
227 AC_DEFINE(XMALLOC_STATISTICS)
228 fi
229 ])
230
231 AC_ARG_ENABLE(carp,
232 [ --enable-carp Enable CARP support],
233 [ if test "$enableval" = "yes" ; then
234 echo "CARP support enabled"
235 AC_DEFINE(USE_CARP)
236 fi
237 ])
238
239 AC_ARG_ENABLE(async_io,
240 [ --enable-async-io[=N_THREADS]
241 Do ASYNC disk I/O using threads.
242 N_THREADS is the number of worker threads
243 defaults to 16. See also src/squid.h for
244 some additional platform tuning],
245 [ case "$enableval" in
246 yes)
247 async_io=yes
248 ;;
249 no)
250 async_io=''
251 ;;
252 *)
253 async_io=yes
254 AC_DEFINE_UNQUOTED(NUMTHREADS, $enableval)
255 ;;
256 esac
257 ])
258
259 if test -n "$async_io" ; then
260 echo "Async I/O enabled"
261 async_io=yes
262 AC_DEFINE(USE_ASYNC_IO)
263 ASYNC_OBJS='$(ASYNC_OBJS)'
264 SQUID_PTHREAD_LIB='$(PTHREADLIB)'
265 CFLAGS="$CFLAGS -D_REENTRANT"
266 case "$host" in
267 i386-unknown-freebsd*)
268 if test "$GCC" = "yes" ; then
269 if test -z "$PRESET_LDFLAGS"; then
270 LDFLAGS="$LDFLAGS -pthread"
271 fi
272 fi
273 ;;
274 esac
275 fi
276 AC_SUBST(ASYNC_OBJS)
277 AC_SUBST(SQUID_PTHREAD_LIB)
278
279 AC_ARG_ENABLE(icmp,
280 [ --enable-icmp Enable ICMP pinging],
281 [ if test "$enableval" = "yes" ; then
282 echo "ICMP enabled"
283 AC_DEFINE(USE_ICMP)
284 fi
285 ])
286
287 AC_ARG_ENABLE(delay_pools,
288 [ --enable-delay-pools Enable delay pools to limit bandwith usage],
289 [ if test "$enableval" = "yes" ; then
290 echo "Delay pools enabled"
291 DELAY_OBJS='$(DELAY_OBJS)'
292 AC_DEFINE(DELAY_POOLS)
293 fi
294 ])
295 AC_SUBST(DELAY_OBJS)
296
297 AC_ARG_ENABLE(mem-gen-trace,
298 [ --enable-mem-gen-trace Do trace of memory stuff],
299 [ if test "$enableval" = "yes" ; then
300 echo "Memory trace (to file) enabled"
301 AC_DEFINE(MEM_GEN_TRACE)
302 fi
303 ])
304
305 AC_ARG_ENABLE(useragent_log,
306 [ --enable-useragent-log Enable logging of User-Agent header],
307 [ if test "$enableval" = "yes" ; then
308 echo "User-Agent logging enabled"
309 AC_DEFINE(USE_USERAGENT_LOG)
310 fi
311 ])
312
313 AC_ARG_ENABLE(wccp,
314 [ --disable-wccp Disable Web Cache Coordination Protocol],
315 [ if test "$enableval" = "no" ; then
316 echo "Web Cache Coordination Protocol disabled"
317 AC_DEFINE(USE_WCCP, 0)
318 else
319 AC_DEFINE(USE_WCCP, 1)
320 fi
321 ])
322
323 AC_ARG_ENABLE(kill_parent_hack,
324 [ --enable-kill-parent-hack
325 Kill parent on shutdown],
326 [ if test "$enableval" = "yes" ; then
327 echo "Kill parent on shutdown"
328 AC_DEFINE(KILL_PARENT_OPT)
329 fi
330 ])
331
332 AC_ARG_ENABLE(snmp,
333 [ --enable-snmp Enable SNMP monitoring],
334 [ if test "$enableval" = "yes" ; then
335 echo "SNMP monitoring enabled"
336 AC_DEFINE(SQUID_SNMP)
337 SNMPLIB='-L../snmplib -lsnmp'
338 SNMP_OBJS='$(SNMP_OBJS)'
339 SNMP_MAKEFILE=./snmplib/Makefile
340 makesnmplib=snmplib
341 fi
342 ])
343 AC_SUBST(SNMPLIB)
344 AC_SUBST(SNMP_OBJS)
345 AC_SUBST(makesnmplib)
346
347 AC_ARG_ENABLE(time_hack,
348 [ --enable-time-hack Update internal timestamp only once per second],
349 [ if test "$enableval" = "yes" ; then
350 echo "Update internal timestamp only once per second"
351 AC_DEFINE(ALARM_UPDATES_TIME)
352 fi
353 ])
354
355 AC_ARG_ENABLE(cachemgr_hostname,
356 [ --enable-cachemgr-hostname[=hostname]
357 Make cachemgr.cgi default to this host],
358 [ case $enableval in
359 yes)
360 AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()])
361 echo "Cachemgr default hostname == host where cachemgr runs"
362 ;;
363 no)
364 : # Nothing to do..
365 ;;
366 *)
367 AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
368 echo "Cachemgr default hostname set to ${enableval}"
369 ;;
370 esac
371 ])
372
373 AC_ARG_ENABLE(arp_acl,
374 [ --enable-arp-acl Enable use of ARP ACL lists (ether address)],
375 [ if test "$enableval" = "yes" ; then
376 echo "ARP ACL lists enabled (ether address)"
377 case "$host" in
378 *-pc-linux-*)
379 ;;
380 *)
381 echo "WARNING: ARP ACL support is only currently supported on Linux"
382 echo " ethernet interfaces, probably won't work on $host."
383 sleep 10
384 ;;
385 esac
386 AC_DEFINE(USE_ARP_ACL)
387 fi
388 ])
389
390 AC_ARG_ENABLE(htcp,
391 [ --enable-htcp Enable HTCP protocol],
392 [ if test "$enableval" = "yes" ; then
393 echo "HTCP enabled"
394 HTCP_OBJS='$(HTCP_OBJS)'
395 AC_DEFINE(USE_HTCP)
396 fi
397 ])
398 AC_SUBST(HTCP_OBJS)
399
400 AC_ARG_ENABLE(forw-via-db,
401 [ --enable-forw-via-db Enable Forw/Via database],
402 [ if test "$enableval" = "yes" ; then
403 echo "FORW-VIA enabled"
404 AC_DEFINE(FORW_VIA_DB)
405 fi
406 ])
407
408 AC_ARG_ENABLE(cache-digests,
409 [ --enable-cache-digests Use Cache Digests
410 see http://squid.nlanr.net/Squid/FAQ/FAQ-16.html],
411 [ if test "$enableval" = "yes" ; then
412 echo "USE_CACHE_DIGESTS enabled"
413 AC_DEFINE(USE_CACHE_DIGESTS)
414 fi
415 ])
416
417 dnl Select Error language
418 AC_ARG_ENABLE(err-language,
419 [ --enable-err-language=lang
420 Select language for Error pages (see errors dir) ],
421 [
422 if test -d errors/$enableval; then
423 ERR_LANGUAGE=$enableval
424 else
425 echo "ERROR! Unknown language $enableval, see errors/"
426 exit 1
427 fi
428 ],[ERR_LANGUAGE="English"])
429 AC_SUBST(ERR_LANGUAGE)
430
431 dnl Enable poll()
432 AC_ARG_ENABLE(poll,
433 [ --enable-poll Enable poll() instead of select(). Normally poll
434 is preferred over select, but configure knows poll
435 is broken on some platforms. If you think you are
436 smarter than the configure script, you may enable
437 poll with this option.
438 --disable-poll Disable the use of poll().],
439 [
440 case "$enableval" in
441 yes)
442 echo "Forcing poll() to be enabled"
443 ac_cv_func_poll='yes'
444 ;;
445 no)
446 echo "Forcing poll() to be disabled"
447 ac_cv_func_poll='no'
448 ;;
449 esac
450 ])
451
452 dnl Disable HTTP violations
453 AC_ARG_ENABLE(http-violations,
454 [ --disable-http-violations
455 This allows you to remove code which is known to
456 violate the HTTP protocol specification.],
457 [ if test "$enableval" = "no" ; then
458 echo "Disabling HTTP Violations"
459 AC_DEFINE(HTTP_VIOLATIONS, 0)
460 else
461 AC_DEFINE(HTTP_VIOLATIONS, 1)
462 fi
463 ])
464
465 dnl Enable IP-Filter Transparent Proxy
466 AC_ARG_ENABLE(ipf-transparent,
467 [ --enable-ipf-transparent
468 Enable Transparent Proxy support for systems
469 using IP-Filter network address redirection.],
470 [ if test "$enableval" = "yes" ; then
471 echo "IP-Filter Transparent Proxy enabled"
472 AC_DEFINE(IPF_TRANSPARENT)
473 IPF_TRANSPARENT="yes"
474 fi
475 ])
476
477 dnl Enable Leak Finding Functions
478 AC_ARG_ENABLE(leakfinder,
479 [ --enable-leakfinder
480 Enable Leak Finding code. Enabling this alone
481 does nothing; you also have to modify the source
482 code to use the leak finding functions. Probably
483 Useful for hackers only.],
484 [ if test "$enableval" = "yes" ; then
485 echo "Leak-Finding enabled"
486 AC_DEFINE(USE_LEAKFINDER)
487 LEAKFINDER_OBJS='$(LEAKFINDER_OBJS)'
488 USE_LEAKFINDER="yes"
489 fi
490 ])
491 AC_SUBST(LEAKFINDER_OBJS)
492
493 dnl Disable HTTP violations
494 AC_ARG_ENABLE(ident-lookups,
495 [ --disable-ident-lookups
496 This allows you to remove code that performs
497 Ident (RFC 931) lookups.],
498 [ if test "$enableval" = "no" ; then
499 echo "Disabling Ident Lookups"
500 AC_DEFINE(USE_IDENT, 0)
501 else
502 AC_DEFINE(USE_IDENT, 1)
503 fi
504 ])
505
506 AC_ARG_ENABLE(internal-dns,
507 [ --disable-internal-dns This prevents Squid from directly sending and
508 receiving DNS messages, and instead enables the
509 old external 'dnsserver' processes.],
510 [ if test "$enableval" = "no" ; then
511 echo "Disabling Internal DNS queries"
512 AC_DEFINE(USE_DNSSERVERS, 1)
513 else
514 AC_DEFINE(USE_DNSSERVERS, 0)
515 fi
516 ])
517
518 AC_ARG_ENABLE(truncate,
519 [ --enable-truncate This uses truncate() instead of unlink() when
520 removing cache files. Truncate gives a little
521 performance improvement, but may cause problems
522 when used with async I/O. Truncate uses more
523 filesystem inodes than unlink..],
524 [ if test "$enableval" = "yes" ; then
525 echo "Enabling truncate instead of unlink"
526 AC_DEFINE(USE_TRUNCATE)
527 fi
528 ])
529
530 dnl Enable underscore in hostnames
531 AC_ARG_ENABLE(underscores,
532 [ --enable-underscores Squid by default rejects any host names with _
533 in their name to conform with internet standars.
534 If you disagree with this you may allow _ in
535 hostnames by using this switch, provided that
536 the resolver library on the host where Squid runs
537 does not reject _ in hostnames...],
538 [ if test "$enableval" = "yes" ; then
539 echo "Enabling the use of underscores in host names"
540 AC_DEFINE(ALLOW_HOSTNAME_UNDERSCORES, 1)
541 fi
542 ])
543
544 dnl Enable HEAP_REPLACEMENT
545 AC_ARG_ENABLE(heap-replacement,
546 [ --enable-heap-replacement
547 This option allows you to use various cache
548 replacement algorithms, instead of the standard
549 LRU algorithm.
550 ],
551 [ if test "$enableval" = "yes" ; then
552 echo "Enabling HEAP_REPLACEMENT"
553 AC_DEFINE(HEAP_REPLACEMENT, 1)
554 fi
555 ])
556
557 dnl Enable "diskd" code
558 AC_ARG_ENABLE(diskd,
559 [ --enable-diskd Uses shared memory, message queues, and external
560 processes for disk I/O.],
561 [ if test "$enableval" = "yes" ; then
562 echo "DISKD enabled"
563 AC_DEFINE(USE_DISKD, 1)
564 OPT_DISKD_EXE='$(DISKD_EXE)'
565 AC_SUBST(OPT_DISKD_EXE)
566 DISKD_OBJS='diskd.o'
567 AC_SUBST(DISKD_OBJS)
568 fi
569 ])
570
571 # Force some compilers to use ANSI features
572 #
573 case "$host" in
574 alpha-dec-osf*)
575 if test "$ac_cv_prog_CC" = "cc" ; then
576 echo "adding '-std1' to cc args for $host"
577 CC="cc -std1";
578 ac_cv_prog_CC="$CC"
579 fi
580 ;;
581 *-hp-hpux*)
582 if test "$ac_cv_prog_CC" = "cc" ; then
583 echo "adding '-Ae' to cc args for $host"
584 CC="cc -Ae";
585 ac_cv_prog_CC="$CC"
586 fi
587 ;;
588 esac
589
590 dnl Check for programs
591 AC_PROG_CPP
592 AC_PROG_INSTALL
593 AC_PROG_RANLIB
594 AC_PROG_LN_S
595 AC_PATH_PROG(SH, sh, /bin/sh)
596 AC_PATH_PROG(FALSE, false, /usr/bin/false)
597 AC_PATH_PROG(TRUE, true, /usr/bin/true)
598 AC_PATH_PROG(RM, rm, $FALSE)
599 AC_PATH_PROG(MV, mv, $FALSE)
600 AC_PATH_PROG(MKDIR, mkdir, $FALSE)
601 AC_PATH_PROG(LN, ln, cp)
602 AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
603 AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
604 AC_PATH_PROG(AR, ar, $FALSE)
605
606 case "$host" in
607 *-hp-hpux*)
608 echo "Disabling 'ranlib' for HP-UX..."
609 RANLIB=":"
610 ;;
611 esac
612
613 dnl set $(AR)
614 AR_R="$AR r"
615 case "$host" in
616 *-next-nextstep3)
617 AR="libtool -o"
618 ;;
619 esac
620 AC_SUBST(AR_R)
621
622 dnl Check for headers
623 AC_HEADER_DIRENT
624 AC_HEADER_STDC
625
626 AC_CHECK_HEADERS( \
627 arpa/inet.h \
628 arpa/nameser.h \
629 assert.h \
630 bstring.h \
631 config.h \
632 crypt.h \
633 ctype.h \
634 errno.h \
635 fcntl.h \
636 getopt.h \
637 gnumalloc.h \
638 grp.h \
639 ip_compat.h \
640 ip_fil.h \
641 ip_nat.h \
642 libc.h \
643 limits.h \
644 malloc.h \
645 math.h \
646 memory.h \
647 mount.h \
648 net/if.h \
649 netdb.h \
650 netinet/in.h \
651 netinet/tcp.h \
652 netinet/ip_compat.h \
653 netinet/ip_fil.h \
654 netinet/ip_nat.h \
655 poll.h \
656 pwd.h \
657 regex.h \
658 resolv.h \
659 sched.h \
660 signal.h \
661 stdarg.h \
662 stddef.h \
663 stdio.h \
664 stdlib.h \
665 string.h \
666 strings.h \
667 sys/file.h \
668 sys/ioctl.h \
669 sys/msg.h \
670 sys/param.h \
671 sys/resource.h \
672 sys/select.h\
673 sys/socket.h \
674 sys/stat.h \
675 sys/statvfs.h \
676 sys/syscall.h \
677 sys/time.h \
678 sys/types.h \
679 sys/un.h \
680 sys/vfs.h \
681 sys/wait.h \
682 syslog.h \
683 time.h \
684 unistd.h \
685 varargs.h \
686 )
687
688 AC_C_CONST
689 AC_C_BIGENDIAN
690
691 AC_CACHE_CHECK(if ANSI prototypes work,ac_cv_have_ansi_prototypes, [
692 AC_TRY_COMPILE([int foo(char *); int foo (char *bar) {return 1;}],
693 [foo("bar")],
694 ac_cv_have_ansi_prototypes="yes",
695 ac_cv_have_ansi_prototypes="no")
696 ])
697 if test $ac_cv_have_ansi_prototypes = "yes" ; then
698 AC_DEFINE(HAVE_ANSI_PROTOTYPES)
699 fi
700
701 AC_CACHE_CHECK(for tm->tm_gmtoff,ac_cv_have_tm_gmoff, [
702 AC_TRY_COMPILE([#include <time.h>
703 #include <sys/time.h>],
704 [struct tm foo;
705 foo.tm_gmtoff = 0;],
706 ac_cv_have_tm_gmoff="yes",
707 ac_cv_have_tm_gmoff="no")
708 ])
709 if test $ac_cv_have_tm_gmoff = "yes" ; then
710 AC_DEFINE(HAVE_TM_GMTOFF)
711 fi
712
713 AC_CACHE_CHECK(for struct mallinfo,ac_cv_have_struct_mallinfo, [
714 AC_TRY_COMPILE([#include <sys/types.h>
715 #if HAVE_MALLOC_H
716 #include <malloc.h>
717 #endif],
718 [struct mallinfo foo;
719 foo.arena = 0;
720 foo.ordblks = 0;
721 foo.smblks = 0;
722 foo.hblks = 0;
723 foo.hblkhd = 0;
724 foo.uordblks = 0;
725 foo.fordblks = 0;
726 foo.keepcost = 0;],
727 ac_cv_have_struct_mallinfo="yes",
728 ac_cv_have_struct_mallinfo="no")
729 ])
730 if test $ac_cv_have_struct_mallinfo = "yes" ; then
731 AC_DEFINE(HAVE_STRUCT_MALLINFO)
732 fi
733
734 AC_CACHE_CHECK(for extended mallinfo,ac_cv_have_ext_mallinfo, [
735 AC_TRY_COMPILE([#include <sys/types.h>
736 #include <malloc.h>],
737 [struct mallinfo foo;
738 foo.mxfast = 0;],
739 ac_cv_have_ext_mallinfo="yes",
740 ac_cv_have_ext_mallinfo="no")
741 ])
742 if test $ac_cv_have_ext_mallinfo = "yes" ; then
743 AC_DEFINE(HAVE_EXT_MALLINFO)
744 fi
745
746 AC_CACHE_CHECK(for struct rusage,ac_cv_have_struct_rusage, [
747 AC_TRY_COMPILE([
748 #if HAVE_SYS_TIME_H
749 #include <sys/time.h>
750 #endif
751 #if HAVE_SYS_RESOURCE_H
752 #include <sys/resource.h>
753 #endif],
754 [struct rusage R;],
755 ac_cv_have_struct_rusage="yes",
756 ac_cv_have_struct_rusage="no")
757 ])
758 if test $ac_cv_have_struct_rusage = "yes" ; then
759 AC_DEFINE(HAVE_STRUCT_RUSAGE)
760 fi
761
762 AC_CACHE_CHECK(for ip->ip_hl, ac_cv_have_ip_hl, [
763 AC_TRY_COMPILE([#include <sys/types.h>
764 #include <netinet/in.h>
765 #include <netinet/in_systm.h>
766 #include <netinet/ip.h>
767 #ifdef __linux__
768 #define ip_hl ihl
769 #endif
770 #ifndef __linux__
771 #define iphdr ip
772 #endif],
773 [struct iphdr ip;
774 ip.ip_hl= 0;],
775 ac_cv_have_ip_hl="yes",
776 ac_cv_have_ip_hl="no")
777 ])
778 if test $ac_cv_have_ip_hl = "yes" ; then
779 AC_DEFINE(HAVE_IP_HL)
780 fi
781
782 dnl Check for typedefs
783 AC_CHECK_SIZEOF(int)
784 AC_CHECK_SIZEOF(long)
785 AC_CHECK_SIZEOF(void *)
786
787 dnl Check for special functions
788 AC_FUNC_ALLOCA
789
790 AC_CHECK_TYPE(pid_t, int)
791 AC_CHECK_TYPE(size_t, unsigned int)
792 AC_CHECK_TYPE(ssize_t, int)
793 AC_CHECK_TYPE(off_t, int)
794 AC_CHECK_TYPE(mode_t, u_short)
795 AC_CHECK_TYPE(fd_mask, int)
796 AC_CHECK_TYPE(mtyp_t, long)
797
798 dnl Check for type in sys/socket.h
799 AC_CACHE_CHECK(for socklen_t, ac_cv_type_socklen_t, [
800 AC_EGREP_CPP([socklen_t[^a-zA-Z_0-9]], [#include <sys/types.h>
801 #include <sys/socket.h>
802 #if STDC_HEADERS
803 #include <stdlib.h>
804 #include <stddef.h>
805 #endif],
806 ac_cv_type_socklen_t=yes,
807 ac_cv_type_socklen_t=no)
808 ])
809 if test $ac_cv_type_socklen_t = no; then
810 AC_DEFINE(socklen_t, int)
811 fi
812
813 dnl Check for needed libraries
814 AC_CHECK_LIB(nsl, main)
815 AC_CHECK_LIB(socket, main)
816
817 if test "x$ac_cv_enabled_dlmalloc" = "xyes" ; then
818 echo "skipping libmalloc check (--enable-dlmalloc specified)"
819 else
820 AC_CHECK_LIB(gnumalloc, main)
821 if test "$ac_cv_lib_gnumalloc_main" = "yes"; then
822 echo "Disabling extended malloc functions when using gnumalloc"
823 ac_cv_func_mallinfo=no
824 ac_cv_func_mallocblksize=no
825 ac_cv_func_mallopt=no
826 else
827 case "$host" in
828 *-sun-solaris*)
829 echo "skipping libmalloc check for $host"
830 ;;
831 i386-*-freebsd*)
832 echo "skipping libmalloc check for $host"
833 ;;
834 *)
835
836 AC_CHECK_LIB(malloc, main)
837 ;;
838 esac
839 fi
840 fi
841
842 AC_CHECK_LIB(bsd, main)
843 AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"])
844 AC_CHECK_LIB(bind, gethostbyname)
845 if test $ac_cv_lib_bind_gethostbyname = "no" ; then
846 case "$host" in
847 i386-*-freebsd*)
848 echo "skipping libresolv checks for $host"
849 ;;
850 *)
851 AC_CHECK_LIB(resolv, inet_aton, AC_CHECK_LIB(44bsd, inet_aton))
852 AC_CHECK_LIB(resolv, main)
853 ;;
854 esac
855 fi
856 AC_CHECK_LIB(m, main)
857
858 dnl Check for libcrypt
859 dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
860 AC_CHECK_LIB(crypt, crypt)
861 if test $ac_cv_lib_crypt_crypt = "yes"; then
862 CRYPTLIB="-lcrypt"
863 fi
864 AC_SUBST(CRYPTLIB)
865
866 dnl Check for pthreads
867 dnl We use pthreads when doing ASYNC I/O
868 AC_CHECK_LIB(pthread, main)
869 if test $ac_cv_lib_pthread_main = "yes"; then
870 PTHREADLIB="-lpthread"
871 fi
872 AC_SUBST(PTHREADLIB)
873
874 dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
875 dnl Robert Side <rside@aiinc.bc.ca>
876 dnl Mon, 18 Jan 1999 17:48:00 GMT
877 case "$host" in
878 *-pc-sco3.2*)
879 AC_CHECK_LIB(intl, strftime)
880 ;;
881 esac
882
883 dnl System-specific library modifications
884 dnl
885 case "$host" in
886 i386-*-solaris2.*)
887 if test "$GCC" = "yes"; then
888 echo "Removing -O for gcc on $host"
889 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
890 fi
891 ;;
892 *-sgi-irix*)
893 echo "Removing -lsocket for IRIX..."
894 LIBS=`echo $LIBS | sed -e s/-lsocket//`
895 echo "Removing -lnsl for IRIX..."
896 LIBS=`echo $LIBS | sed -e s/-lnsl//`
897 echo "Removing -lbsd for IRIX..."
898 LIBS=`echo $LIBS | sed -e s/-lbsd//`
899 ;;
900 dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
901 dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
902 dnl Please change your configure script. AIX doesn't need -lbsd.
903 *-ibm-aix*)
904 echo "Removing -lbsd for AIX..."
905 LIBS=`echo $LIBS | sed -e s/-lbsd//`
906 dnl From: mlaster@metavillage.com (Mike Laster)
907 dnl AIX 4.1.4.x does not have header files for snprintf/vsnprintf
908 dnl So using the internal versions generates a load of warnings
909 dnl during compile.
910 echo "disabling snprintf/vsnprintf for $host"
911 ac_cv_func_snprintf=no
912 ac_cv_func_vsnprintf=no
913 ;;
914 *m88k*)
915 CFLAGS="$CFLAGS -D_SQUID_MOTOROLA_"
916 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
917 ;;
918 [*-*-solaris2.[0-4]])
919 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
920 ;;
921 [*-sony-newsos[56]*])
922 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
923 ;;
924 esac
925
926 # Recommended by Balint Nagy Endre <bne@CareNet.hu>
927 case "$host" in
928 *-univel-sysv4.2MP)
929 if test `uname -v` = "2.03"; then
930 echo "disabling mallinfo for $host"
931 ac_cv_func_mallinfo=no
932 fi
933 ;;
934 esac
935
936 dnl This has to be before AC_CHECK_FUNCS
937 # Disable poll() on certain platforms. Override by setting ac_cv_func_poll
938 # when running configure.
939 if test -z "$ac_cv_func_poll"; then
940 case "$host" in
941 [alpha-dec-osf3.*])
942 # John Kay (jkay@nlanr.net) 19970818
943 echo "disabling poll for $host..."
944 ac_cv_func_poll='no'
945 ;;
946 [*-hp-hpux*.*])
947 # Duane Wessels
948 echo "disabling poll for $host..."
949 ac_cv_func_poll='no'
950 ;;
951 [*-linux-*])
952 # Henrik Nordstrom (hno@hem.passagen.se) 19980817
953 # poll is problematic on Linux. We disable it
954 # by default until Linux gets it right.
955 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
956 if test $rev -lt 002002; then
957 echo "disabling poll for $host < 2.2..."
958 ac_cv_func_poll='no'
959 fi
960 ;;
961 [powerpc-ibm-aix4.1.*])
962 # Mike Laster (mlaster@metavillage.com) 19981021
963 echo "disabling poll for $host..."
964 ac_cv_func_poll='no'
965 ;;
966 [*-pc-sco3.2*])
967 # Robert Side <rside@aiinc.bc.ca>
968 # Mon, 18 Jan 1999 17:48:00 GMT
969 echo "disabling poll for $host..."
970 ac_cv_func_poll='no'
971 ;;
972 esac
973 fi
974
975 dnl Check for library functions
976 AC_CHECK_FUNCS(\
977 bcopy \
978 crypt \
979 fchmod \
980 getdtablesize \
981 getpagesize \
982 getrusage \
983 getspnam \
984 lrand48 \
985 mallinfo \
986 mallocblksize \
987 mallopt \
988 memcpy \
989 memmove \
990 memset \
991 mktime \
992 mstats \
993 poll \
994 putenv \
995 random \
996 regcomp \
997 regexec \
998 regfree \
999 res_init \
1000 rint \
1001 seteuid \
1002 setpgrp \
1003 setrlimit \
1004 getrlimit \
1005 setsid \
1006 sigaction \
1007 snprintf \
1008 srand48 \
1009 srandom \
1010 sysconf \
1011 syslog \
1012 timegm \
1013 vsnprintf \
1014 )
1015
1016 if test "$async_io" = "yes" ; then
1017 AC_CHECK_FUNCS(\
1018 pthread_attr_setscope \
1019 pthread_setschedparam \
1020 pthread_attr_setschedparam \
1021 )
1022 fi
1023
1024 dnl Yay! Another Linux brokenness. Its not good enough
1025 dnl to know that setresuid() exists, because RedHat 5.0 declares
1026 dnl setresuid() but doesn't implement it.
1027 dnl
1028 AC_CACHE_CHECK(if setresuid is implemented, ac_cv_func_setresuid,
1029 AC_TRY_RUN([
1030 #include <stdlib.h>
1031 int main() {
1032 if(setresuid(-1,-1,-1)) {
1033 perror("setresuid:");
1034 exit(1);
1035 }
1036 exit(0);
1037 }
1038 ],ac_cv_func_setresuid="yes",ac_cv_func_setresuid="no")
1039 )
1040 if test "$ac_cv_func_setresuid" = "yes" ; then
1041 AC_DEFINE(HAVE_SETRESUID)
1042 fi
1043
1044 dnl IP-Filter support requires ipf header files. These aren't
1045 dnl installed by default, so we need to check for them
1046 if test "$IPF_TRANSPARENT" ; then
1047 AC_MSG_CHECKING(if IP-Filter header files are installed)
1048 if test "$ac_cv_header_ip_compat_h" = "yes" &&
1049 test "$ac_cv_header_ip_fil_h" = "yes" &&
1050 test "$ac_cv_header_ip_nat_h" = "yes" ; then
1051 IPF_TRANSPARENT="yes"
1052 AC_DEFINE(IPF_TRANSPARENT, 1)
1053 elif test "$ac_cv_header_netinet_ip_compat_h" = "yes" &&
1054 test "$ac_cv_header_netinet_ip_fil_h" = "yes" &&
1055 test "$ac_cv_header_netinet_ip_nat_h" = "yes" ; then
1056 IPF_TRANSPARENT="yes"
1057 AC_DEFINE(IPF_TRANSPARENT, 1)
1058 else
1059 IPF_TRANSPARENT="no"
1060 AC_DEFINE(IPF_TRANSPARENT, 0)
1061 fi
1062 AC_MSG_RESULT($IPF_TRANSPARENT)
1063 fi
1064 if test "$IPF_TRANSPARENT" = "no" ; then
1065 echo "WARNING: Cannot find necessary IP-Filter header files"
1066 echo " Transparent Proxy support WILL NOT be enabled"
1067 sleep 10
1068 fi
1069
1070 if test -z "$USE_GNUREGEX" ; then
1071 case "$host" in
1072 *-sun-solaris2.[[0-4]])
1073 USE_GNUREGEX="yes"
1074 ;;
1075 *-next-nextstep*)
1076 USE_GNUREGEX="yes"
1077 ;;
1078 esac
1079 fi
1080 AC_MSG_CHECKING(if GNUregex needs to be compiled)
1081 if test -z "$USE_GNUREGEX"; then
1082 if test "$ac_cv_func_regcomp" = "no" || test "$USE_GNUREGEX" = "yes" ; then
1083 USE_GNUREGEX="yes"
1084 else
1085 AC_TRY_COMPILE([#include <sys/types.h>
1086 #include <regex.h>],[regex_t t; regcomp(&t,"",0);],
1087 USE_GNUREGEX="no",
1088 USE_GNUREGEX="yes")
1089 fi
1090 fi
1091 AC_MSG_RESULT($USE_GNUREGEX)
1092 if test "$USE_GNUREGEX" = "yes"; then
1093 REGEXLIB="-lregex"
1094 LIBREGEX="libregex.a"
1095 AC_DEFINE(USE_GNUREGEX)
1096 fi
1097 AC_SUBST(REGEXLIB)
1098 AC_SUBST(LIBREGEX)
1099
1100 AC_REPLACE_FUNCS(\
1101 drand48 \
1102 tempnam \
1103 strerror \
1104 )
1105
1106 dnl Not cached since people are likely to tune this
1107 AC_MSG_CHECKING(Default FD_SETSIZE value)
1108 AC_TRY_RUN([
1109 #if HAVE_STDIO_H
1110 #include <stdio.h>
1111 #endif
1112 #if HAVE_UNISTD_H
1113 #include <unistd.h>
1114 #endif
1115 #if HAVE_SYS_TIME_H
1116 #include <sys/time.h>
1117 #endif
1118 #if HAVE_SYS_SELECT_H
1119 #include <sys/select.h>
1120 #endif
1121 #if HAVE_SYS_TYPES_H
1122 #include <sys/types.h>
1123 #endif
1124 main() {
1125 FILE *fp = fopen("conftestval", "w");
1126 fprintf (fp, "%d\n", FD_SETSIZE);
1127 exit(0);
1128 }
1129 ],
1130 DEFAULT_FD_SETSIZE=`cat conftestval`,
1131 DEFAULT_FD_SETSIZE=256,
1132 DEFAULT_FD_SETSIZE=256)
1133 AC_MSG_RESULT($DEFAULT_FD_SETSIZE)
1134 AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE)
1135
1136 dnl Not cached since people are likely to tune this
1137 AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
1138 dnl damn! FreeBSD's pthreads breaks dup2().
1139 TLDFLAGS="$LDFLAGS"
1140 case $host in
1141 i386-unknown-freebsd*)
1142 if echo "$LDFLAGS" | grep -q pthread; then
1143 LDFLAGS=`echo $LDFLAGS | sed -e "s/-pthread//"`
1144 fi
1145 esac
1146 AC_TRY_RUN([
1147 #include <stdio.h>
1148 #include <unistd.h>
1149 #include <sys/time.h> /* needed on FreeBSD */
1150 #include <sys/param.h>
1151 #include <sys/resource.h>
1152 main() {
1153 FILE *fp;
1154 int i,j;
1155 #if __CYGWIN32__
1156 /* getrlimit and sysconf returns bogous values on cygwin32.
1157 * Number of fds is virtually unlimited in cygwin (sys/param.h)
1158 */
1159 i = NOFILE;
1160 #elif HAVE_SETRLIMIT
1161 struct rlimit rl;
1162 #if defined(RLIMIT_NOFILE)
1163 if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
1164 perror("getrlimit: RLIMIT_NOFILE");
1165 } else {
1166 rl.rlim_cur = rl.rlim_max; /* set it to the max */
1167 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
1168 perror("setrlimit: RLIMIT_NOFILE");
1169 }
1170 }
1171 #elif defined(RLIMIT_OFILE)
1172 if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
1173 perror("getrlimit: RLIMIT_OFILE");
1174 } else {
1175 rl.rlim_cur = rl.rlim_max; /* set it to the max */
1176 if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
1177 perror("setrlimit: RLIMIT_OFILE");
1178 }
1179 }
1180 #endif /* RLIMIT_NOFILE */
1181 #endif /* HAVE_SETRLIMIT */
1182 /* by starting at 2^14, we will never get higher
1183 than 2^15 for SQUID_MAXFD */
1184 i = j = 1<<14;
1185 while (j) {
1186 j >>= 1;
1187 if (dup2(0, i) < 0) {
1188 i -= j;
1189 } else {
1190 close(i);
1191 i += j;
1192 }
1193 }
1194 i++;
1195 fp = fopen("conftestval", "w");
1196 fprintf (fp, "%d\n", i);
1197 exit(0);
1198 }
1199 ],
1200 SQUID_MAXFD=`cat conftestval`,
1201 SQUID_MAXFD=256,
1202 SQUID_MAXFD=256)
1203 AC_MSG_RESULT($SQUID_MAXFD)
1204 AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD)
1205 if test "$SQUID_MAXFD" -lt 512 ; then
1206 echo "WARNING: $SQUID_MAXFD may not be enough filedescriptors if your"
1207 echo " cache will be very busy. Please see the FAQ page"
1208 echo " http://squid.nlanr.net/Squid/FAQ/FAQ-11.html#filedescriptors"
1209 echo " on how to increase your filedescriptor limit"
1210 sleep 10
1211 fi
1212 LDFLAGS="$TLDFLAGS"
1213
1214 dnl Not cached since people are likely to tune this
1215 AC_MSG_CHECKING(Default UDP send buffer size)
1216 AC_TRY_RUN([
1217 #include <stdlib.h>
1218 #include <stdio.h>
1219 #include <sys/types.h>
1220 #include <sys/socket.h>
1221 #include <netinet/in.h>
1222 main ()
1223 {
1224 FILE *fp;
1225 int fd,val=0,len=sizeof(int);
1226 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
1227 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
1228 if (val<=0) exit(1);
1229 fp = fopen("conftestval", "w");
1230 fprintf (fp, "%d\n", val);
1231 exit(0);
1232 }
1233 ],
1234 SQUID_UDP_SO_SNDBUF=`cat conftestval`,
1235 SQUID_UDP_SO_SNDBUF=16384,
1236 SQUID_UDP_SO_SNDBUF=16384)
1237 AC_MSG_RESULT($SQUID_UDP_SO_SNDBUF)
1238 AC_DEFINE_UNQUOTED(SQUID_UDP_SO_SNDBUF, $SQUID_UDP_SO_SNDBUF)
1239
1240 dnl Not cached since people are likely to tune this
1241 AC_MSG_CHECKING(Default UDP receive buffer size)
1242 AC_TRY_RUN([
1243 #include <stdlib.h>
1244 #include <stdio.h>
1245 #include <sys/types.h>
1246 #include <sys/socket.h>
1247 #include <netinet/in.h>
1248 main ()
1249 {
1250 FILE *fp;
1251 int fd,val=0,len=sizeof(int);
1252 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
1253 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
1254 if (val <= 0) exit(1);
1255 fp = fopen("conftestval", "w");
1256 fprintf (fp, "%d\n", val);
1257 exit(0);
1258 }
1259 ],
1260 SQUID_UDP_SO_RCVBUF=`cat conftestval`,
1261 SQUID_UDP_SO_RCVBUF=16384,
1262 SQUID_UDP_SO_RCVBUF=16384)
1263 AC_MSG_RESULT($SQUID_UDP_SO_RCVBUF)
1264 AC_DEFINE_UNQUOTED(SQUID_UDP_SO_RCVBUF, $SQUID_UDP_SO_RCVBUF)
1265
1266 dnl Not cached since people are likely to tune this
1267 AC_MSG_CHECKING(Default TCP send buffer size)
1268 AC_TRY_RUN([
1269 #include <stdlib.h>
1270 #include <stdio.h>
1271 #include <sys/types.h>
1272 #include <sys/socket.h>
1273 #include <netinet/in.h>
1274 main ()
1275 {
1276 FILE *fp;
1277 int fd,val=0,len=sizeof(int);
1278 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
1279 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
1280 if (val <= 0) exit(1);
1281 fp = fopen("conftestval", "w");
1282 fprintf (fp, "%d\n", val);
1283 exit(0);
1284 }
1285 ],
1286 SQUID_TCP_SO_SNDBUF=`cat conftestval`,
1287 SQUID_TCP_SO_SNDBUF=16384,
1288 SQUID_TCP_SO_SNDBUF=16384)
1289 AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF)
1290 AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF)
1291
1292 dnl Not cached since people are likely to tune this
1293 AC_MSG_CHECKING(Default TCP receive buffer size)
1294 AC_TRY_RUN([
1295 #include <stdlib.h>
1296 #include <stdio.h>
1297 #include <sys/types.h>
1298 #include <sys/socket.h>
1299 #include <netinet/in.h>
1300 main ()
1301 {
1302 FILE *fp;
1303 int fd,val=0,len=sizeof(int);
1304 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
1305 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
1306 if (val <= 0) exit(1);
1307 fp = fopen("conftestval", "w");
1308 fprintf (fp, "%d\n", val);
1309 exit(0);
1310 }
1311 ],
1312 SQUID_TCP_SO_RCVBUF=`cat conftestval`,
1313 SQUID_TCP_SO_RCVBUF=16384,
1314 SQUID_TCP_SO_RCVBUF=16384)
1315 AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF)
1316 AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF)
1317
1318 AC_CACHE_CHECK(if sys_errlist is already defined, ac_cv_needs_sys_errlist,
1319 AC_TRY_COMPILE([#include <stdio.h>],[char *s = sys_errlist;],
1320 ac_cv_needs_sys_errlist="no",
1321 ac_cv_needs_sys_errlist="yes")
1322 )
1323 if test "$ac_cv_needs_sys_errlist" = "yes" ; then
1324 AC_DEFINE(NEED_SYS_ERRLIST)
1325 fi
1326
1327 dnl Not cached since people are likely to change this
1328 AC_MSG_CHECKING(for libresolv _dns_ttl_ hack)
1329 AC_TRY_LINK(extern int _dns_ttl_;,return _dns_ttl_;,
1330 [AC_MSG_RESULT(yes)
1331 AC_DEFINE(LIBRESOLV_DNS_TTL_HACK)],
1332 AC_MSG_RESULT(no))
1333
1334 AC_MSG_CHECKING(if inet_ntoa() actually works)
1335 AC_TRY_RUN([
1336 #include <stdlib.h>
1337 #include <stdio.h>
1338 #include <sys/types.h>
1339 #include <netinet/in.h>
1340 #include <arpa/inet.h>
1341 main ()
1342 {
1343 FILE *fp;
1344 struct in_addr in;
1345 in.s_addr = inet_addr("1.2.3.4");
1346 fp = fopen("conftestval", "w");
1347 fprintf (fp, "%s\n", inet_ntoa(in));
1348 exit(0);
1349 }
1350 ],
1351 INET_NTOA_RESULT=`cat conftestval`,
1352 INET_NTOA_RESULT="broken",
1353 INET_NTOA_RESULT="broken")
1354 if test "$INET_NTOA_RESULT" = "1.2.3.4" ; then
1355 AC_MSG_RESULT("yes")
1356 else
1357 AC_MSG_RESULT("no")
1358 echo "Will use our own inet_ntoa()."
1359 LIBOBJS="$LIBOBJS inet_ntoa.o"
1360 # echo "WARNING: This looks bad, and probably prevents Squid from working."
1361 # echo " If you're on IRIX and using GCC 2.8, you probably need"
1362 # echo " to use the IRIX C compiler instead."
1363 # sleep 10
1364 fi
1365
1366 if test "$ac_cv_header_sys_statvfs_h" = "yes" ; then
1367 AC_MSG_CHECKING(for working statvfs() interface)
1368 AC_TRY_COMPILE([
1369 #include <stdlib.h>
1370 #include <stdio.h>
1371 #include <sys/types.h>
1372 #include <sys/statvfs.h>
1373 ],
1374 [
1375 struct statvfs sfs;
1376 sfs.f_blocks = sfs.f_bfree = sfs.f_frsize =
1377 sfs.f_files = sfs.f_ffree = 0;
1378 statvfs("/tmp", &sfs);
1379 ],
1380 ac_cv_func_statvfs=yes,
1381 ac_cv_func_statvfs=no)
1382 AC_MSG_RESULT($ac_cv_func_statvfs)
1383 if test "$ac_cv_func_statvfs" = "yes" ; then
1384 AC_DEFINE(HAVE_STATVFS)
1385 fi
1386 fi
1387
1388 AC_CACHE_CHECK(for _res.nsaddr_list, ac_cv_have_res_nsaddr_list,
1389 AC_TRY_COMPILE([
1390 #if HAVE_SYS_TYPES_H
1391 #include <sys/types.h>
1392 #endif
1393 #if HAVE_NETINET_IN_H
1394 #include <netinet/in.h>
1395 #endif
1396 #if HAVE_ARPA_INET_H
1397 #include <arpa/inet.h>
1398 #endif
1399 #if HAVE_ARPA_NAMESER_H
1400 #include <arpa/nameser.h>
1401 #endif
1402 #if HAVE_RESOLV_H
1403 #include <resolv.h>
1404 #endif
1405 ],
1406 [_res.nsaddr_list[[0]];],
1407 ac_cv_have_res_nsaddr_list="yes",
1408 ac_cv_have_res_nsaddr_list="no"))
1409 if test $ac_cv_have_res_nsaddr_list = "yes" ; then
1410 AC_DEFINE(HAVE_RES_NSADDR_LIST)
1411 fi
1412
1413 if test $ac_cv_have_res_nsaddr_list = "no" ; then
1414 AC_CACHE_CHECK(for _res.ns_list, ac_cv_have_res_ns_list,
1415 AC_TRY_COMPILE([
1416 #if HAVE_SYS_TYPES_H
1417 #include <sys/types.h>
1418 #endif
1419 #if HAVE_NETINET_IN_H
1420 #include <netinet/in.h>
1421 #endif
1422 #if HAVE_ARPA_INET_H
1423 #include <arpa/inet.h>
1424 #endif
1425 #if HAVE_ARPA_NAMESER_H
1426 #include <arpa/nameser.h>
1427 #endif
1428 #if HAVE_RESOLV_H
1429 #include <resolv.h>
1430 #endif
1431 ],
1432 [_res.ns_list[[0]].addr;],
1433 ac_cv_have_res_ns_list="yes",
1434 ac_cv_have_res_ns_list="no"))
1435 if test $ac_cv_have_res_ns_list = "yes" ; then
1436 AC_DEFINE(HAVE_RES_NS_LIST)
1437 fi
1438 fi
1439
1440 dnl Need the debugging version of malloc if available
1441 XTRA_OBJS=''
1442 if test "$ac_cv_lib_malloc_main" = "yes" ; then
1443 if test -r /usr/lib/debug/malloc.o ; then
1444 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
1445 fi
1446 if test -r /usr/lib/debug/mallocmap.o ; then
1447 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
1448 fi
1449 fi
1450
1451 AC_SUBST(XTRA_OBJS)
1452
1453 if test -z "$XTRA_LIBS"; then
1454 XTRA_LIBS="$LIBS"
1455 dnl -lcrypt is set in CRYPTLIB
1456 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/-lcrypt//"`
1457 dnl -lpthread is set in PTHREADLIB
1458 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/-lpthread//"`
1459 dnl minor cleanup
1460 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
1461 LIBS=''
1462 fi
1463 AC_SUBST(XTRA_LIBS)
1464
1465 dnl Clean up after OSF/1 core dump bug
1466 rm -f core
1467
1468 AC_OUTPUT(\
1469 ./makefile \
1470 ./lib/Makefile \
1471 ./include/config.h \
1472 ./scripts/Makefile \
1473 ./scripts/RunCache \
1474 ./scripts/RunAccel \
1475 ./src/Makefile \
1476 ./contrib/Makefile \
1477 $SNMP_MAKEFILE \
1478 ./icons/Makefile \
1479 ./errors/Makefile \
1480 ./auth_modules/dummy \
1481 ./auth_modules/NCSA/Makefile \
1482 ./auth_modules/PAM/Makefile \
1483 ./auth_modules/SMB/Makefile
1484 ./auth_modules/getpwnam/Makefile \
1485 ./auth_modules/LDAP/Makefile \
1486 )