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