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