]> git.ipfire.org Git - thirdparty/squid.git/blame - configure.in
namespace cleanup
[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
0e6d05ef 6dnl $Id: configure.in,v 1.225 2001/05/05 17:49:54 hno Exp $
090089c4 7dnl
8dnl
090089c4 9dnl
a26bdc75 10AC_INIT(src/main.c)
090089c4 11AC_CONFIG_HEADER(include/autoconf.h)
0e6d05ef 12AC_REVISION($Revision: 1.225 $)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 \
db40ae20 1057)
1058
aee0606f 1059AC_C_CONST
d57288d2 1060AC_C_BIGENDIAN
aee0606f 1061
5c51415d 1062AC_CACHE_CHECK(if ANSI prototypes work,ac_cv_have_ansi_prototypes, [
1063 AC_TRY_COMPILE([int foo(char *); int foo (char *bar) {return 1;}],
1064 [foo("bar")],
1065 ac_cv_have_ansi_prototypes="yes",
1066 ac_cv_have_ansi_prototypes="no")
1067])
1068if test $ac_cv_have_ansi_prototypes = "yes" ; then
1069 AC_DEFINE(HAVE_ANSI_PROTOTYPES)
1070fi
20a50bb9 1071
5c51415d 1072AC_CACHE_CHECK(for tm->tm_gmtoff,ac_cv_have_tm_gmoff, [
1073 AC_TRY_COMPILE([#include <time.h>
46c883ed 1074#include <sys/time.h>],
5c51415d 1075 [struct tm foo;
1076 foo.tm_gmtoff = 0;],
1077 ac_cv_have_tm_gmoff="yes",
1078 ac_cv_have_tm_gmoff="no")
1079])
1080if test $ac_cv_have_tm_gmoff = "yes" ; then
1081 AC_DEFINE(HAVE_TM_GMTOFF)
1082fi
46c883ed 1083
eb824054 1084AC_CACHE_CHECK(for struct mallinfo,ac_cv_have_struct_mallinfo, [
1085 AC_TRY_COMPILE([#include <sys/types.h>
1086#if HAVE_MALLOC_H
1087#include <malloc.h>
1088#endif],
1089 [struct mallinfo foo;
1090 foo.arena = 0;
1091 foo.ordblks = 0;
1092 foo.smblks = 0;
1093 foo.hblks = 0;
1094 foo.hblkhd = 0;
1095 foo.uordblks = 0;
1096 foo.fordblks = 0;
1097 foo.keepcost = 0;],
1098 ac_cv_have_struct_mallinfo="yes",
1099 ac_cv_have_struct_mallinfo="no")
1100])
1101if test $ac_cv_have_struct_mallinfo = "yes" ; then
1102 AC_DEFINE(HAVE_STRUCT_MALLINFO)
1103fi
1104
5c51415d 1105AC_CACHE_CHECK(for extended mallinfo,ac_cv_have_ext_mallinfo, [
1106 AC_TRY_COMPILE([#include <sys/types.h>
46c883ed 1107#include <malloc.h>],
5c51415d 1108 [struct mallinfo foo;
1109 foo.mxfast = 0;],
1110 ac_cv_have_ext_mallinfo="yes",
1111 ac_cv_have_ext_mallinfo="no")
1112])
1113if test $ac_cv_have_ext_mallinfo = "yes" ; then
1114 AC_DEFINE(HAVE_EXT_MALLINFO)
1115fi
090089c4 1116
b54a6789 1117AC_CACHE_CHECK(for struct rusage,ac_cv_have_struct_rusage, [
1118 AC_TRY_COMPILE([
8ff51bba 1119#if HAVE_SYS_TIME_H
1120#include <sys/time.h>
1121#endif
b54a6789 1122#if HAVE_SYS_RESOURCE_H
1123#include <sys/resource.h>
1124#endif],
1125 [struct rusage R;],
1126 ac_cv_have_struct_rusage="yes",
1127 ac_cv_have_struct_rusage="no")
1128])
1129if test $ac_cv_have_struct_rusage = "yes" ; then
1130 AC_DEFINE(HAVE_STRUCT_RUSAGE)
1131fi
1132
5c51415d 1133AC_CACHE_CHECK(for ip->ip_hl, ac_cv_have_ip_hl, [
1134 AC_TRY_COMPILE([#include <sys/types.h>
a025a745 1135#include <netinet/in.h>
1136#include <netinet/in_systm.h>
6ad85e8a 1137#include <netinet/ip.h>
b05490a8 1138#if defined (__linux__) || defined (__CYGWIN__)
6ad85e8a 1139#define ip_hl ihl
1140#endif
1141#ifndef __linux__
b05490a8 1142#ifndef __CYGWIN__
6ad85e8a 1143#define iphdr ip
b05490a8 1144#endif
6ad85e8a 1145#endif],
5c51415d 1146 [struct iphdr ip;
1147 ip.ip_hl= 0;],
1148 ac_cv_have_ip_hl="yes",
1149 ac_cv_have_ip_hl="no")
1150])
1151if test $ac_cv_have_ip_hl = "yes" ; then
1152 AC_DEFINE(HAVE_IP_HL)
1153fi
a025a745 1154
090089c4 1155dnl Check for typedefs
77d6bd88 1156AC_CHECK_SIZEOF(void *)
1157AC_CHECK_SIZEOF(short)
090089c4 1158AC_CHECK_SIZEOF(int)
1159AC_CHECK_SIZEOF(long)
77d6bd88 1160AC_CHECK_SIZEOF(long long)
1161AC_CHECK_SIZEOF(__int64)
1162AC_CHECK_SIZEOF(int16_t)
1163AC_CHECK_SIZEOF(uint16_t)
1164AC_CHECK_SIZEOF(u_int16_t)
1165AC_CHECK_SIZEOF(int32_t)
1166AC_CHECK_SIZEOF(uint32_t)
1167AC_CHECK_SIZEOF(u_int32_t)
1168AC_CHECK_SIZEOF(int64_t)
1169AC_CHECK_SIZEOF(uint64_t)
1170AC_CHECK_SIZEOF(u_int64_t)
1171
1172dnl int16_t
1173if test "x$ac_cv_sizeof_short" = "x2"; then
1174 AC_CHECK_TYPE(int16_t,short)
1175elif test "x$ac_cv_sizeof_int" = "x2"; then
1176 AC_CHECK_TYPE(int16_t,int)
1177fi
1178dnl u_int16t_t
1179if test "x$ac_cv_sizeof_uint16_t" = "x2"; then
1180 AC_CHECK_TYPE(u_int16_t,uint16_t)
1181elif test "x$ac_cv_sizeof_short" = "x2"; then
1182 AC_CHECK_TYPE(u_int16_t,unsigned short)
1183elif test "x$ac_cv_sizeof_int" = "x2"; then
1184 AC_CHECK_TYPE(u_int16_t,unsigned int)
1185fi
1186dnl int32_t
1187if test "x$ac_cv_sizeof_int" = "x4"; then
1188 AC_CHECK_TYPE(int32_t,int)
1189elif "x$ac_cv_sizeof_long" = "x4"; then
1190 AC_CHECK_TYPE(int32_t,long)
1191fi
1192dnl u_int32_t
1193if test "x$ac_cv_sizeof_uint32_t" = "x4"; then
1194 AC_CHECK_TYPE(u_int32_t,uint32_t)
1195elif test "x$ac_cv_sizeof_int" = "x4"; then
1196 AC_CHECK_TYPE(u_int32_t,unsigned int)
1197elif test "x$ac_cv_sizeof_long" = "x4"; then
1198 AC_CHECK_TYPE(u_int32_t,unsigned long)
1199fi
1200dnl int64_t
1201if test "x$ac_cv_sizeof_long" = "x8"; then
1202 AC_CHECK_TYPE(int64_t,long)
1203elif test "x$ac_cv_sizeof_long_long" = "x8"; then
1204 AC_CHECK_TYPE(int64_t,long long)
1205elif test "x$ac_cv_sizeof___int64" = "x8"; then
1206 AC_CHECK_TYPE(int64_t,__int64)
1207fi
1208dnl u_int64_t
1209if test "x$ac_cv_sizeof_uint64_t" = "x8"; then
1210 AC_CHECK_TYPE(u_int64_t,uint64_t)
1211elif test "x$ac_cv_sizeof_long" = "x8"; then
1212 AC_CHECK_TYPE(u_int64_t,unsigned long)
1213elif test "x$ac_cv_sizeof_long_long" = "x8"; then
1214 AC_CHECK_TYPE(u_int64_t,unsigned long long)
1215elif test "x$ac_cv_sizeof___int64" = "x8"; then
1216 AC_CHECK_TYPE(int64_t,unsigned __int64)
1217fi
090089c4 1218
3f6fcd8a 1219AC_CHECK_TYPE(pid_t, int)
0897af2d 1220AC_CHECK_TYPE(size_t, unsigned int)
1221AC_CHECK_TYPE(ssize_t, int)
3f6fcd8a 1222AC_CHECK_TYPE(off_t, int)
95cf2361 1223AC_CHECK_TYPE(mode_t, u_short)
c716a1dd 1224AC_CHECK_TYPE(fd_mask, int)
3f6fcd8a 1225
77d6bd88 1226dnl Check for special functions
1227AC_FUNC_ALLOCA
1228
1229
6637e3a5 1230dnl Check for type in sys/socket.h
1231AC_CACHE_CHECK(for socklen_t, ac_cv_type_socklen_t, [
1232 AC_EGREP_CPP([socklen_t[^a-zA-Z_0-9]], [#include <sys/types.h>
1233#include <sys/socket.h>
1234#if STDC_HEADERS
1235#include <stdlib.h>
1236#include <stddef.h>
1237#endif],
1238 ac_cv_type_socklen_t=yes,
1239 ac_cv_type_socklen_t=no)
1240])
1241if test $ac_cv_type_socklen_t = no; then
1242 AC_DEFINE(socklen_t, int)
1243fi
1244
aea1be68 1245dnl Check for mtyp_t in some headers
1246AC_CACHE_CHECK(for mtyp_t, ac_cv_type_mtyp_t, [
1247 AC_EGREP_CPP([mtyp_t[^a-zA-Z_0-9]], [#include <sys/types.h>
1248#include <sys/ipc.h>
1249#include <sys/msg.h>],
1250 ac_cv_type_mtyp_t=yes,
1251 ac_cv_type_mtyp_t=no)
1252])
1253if test $ac_cv_type_mtyp_t = no; then
1254 AC_DEFINE(mtyp_t, long)
1255 fi
1256
090089c4 1257dnl Check for needed libraries
30a4f2a8 1258AC_CHECK_LIB(nsl, main)
6716b242 1259AC_CHECK_LIB(socket, main)
94d48591 1260
1261if test "x$ac_cv_enabled_dlmalloc" = "xyes" ; then
1262 echo "skipping libmalloc check (--enable-dlmalloc specified)"
5c51415d 1263else
94d48591 1264 AC_CHECK_LIB(gnumalloc, main)
1265 if test "$ac_cv_lib_gnumalloc_main" = "yes"; then
1266 echo "Disabling extended malloc functions when using gnumalloc"
1267 ac_cv_func_mallinfo=no
1268 ac_cv_func_mallocblksize=no
1269 ac_cv_func_mallopt=no
1270 else
1271 case "$host" in
1272 *-sun-solaris*)
1273 echo "skipping libmalloc check for $host"
1274 ;;
1275 i386-*-freebsd*)
1276 echo "skipping libmalloc check for $host"
1277 ;;
1278 *)
1279
1280 AC_CHECK_LIB(malloc, main)
1281 ;;
1282 esac
1283 fi
8a15e65e 1284fi
94d48591 1285
6716b242 1286AC_CHECK_LIB(bsd, main)
be79ade0 1287AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"])
04a56fa3 1288AC_CHECK_LIB(bind, gethostbyname)
1289if test $ac_cv_lib_bind_gethostbyname = "no" ; then
1290 case "$host" in
78743365 1291 i386-*-freebsd*)
1292 echo "skipping libresolv checks for $host"
1293 ;;
1294 *)
1295 AC_CHECK_LIB(resolv, inet_aton, AC_CHECK_LIB(44bsd, inet_aton))
1296 AC_CHECK_LIB(resolv, main)
1297 ;;
04a56fa3 1298 esac
1299fi
e0bddc45 1300AC_CHECK_LIB(m, main)
090089c4 1301
1302dnl Check for libcrypt
b8de7ebe 1303dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
042b1f8a 1304AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
be79ade0 1305AC_SUBST(CRYPTLIB)
77f675ad 1306
042b1f8a 1307dnl Check for libdl, used by auth_modules/PAM
1308AC_CHECK_LIB(dl, dlopen, [DLLIB="-ldl"])
1309AC_SUBST(DLLIB)
1310
e5f4e1b0 1311dnl Check for pthreads
1312dnl We use pthreads when doing ASYNC I/O
042b1f8a 1313AC_CHECK_LIB(pthread, main, [PTHREADLIB="-lpthread"])
71f8abc8 1314AC_SUBST(PTHREADLIB)
1315
86ec11aa 1316dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
1317dnl Robert Side <rside@aiinc.bc.ca>
1318dnl Mon, 18 Jan 1999 17:48:00 GMT
1319case "$host" in
1320 *-pc-sco3.2*)
1321 AC_CHECK_LIB(intl, strftime)
1322 ;;
1323esac
1324
77f675ad 1325dnl System-specific library modifications
1326dnl
1327case "$host" in
88738790 1328 i386-*-solaris2.*)
7149a49f 1329 if test "$GCC" = "yes"; then
1330 echo "Removing -O for gcc on $host"
80e92d6d 1331 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
7149a49f 1332 fi
1333 ;;
77f675ad 1334 *-sgi-irix*)
1335 echo "Removing -lsocket for IRIX..."
6716b242 1336 LIBS=`echo $LIBS | sed -e s/-lsocket//`
77f675ad 1337 echo "Removing -lnsl for IRIX..."
6716b242 1338 LIBS=`echo $LIBS | sed -e s/-lnsl//`
c415c128 1339 ac_cv_lib_nsl_main=no
b44c0fb4 1340 echo "Removing -lbsd for IRIX..."
1341 LIBS=`echo $LIBS | sed -e s/-lbsd//`
77f675ad 1342 ;;
4ba0bd0e 1343dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
1344dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
1345dnl Please change your configure script. AIX doesn't need -lbsd.
1346 *-ibm-aix*)
1347 echo "Removing -lbsd for AIX..."
1348 LIBS=`echo $LIBS | sed -e s/-lbsd//`
c68e9c6b 1349dnl From: mlaster@metavillage.com (Mike Laster)
1350dnl AIX 4.1.4.x does not have header files for snprintf/vsnprintf
1351dnl So using the internal versions generates a load of warnings
1352dnl during compile.
1353 echo "disabling snprintf/vsnprintf for $host"
1354 ac_cv_func_snprintf=no
1355 ac_cv_func_vsnprintf=no
4ba0bd0e 1356 ;;
30a4f2a8 1357 *m88k*)
1358 CFLAGS="$CFLAGS -D_SQUID_MOTOROLA_"
7149a49f 1359 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
1360 ;;
580ce039 1361 [*-*-solaris2.[0-4]])
7149a49f 1362 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
30a4f2a8 1363 ;;
711fa75e 1364 [*-sony-newsos[56]*])
f62c73dc 1365 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
1366 ;;
77f675ad 1367esac
090089c4 1368
d20b1cd0 1369# Remove optimization for GCC 2.95.[12]
1370# gcc -O[2] on *BSD and Linux (x86) causes pointers to magically become NULL
1371if test "$GCC" = "yes"; then
1372 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
1373 case "$GCCVER" in
1374 [2.95.[12]])
1375 echo "Removing -O for gcc on $host with GCC $GCCVER"
1376 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
1377 ;;
1378 esac
1379fi
1380
176d10ee 1381# Recommended by Balint Nagy Endre <bne@CareNet.hu>
1382case "$host" in
1383 *-univel-sysv4.2MP)
1384 if test `uname -v` = "2.03"; then
1385 echo "disabling mallinfo for $host"
1386 ac_cv_func_mallinfo=no
1387 fi
1388 ;;
1389esac
1390
84cecfd2 1391dnl This has to be before AC_CHECK_FUNCS
1392# Disable poll() on certain platforms. Override by setting ac_cv_func_poll
1393# when running configure.
1394if test -z "$ac_cv_func_poll"; then
1395 case "$host" in
1396 [alpha-dec-osf3.*])
1397 # John Kay (jkay@nlanr.net) 19970818
1398 echo "disabling poll for $host..."
1399 ac_cv_func_poll='no'
1400 ;;
1401 [*-hp-hpux*.*])
1402 # Duane Wessels
1403 echo "disabling poll for $host..."
1404 ac_cv_func_poll='no'
1405 ;;
1406 [*-linux-*])
9bb83c8b 1407 # Henrik Nordstrom (hno@hem.passagen.se) 19980817
1408 # poll is problematic on Linux. We disable it
1409 # by default until Linux gets it right.
b6a2f15e 1410 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
1411 if test $rev -lt 002002; then
1412 echo "disabling poll for $host < 2.2..."
1413 ac_cv_func_poll='no'
1414 fi
84cecfd2 1415 ;;
c68e9c6b 1416 [powerpc-ibm-aix4.1.*])
1417 # Mike Laster (mlaster@metavillage.com) 19981021
1418 echo "disabling poll for $host..."
1419 ac_cv_func_poll='no'
1420 ;;
86ec11aa 1421 [*-pc-sco3.2*])
1422 # Robert Side <rside@aiinc.bc.ca>
1423 # Mon, 18 Jan 1999 17:48:00 GMT
1424 echo "disabling poll for $host..."
1425 ac_cv_func_poll='no'
1426 ;;
84cecfd2 1427 esac
1428fi
176d10ee 1429
6716b242 1430dnl Check for library functions
1431AC_CHECK_FUNCS(\
30a4f2a8 1432 bcopy \
ce3d30fb 1433 backtrace_symbols_fd \
df087e68 1434 crypt \
4ac29a5b 1435 fchmod \
6716b242 1436 getdtablesize \
8505e57b 1437 getpagesize \
30a4f2a8 1438 getrusage \
9c1d8929 1439 getspnam \
30a4f2a8 1440 lrand48 \
6716b242 1441 mallinfo \
0f5efab0 1442 mallocblksize \
6716b242 1443 mallopt \
2ae6b9b0 1444 memcpy \
30a4f2a8 1445 memmove \
dac27377 1446 memset \
b99a6dec 1447 mkstemp \
1812b6c7 1448 mktime \
88738790 1449 mstats \
84cecfd2 1450 poll \
cd748f27 1451 pthread_attr_setscope \
1452 pthread_setschedparam \
1453 pthread_attr_setschedparam \
42b51993 1454 pthread_sigmask \
c68e9c6b 1455 putenv \
b1e77ec1 1456 random \
6716b242 1457 regcomp \
1458 regexec \
1459 regfree \
30a4f2a8 1460 res_init \
4915be3b 1461 rint \
234967c9 1462 seteuid \
c415c128 1463 setgroups \
30a4f2a8 1464 setpgrp \
6716b242 1465 setrlimit \
b6a2f15e 1466 getrlimit \
30a4f2a8 1467 setsid \
1468 sigaction \
11430c03 1469 snprintf \
30a4f2a8 1470 srand48 \
b1e77ec1 1471 srandom \
0343b99c 1472 statfs \
6716b242 1473 sysconf \
1474 syslog \
234967c9 1475 timegm \
28da5e0d 1476 vsnprintf \
77d6bd88 1477 bswap_16 \
1478 bswap_32 \
6716b242 1479)
1480
60939927 1481dnl Yay! Another Linux brokenness. Its not good enough
1482dnl to know that setresuid() exists, because RedHat 5.0 declares
1483dnl setresuid() but doesn't implement it.
1484dnl
1485AC_CACHE_CHECK(if setresuid is implemented, ac_cv_func_setresuid,
5c51415d 1486 AC_TRY_RUN([
60939927 1487#include <stdlib.h>
5c51415d 1488 int main() {
1489 if(setresuid(-1,-1,-1)) {
1490 perror("setresuid:");
1491 exit(1);
60939927 1492 }
1493 exit(0);
5c51415d 1494 }
1495 ],ac_cv_func_setresuid="yes",ac_cv_func_setresuid="no")
60939927 1496)
5c51415d 1497if test "$ac_cv_func_setresuid" = "yes" ; then
1498 AC_DEFINE(HAVE_SETRESUID)
1499fi
60939927 1500
5cafc1d6 1501dnl IP-Filter support requires ipf header files. These aren't
1502dnl installed by default, so we need to check for them
1503if test "$IPF_TRANSPARENT" ; then
1504 AC_MSG_CHECKING(if IP-Filter header files are installed)
42b51993 1505 # hold on to your hats...
1506 if test "$ac_cv_header_ip_compat_h" = "yes" ||
1507 test "$ac_cv_header_ip_fil_compat_h" = "yes" ||
87d21d8b 1508 test "$ac_cv_header_netinet_ip_compat_h" = "yes" ||
1509 test "$ac_cv_header_netinet_ip_fil_compat_h" = "yes" ; then
42b51993 1510 have_ipfilter_compat_header="yes"
1511 fi
1512 if test "x$have_ipfilter_compat_header" = "xyes" &&
eb824054 1513 test "$ac_cv_header_ip_fil_h" = "yes" &&
1514 test "$ac_cv_header_ip_nat_h" = "yes" ; then
1515 IPF_TRANSPARENT="yes"
1516 AC_DEFINE(IPF_TRANSPARENT, 1)
42b51993 1517 elif test "$have_ipfilter_compat_header" = "yes" &&
eb824054 1518 test "$ac_cv_header_netinet_ip_fil_h" = "yes" &&
1519 test "$ac_cv_header_netinet_ip_nat_h" = "yes" ; then
1520 IPF_TRANSPARENT="yes"
1521 AC_DEFINE(IPF_TRANSPARENT, 1)
1522 else
5cafc1d6 1523 IPF_TRANSPARENT="no"
1524 AC_DEFINE(IPF_TRANSPARENT, 0)
5cafc1d6 1525 fi
1526 AC_MSG_RESULT($IPF_TRANSPARENT)
1527fi
1528if test "$IPF_TRANSPARENT" = "no" ; then
1529 echo "WARNING: Cannot find necessary IP-Filter header files"
1530 echo " Transparent Proxy support WILL NOT be enabled"
1531 sleep 10
1532fi
1533
d852fbad 1534dnl Linux-Netfilter support requires Linux 2.4 kernel header files.
1535dnl Shamelessly copied from above
1536if test "$LINUX_NETFILTER" ; then
1537 AC_MSG_CHECKING(if Linux 2.4 kernel header files are installed)
1538 # hold on to your hats...
1539 if test "$ac_cv_header_linux_netfilter_ipv4_h" = "yes"; then
1540 LINUX_NETFILTER="yes"
1541 AC_DEFINE(LINUX_NETFILTER, 1)
1542 else
1543 LINUX_NETFILTER="no"
1544 AC_DEFINE(LINUX_NETFILTER, 0)
1545 fi
1546 AC_MSG_RESULT($LINUX_NETFILTER)
1547fi
1548if test "$LINUX_NETFILTER" = "no" ; then
1549 echo "WARNING: Cannot find necessary Linux 2.4 kernel header files"
1550 echo " Linux 2.4 Transparent Proxy support WILL NOT be enabled"
1551 sleep 10
1552fi
1553
91bc414e 1554if test -z "$USE_GNUREGEX" ; then
1555 case "$host" in
1556 *-sun-solaris2.[[0-4]])
1557 USE_GNUREGEX="yes"
1558 ;;
1559 *-next-nextstep*)
1560 USE_GNUREGEX="yes"
1561 ;;
1562 esac
1563fi
7a081912 1564AC_MSG_CHECKING(if GNUregex needs to be compiled)
91bc414e 1565if test -z "$USE_GNUREGEX"; then
55878dfd 1566if test "$ac_cv_func_regcomp" = "no" || test "$USE_GNUREGEX" = "yes" ; then
74946a0f 1567 USE_GNUREGEX="yes"
00fa2c12 1568else
0cccc031 1569 AC_TRY_COMPILE([#include <sys/types.h>
1570#include <regex.h>],[regex_t t; regcomp(&t,"",0);],
91bc414e 1571 USE_GNUREGEX="no",
1572 USE_GNUREGEX="yes")
1573fi
00fa2c12 1574fi
74946a0f 1575AC_MSG_RESULT($USE_GNUREGEX)
1576if test "$USE_GNUREGEX" = "yes"; then
26675bf4 1577 REGEXLIB="-lregex"
7a081912 1578 LIBREGEX="libregex.a"
74946a0f 1579 AC_DEFINE(USE_GNUREGEX)
7a081912 1580fi
26675bf4 1581AC_SUBST(REGEXLIB)
00fa2c12 1582AC_SUBST(LIBREGEX)
7a081912 1583
3f6fcd8a 1584AC_REPLACE_FUNCS(\
3d0cf10e 1585 drand48 \
3f6fcd8a 1586 tempnam \
4d38fc7e 1587 strerror \
3f6fcd8a 1588)
1589
5c51415d 1590dnl Not cached since people are likely to tune this
e924600d 1591AC_MSG_CHECKING(Default FD_SETSIZE value)
1592AC_TRY_RUN([
1593#if HAVE_STDIO_H
1594#include <stdio.h>
1595#endif
1596#if HAVE_UNISTD_H
1597#include <unistd.h>
1598#endif
1599#if HAVE_SYS_TIME_H
1600#include <sys/time.h>
1601#endif
1602#if HAVE_SYS_SELECT_H
1603#include <sys/select.h>
1604#endif
1605#if HAVE_SYS_TYPES_H
1606#include <sys/types.h>
1607#endif
1608main() {
635e6242 1609 FILE *fp = fopen("conftestval", "w");
1610 fprintf (fp, "%d\n", FD_SETSIZE);
e924600d 1611 exit(0);
1612}
1613],
1614DEFAULT_FD_SETSIZE=`cat conftestval`,
1615DEFAULT_FD_SETSIZE=256,
1616DEFAULT_FD_SETSIZE=256)
1617AC_MSG_RESULT($DEFAULT_FD_SETSIZE)
1618AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE)
1619
5c51415d 1620dnl Not cached since people are likely to tune this
234967c9 1621AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
c76d8acc 1622dnl damn! FreeBSD's pthreads breaks dup2().
1623TLDFLAGS="$LDFLAGS"
1624case $host in
1625i386-unknown-freebsd*)
1626 if echo "$LDFLAGS" | grep -q pthread; then
1627 LDFLAGS=`echo $LDFLAGS | sed -e "s/-pthread//"`
1628 fi
1629esac
234967c9 1630AC_TRY_RUN([
8cca06da 1631#include <stdio.h>
234967c9 1632#include <unistd.h>
30a4f2a8 1633#include <sys/time.h> /* needed on FreeBSD */
234967c9 1634#include <sys/param.h>
1635#include <sys/resource.h>
1636main() {
635e6242 1637 FILE *fp;
234967c9 1638 int i,j;
42b51993 1639#if defined(__CYGWIN32__) || defined (__CYGWIN__)
b05490a8 1640 /* getrlimit and sysconf returns bogous values on cygwin32.
df087e68 1641 * Number of fds is virtually unlimited in cygwin (sys/param.h)
b05490a8 1642 * __CYGWIN32__ is deprecated.
df087e68 1643 */
1644 i = NOFILE;
b05490a8 1645#else
1646#if HAVE_SETRLIMIT
234967c9 1647 struct rlimit rl;
1648#if defined(RLIMIT_NOFILE)
1649 if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
1650 perror("getrlimit: RLIMIT_NOFILE");
1651 } else {
1652 rl.rlim_cur = rl.rlim_max; /* set it to the max */
1653 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
1654 perror("setrlimit: RLIMIT_NOFILE");
1655 }
1656 }
1657#elif defined(RLIMIT_OFILE)
1658 if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
1659 perror("getrlimit: RLIMIT_OFILE");
1660 } else {
1661 rl.rlim_cur = rl.rlim_max; /* set it to the max */
1662 if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
1663 perror("setrlimit: RLIMIT_OFILE");
1664 }
1665 }
1666#endif /* RLIMIT_NOFILE */
1667#endif /* HAVE_SETRLIMIT */
d9399075 1668 /* by starting at 2^14, we will never get higher
1669 than 2^15 for SQUID_MAXFD */
1670 i = j = 1<<14;
1671 while (j) {
1672 j >>= 1;
1673 if (dup2(0, i) < 0) {
1674 i -= j;
1675 } else {
1676 close(i);
1677 i += j;
1678 }
1679 }
1680 i++;
b05490a8 1681#endif /* IF !DEF CYGWIN */
635e6242 1682 fp = fopen("conftestval", "w");
1683 fprintf (fp, "%d\n", i);
234967c9 1684 exit(0);
1685}
1686],
431d84c5 1687SQUID_MAXFD=`cat conftestval`,
1688SQUID_MAXFD=256,
1689SQUID_MAXFD=256)
1690AC_MSG_RESULT($SQUID_MAXFD)
1691AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD)
b9cc811d 1692if test "$SQUID_MAXFD" -lt 512 ; then
80ab193b 1693 echo "WARNING: $SQUID_MAXFD may not be enough filedescriptors if your"
1694 echo " cache will be very busy. Please see the FAQ page"
2b6662ba 1695 echo " http://www.squid-cache.org/FAQ/FAQ-11.html#filedescriptors"
e692ff35 1696 echo " on how to increase your filedescriptor limit"
933cc58d 1697 sleep 10
80ab193b 1698fi
c76d8acc 1699LDFLAGS="$TLDFLAGS"
234967c9 1700
5c51415d 1701dnl Not cached since people are likely to tune this
30a4f2a8 1702AC_MSG_CHECKING(Default UDP send buffer size)
1703AC_TRY_RUN([
8cca06da 1704#include <stdlib.h>
1705#include <stdio.h>
30a4f2a8 1706#include <sys/types.h>
1707#include <sys/socket.h>
1708#include <netinet/in.h>
1709main ()
1710{
635e6242 1711 FILE *fp;
30a4f2a8 1712 int fd,val=0,len=sizeof(int);
1713 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
1714 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
1715 if (val<=0) exit(1);
635e6242 1716 fp = fopen("conftestval", "w");
1717 fprintf (fp, "%d\n", val);
30a4f2a8 1718 exit(0);
1719}
1720],
1721SQUID_UDP_SO_SNDBUF=`cat conftestval`,
1c481e00 1722SQUID_UDP_SO_SNDBUF=16384,
1723SQUID_UDP_SO_SNDBUF=16384)
30a4f2a8 1724AC_MSG_RESULT($SQUID_UDP_SO_SNDBUF)
1725AC_DEFINE_UNQUOTED(SQUID_UDP_SO_SNDBUF, $SQUID_UDP_SO_SNDBUF)
1726
5c51415d 1727dnl Not cached since people are likely to tune this
30a4f2a8 1728AC_MSG_CHECKING(Default UDP receive buffer size)
1729AC_TRY_RUN([
8cca06da 1730#include <stdlib.h>
1731#include <stdio.h>
30a4f2a8 1732#include <sys/types.h>
1733#include <sys/socket.h>
1734#include <netinet/in.h>
1735main ()
1736{
635e6242 1737 FILE *fp;
30a4f2a8 1738 int fd,val=0,len=sizeof(int);
1739 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
1740 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
1741 if (val <= 0) exit(1);
635e6242 1742 fp = fopen("conftestval", "w");
1743 fprintf (fp, "%d\n", val);
30a4f2a8 1744 exit(0);
1745}
1746],
1747SQUID_UDP_SO_RCVBUF=`cat conftestval`,
1c481e00 1748SQUID_UDP_SO_RCVBUF=16384,
1749SQUID_UDP_SO_RCVBUF=16384)
30a4f2a8 1750AC_MSG_RESULT($SQUID_UDP_SO_RCVBUF)
1751AC_DEFINE_UNQUOTED(SQUID_UDP_SO_RCVBUF, $SQUID_UDP_SO_RCVBUF)
1752
5c51415d 1753dnl Not cached since people are likely to tune this
30a4f2a8 1754AC_MSG_CHECKING(Default TCP send buffer size)
1755AC_TRY_RUN([
8cca06da 1756#include <stdlib.h>
1757#include <stdio.h>
30a4f2a8 1758#include <sys/types.h>
1759#include <sys/socket.h>
1760#include <netinet/in.h>
1761main ()
1762{
635e6242 1763 FILE *fp;
30a4f2a8 1764 int fd,val=0,len=sizeof(int);
1765 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
1766 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
1767 if (val <= 0) exit(1);
635e6242 1768 fp = fopen("conftestval", "w");
1769 fprintf (fp, "%d\n", val);
30a4f2a8 1770 exit(0);
1771}
1772],
1773SQUID_TCP_SO_SNDBUF=`cat conftestval`,
1c481e00 1774SQUID_TCP_SO_SNDBUF=16384,
1775SQUID_TCP_SO_SNDBUF=16384)
30a4f2a8 1776AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF)
1777AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF)
1778
5c51415d 1779dnl Not cached since people are likely to tune this
30a4f2a8 1780AC_MSG_CHECKING(Default TCP receive buffer size)
1781AC_TRY_RUN([
8cca06da 1782#include <stdlib.h>
1783#include <stdio.h>
30a4f2a8 1784#include <sys/types.h>
1785#include <sys/socket.h>
1786#include <netinet/in.h>
1787main ()
1788{
635e6242 1789 FILE *fp;
30a4f2a8 1790 int fd,val=0,len=sizeof(int);
1791 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
1792 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
1793 if (val <= 0) exit(1);
635e6242 1794 fp = fopen("conftestval", "w");
1795 fprintf (fp, "%d\n", val);
30a4f2a8 1796 exit(0);
1797}
1798],
1799SQUID_TCP_SO_RCVBUF=`cat conftestval`,
1c481e00 1800SQUID_TCP_SO_RCVBUF=16384,
1801SQUID_TCP_SO_RCVBUF=16384)
30a4f2a8 1802AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF)
1803AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF)
1804
5c51415d 1805AC_CACHE_CHECK(if sys_errlist is already defined, ac_cv_needs_sys_errlist,
9bc73deb 1806 AC_TRY_COMPILE([#include <stdio.h>],[char *s = sys_errlist;],
5c51415d 1807 ac_cv_needs_sys_errlist="no",
1808 ac_cv_needs_sys_errlist="yes")
1809)
1810if test "$ac_cv_needs_sys_errlist" = "yes" ; then
1811 AC_DEFINE(NEED_SYS_ERRLIST)
1812fi
30a4f2a8 1813
5c51415d 1814dnl Not cached since people are likely to change this
6bf65235 1815AC_MSG_CHECKING(for libresolv _dns_ttl_ hack)
1816AC_TRY_LINK(extern int _dns_ttl_;,return _dns_ttl_;,
1817[AC_MSG_RESULT(yes)
1818AC_DEFINE(LIBRESOLV_DNS_TTL_HACK)],
1819AC_MSG_RESULT(no))
1820
a937d5e3 1821AC_MSG_CHECKING(if inet_ntoa() actually works)
1822AC_TRY_RUN([
1823#include <stdlib.h>
1824#include <stdio.h>
1825#include <sys/types.h>
1826#include <netinet/in.h>
1827#include <arpa/inet.h>
1828main ()
1829{
635e6242 1830 FILE *fp;
a937d5e3 1831 struct in_addr in;
1832 in.s_addr = inet_addr("1.2.3.4");
635e6242 1833 fp = fopen("conftestval", "w");
1834 fprintf (fp, "%s\n", inet_ntoa(in));
a937d5e3 1835 exit(0);
1836}
1837],
1838INET_NTOA_RESULT=`cat conftestval`,
1839INET_NTOA_RESULT="broken",
1840INET_NTOA_RESULT="broken")
1841if test "$INET_NTOA_RESULT" = "1.2.3.4" ; then
1842 AC_MSG_RESULT("yes")
1843else
1844 AC_MSG_RESULT("no")
b6a2f15e 1845 echo "Will use our own inet_ntoa()."
1846 LIBOBJS="$LIBOBJS inet_ntoa.o"
1847# echo "WARNING: This looks bad, and probably prevents Squid from working."
1848# echo " If you're on IRIX and using GCC 2.8, you probably need"
1849# echo " to use the IRIX C compiler instead."
1850# sleep 10
a937d5e3 1851fi
1852
b6a2f15e 1853if test "$ac_cv_header_sys_statvfs_h" = "yes" ; then
c68e9c6b 1854AC_MSG_CHECKING(for working statvfs() interface)
1855AC_TRY_COMPILE([
1856#include <stdlib.h>
1857#include <stdio.h>
1858#include <sys/types.h>
1859#include <sys/statvfs.h>
1860],
1861[
1862struct statvfs sfs;
1863sfs.f_blocks = sfs.f_bfree = sfs.f_frsize =
1864sfs.f_files = sfs.f_ffree = 0;
1865statvfs("/tmp", &sfs);
1866],
1867 ac_cv_func_statvfs=yes,
1868 ac_cv_func_statvfs=no)
1869AC_MSG_RESULT($ac_cv_func_statvfs)
6b8e7481 1870if test "$ac_cv_func_statvfs" = "yes" ; then
b6a2f15e 1871 AC_DEFINE(HAVE_STATVFS)
1872fi
6b8e7481 1873fi
c68e9c6b 1874
1875AC_CACHE_CHECK(for _res.nsaddr_list, ac_cv_have_res_nsaddr_list,
1876AC_TRY_COMPILE([
1877#if HAVE_SYS_TYPES_H
1878#include <sys/types.h>
1879#endif
1880#if HAVE_NETINET_IN_H
1881#include <netinet/in.h>
1882#endif
1883#if HAVE_ARPA_INET_H
1884#include <arpa/inet.h>
1885#endif
1886#if HAVE_ARPA_NAMESER_H
1887#include <arpa/nameser.h>
1888#endif
1889#if HAVE_RESOLV_H
1890#include <resolv.h>
1891#endif
1892],
1893[_res.nsaddr_list[[0]];],
1894ac_cv_have_res_nsaddr_list="yes",
1895ac_cv_have_res_nsaddr_list="no"))
1896if test $ac_cv_have_res_nsaddr_list = "yes" ; then
1897 AC_DEFINE(HAVE_RES_NSADDR_LIST)
1898fi
1899
1900if test $ac_cv_have_res_nsaddr_list = "no" ; then
1901AC_CACHE_CHECK(for _res.ns_list, ac_cv_have_res_ns_list,
1902AC_TRY_COMPILE([
1903#if HAVE_SYS_TYPES_H
1904#include <sys/types.h>
1905#endif
1906#if HAVE_NETINET_IN_H
1907#include <netinet/in.h>
1908#endif
1909#if HAVE_ARPA_INET_H
1910#include <arpa/inet.h>
1911#endif
1912#if HAVE_ARPA_NAMESER_H
1913#include <arpa/nameser.h>
1914#endif
1915#if HAVE_RESOLV_H
1916#include <resolv.h>
1917#endif
1918],
1919[_res.ns_list[[0]].addr;],
1920ac_cv_have_res_ns_list="yes",
1921ac_cv_have_res_ns_list="no"))
1922if test $ac_cv_have_res_ns_list = "yes" ; then
1923 AC_DEFINE(HAVE_RES_NS_LIST)
1924fi
1925fi
1926
090089c4 1927dnl Need the debugging version of malloc if available
1928XTRA_OBJS=''
6509a1a0 1929if test "$ac_cv_lib_malloc_main" = "yes" ; then
090089c4 1930 if test -r /usr/lib/debug/malloc.o ; then
1931 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
1932 fi
1933 if test -r /usr/lib/debug/mallocmap.o ; then
1934 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
1935 fi
1936fi
2bbd722b 1937
090089c4 1938AC_SUBST(XTRA_OBJS)
1939
38fea766 1940if test -z "$XTRA_LIBS"; then
1941 XTRA_LIBS="$LIBS"
0f5a16f8 1942 dnl minor cleanup
1943 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
38fea766 1944 LIBS=''
1945fi
090089c4 1946AC_SUBST(XTRA_LIBS)
1947
090089c4 1948dnl Clean up after OSF/1 core dump bug
1949rm -f core
1950
caa4f581 1951FS_MAKEFILES=""
1952for fs in $STORE_MODULES none; do
1953 if test $fs != none; then
1954 FS_MAKEFILES="$FS_MAKEFILES ./src/fs/$fs/Makefile"
1955 fi
1956done
1957REPL_MAKEFILES=""
1958for repl in $REPL_POLICIES none; do
1959 if test $repl != none; then
1960 REPL_MAKEFILES="$REPL_MAKEFILES ./src/repl/$repl/Makefile"
1961 fi
1962done
1963
63bf42ae 1964dnl This could actually be used to find all the Makefiles..
baff95b9 1965AUTH_MAKEFILES=""
63bf42ae 1966for auth in `find $srcdir/src/auth -type d -print`; do
baff95b9 1967 if test -f $auth/Makefile.in; then
63bf42ae 1968 dir=`echo $auth | sed -e "s|^$srcdir/||"`
1969 AUTH_MAKEFILES="$AUTH_MAKEFILES ./$dir/Makefile"
1970 fi
94439e4e 1971done
1972
090089c4 1973AC_OUTPUT(\
0992a350 1974 ./makefile \
090089c4 1975 ./lib/Makefile \
a26bdc75 1976 ./include/config.h \
090089c4 1977 ./scripts/Makefile \
1978 ./scripts/RunCache \
1979 ./scripts/RunAccel \
a26bdc75 1980 ./src/Makefile \
cd748f27 1981 ./src/fs/Makefile \
caa4f581 1982 $FS_MAKEFILES \
6a566b9c 1983 ./src/repl/Makefile \
caa4f581 1984 $REPL_MAKEFILES \
94439e4e 1985 ./src/auth/Makefile \
baff95b9 1986 $AUTH_MAKEFILES \
e550e8b6 1987 ./contrib/Makefile \
8a7f0105 1988 $SNMP_MAKEFILE \
81280a96 1989 ./icons/Makefile \
d4fb069d 1990 ./errors/Makefile \
090089c4 1991)