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