]> git.ipfire.org Git - thirdparty/squid.git/blame - configure.in
Restored the #if USE_UNLINKD statements. These are used by the
[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
fe0810ac 6dnl $Id: configure.in,v 1.191 2000/05/31 01:04:44 hno Exp $
090089c4 7dnl
8dnl
090089c4 9dnl
a26bdc75 10AC_INIT(src/main.c)
090089c4 11AC_CONFIG_HEADER(include/autoconf.h)
fe0810ac 12AC_REVISION($Revision: 1.191 $)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
fe0810ac 638dnl Disable "unlinkd" cde
639AC_ARG_ENABLE(unlinkd,
640[ --disable-unlinkd Do not use unlinkd],
641[ if test "$enableval" = "no" ; then
642 USE_UNLINKD=0
643 else
644 USE_UNLINKD=1
645 fi
646],[
647 # Here we should probably use some magic depending on the selected
648 # storage models
649 USE_UNLINKD=1
650])
651if test $USE_UNLINKD; then
652 echo "unlinkd enabled"
653 AC_DEFINE(USE_UNLINKD)
654 OPT_UNLINKD_EXE='$(OPT_UNLINKD_EXE)'
655 UNLINKD_OBJS='unlinkd.o'
656else
657 echo "unlinkd disabled"
658 OPT_UNLINKD_EXE=''
659 UNLINKD_OBJS=''
660fi
661AC_SUBST(OPT_UNLINKD_EXE)
662AC_SUBST(UNLINKD_OBJS)
663
ce3d30fb 664dnl Enable backtraces on fatal errors
665AC_ARG_ENABLE(stacktraces,
666[ --enable-stacktraces Enable automatic call backtrace on fatal errors],
667[ if test "$enableval" = "yes" ; then
668 echo "Enabling automatic stack backtraces on fatal errors"
669 AC_DEFINE(PRINT_STACK_TRACE, 1)
670 fi
671])
672
fd9aaa3e 673# Force some compilers to use ANSI features
674#
675case "$host" in
676 alpha-dec-osf*)
677 if test "$ac_cv_prog_CC" = "cc" ; then
678 echo "adding '-std1' to cc args for $host"
679 CC="cc -std1";
680 ac_cv_prog_CC="$CC"
681 fi
682 ;;
c68e9c6b 683 *-hp-hpux*)
684 if test "$ac_cv_prog_CC" = "cc" ; then
685 echo "adding '-Ae' to cc args for $host"
686 CC="cc -Ae";
687 ac_cv_prog_CC="$CC"
688 fi
689 ;;
fd9aaa3e 690esac
691
090089c4 692dnl Check for programs
693AC_PROG_CPP
694AC_PROG_INSTALL
695AC_PROG_RANLIB
696AC_PROG_LN_S
81280a96 697AC_PATH_PROG(SH, sh, /bin/sh)
d9f67e6f 698AC_PATH_PROG(FALSE, false, /usr/bin/false)
699AC_PATH_PROG(TRUE, true, /usr/bin/true)
700AC_PATH_PROG(RM, rm, $FALSE)
701AC_PATH_PROG(MV, mv, $FALSE)
702AC_PATH_PROG(MKDIR, mkdir, $FALSE)
090089c4 703AC_PATH_PROG(LN, ln, cp)
983061ed 704AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
d9f67e6f 705AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
6ad85e8a 706AC_PATH_PROG(AR, ar, $FALSE)
707
708case "$host" in
709 *-hp-hpux*)
710 echo "Disabling 'ranlib' for HP-UX..."
711 RANLIB=":"
712 ;;
713esac
714
715dnl set $(AR)
716AR_R="$AR r"
717case "$host" in
718 *-next-nextstep3)
719 AR="libtool -o"
720 ;;
721esac
722AC_SUBST(AR_R)
090089c4 723
724dnl Check for headers
725AC_HEADER_DIRENT
726AC_HEADER_STDC
db40ae20 727
728AC_CHECK_HEADERS( \
db40ae20 729 arpa/inet.h \
30a4f2a8 730 arpa/nameser.h \
9441aa34 731 assert.h \
db40ae20 732 bstring.h \
733 config.h \
734 crypt.h \
30a4f2a8 735 ctype.h \
736 errno.h \
ce3d30fb 737 execinfo.h \
db40ae20 738 fcntl.h \
9c1d8929 739 getopt.h \
88738790 740 gnumalloc.h \
30a4f2a8 741 grp.h \
5cafc1d6 742 ip_compat.h \
743 ip_fil.h \
744 ip_nat.h \
30a4f2a8 745 libc.h \
6ad85e8a 746 limits.h \
30a4f2a8 747 malloc.h \
e0bddc45 748 math.h \
db40ae20 749 memory.h \
b075cbb1 750 mount.h \
5cafc1d6 751 net/if.h \
30a4f2a8 752 netdb.h \
c415c128 753 netinet/if_ether.h \
db40ae20 754 netinet/in.h \
30a4f2a8 755 netinet/tcp.h \
eb824054 756 netinet/ip_compat.h \
757 netinet/ip_fil.h \
758 netinet/ip_nat.h \
dcfe6390 759 poll.h \
30a4f2a8 760 pwd.h \
761 regex.h \
762 resolv.h \
c68e9c6b 763 sched.h \
30a4f2a8 764 signal.h \
765 stdarg.h \
766 stddef.h \
767 stdio.h \
db40ae20 768 stdlib.h \
769 string.h \
770 strings.h \
771 sys/file.h \
5cafc1d6 772 sys/ioctl.h \
0343b99c 773 sys/mount.h \
ebb3c3ba 774 sys/msg.h \
30a4f2a8 775 sys/param.h \
776 sys/resource.h \
db40ae20 777 sys/select.h\
30a4f2a8 778 sys/socket.h \
779 sys/stat.h \
b075cbb1 780 sys/statvfs.h \
0343b99c 781 sys/vfs.h \
30a4f2a8 782 sys/syscall.h \
db40ae20 783 sys/time.h \
784 sys/types.h \
30a4f2a8 785 sys/un.h \
b075cbb1 786 sys/vfs.h \
30a4f2a8 787 sys/wait.h \
db40ae20 788 syslog.h \
30a4f2a8 789 time.h \
790 unistd.h \
791 varargs.h \
db40ae20 792)
793
aee0606f 794AC_C_CONST
d57288d2 795AC_C_BIGENDIAN
aee0606f 796
5c51415d 797AC_CACHE_CHECK(if ANSI prototypes work,ac_cv_have_ansi_prototypes, [
798 AC_TRY_COMPILE([int foo(char *); int foo (char *bar) {return 1;}],
799 [foo("bar")],
800 ac_cv_have_ansi_prototypes="yes",
801 ac_cv_have_ansi_prototypes="no")
802])
803if test $ac_cv_have_ansi_prototypes = "yes" ; then
804 AC_DEFINE(HAVE_ANSI_PROTOTYPES)
805fi
20a50bb9 806
5c51415d 807AC_CACHE_CHECK(for tm->tm_gmtoff,ac_cv_have_tm_gmoff, [
808 AC_TRY_COMPILE([#include <time.h>
46c883ed 809#include <sys/time.h>],
5c51415d 810 [struct tm foo;
811 foo.tm_gmtoff = 0;],
812 ac_cv_have_tm_gmoff="yes",
813 ac_cv_have_tm_gmoff="no")
814])
815if test $ac_cv_have_tm_gmoff = "yes" ; then
816 AC_DEFINE(HAVE_TM_GMTOFF)
817fi
46c883ed 818
eb824054 819AC_CACHE_CHECK(for struct mallinfo,ac_cv_have_struct_mallinfo, [
820 AC_TRY_COMPILE([#include <sys/types.h>
821#if HAVE_MALLOC_H
822#include <malloc.h>
823#endif],
824 [struct mallinfo foo;
825 foo.arena = 0;
826 foo.ordblks = 0;
827 foo.smblks = 0;
828 foo.hblks = 0;
829 foo.hblkhd = 0;
830 foo.uordblks = 0;
831 foo.fordblks = 0;
832 foo.keepcost = 0;],
833 ac_cv_have_struct_mallinfo="yes",
834 ac_cv_have_struct_mallinfo="no")
835])
836if test $ac_cv_have_struct_mallinfo = "yes" ; then
837 AC_DEFINE(HAVE_STRUCT_MALLINFO)
838fi
839
5c51415d 840AC_CACHE_CHECK(for extended mallinfo,ac_cv_have_ext_mallinfo, [
841 AC_TRY_COMPILE([#include <sys/types.h>
46c883ed 842#include <malloc.h>],
5c51415d 843 [struct mallinfo foo;
844 foo.mxfast = 0;],
845 ac_cv_have_ext_mallinfo="yes",
846 ac_cv_have_ext_mallinfo="no")
847])
848if test $ac_cv_have_ext_mallinfo = "yes" ; then
849 AC_DEFINE(HAVE_EXT_MALLINFO)
850fi
090089c4 851
b54a6789 852AC_CACHE_CHECK(for struct rusage,ac_cv_have_struct_rusage, [
853 AC_TRY_COMPILE([
8ff51bba 854#if HAVE_SYS_TIME_H
855#include <sys/time.h>
856#endif
b54a6789 857#if HAVE_SYS_RESOURCE_H
858#include <sys/resource.h>
859#endif],
860 [struct rusage R;],
861 ac_cv_have_struct_rusage="yes",
862 ac_cv_have_struct_rusage="no")
863])
864if test $ac_cv_have_struct_rusage = "yes" ; then
865 AC_DEFINE(HAVE_STRUCT_RUSAGE)
866fi
867
5c51415d 868AC_CACHE_CHECK(for ip->ip_hl, ac_cv_have_ip_hl, [
869 AC_TRY_COMPILE([#include <sys/types.h>
a025a745 870#include <netinet/in.h>
871#include <netinet/in_systm.h>
6ad85e8a 872#include <netinet/ip.h>
873#ifdef __linux__
874#define ip_hl ihl
875#endif
876#ifndef __linux__
877#define iphdr ip
878#endif],
5c51415d 879 [struct iphdr ip;
880 ip.ip_hl= 0;],
881 ac_cv_have_ip_hl="yes",
882 ac_cv_have_ip_hl="no")
883])
884if test $ac_cv_have_ip_hl = "yes" ; then
885 AC_DEFINE(HAVE_IP_HL)
886fi
a025a745 887
090089c4 888dnl Check for typedefs
889AC_CHECK_SIZEOF(int)
890AC_CHECK_SIZEOF(long)
b6a2f15e 891AC_CHECK_SIZEOF(void *)
090089c4 892
256cf05b 893dnl Check for special functions
894AC_FUNC_ALLOCA
090089c4 895
3f6fcd8a 896AC_CHECK_TYPE(pid_t, int)
0897af2d 897AC_CHECK_TYPE(size_t, unsigned int)
898AC_CHECK_TYPE(ssize_t, int)
3f6fcd8a 899AC_CHECK_TYPE(off_t, int)
95cf2361 900AC_CHECK_TYPE(mode_t, u_short)
c716a1dd 901AC_CHECK_TYPE(fd_mask, int)
3f6fcd8a 902
6637e3a5 903dnl Check for type in sys/socket.h
904AC_CACHE_CHECK(for socklen_t, ac_cv_type_socklen_t, [
905 AC_EGREP_CPP([socklen_t[^a-zA-Z_0-9]], [#include <sys/types.h>
906#include <sys/socket.h>
907#if STDC_HEADERS
908#include <stdlib.h>
909#include <stddef.h>
910#endif],
911 ac_cv_type_socklen_t=yes,
912 ac_cv_type_socklen_t=no)
913])
914if test $ac_cv_type_socklen_t = no; then
915 AC_DEFINE(socklen_t, int)
916fi
917
aea1be68 918dnl Check for mtyp_t in some headers
919AC_CACHE_CHECK(for mtyp_t, ac_cv_type_mtyp_t, [
920 AC_EGREP_CPP([mtyp_t[^a-zA-Z_0-9]], [#include <sys/types.h>
921#include <sys/ipc.h>
922#include <sys/msg.h>],
923 ac_cv_type_mtyp_t=yes,
924 ac_cv_type_mtyp_t=no)
925])
926if test $ac_cv_type_mtyp_t = no; then
927 AC_DEFINE(mtyp_t, long)
928 fi
929
090089c4 930dnl Check for needed libraries
30a4f2a8 931AC_CHECK_LIB(nsl, main)
6716b242 932AC_CHECK_LIB(socket, main)
94d48591 933
934if test "x$ac_cv_enabled_dlmalloc" = "xyes" ; then
935 echo "skipping libmalloc check (--enable-dlmalloc specified)"
5c51415d 936else
94d48591 937 AC_CHECK_LIB(gnumalloc, main)
938 if test "$ac_cv_lib_gnumalloc_main" = "yes"; then
939 echo "Disabling extended malloc functions when using gnumalloc"
940 ac_cv_func_mallinfo=no
941 ac_cv_func_mallocblksize=no
942 ac_cv_func_mallopt=no
943 else
944 case "$host" in
945 *-sun-solaris*)
946 echo "skipping libmalloc check for $host"
947 ;;
948 i386-*-freebsd*)
949 echo "skipping libmalloc check for $host"
950 ;;
951 *)
952
953 AC_CHECK_LIB(malloc, main)
954 ;;
955 esac
956 fi
8a15e65e 957fi
94d48591 958
6716b242 959AC_CHECK_LIB(bsd, main)
be79ade0 960AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"])
04a56fa3 961AC_CHECK_LIB(bind, gethostbyname)
962if test $ac_cv_lib_bind_gethostbyname = "no" ; then
963 case "$host" in
78743365 964 i386-*-freebsd*)
965 echo "skipping libresolv checks for $host"
966 ;;
967 *)
968 AC_CHECK_LIB(resolv, inet_aton, AC_CHECK_LIB(44bsd, inet_aton))
969 AC_CHECK_LIB(resolv, main)
970 ;;
04a56fa3 971 esac
972fi
e0bddc45 973AC_CHECK_LIB(m, main)
090089c4 974
975dnl Check for libcrypt
b8de7ebe 976dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
0f5a16f8 977AC_CHECK_LIB(crypt, crypt)
978if test $ac_cv_lib_crypt_crypt = "yes"; then
979 CRYPTLIB="-lcrypt"
980fi
be79ade0 981AC_SUBST(CRYPTLIB)
77f675ad 982
e5f4e1b0 983dnl Check for pthreads
984dnl We use pthreads when doing ASYNC I/O
0f5a16f8 985AC_CHECK_LIB(pthread, main)
986if test $ac_cv_lib_pthread_main = "yes"; then
987 PTHREADLIB="-lpthread"
988fi
71f8abc8 989AC_SUBST(PTHREADLIB)
990
86ec11aa 991dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
992dnl Robert Side <rside@aiinc.bc.ca>
993dnl Mon, 18 Jan 1999 17:48:00 GMT
994case "$host" in
995 *-pc-sco3.2*)
996 AC_CHECK_LIB(intl, strftime)
997 ;;
998esac
999
77f675ad 1000dnl System-specific library modifications
1001dnl
1002case "$host" in
88738790 1003 i386-*-solaris2.*)
7149a49f 1004 if test "$GCC" = "yes"; then
1005 echo "Removing -O for gcc on $host"
80e92d6d 1006 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
7149a49f 1007 fi
1008 ;;
77f675ad 1009 *-sgi-irix*)
1010 echo "Removing -lsocket for IRIX..."
6716b242 1011 LIBS=`echo $LIBS | sed -e s/-lsocket//`
77f675ad 1012 echo "Removing -lnsl for IRIX..."
6716b242 1013 LIBS=`echo $LIBS | sed -e s/-lnsl//`
c415c128 1014 ac_cv_lib_nsl_main=no
b44c0fb4 1015 echo "Removing -lbsd for IRIX..."
1016 LIBS=`echo $LIBS | sed -e s/-lbsd//`
77f675ad 1017 ;;
4ba0bd0e 1018dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
1019dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
1020dnl Please change your configure script. AIX doesn't need -lbsd.
1021 *-ibm-aix*)
1022 echo "Removing -lbsd for AIX..."
1023 LIBS=`echo $LIBS | sed -e s/-lbsd//`
c68e9c6b 1024dnl From: mlaster@metavillage.com (Mike Laster)
1025dnl AIX 4.1.4.x does not have header files for snprintf/vsnprintf
1026dnl So using the internal versions generates a load of warnings
1027dnl during compile.
1028 echo "disabling snprintf/vsnprintf for $host"
1029 ac_cv_func_snprintf=no
1030 ac_cv_func_vsnprintf=no
4ba0bd0e 1031 ;;
30a4f2a8 1032 *m88k*)
1033 CFLAGS="$CFLAGS -D_SQUID_MOTOROLA_"
7149a49f 1034 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
1035 ;;
580ce039 1036 [*-*-solaris2.[0-4]])
7149a49f 1037 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
30a4f2a8 1038 ;;
711fa75e 1039 [*-sony-newsos[56]*])
f62c73dc 1040 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
1041 ;;
77f675ad 1042esac
090089c4 1043
d20b1cd0 1044# Remove optimization for GCC 2.95.[12]
1045# gcc -O[2] on *BSD and Linux (x86) causes pointers to magically become NULL
1046if test "$GCC" = "yes"; then
1047 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
1048 case "$GCCVER" in
1049 [2.95.[12]])
1050 echo "Removing -O for gcc on $host with GCC $GCCVER"
1051 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
1052 ;;
1053 esac
1054fi
1055
176d10ee 1056# Recommended by Balint Nagy Endre <bne@CareNet.hu>
1057case "$host" in
1058 *-univel-sysv4.2MP)
1059 if test `uname -v` = "2.03"; then
1060 echo "disabling mallinfo for $host"
1061 ac_cv_func_mallinfo=no
1062 fi
1063 ;;
1064esac
1065
84cecfd2 1066dnl This has to be before AC_CHECK_FUNCS
1067# Disable poll() on certain platforms. Override by setting ac_cv_func_poll
1068# when running configure.
1069if test -z "$ac_cv_func_poll"; then
1070 case "$host" in
1071 [alpha-dec-osf3.*])
1072 # John Kay (jkay@nlanr.net) 19970818
1073 echo "disabling poll for $host..."
1074 ac_cv_func_poll='no'
1075 ;;
1076 [*-hp-hpux*.*])
1077 # Duane Wessels
1078 echo "disabling poll for $host..."
1079 ac_cv_func_poll='no'
1080 ;;
1081 [*-linux-*])
9bb83c8b 1082 # Henrik Nordstrom (hno@hem.passagen.se) 19980817
1083 # poll is problematic on Linux. We disable it
1084 # by default until Linux gets it right.
b6a2f15e 1085 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
1086 if test $rev -lt 002002; then
1087 echo "disabling poll for $host < 2.2..."
1088 ac_cv_func_poll='no'
1089 fi
84cecfd2 1090 ;;
c68e9c6b 1091 [powerpc-ibm-aix4.1.*])
1092 # Mike Laster (mlaster@metavillage.com) 19981021
1093 echo "disabling poll for $host..."
1094 ac_cv_func_poll='no'
1095 ;;
86ec11aa 1096 [*-pc-sco3.2*])
1097 # Robert Side <rside@aiinc.bc.ca>
1098 # Mon, 18 Jan 1999 17:48:00 GMT
1099 echo "disabling poll for $host..."
1100 ac_cv_func_poll='no'
1101 ;;
84cecfd2 1102 esac
1103fi
176d10ee 1104
6716b242 1105dnl Check for library functions
1106AC_CHECK_FUNCS(\
30a4f2a8 1107 bcopy \
ce3d30fb 1108 backtrace_symbols_fd \
df087e68 1109 crypt \
4ac29a5b 1110 fchmod \
6716b242 1111 getdtablesize \
8505e57b 1112 getpagesize \
30a4f2a8 1113 getrusage \
9c1d8929 1114 getspnam \
30a4f2a8 1115 lrand48 \
6716b242 1116 mallinfo \
0f5efab0 1117 mallocblksize \
6716b242 1118 mallopt \
2ae6b9b0 1119 memcpy \
30a4f2a8 1120 memmove \
dac27377 1121 memset \
1812b6c7 1122 mktime \
88738790 1123 mstats \
84cecfd2 1124 poll \
cd748f27 1125 pthread_attr_setscope \
1126 pthread_setschedparam \
1127 pthread_attr_setschedparam \
c68e9c6b 1128 putenv \
b1e77ec1 1129 random \
6716b242 1130 regcomp \
1131 regexec \
1132 regfree \
30a4f2a8 1133 res_init \
4915be3b 1134 rint \
234967c9 1135 seteuid \
c415c128 1136 setgroups \
30a4f2a8 1137 setpgrp \
6716b242 1138 setrlimit \
b6a2f15e 1139 getrlimit \
30a4f2a8 1140 setsid \
1141 sigaction \
11430c03 1142 snprintf \
30a4f2a8 1143 srand48 \
b1e77ec1 1144 srandom \
0343b99c 1145 statfs \
6716b242 1146 sysconf \
1147 syslog \
234967c9 1148 timegm \
28da5e0d 1149 vsnprintf \
6716b242 1150)
1151
60939927 1152dnl Yay! Another Linux brokenness. Its not good enough
1153dnl to know that setresuid() exists, because RedHat 5.0 declares
1154dnl setresuid() but doesn't implement it.
1155dnl
1156AC_CACHE_CHECK(if setresuid is implemented, ac_cv_func_setresuid,
5c51415d 1157 AC_TRY_RUN([
60939927 1158#include <stdlib.h>
5c51415d 1159 int main() {
1160 if(setresuid(-1,-1,-1)) {
1161 perror("setresuid:");
1162 exit(1);
60939927 1163 }
1164 exit(0);
5c51415d 1165 }
1166 ],ac_cv_func_setresuid="yes",ac_cv_func_setresuid="no")
60939927 1167)
5c51415d 1168if test "$ac_cv_func_setresuid" = "yes" ; then
1169 AC_DEFINE(HAVE_SETRESUID)
1170fi
60939927 1171
5cafc1d6 1172dnl IP-Filter support requires ipf header files. These aren't
1173dnl installed by default, so we need to check for them
1174if test "$IPF_TRANSPARENT" ; then
1175 AC_MSG_CHECKING(if IP-Filter header files are installed)
eb824054 1176 if test "$ac_cv_header_ip_compat_h" = "yes" &&
1177 test "$ac_cv_header_ip_fil_h" = "yes" &&
1178 test "$ac_cv_header_ip_nat_h" = "yes" ; then
1179 IPF_TRANSPARENT="yes"
1180 AC_DEFINE(IPF_TRANSPARENT, 1)
1181 elif test "$ac_cv_header_netinet_ip_compat_h" = "yes" &&
1182 test "$ac_cv_header_netinet_ip_fil_h" = "yes" &&
1183 test "$ac_cv_header_netinet_ip_nat_h" = "yes" ; then
1184 IPF_TRANSPARENT="yes"
1185 AC_DEFINE(IPF_TRANSPARENT, 1)
1186 else
5cafc1d6 1187 IPF_TRANSPARENT="no"
1188 AC_DEFINE(IPF_TRANSPARENT, 0)
5cafc1d6 1189 fi
1190 AC_MSG_RESULT($IPF_TRANSPARENT)
1191fi
1192if test "$IPF_TRANSPARENT" = "no" ; then
1193 echo "WARNING: Cannot find necessary IP-Filter header files"
1194 echo " Transparent Proxy support WILL NOT be enabled"
1195 sleep 10
1196fi
1197
91bc414e 1198if test -z "$USE_GNUREGEX" ; then
1199 case "$host" in
1200 *-sun-solaris2.[[0-4]])
1201 USE_GNUREGEX="yes"
1202 ;;
1203 *-next-nextstep*)
1204 USE_GNUREGEX="yes"
1205 ;;
1206 esac
1207fi
7a081912 1208AC_MSG_CHECKING(if GNUregex needs to be compiled)
91bc414e 1209if test -z "$USE_GNUREGEX"; then
55878dfd 1210if test "$ac_cv_func_regcomp" = "no" || test "$USE_GNUREGEX" = "yes" ; then
74946a0f 1211 USE_GNUREGEX="yes"
00fa2c12 1212else
0cccc031 1213 AC_TRY_COMPILE([#include <sys/types.h>
1214#include <regex.h>],[regex_t t; regcomp(&t,"",0);],
91bc414e 1215 USE_GNUREGEX="no",
1216 USE_GNUREGEX="yes")
1217fi
00fa2c12 1218fi
74946a0f 1219AC_MSG_RESULT($USE_GNUREGEX)
1220if test "$USE_GNUREGEX" = "yes"; then
26675bf4 1221 REGEXLIB="-lregex"
7a081912 1222 LIBREGEX="libregex.a"
74946a0f 1223 AC_DEFINE(USE_GNUREGEX)
7a081912 1224fi
26675bf4 1225AC_SUBST(REGEXLIB)
00fa2c12 1226AC_SUBST(LIBREGEX)
7a081912 1227
3f6fcd8a 1228AC_REPLACE_FUNCS(\
3d0cf10e 1229 drand48 \
3f6fcd8a 1230 tempnam \
4d38fc7e 1231 strerror \
3f6fcd8a 1232)
1233
5c51415d 1234dnl Not cached since people are likely to tune this
e924600d 1235AC_MSG_CHECKING(Default FD_SETSIZE value)
1236AC_TRY_RUN([
1237#if HAVE_STDIO_H
1238#include <stdio.h>
1239#endif
1240#if HAVE_UNISTD_H
1241#include <unistd.h>
1242#endif
1243#if HAVE_SYS_TIME_H
1244#include <sys/time.h>
1245#endif
1246#if HAVE_SYS_SELECT_H
1247#include <sys/select.h>
1248#endif
1249#if HAVE_SYS_TYPES_H
1250#include <sys/types.h>
1251#endif
1252main() {
635e6242 1253 FILE *fp = fopen("conftestval", "w");
1254 fprintf (fp, "%d\n", FD_SETSIZE);
e924600d 1255 exit(0);
1256}
1257],
1258DEFAULT_FD_SETSIZE=`cat conftestval`,
1259DEFAULT_FD_SETSIZE=256,
1260DEFAULT_FD_SETSIZE=256)
1261AC_MSG_RESULT($DEFAULT_FD_SETSIZE)
1262AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE)
1263
5c51415d 1264dnl Not cached since people are likely to tune this
234967c9 1265AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
c76d8acc 1266dnl damn! FreeBSD's pthreads breaks dup2().
1267TLDFLAGS="$LDFLAGS"
1268case $host in
1269i386-unknown-freebsd*)
1270 if echo "$LDFLAGS" | grep -q pthread; then
1271 LDFLAGS=`echo $LDFLAGS | sed -e "s/-pthread//"`
1272 fi
1273esac
234967c9 1274AC_TRY_RUN([
8cca06da 1275#include <stdio.h>
234967c9 1276#include <unistd.h>
30a4f2a8 1277#include <sys/time.h> /* needed on FreeBSD */
234967c9 1278#include <sys/param.h>
1279#include <sys/resource.h>
1280main() {
635e6242 1281 FILE *fp;
234967c9 1282 int i,j;
df087e68 1283#if __CYGWIN32__
1284 /* getrlimit and sysconf returns bogous values on cygwin32.
1285 * Number of fds is virtually unlimited in cygwin (sys/param.h)
1286 */
1287 i = NOFILE;
d9399075 1288#elif HAVE_SETRLIMIT
234967c9 1289 struct rlimit rl;
1290#if defined(RLIMIT_NOFILE)
1291 if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
1292 perror("getrlimit: RLIMIT_NOFILE");
1293 } else {
1294 rl.rlim_cur = rl.rlim_max; /* set it to the max */
1295 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
1296 perror("setrlimit: RLIMIT_NOFILE");
1297 }
1298 }
1299#elif defined(RLIMIT_OFILE)
1300 if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
1301 perror("getrlimit: RLIMIT_OFILE");
1302 } else {
1303 rl.rlim_cur = rl.rlim_max; /* set it to the max */
1304 if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
1305 perror("setrlimit: RLIMIT_OFILE");
1306 }
1307 }
1308#endif /* RLIMIT_NOFILE */
1309#endif /* HAVE_SETRLIMIT */
d9399075 1310 /* by starting at 2^14, we will never get higher
1311 than 2^15 for SQUID_MAXFD */
1312 i = j = 1<<14;
1313 while (j) {
1314 j >>= 1;
1315 if (dup2(0, i) < 0) {
1316 i -= j;
1317 } else {
1318 close(i);
1319 i += j;
1320 }
1321 }
1322 i++;
635e6242 1323 fp = fopen("conftestval", "w");
1324 fprintf (fp, "%d\n", i);
234967c9 1325 exit(0);
1326}
1327],
431d84c5 1328SQUID_MAXFD=`cat conftestval`,
1329SQUID_MAXFD=256,
1330SQUID_MAXFD=256)
1331AC_MSG_RESULT($SQUID_MAXFD)
1332AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD)
b9cc811d 1333if test "$SQUID_MAXFD" -lt 512 ; then
80ab193b 1334 echo "WARNING: $SQUID_MAXFD may not be enough filedescriptors if your"
1335 echo " cache will be very busy. Please see the FAQ page"
043e3d78 1336 echo " http://squid.nlanr.net/Squid/FAQ/FAQ-11.html#filedescriptors"
e692ff35 1337 echo " on how to increase your filedescriptor limit"
933cc58d 1338 sleep 10
80ab193b 1339fi
c76d8acc 1340LDFLAGS="$TLDFLAGS"
234967c9 1341
5c51415d 1342dnl Not cached since people are likely to tune this
30a4f2a8 1343AC_MSG_CHECKING(Default UDP send buffer size)
1344AC_TRY_RUN([
8cca06da 1345#include <stdlib.h>
1346#include <stdio.h>
30a4f2a8 1347#include <sys/types.h>
1348#include <sys/socket.h>
1349#include <netinet/in.h>
1350main ()
1351{
635e6242 1352 FILE *fp;
30a4f2a8 1353 int fd,val=0,len=sizeof(int);
1354 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
1355 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
1356 if (val<=0) exit(1);
635e6242 1357 fp = fopen("conftestval", "w");
1358 fprintf (fp, "%d\n", val);
30a4f2a8 1359 exit(0);
1360}
1361],
1362SQUID_UDP_SO_SNDBUF=`cat conftestval`,
1c481e00 1363SQUID_UDP_SO_SNDBUF=16384,
1364SQUID_UDP_SO_SNDBUF=16384)
30a4f2a8 1365AC_MSG_RESULT($SQUID_UDP_SO_SNDBUF)
1366AC_DEFINE_UNQUOTED(SQUID_UDP_SO_SNDBUF, $SQUID_UDP_SO_SNDBUF)
1367
5c51415d 1368dnl Not cached since people are likely to tune this
30a4f2a8 1369AC_MSG_CHECKING(Default UDP receive buffer size)
1370AC_TRY_RUN([
8cca06da 1371#include <stdlib.h>
1372#include <stdio.h>
30a4f2a8 1373#include <sys/types.h>
1374#include <sys/socket.h>
1375#include <netinet/in.h>
1376main ()
1377{
635e6242 1378 FILE *fp;
30a4f2a8 1379 int fd,val=0,len=sizeof(int);
1380 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
1381 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
1382 if (val <= 0) exit(1);
635e6242 1383 fp = fopen("conftestval", "w");
1384 fprintf (fp, "%d\n", val);
30a4f2a8 1385 exit(0);
1386}
1387],
1388SQUID_UDP_SO_RCVBUF=`cat conftestval`,
1c481e00 1389SQUID_UDP_SO_RCVBUF=16384,
1390SQUID_UDP_SO_RCVBUF=16384)
30a4f2a8 1391AC_MSG_RESULT($SQUID_UDP_SO_RCVBUF)
1392AC_DEFINE_UNQUOTED(SQUID_UDP_SO_RCVBUF, $SQUID_UDP_SO_RCVBUF)
1393
5c51415d 1394dnl Not cached since people are likely to tune this
30a4f2a8 1395AC_MSG_CHECKING(Default TCP send buffer size)
1396AC_TRY_RUN([
8cca06da 1397#include <stdlib.h>
1398#include <stdio.h>
30a4f2a8 1399#include <sys/types.h>
1400#include <sys/socket.h>
1401#include <netinet/in.h>
1402main ()
1403{
635e6242 1404 FILE *fp;
30a4f2a8 1405 int fd,val=0,len=sizeof(int);
1406 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
1407 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
1408 if (val <= 0) exit(1);
635e6242 1409 fp = fopen("conftestval", "w");
1410 fprintf (fp, "%d\n", val);
30a4f2a8 1411 exit(0);
1412}
1413],
1414SQUID_TCP_SO_SNDBUF=`cat conftestval`,
1c481e00 1415SQUID_TCP_SO_SNDBUF=16384,
1416SQUID_TCP_SO_SNDBUF=16384)
30a4f2a8 1417AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF)
1418AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF)
1419
5c51415d 1420dnl Not cached since people are likely to tune this
30a4f2a8 1421AC_MSG_CHECKING(Default TCP receive buffer size)
1422AC_TRY_RUN([
8cca06da 1423#include <stdlib.h>
1424#include <stdio.h>
30a4f2a8 1425#include <sys/types.h>
1426#include <sys/socket.h>
1427#include <netinet/in.h>
1428main ()
1429{
635e6242 1430 FILE *fp;
30a4f2a8 1431 int fd,val=0,len=sizeof(int);
1432 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
1433 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
1434 if (val <= 0) exit(1);
635e6242 1435 fp = fopen("conftestval", "w");
1436 fprintf (fp, "%d\n", val);
30a4f2a8 1437 exit(0);
1438}
1439],
1440SQUID_TCP_SO_RCVBUF=`cat conftestval`,
1c481e00 1441SQUID_TCP_SO_RCVBUF=16384,
1442SQUID_TCP_SO_RCVBUF=16384)
30a4f2a8 1443AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF)
1444AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF)
1445
5c51415d 1446AC_CACHE_CHECK(if sys_errlist is already defined, ac_cv_needs_sys_errlist,
9bc73deb 1447 AC_TRY_COMPILE([#include <stdio.h>],[char *s = sys_errlist;],
5c51415d 1448 ac_cv_needs_sys_errlist="no",
1449 ac_cv_needs_sys_errlist="yes")
1450)
1451if test "$ac_cv_needs_sys_errlist" = "yes" ; then
1452 AC_DEFINE(NEED_SYS_ERRLIST)
1453fi
30a4f2a8 1454
5c51415d 1455dnl Not cached since people are likely to change this
6bf65235 1456AC_MSG_CHECKING(for libresolv _dns_ttl_ hack)
1457AC_TRY_LINK(extern int _dns_ttl_;,return _dns_ttl_;,
1458[AC_MSG_RESULT(yes)
1459AC_DEFINE(LIBRESOLV_DNS_TTL_HACK)],
1460AC_MSG_RESULT(no))
1461
a937d5e3 1462AC_MSG_CHECKING(if inet_ntoa() actually works)
1463AC_TRY_RUN([
1464#include <stdlib.h>
1465#include <stdio.h>
1466#include <sys/types.h>
1467#include <netinet/in.h>
1468#include <arpa/inet.h>
1469main ()
1470{
635e6242 1471 FILE *fp;
a937d5e3 1472 struct in_addr in;
1473 in.s_addr = inet_addr("1.2.3.4");
635e6242 1474 fp = fopen("conftestval", "w");
1475 fprintf (fp, "%s\n", inet_ntoa(in));
a937d5e3 1476 exit(0);
1477}
1478],
1479INET_NTOA_RESULT=`cat conftestval`,
1480INET_NTOA_RESULT="broken",
1481INET_NTOA_RESULT="broken")
1482if test "$INET_NTOA_RESULT" = "1.2.3.4" ; then
1483 AC_MSG_RESULT("yes")
1484else
1485 AC_MSG_RESULT("no")
b6a2f15e 1486 echo "Will use our own inet_ntoa()."
1487 LIBOBJS="$LIBOBJS inet_ntoa.o"
1488# echo "WARNING: This looks bad, and probably prevents Squid from working."
1489# echo " If you're on IRIX and using GCC 2.8, you probably need"
1490# echo " to use the IRIX C compiler instead."
1491# sleep 10
a937d5e3 1492fi
1493
b6a2f15e 1494if test "$ac_cv_header_sys_statvfs_h" = "yes" ; then
c68e9c6b 1495AC_MSG_CHECKING(for working statvfs() interface)
1496AC_TRY_COMPILE([
1497#include <stdlib.h>
1498#include <stdio.h>
1499#include <sys/types.h>
1500#include <sys/statvfs.h>
1501],
1502[
1503struct statvfs sfs;
1504sfs.f_blocks = sfs.f_bfree = sfs.f_frsize =
1505sfs.f_files = sfs.f_ffree = 0;
1506statvfs("/tmp", &sfs);
1507],
1508 ac_cv_func_statvfs=yes,
1509 ac_cv_func_statvfs=no)
1510AC_MSG_RESULT($ac_cv_func_statvfs)
6b8e7481 1511if test "$ac_cv_func_statvfs" = "yes" ; then
b6a2f15e 1512 AC_DEFINE(HAVE_STATVFS)
1513fi
6b8e7481 1514fi
c68e9c6b 1515
1516AC_CACHE_CHECK(for _res.nsaddr_list, ac_cv_have_res_nsaddr_list,
1517AC_TRY_COMPILE([
1518#if HAVE_SYS_TYPES_H
1519#include <sys/types.h>
1520#endif
1521#if HAVE_NETINET_IN_H
1522#include <netinet/in.h>
1523#endif
1524#if HAVE_ARPA_INET_H
1525#include <arpa/inet.h>
1526#endif
1527#if HAVE_ARPA_NAMESER_H
1528#include <arpa/nameser.h>
1529#endif
1530#if HAVE_RESOLV_H
1531#include <resolv.h>
1532#endif
1533],
1534[_res.nsaddr_list[[0]];],
1535ac_cv_have_res_nsaddr_list="yes",
1536ac_cv_have_res_nsaddr_list="no"))
1537if test $ac_cv_have_res_nsaddr_list = "yes" ; then
1538 AC_DEFINE(HAVE_RES_NSADDR_LIST)
1539fi
1540
1541if test $ac_cv_have_res_nsaddr_list = "no" ; then
1542AC_CACHE_CHECK(for _res.ns_list, ac_cv_have_res_ns_list,
1543AC_TRY_COMPILE([
1544#if HAVE_SYS_TYPES_H
1545#include <sys/types.h>
1546#endif
1547#if HAVE_NETINET_IN_H
1548#include <netinet/in.h>
1549#endif
1550#if HAVE_ARPA_INET_H
1551#include <arpa/inet.h>
1552#endif
1553#if HAVE_ARPA_NAMESER_H
1554#include <arpa/nameser.h>
1555#endif
1556#if HAVE_RESOLV_H
1557#include <resolv.h>
1558#endif
1559],
1560[_res.ns_list[[0]].addr;],
1561ac_cv_have_res_ns_list="yes",
1562ac_cv_have_res_ns_list="no"))
1563if test $ac_cv_have_res_ns_list = "yes" ; then
1564 AC_DEFINE(HAVE_RES_NS_LIST)
1565fi
1566fi
1567
090089c4 1568dnl Need the debugging version of malloc if available
1569XTRA_OBJS=''
6509a1a0 1570if test "$ac_cv_lib_malloc_main" = "yes" ; then
090089c4 1571 if test -r /usr/lib/debug/malloc.o ; then
1572 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
1573 fi
1574 if test -r /usr/lib/debug/mallocmap.o ; then
1575 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
1576 fi
1577fi
2bbd722b 1578
090089c4 1579AC_SUBST(XTRA_OBJS)
1580
38fea766 1581if test -z "$XTRA_LIBS"; then
1582 XTRA_LIBS="$LIBS"
0f5a16f8 1583 dnl -lcrypt is set in CRYPTLIB
1584 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/-lcrypt//"`
1585 dnl -lpthread is set in PTHREADLIB
1586 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/-lpthread//"`
1587 dnl minor cleanup
1588 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
38fea766 1589 LIBS=''
1590fi
090089c4 1591AC_SUBST(XTRA_LIBS)
1592
090089c4 1593dnl Clean up after OSF/1 core dump bug
1594rm -f core
1595
1596AC_OUTPUT(\
0992a350 1597 ./makefile \
090089c4 1598 ./lib/Makefile \
a26bdc75 1599 ./include/config.h \
090089c4 1600 ./scripts/Makefile \
1601 ./scripts/RunCache \
1602 ./scripts/RunAccel \
a26bdc75 1603 ./src/Makefile \
cd748f27 1604 ./src/fs/Makefile \
1605 ./src/fs/ufs/Makefile \
1606 ./src/fs/aufs/Makefile \
1607 ./src/fs/coss/Makefile \
1608 ./src/fs/diskd/Makefile \
e550e8b6 1609 ./contrib/Makefile \
8a7f0105 1610 $SNMP_MAKEFILE \
81280a96 1611 ./icons/Makefile \
d4fb069d 1612 ./errors/Makefile \
380f0a87 1613 ./auth_modules/Makefile \
dbfa0154 1614 ./auth_modules/NCSA/Makefile \
bf10b227 1615 ./auth_modules/PAM/Makefile \
380f0a87 1616 ./auth_modules/SMB/Makefile \
1617 ./auth_modules/MSNT/Makefile \
b6a2f15e 1618 ./auth_modules/getpwnam/Makefile \
9bc73deb 1619 ./auth_modules/LDAP/Makefile \
090089c4 1620)