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