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