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