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