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