]> git.ipfire.org Git - thirdparty/squid.git/blame - configure.in
More SunPRO cc warnings and errors..
[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
246d7ffc 6dnl $Id: configure.in,v 1.235 2001/10/03 09:02:24 hno 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)
246d7ffc 14AC_REVISION($Revision: 1.235 $)dnl
a2794549 15AC_PREFIX_DEFAULT(/usr/local/squid)
246d7ffc 16AM_MAINTAINER_MODE
a2794549 17
18dnl Set default LDFLAGS
19if test -z "$LDFLAGS"; then
20 LDFLAGS="-g"
21fi
22
23PRESET_CFLAGS="$CFLAGS"
090089c4 24
a2794549 25dnl Check for GNU cc
26AC_PROG_CC
27AM_PROG_CC_C_O
88d50a22 28AC_CANONICAL_HOST
29
a2794549 30
26675bf4 31CRYPTLIB=''
00fa2c12 32REGEXLIB='' # -lregex
33LIBREGEX='' # libregex.a
090089c4 34
983061ed 35dnl use directory structure of cached as default (hack)
57a1e5d3 36if test "$libexecdir" = '${exec_prefix}/libexec' &&
37 test "$localstatedir" = '${prefix}/var'; then
71e14c70 38 libexecdir='${prefix}/libexec/squid'
983061ed 39 localstatedir='${prefix}'
983061ed 40fi
41
a2794549 42dnl find out the exe extension for this platform. If it's not empty, use it for CGI's as well.
43AC_EXEEXT
44AC_OBJEXT
45
46if test -z "$EXEEXT"; then
47 CGIEXT=".cgi"
48else
49 CGIEXT="$EXEEXT"
50fi
51
0e6d05ef 52dnl this should be expanded to a list of platform sensible support requirements.
53dnl (adding an option like --enable-cygwin-support doesn't make sense :]) - R Collins 2001
df087e68 54case "$host_os" in
a2794549 55cygwin|cygwin32)
56 AM_CONDITIONAL(ENABLE_WIN32SPECIFIC, true)
df087e68 57 ;;
58*)
a2794549 59 AM_CONDITIONAL(ENABLE_WIN32SPECIFIC, false)
df087e68 60 ;;
61esac
df087e68 62
a26bdc75 63if test -z "$CACHE_HTTP_PORT"; then
64 CACHE_HTTP_PORT="3128"
65fi
66if test -z "$CACHE_ICP_PORT"; then
67 CACHE_ICP_PORT="3130"
68fi
a26bdc75 69
090089c4 70dnl Subsitutions
4d683a65 71AC_DEFINE_UNQUOTED(CACHE_HTTP_PORT, $CACHE_HTTP_PORT)
72AC_DEFINE_UNQUOTED(CACHE_ICP_PORT, $CACHE_ICP_PORT)
090089c4 73
30a4f2a8 74AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host")
75
090089c4 76
6ad85e8a 77dnl Gerben Wierda <Gerben_Wierda@RnA.nl>
78case "$host" in
79 mab-next-nextstep3)
80 CC="$CC -arch m68k -arch i486 -arch hppa -arch sparc"
81 ;;
82esac
83
30a4f2a8 84dnl Set Default CFLAGS
85if test -z "$PRESET_CFLAGS"; then
86 if test "$GCC" = "yes"; then
87 case "$host" in
97b12a5b 88 *-sun-sunos*)
30a4f2a8 89 # sunos has too many warnings for this to be useful
90 # motorola too
91 ;;
97b12a5b 92 *m88k*)
93 # Motorola cc/ld does not like -02 but is ok on -O
94 CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]/-O/'`
95 ;;
30a4f2a8 96 *)
97 CFLAGS="$CFLAGS -Wall"
98 ;;
99 esac
81a820c6 100 else
101 case "$host" in
c415c128 102 *mips-sgi-irix6.*)
81a820c6 103 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
c415c128 104 CFLAGS="$CFLAGS -n32 -mips3 -O3 -OPT:Olimit=0:space=OFF \
81a820c6 105 -woff 1009,1014,1048,1110,1116,1185,1188,1204,1230,1233 \
106 -Wl,-woff,85,-woff,84,-woff,134 \
107 -nostdinc -I/usr/include -D_BSD_SIGNALS"
108 ;;
e8f5fb18 109 alpha-dec-osf4.*)
553c24ae 110 # Mogul says DEC compilers take both -g and -O2
b6a2f15e 111 CFLAGS=`echo $CFLAGS | sed -e 's/-g/-g3/'`
553c24ae 112 CFLAGS="$CFLAGS -O2"
113 ;;
81a820c6 114 *)
115 ;;
116 esac
30a4f2a8 117 fi
30a4f2a8 118fi
119
120dnl Set LDFLAGS
121if test -z "$PRESET_LDFLAGS"; then
122 if test "$GCC" = "yes"; then
123 case "$host" in
124 *)
125 # nothing
126 ;;
127 esac
81a820c6 128 else
129 case "$host" in
c415c128 130 *mips-sgi-irix6.*)
81a820c6 131 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
c415c128 132 LDFLAGS="-n32 -mips3 -nostdlib -L/usr/lib32"
81a820c6 133 ;;
134 esac
30a4f2a8 135 fi
136fi
2060fa9a 137
e5f4e1b0 138dnl Enable optional modules
139AC_ARG_ENABLE(dlmalloc,
94d48591 140[ --enable-dlmalloc[=LIB] Compile & use the malloc package by Doug Lea],
e5f4e1b0 141[
94d48591 142 case "$enableval" in
143 'yes')
029ce4ae 144 use_dlmalloc="yes"
94d48591 145 LIBDLMALLOC="libdlmalloc.a"
146 LIB_MALLOC="-L../lib -ldlmalloc"
029ce4ae 147 echo "dlmalloc enabled"
94d48591 148 ;;
149 'no')
029ce4ae 150 use_dlmalloc="no"
151 echo "dlmalloc disabled"
94d48591 152 ;;
029ce4ae 153 *) use_dlmalloc="yes"
154 LIB_MALLOC="$enableval"
155 echo "dlmalloc enabled with $LIB_MALLOC"
156 esac
157])
158if test "${use_dlmalloc-unset}" = unset; then
159 case "$host" in
160 i386-*-solaris2.*)
161 echo "Enabling dlmalloc for $host"
162 use_dlmalloc="yes"
d20b1cd0 163 LIBDLMALLOC="libdlmalloc.a"
164 LIB_MALLOC="-L../lib -ldlmalloc"
029ce4ae 165 ;;
166 esac
167fi
168if test "x$ac_cv_enabled_dlmalloc" = "xyes"; then
169 # Ok. dlmalloc was enabled before, but state may be changed.
170 # we have to test these again
171 unset ac_cv_func_mallinfo
172 unset ac_cv_func_mallocblksize
173 unset ac_cv_func_free
174 unset ac_cv_func_realloc
175 unset ac_cv_func_memalign
176 unset ac_cv_func_valloc
177 unset ac_cv_func_pvalloc
178 unset ac_cv_func_calloc
179 unset ac_cv_func_cfree
180 unset ac_cv_func_malloc_trim
181 unset ac_cv_func_malloc_usable_size
182 unset ac_cv_func_malloc_stats
183 unset ac_cv_func_mallinfo
184 unset ac_cv_func_mallopt
185 unset ac_cv_lib_gnumalloc
186 unset ac_cv_header_gnumalloc_h
187 unset ac_cv_lib_malloc
188 unset ac_cv_enabled_dlmalloc
189fi
190if test "$use_dlmalloc" = yes; then
94d48591 191 ac_cv_func_mallinfo="yes"
192 ac_cv_func_mallocblksize="no"
193 ac_cv_func_free="yes"
194 ac_cv_func_realloc="yes"
195 ac_cv_func_memalign="yes"
196 ac_cv_func_valloc="yes"
197 ac_cv_func_pvalloc="yes"
198 ac_cv_func_calloc="yes"
199 ac_cv_func_cfree="yes"
200 ac_cv_func_malloc_trim="yes"
201 ac_cv_func_malloc_usable_size="yes"
202 ac_cv_func_malloc_stats="yes"
94d48591 203 ac_cv_func_mallopt="yes"
204 ac_cv_lib_gnumalloc="no"
85efe3ec 205 ac_cv_header_gnumalloc_h="no"
94d48591 206 ac_cv_lib_malloc="no"
207 ac_cv_enabled_dlmalloc="yes"
029ce4ae 208fi
209
e5f4e1b0 210AC_SUBST(LIBDLMALLOC)
211AC_SUBST(LIB_MALLOC)
212
213AC_ARG_ENABLE(gnuregex,
214[ --enable-gnuregex Compile GNUregex],
215[USE_GNUREGEX=$enableval])
216
d9180414 217AC_ARG_ENABLE(xmalloc-debug,
e5f4e1b0 218[ --enable-xmalloc-debug Do some simple malloc debugging],
219[ if test "$enableval" = "yes" ; then
220 echo "Malloc debugging enabled"
221 AC_DEFINE(XMALLOC_DEBUG)
222 fi
223])
224
d9180414 225AC_ARG_ENABLE(xmalloc-debug-trace,
027acbaf 226[ --enable-xmalloc-debug-trace
e5f4e1b0 227 Detailed trace of memory allocations],
228[ if test "$enableval" = "yes" ; then
027acbaf 229 echo "Malloc debug trace enabled"
230 AC_DEFINE(XMALLOC_TRACE)
231 AC_DEFINE(XMALLOC_DEBUG)
e5f4e1b0 232 fi
233])
234
d9180414 235AC_ARG_ENABLE(xmalloc-statistics,
e5f4e1b0 236[ --enable-xmalloc-statistics
237 Show malloc statistics in status page],
238[ if test "$enableval" = "yes" ; then
239 echo "Malloc statistics enabled"
240 AC_DEFINE(XMALLOC_STATISTICS)
241 fi
242])
243
323fe0d4 244AC_ARG_ENABLE(carp,
245[ --enable-carp Enable CARP support],
246[ if test "$enableval" = "yes" ; then
247 echo "CARP support enabled"
248 AC_DEFINE(USE_CARP)
249 fi
250])
251
cd748f27 252AC_ARG_ENABLE(async-io,
9bc73deb 253[ --enable-async-io[=N_THREADS]
cd748f27 254 Shorthand for
f85c88f3 255 --with-aufs-threads=N_THREADS
cd748f27 256 --with-pthreads
257 --enable-storeio=ufs,aufs],
258[ case $enableval in
9bc73deb 259 yes)
cd748f27 260 with_pthreads=yes
261 STORE_MODULES="ufs aufs"
9bc73deb 262 ;;
263 no)
9bc73deb 264 ;;
265 *)
f85c88f3 266 aufs_io_threads=$enableval
cd748f27 267 with_pthreads=yes
268 STORE_MODULES="ufs aufs"
9bc73deb 269 ;;
270 esac
271])
272
f85c88f3 273AC_ARG_WITH(aufs-threads,
274[ --with-aufs-threads=N_THREADS
cd748f27 275 Tune the number of worker threads for the aufs object
276 store.],
f85c88f3 277[ aufs_io_threads=$withval ])
278if test "$aufs_io_threads"; then
279 echo "With $aufs_io_threads aufs threads"
cd748f27 280 with_pthreads=yes
f85c88f3 281 AC_DEFINE_UNQUOTED(AUFS_IO_THREADS,$aufs_io_threads)
cd748f27 282fi
283
284AC_ARG_WITH(pthreads,
285[ --with-pthreads Use POSIX Threads],
286[ if test "$enableval" = "yes"; then
287 with_pthreads=yes
288 fi
289])
290if test "$with_pthreads"; then
291 echo "With pthreads"
9fc0b4b8 292 SQUID_PTHREAD_LIB='$(PTHREADLIB)'
293 CFLAGS="$CFLAGS -D_REENTRANT"
c68e9c6b 294 case "$host" in
295 i386-unknown-freebsd*)
cd748f27 296 if test "$GCC" = "yes" ; then
297 if test -z "$PRESET_LDFLAGS"; then
298 LDFLAGS="$LDFLAGS -pthread"
299 fi
300 fi
301 ;;
c68e9c6b 302 esac
9bc73deb 303fi
e5f4e1b0 304AC_SUBST(SQUID_PTHREAD_LIB)
305
f85c88f3 306AC_ARG_WITH(aio,
307[ --with-aio Use POSIX AIO],
308[ if test "$enableval" = "yes"; then
309 with_aio=yes
310 fi
311])
312if test "$with_aio"; then
313 echo "With aio"
314 SQUID_AIO_LIB='$(AIOLIB)'
315fi
316AC_SUBST(SQUID_AIO_LIB)
317
cd748f27 318AC_ARG_ENABLE(storeio,
319[ --enable-storeio=\"list of modules\"
320 Build support for the list of store I/O modules.
321 The default is only to build the "ufs" module.
322 See src/fs for a list of available modules, or
323 Programmers Guide section <not yet written>
324 for details on how to build your custom store module],
325[ case $enableval in
326 yes)
327 for module in $srcdir/src/fs/*; do
328 if test -f $module/Makefile.in; then
329 STORE_MODULES="$STORE_MODULES `basename $module`"
a2794549 330 fi
cd748f27 331 done
332 ;;
333 no)
334 ;;
335 *) STORE_MODULES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
336 ;;
337 esac
338],
339[ if test -z "$STORE_MODULES"; then
340 STORE_MODULES="ufs"
341 fi
342])
d1aad03d 343echo "Store modules built: $STORE_MODULES"
a2794549 344STORE_OBJS="fs/lib`echo $STORE_MODULES|sed -e 's% %.a fs/lib%g'`.a"
cd748f27 345AC_SUBST(STORE_OBJS)
6652c622 346STORE_LIBS="`echo $STORE_OBJS|sed -e 's%fs/%%g'`"
f71946fc 347AC_SUBST(STORE_LIBS)
a2794549 348dnl remove all but diskd - its the only module that needs to recurse
349dnl into the sub directory
350STORE_MODULE_SUBDIRS=
351for fs in $STORE_MODULES none; do
f6ff4419 352 if test "$fs" = "diskd"; then
a2794549 353 STORE_MODULE_SUBDIRS="$STORE_MODULE_SUBDIRS $fs"
bacca099 354 OPT_DISKD_EXE='diskd$(EXEEXT)'
a2794549 355 fi
356done
357AC_SUBST(STORE_MODULES)
358AC_SUBST(STORE_MODULE_SUBDIRS)
bacca099 359AC_SUBST(OPT_DISKD_EXE)
a2794549 360
cd748f27 361
6a566b9c 362dnl --enable-heap-replacement compability option
363AC_ARG_ENABLE(heap-replacement,
364[ --enable-heap-replacement
365 Backwards compability option. Please use the
366 new --enable-removal-policies directive instead.],
367[ if test "$enableval" = "yes" ; then
368 echo "--enable-heap-replacement is obsolete. please use the new"
369 echo "--enable-removal-policies directive instead"
370 sleep 5
371 REPL_POLICIES="heap"
372 fi
373])
374
d9180414 375AC_ARG_ENABLE(removal-policies,
6a566b9c 376[ --enable-removal-policies=\"list of policies\"
377 Build support for the list of removal policies.
378 The default is only to build the "lru" module.
379 See src/repl for a list of available modules, or
380 Programmers Guide section 9.9 for details on how
381 to build your custom policy],
382[ case $enableval in
383 yes)
384 for module in $srcdir/src/repl/*; do
385 if test -f $module/Makefile.in; then
386 REPL_POLICIES="$REPL_POLICIES `basename $module`"
387 fi
388 done
389 ;;
390 no)
391 ;;
392 *) REPL_POLICIES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
393 ;;
394 esac
395],
396[ if test -z "$REPL_POLICIES"; then
397 REPL_POLICIES="lru"
398 fi
399])
65033bdd 400echo "Removal policies built: $REPL_POLICIES"
6a566b9c 401AC_SUBST(REPL_POLICIES)
a2794549 402REPL_OBJS="repl/lib`echo $REPL_POLICIES|sed -e 's% %.a repl/lib%g'`.a"
6a566b9c 403AC_SUBST(REPL_OBJS)
6652c622 404REPL_LIBS="`echo $REPL_OBJS|sed -e 's%repl/%%g'`"
f71946fc 405AC_SUBST(REPL_LIBS)
6a566b9c 406
8efddab9 407OPT_PINGER=''
3c573763 408OPT_PINGER_EXE=''
e5f4e1b0 409AC_ARG_ENABLE(icmp,
410[ --enable-icmp Enable ICMP pinging],
411[ if test "$enableval" = "yes" ; then
412 echo "ICMP enabled"
413 AC_DEFINE(USE_ICMP)
8efddab9 414 OPT_PINGER='pinger'
415 OPT_PINGER_EXE='pinger$(EXEEXT)'
e5f4e1b0 416 fi
417])
8efddab9 418AC_SUBST(OPT_PINGER)
3c573763 419AC_SUBST(OPT_PINGER_EXE)
e5f4e1b0 420
a2794549 421AM_CONDITIONAL(USE_DELAY_POOLS, false)
d9180414 422AC_ARG_ENABLE(delay-pools,
76d83c52 423[ --enable-delay-pools Enable delay pools to limit bandwidth usage],
e5f4e1b0 424[ if test "$enableval" = "yes" ; then
95e36d02 425 echo "Delay pools enabled"
95e36d02 426 AC_DEFINE(DELAY_POOLS)
a2794549 427 AM_CONDITIONAL(USE_DELAY_POOLS, true)
e5f4e1b0 428 fi
429])
430
36a97e19 431AC_ARG_ENABLE(mem-gen-trace,
432[ --enable-mem-gen-trace Do trace of memory stuff],
433[ if test "$enableval" = "yes" ; then
434 echo "Memory trace (to file) enabled"
435 AC_DEFINE(MEM_GEN_TRACE)
436 fi
437])
438
d9180414 439AC_ARG_ENABLE(useragent-log,
e5f4e1b0 440[ --enable-useragent-log Enable logging of User-Agent header],
441[ if test "$enableval" = "yes" ; then
442 echo "User-Agent logging enabled"
443 AC_DEFINE(USE_USERAGENT_LOG)
444 fi
445])
446
dfca7e1a 447AC_ARG_ENABLE(referer-log,
448[ --enable-referer-log Enable logging of Referer header],
449[ if test "$enableval" = "yes" ; then
450 echo "Referer logging enabled"
451 AC_DEFINE(USE_REFERER_LOG)
452 fi
453])
454
320e9f36 455AC_ARG_ENABLE(wccp,
eb824054 456[ --disable-wccp Disable Web Cache Coordination Protocol],
457[ if test "$enableval" = "no" ; then
458 echo "Web Cache Coordination Protocol disabled"
459 AC_DEFINE(USE_WCCP, 0)
460 else
461 AC_DEFINE(USE_WCCP, 1)
320e9f36 462 fi
463])
320e9f36 464
d9180414 465AC_ARG_ENABLE(kill-parent-hack,
9fc0b4b8 466[ --enable-kill-parent-hack
467 Kill parent on shutdown],
e5f4e1b0 468[ if test "$enableval" = "yes" ; then
469 echo "Kill parent on shutdown"
470 AC_DEFINE(KILL_PARENT_OPT)
471 fi
472])
473
a2794549 474AM_CONDITIONAL(USE_SNMP, false)
e5f4e1b0 475AC_ARG_ENABLE(snmp,
476[ --enable-snmp Enable SNMP monitoring],
477[ if test "$enableval" = "yes" ; then
478 echo "SNMP monitoring enabled"
479 AC_DEFINE(SQUID_SNMP)
480 SNMPLIB='-L../snmplib -lsnmp'
a2794549 481 AM_CONDITIONAL(USE_SNMP, true)
8a7f0105 482 SNMP_MAKEFILE=./snmplib/Makefile
e5f4e1b0 483 makesnmplib=snmplib
484 fi
485])
486AC_SUBST(SNMPLIB)
e5f4e1b0 487AC_SUBST(makesnmplib)
488
d9180414 489AC_ARG_ENABLE(time-hack,
e5f4e1b0 490[ --enable-time-hack Update internal timestamp only once per second],
491[ if test "$enableval" = "yes" ; then
492 echo "Update internal timestamp only once per second"
493 AC_DEFINE(ALARM_UPDATES_TIME)
494 fi
495])
496
d9180414 497AC_ARG_ENABLE(cachemgr-hostname,
e5f4e1b0 498[ --enable-cachemgr-hostname[=hostname]
499 Make cachemgr.cgi default to this host],
500[ case $enableval in
501 yes)
502 AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()])
503 echo "Cachemgr default hostname == host where cachemgr runs"
504 ;;
505 no)
506 : # Nothing to do..
507 ;;
508 *)
509 AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
510 echo "Cachemgr default hostname set to ${enableval}"
511 ;;
512 esac
513])
514
d9180414 515AC_ARG_ENABLE(arp-acl,
e5f4e1b0 516[ --enable-arp-acl Enable use of ARP ACL lists (ether address)],
517[ if test "$enableval" = "yes" ; then
518 echo "ARP ACL lists enabled (ether address)"
933cc58d 519 case "$host" in
a931a29b 520 *-pc-linux-*)
521 ;;
933cc58d 522 *)
bd0c865a 523 echo "WARNING: ARP ACL support is only currently supported on Linux"
524 echo " ethernet interfaces, probably won't work on $host."
933cc58d 525 sleep 10
526 ;;
527 esac
e5f4e1b0 528 AC_DEFINE(USE_ARP_ACL)
529 fi
530])
531
a2794549 532AM_CONDITIONAL(ENABLE_HTCP, false)
74075210 533AC_ARG_ENABLE(htcp,
88b7de25 534[ --enable-htcp Enable HTCP protocol],
b4b8b6da 535[ if test "$enableval" = "yes" ; then
536 echo "HTCP enabled"
b4b8b6da 537 AC_DEFINE(USE_HTCP)
a2794549 538 AM_CONDITIONAL(ENABLE_HTCP, true)
b4b8b6da 539 fi
74075210 540])
a2794549 541
542AM_CONDITIONAL(ENABLE_SSL, false)
543SSLINC=""
74075210 544
1f7c9178 545AC_ARG_ENABLE(ssl,
546[ --enable-ssl Enable ssl gatewaying support using OpenSSL],
547[ if test "$enableval" != "no"; then
548 echo "SSL gatewaying enabled"
549 AC_DEFINE(USE_SSL)
a2794549 550 AM_CONDITIONAL(ENABLE_SSL, true)
1f7c9178 551 SSLLIB='-lssl -lcrypto'
552 USE_OPENSSL=1
553 fi
554])
555
556AC_ARG_WITH(openssl,
557[ --with-openssl[=prefix]
558 Compile with the OpenSSL libraries. The path to
559 the OpenSSL development libraries and headers
560 installation can be specified if outside of the
561 system standard directories],
562[
563 case "$with_ssl" in
564 yes)
565 USE_OPENSSL=1
a2794549 566 AM_CONDITIONAL(ENABLE_SSL, true)
1f7c9178 567 ;;
568 no)
569 USE_OPENSSL=
570 ;;
571 *)
572 SSLLIBDIR="$with_ssl/lib"
573 SSLINC="-I$with_ssl/include"
574 USE_OPENSSL=1
a2794549 575 AM_CONDITIONAL(ENABLE_SSL, true)
1f7c9178 576 esac
577])
578
579if test -n "$USE_OPENSSL"; then
580 AC_DEFINE(USE_OPENSSL)
581 if test -z "$SSLLIB"; then
582 SSLLIB="-lcrypto" # for MD5 routines
583 fi
584fi
585if test -n "$SSLLIBDIR"; then
586 SSLLIB="-L$SSLLIBDIR $SSLLIB"
587fi
1f7c9178 588AC_SUBST(SSLLIB)
a2794549 589AC_SUBST(SSLINC)
1f7c9178 590
02749868 591AC_ARG_ENABLE(forw-via-db,
592[ --enable-forw-via-db Enable Forw/Via database],
593[ if test "$enableval" = "yes" ; then
594 echo "FORW-VIA enabled"
595 AC_DEFINE(FORW_VIA_DB)
596 fi
597])
598
6cfa8966 599AC_ARG_ENABLE(cache-digests,
22df58ea 600[ --enable-cache-digests Use Cache Digests
2b6662ba 601 see http://www.squid-cache.org/FAQ/FAQ-16.html],
484f2ebc 602[ if test "$enableval" = "yes" ; then
6cfa8966 603 echo "USE_CACHE_DIGESTS enabled"
604 AC_DEFINE(USE_CACHE_DIGESTS)
484f2ebc 605 fi
606])
607
933cc58d 608dnl Select Error language
609AC_ARG_ENABLE(err-language,
610[ --enable-err-language=lang
611 Select language for Error pages (see errors dir) ],
612[
cf9d704a 613 if test -d $srcdir/errors/$enableval; then
933cc58d 614 ERR_LANGUAGE=$enableval
615 else
616 echo "ERROR! Unknown language $enableval, see errors/"
617 exit 1
618 fi
93a8bb45 619],[ERR_LANGUAGE="English"])
933cc58d 620AC_SUBST(ERR_LANGUAGE)
621
cd748f27 622dnl Size of COSS memory buffer
623AC_ARG_WITH(coss-membuf-size,
624[ --with-coss-membuf-size COSS membuf size (default 1048576 bytes) ],
625[ if test "$with_coss_membuf_size"; then
626 echo "Setting COSS membuf size to $with_coss_membuf_size bytes"
627 AC_DEFINE_UNQUOTED(COSS_MEMBUF_SZ, $with_coss_membuf_size)
628 fi
629])
630
9bb83c8b 631dnl Enable poll()
632AC_ARG_ENABLE(poll,
633[ --enable-poll Enable poll() instead of select(). Normally poll
634 is preferred over select, but configure knows poll
635 is broken on some platforms. If you think you are
636 smarter than the configure script, you may enable
637 poll with this option.
c68e9c6b 638 --disable-poll Disable the use of poll().],
639[
640 case "$enableval" in
641 yes)
9bb83c8b 642 echo "Forcing poll() to be enabled"
643 ac_cv_func_poll='yes'
c68e9c6b 644 ;;
645 no)
646 echo "Forcing poll() to be disabled"
647 ac_cv_func_poll='no'
648 ;;
649 esac
9bb83c8b 650])
651
72fd085a 652dnl Disable HTTP violations
653AC_ARG_ENABLE(http-violations,
654[ --disable-http-violations
655 This allows you to remove code which is known to
c68e9c6b 656 violate the HTTP protocol specification.],
72fd085a 657[ if test "$enableval" = "no" ; then
658 echo "Disabling HTTP Violations"
6eec93b2 659 AC_DEFINE(HTTP_VIOLATIONS, 0)
72fd085a 660 else
6eec93b2 661 AC_DEFINE(HTTP_VIOLATIONS, 1)
72fd085a 662 fi
663])
664
5cafc1d6 665dnl Enable IP-Filter Transparent Proxy
666AC_ARG_ENABLE(ipf-transparent,
667[ --enable-ipf-transparent
668 Enable Transparent Proxy support for systems
c68e9c6b 669 using IP-Filter network address redirection.],
5cafc1d6 670[ if test "$enableval" = "yes" ; then
671 echo "IP-Filter Transparent Proxy enabled"
672 AC_DEFINE(IPF_TRANSPARENT)
673 IPF_TRANSPARENT="yes"
674 fi
675])
676
d852fbad 677dnl Enable Linux Netfilter (2.4) Transparent Proxy
678AC_ARG_ENABLE(linux-netfilter,
679[ --enable-linux-netfilter
680 Enable Transparent Proxy support for Linux 2.4.],
681[ if test "$enableval" = "yes" ; then
682 echo "Linux-Netfilter Transparent Proxy enabled"
683 AC_DEFINE(LINUX_NETFILTER)
684 LINUX_NETFILTER="yes"
685 fi
686])
687
a2794549 688AM_CONDITIONAL(MAKE_LEAKFINDER, false)
5d620373 689dnl Enable Leak Finding Functions
690AC_ARG_ENABLE(leakfinder,
691[ --enable-leakfinder
692 Enable Leak Finding code. Enabling this alone
693 does nothing; you also have to modify the source
694 code to use the leak finding functions. Probably
695 Useful for hackers only.],
696[ if test "$enableval" = "yes" ; then
697 echo "Leak-Finding enabled"
698 AC_DEFINE(USE_LEAKFINDER)
5d620373 699 USE_LEAKFINDER="yes"
a2794549 700 AM_CONDITIONAL(MAKE_LEAKFINDER, true)
5d620373 701 fi
702])
5d620373 703
3898f57f 704AC_ARG_ENABLE(ident-lookups,
705[ --disable-ident-lookups
706 This allows you to remove code that performs
707 Ident (RFC 931) lookups.],
708[ if test "$enableval" = "no" ; then
709 echo "Disabling Ident Lookups"
710 AC_DEFINE(USE_IDENT, 0)
711 else
712 AC_DEFINE(USE_IDENT, 1)
713 fi
714])
715
a2794549 716AM_CONDITIONAL(USE_DNSSERVER, false)
3c573763 717use_dnsserver=
eb824054 718AC_ARG_ENABLE(internal-dns,
7e3ce7b9 719[ --disable-internal-dns This prevents Squid from directly sending and
eb824054 720 receiving DNS messages, and instead enables the
721 old external 'dnsserver' processes.],
722[ if test "$enableval" = "no" ; then
723 echo "Disabling Internal DNS queries"
3c573763 724 use_dnsserver="yes"
eb824054 725 fi
726])
3c573763 727if test "$use_dnsserver" = "yes"; then
7b800d9f 728 AC_DEFINE(USE_DNSSERVERS)
bacca099 729 OPT_DNSSERVER_EXE='dnsserver$(EXEEXT)'
a2794549 730 AM_CONDITIONAL(USE_DNSSERVER, true)
3c573763 731else
732 OPT_DNSSERVER_EXE=''
3c573763 733fi
734AC_SUBST(OPT_DNSSERVER_EXE)
eb824054 735
736AC_ARG_ENABLE(truncate,
7e3ce7b9 737[ --enable-truncate This uses truncate() instead of unlink() when
eb824054 738 removing cache files. Truncate gives a little
739 performance improvement, but may cause problems
740 when used with async I/O. Truncate uses more
741 filesystem inodes than unlink..],
742[ if test "$enableval" = "yes" ; then
743 echo "Enabling truncate instead of unlink"
744 AC_DEFINE(USE_TRUNCATE)
745 fi
746])
747
9bc73deb 748dnl Enable underscore in hostnames
749AC_ARG_ENABLE(underscores,
750[ --enable-underscores Squid by default rejects any host names with _
76d83c52 751 in their name to conform with internet standards.
9bc73deb 752 If you disagree with this you may allow _ in
753 hostnames by using this switch, provided that
754 the resolver library on the host where Squid runs
755 does not reject _ in hostnames...],
756[ if test "$enableval" = "yes" ; then
757 echo "Enabling the use of underscores in host names"
758 AC_DEFINE(ALLOW_HOSTNAME_UNDERSCORES, 1)
759 fi
760])
761
94439e4e 762
763dnl Select auth schemes modules to build
764AC_ARG_ENABLE(auth,
765[ --enable-auth=\"list of auth scheme modules\"
766 Build support for the list of authentication schemes.
767 The default is to build support for the Basic scheme.
768 See src/auth for a list of available modules, or
769 Programmers Guide section authentication schemes
770 for details on how to build your custom auth scheme
771 module],
772[ case $enableval in
773 yes)
774 for module in $srcdir/src/auth/*; do
775 if test -f $module/Makefile.in; then
776 AUTH_MODULES="$AUTH_MODULES `basename $module`"
777 fi
778 done
779 ;;
780 no)
781 ;;
782 *) AUTH_MODULES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
783 ;;
784 esac
785],
786[ if test -z "$AUTH_MODULES"; then
787 AUTH_MODULES="basic"
788 fi
789])
790echo "Auth scheme modules built: $AUTH_MODULES"
791AC_SUBST(AUTH_MODULES)
a2794549 792AUTH_OBJS="auth/lib`echo $AUTH_MODULES|sed -e 's% %.a auth/lib%g'`.a"
94439e4e 793AC_SUBST(AUTH_OBJS)
6652c622 794AUTH_LIBS="`echo $AUTH_OBJS|sed -e 's%auth/%%g'`"
94439e4e 795AC_SUBST(AUTH_LIBS)
796
797dnl Select basic auth scheme helpers to build
798BASIC_AUTH_HELPERS=""
380f0a87 799AC_ARG_ENABLE(auth-modules,
94439e4e 800[ --enable-auth-modules=\"list of helpers\"
801 Backwards compability alias for
802 --enable-basic-auth-helpers],
803[ echo "--enable-auth-modules is obsolete. Please use the new"
804 echo "option --enable-basic-auth-helpers"
805 sleep 5
806 case "$enableval" in
807 yes)
808 for helper in $srcdir/src/auth/basic/helpers/*; do
809 if test -f $helper/Makefile.in; then
fc83a946 810 BASIC_AUTH_HELPERS="$BASIC_AUTH_HELPERS `basename $helper`"
94439e4e 811 fi
812 done
813 ;;
814 no)
815 ;;
816 *)
fc83a946 817 BASIC_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
94439e4e 818 esac
819])
820AC_ARG_ENABLE(basic-auth-helpers,
821[ --enable-basic-auth-helpers=\"list of helpers\"
822 This option selects which basic scheme proxy_auth
823 helpers to build and install as part of the normal
824 build process. For a list of available
825 helpers see the src/auth/basic/helpers directory.],
826[ case "$enableval" in
827 yes)
828 BASIC_AUTH_HELPERS=""
829 for helper in $srcdir/src/auth/basic/helpers/*; do
830 if test -f $helper/Makefile.in; then
fc83a946 831 BASIC_AUTH_HELPERS="$BASIC_AUTH_HELPERS `basename $helper`"
94439e4e 832 fi
833 done
834 ;;
835 no)
836 ;;
837 *)
fc83a946 838 BASIC_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
94439e4e 839 esac
840])
fc83a946 841if test -n "$BASIC_AUTH_HELPERS"; then
842 echo "Basic auth helpers built: $BASIC_AUTH_HELPERS"
94439e4e 843fi
fc83a946 844AC_SUBST(BASIC_AUTH_HELPERS)
94439e4e 845
846dnl Select ntlm auth helpers to build
847NTLM_AUTH_HELPERS=
848AC_ARG_ENABLE(ntlm-auth-helpers,
849[ --enable-ntlm-auth-helpers=\"list of helpers\"
850 This option selects which proxy_auth ntlm helpers
851 to build and install as part of the normal build
380f0a87 852 process. For a list of available modules see
94439e4e 853 the src/auth/ntlm/helpers directory.],
380f0a87 854[ case "$enableval" in
855 yes)
94439e4e 856 for helper in $srcdir/src/auth/ntlm/helpers/*; do
857 if test -f $helper/Makefile.in; then
858 NTLM_AUTH_HELPERS="$NTLM_AUTH_HELPERS `basename $helper`"
380f0a87 859 fi
860 done
861 ;;
862 no)
863 ;;
864 *)
94439e4e 865 NTLM_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
380f0a87 866 esac
867])
94439e4e 868if test -n "$NTLM_AUTH_HELPERS"; then
869 echo "NTLM auth helpers built: $NTLM_AUTH_HELPERS"
380f0a87 870fi
94439e4e 871AC_SUBST(NTLM_AUTH_HELPERS)
872
2d70df72 873dnl Select digest auth scheme helpers to build
874DIGEST_AUTH_HELPERS=
875AC_ARG_ENABLE(digest-auth-helpers,
876[ --enable-digest-auth-helpers=\"list of helpers\"
877 This option selects which digest scheme authentication
878 helpers to build and install as part of the normal build
879 process. For a list of available modules see the
880 src/auth/digest/helpers directory.],
881[ case "$enableval" in
882 yes)
883 for helper in $srcdir/src/auth/digest/helpers/*; do
884 if test -f $helper/Makefile.in; then
885 DIGEST_AUTH_HELPERS="$DIGEST_AUTH_HELPERS `basename $helper`"
886 fi
887 done
888 ;;
889 no)
890 ;;
891 *)
892 DIGEST_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
893 esac
894])
895if test -n "$DIGEST_AUTH_HELPERS"; then
896 echo "Digest auth helpers built: $DIGEST_AUTH_HELPERS"
897fi
898AC_SUBST(DIGEST_AUTH_HELPERS)
380f0a87 899
6437ac71 900dnl Enable "NTLM fail open"
901AC_ARG_ENABLE(ntlm-fail-open,
902[ --enable-ntlm-fail-open Enable NTLM fail open, where a helper that fails one of the
903 Authentication steps can allow squid to still authenticate
904 the user.],
905[ if test "$enableval" = "yes" ; then
906 AC_DEFINE(NTLM_FAIL_OPEN)
907 fi
908])
909
3c573763 910dnl Disable "unlinkd" code
fe0810ac 911AC_ARG_ENABLE(unlinkd,
912[ --disable-unlinkd Do not use unlinkd],
913[ if test "$enableval" = "no" ; then
3c573763 914 use_unlinkd=no
fe0810ac 915 else
3c573763 916 use_unlinkd=yes
fe0810ac 917 fi
918],[
919 # Here we should probably use some magic depending on the selected
920 # storage models
3c573763 921 use_unlinkd=yes
fe0810ac 922])
3c573763 923if test "$use_unlinkd" = "yes"; then
fe0810ac 924 echo "unlinkd enabled"
925 AC_DEFINE(USE_UNLINKD)
a2794549 926 AM_CONDITIONAL(ENABLE_UNLINKD, true)
fe0810ac 927else
928 echo "unlinkd disabled"
a2794549 929 AM_CONDITIONAL(ENABLE_UNLINKD, false)
fe0810ac 930fi
fe0810ac 931
ce3d30fb 932dnl Enable backtraces on fatal errors
933AC_ARG_ENABLE(stacktraces,
934[ --enable-stacktraces Enable automatic call backtrace on fatal errors],
935[ if test "$enableval" = "yes" ; then
936 echo "Enabling automatic stack backtraces on fatal errors"
937 AC_DEFINE(PRINT_STACK_TRACE, 1)
938 fi
939])
940
f66a9ef4 941dnl Enable X-Accelerator-Vary for Vary support within an accelerator setup
942AC_ARG_ENABLE(x_accelerator_vary,
943[ --enable-x-accelerator-vary Enable support for the X-Accelerator-Vary
944 HTTP header. Can be used to indicate
945 variance within an accelerator setup.
946 Typically used together with other code
947 that adds custom HTTP headers to the requests.],
948[ if test "$enableval" = "yes" ; then
949 echo "Enabling support for X-Accelerator-Vary"
950 AC_DEFINE(X_ACCELERATOR_VARY, 1)
951 fi
952])
953
fd9aaa3e 954# Force some compilers to use ANSI features
955#
956case "$host" in
957 alpha-dec-osf*)
958 if test "$ac_cv_prog_CC" = "cc" ; then
959 echo "adding '-std1' to cc args for $host"
960 CC="cc -std1";
961 ac_cv_prog_CC="$CC"
962 fi
963 ;;
c68e9c6b 964 *-hp-hpux*)
965 if test "$ac_cv_prog_CC" = "cc" ; then
966 echo "adding '-Ae' to cc args for $host"
967 CC="cc -Ae";
968 ac_cv_prog_CC="$CC"
969 fi
970 ;;
fd9aaa3e 971esac
972
090089c4 973dnl Check for programs
974AC_PROG_CPP
975AC_PROG_INSTALL
976AC_PROG_RANLIB
977AC_PROG_LN_S
81280a96 978AC_PATH_PROG(SH, sh, /bin/sh)
d9f67e6f 979AC_PATH_PROG(FALSE, false, /usr/bin/false)
980AC_PATH_PROG(TRUE, true, /usr/bin/true)
981AC_PATH_PROG(RM, rm, $FALSE)
982AC_PATH_PROG(MV, mv, $FALSE)
983AC_PATH_PROG(MKDIR, mkdir, $FALSE)
090089c4 984AC_PATH_PROG(LN, ln, cp)
4e9d8e26 985AC_PATH_PROG(PERL, perl, none)
a2794549 986dnl automake handles this AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
6ad85e8a 987AC_PATH_PROG(AR, ar, $FALSE)
988
4e9d8e26 989if test "$ac_cv_path_PERL" = "none"; then
990 echo "Perl is required to compile Squid"
991 echo "Please install Perl and then re-run configure"
992 exit 1
993fi
994
6ad85e8a 995case "$host" in
996 *-hp-hpux*)
997 echo "Disabling 'ranlib' for HP-UX..."
998 RANLIB=":"
999 ;;
1000esac
1001
1002dnl set $(AR)
1003AR_R="$AR r"
1004case "$host" in
1005 *-next-nextstep3)
1006 AR="libtool -o"
1007 ;;
1008esac
1009AC_SUBST(AR_R)
090089c4 1010
1011dnl Check for headers
1012AC_HEADER_DIRENT
1013AC_HEADER_STDC
db40ae20 1014
1015AC_CHECK_HEADERS( \
db40ae20 1016 arpa/inet.h \
30a4f2a8 1017 arpa/nameser.h \
9441aa34 1018 assert.h \
db40ae20 1019 bstring.h \
db40ae20 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-*])
f5cec332 1442 # Henrik Nordstrom (hno@squid-cache.org) 19980817
9bb83c8b 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 \
a2794549 2020 scripts/Makefile \
2021 scripts/RunCache \
2022 scripts/RunAccel \
2023 src/Makefile \
2024 src/fs/Makefile \
2025 src/repl/Makefile \
2026 src/auth/Makefile \
2027 src/auth/basic/Makefile \
2028 src/auth/basic/helpers/Makefile \
2029 src/auth/basic/helpers/LDAP/Makefile \
2030 src/auth/basic/helpers/MSNT/Makefile \
2031 src/auth/basic/helpers/NCSA/Makefile \
2032 src/auth/basic/helpers/PAM/Makefile \
2033 src/auth/basic/helpers/SMB/Makefile \
2034 src/auth/basic/helpers/YP/Makefile \
2035 src/auth/basic/helpers/getpwnam/Makefile \
2036 src/auth/basic/helpers/multi-domain-NTLM/Makefile \
2037 src/auth/digest/Makefile \
2038 src/auth/digest/helpers/Makefile \
2039 src/auth/digest/helpers/password/Makefile \
2040 src/auth/ntlm/Makefile \
2041 src/auth/ntlm/helpers/Makefile \
2042 src/auth/ntlm/helpers/fakeauth/Makefile \
2043 src/auth/ntlm/helpers/no_check/Makefile \
2044 src/auth/ntlm/helpers/NTLMSSP/Makefile \
2045 src/auth/ntlm/helpers/NTLMSSP/smbval/Makefile \
2046 contrib/Makefile \
2047 snmplib/Makefile \
2048 icons/Makefile \
2049 errors/Makefile \
2050 src/fs/aufs/Makefile \
2051 src/fs/coss/Makefile \
2052 src/fs/diskd/Makefile \
2053 src/fs/null/Makefile \
2054 src/fs/ufs/Makefile \
2055 src/repl/heap/Makefile \
2056 src/repl/lru/Makefile \]
090089c4 2057)