]> git.ipfire.org Git - thirdparty/squid.git/blame - configure.in
Summary: Swallow request bodies even when denying access.
[thirdparty/squid.git] / configure.in
CommitLineData
1b3db6d9 1
2877b8a9 2dnl Configuration input file for Squid
090089c4 3dnl
983061ed 4dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9)
090089c4 5dnl
f9576890 6dnl $Id: configure.in,v 1.343 2003/08/05 21:40:00 robertc Exp $
090089c4 7dnl
8dnl
090089c4 9dnl
6a9f6389 10AC_INIT
856e69c5 11AC_PREREQ(2.52)
e6ccf245 12AC_CONFIG_SRCDIR([src/main.cc])
71b12d7c 13AC_CONFIG_AUX_DIR(cfgaux)
378120f3 14AM_INIT_AUTOMAKE(squid, 3.0-PRE2-CVS)
a2794549 15AM_CONFIG_HEADER(include/autoconf.h)
f9576890 16AC_REVISION($Revision: 1.343 $)dnl
a2794549 17AC_PREFIX_DEFAULT(/usr/local/squid)
246d7ffc 18AM_MAINTAINER_MODE
a2794549 19
20dnl Set default LDFLAGS
21if test -z "$LDFLAGS"; then
22 LDFLAGS="-g"
23fi
24
25PRESET_CFLAGS="$CFLAGS"
090089c4 26
a2794549 27dnl Check for GNU cc
28AC_PROG_CC
c4b0db82 29AC_LANG_C
29b8d8d6 30AC_PROG_CXX
a2794549 31AM_PROG_CC_C_O
88d50a22 32AC_CANONICAL_HOST
33
a2794549 34
26675bf4 35CRYPTLIB=''
00fa2c12 36REGEXLIB='' # -lregex
37LIBREGEX='' # libregex.a
090089c4 38
a2794549 39dnl find out the exe extension for this platform. If it's not empty, use it for CGI's as well.
40AC_EXEEXT
41AC_OBJEXT
42
43if test -z "$EXEEXT"; then
44 CGIEXT=".cgi"
45else
7aeb8001 46 # automake automatically adds .exe when installing binaries
47 CGIEXT=""
a2794549 48fi
7aeb8001 49AC_SUBST(CGIEXT)
a2794549 50
0e6d05ef 51dnl this should be expanded to a list of platform sensible support requirements.
52dnl (adding an option like --enable-cygwin-support doesn't make sense :]) - R Collins 2001
df087e68 53case "$host_os" in
a2794549 54cygwin|cygwin32)
55 AM_CONDITIONAL(ENABLE_WIN32SPECIFIC, true)
df087e68 56 ;;
57*)
a2794549 58 AM_CONDITIONAL(ENABLE_WIN32SPECIFIC, false)
df087e68 59 ;;
60esac
df087e68 61
a26bdc75 62if test -z "$CACHE_HTTP_PORT"; then
63 CACHE_HTTP_PORT="3128"
64fi
65if test -z "$CACHE_ICP_PORT"; then
66 CACHE_ICP_PORT="3130"
67fi
a26bdc75 68
090089c4 69dnl Subsitutions
6a9f6389 70AC_DEFINE_UNQUOTED(CACHE_HTTP_PORT, $CACHE_HTTP_PORT,
71[What default TCP port to use for HTTP listening?])
72AC_DEFINE_UNQUOTED(CACHE_ICP_PORT, $CACHE_ICP_PORT,
73[What default UDP port to use for ICP listening?])
090089c4 74
6a9f6389 75AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host",[Host type from configure])
30a4f2a8 76
6a9f6389 77AC_DEFINE_UNQUOTED(SQUID_CONFIGURE_OPTIONS, "$ac_configure_args", [configure command line used to configure Squid])
090089c4 78
d96ceb8e 79dnl Check for GNU cc
80AC_PROG_CC
81
6ad85e8a 82dnl Gerben Wierda <Gerben_Wierda@RnA.nl>
83case "$host" in
84 mab-next-nextstep3)
85 CC="$CC -arch m68k -arch i486 -arch hppa -arch sparc"
86 ;;
87esac
88
30a4f2a8 89dnl Set Default CFLAGS
90if test -z "$PRESET_CFLAGS"; then
91 if test "$GCC" = "yes"; then
92 case "$host" in
97b12a5b 93 *-sun-sunos*)
30a4f2a8 94 # sunos has too many warnings for this to be useful
95 # motorola too
96 ;;
97b12a5b 97 *m88k*)
98 # Motorola cc/ld does not like -02 but is ok on -O
99 CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]/-O/'`
100 ;;
30a4f2a8 101 *)
102 CFLAGS="$CFLAGS -Wall"
103 ;;
104 esac
81a820c6 105 else
106 case "$host" in
c415c128 107 *mips-sgi-irix6.*)
81a820c6 108 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
c415c128 109 CFLAGS="$CFLAGS -n32 -mips3 -O3 -OPT:Olimit=0:space=OFF \
58dc050d 110 -woff 1009,1014,1110,1116,1185,1188,1204,1230,1233 \
81a820c6 111 -Wl,-woff,85,-woff,84,-woff,134 \
112 -nostdinc -I/usr/include -D_BSD_SIGNALS"
113 ;;
e8f5fb18 114 alpha-dec-osf4.*)
553c24ae 115 # Mogul says DEC compilers take both -g and -O2
b6a2f15e 116 CFLAGS=`echo $CFLAGS | sed -e 's/-g/-g3/'`
553c24ae 117 CFLAGS="$CFLAGS -O2"
118 ;;
81a820c6 119 *)
120 ;;
121 esac
30a4f2a8 122 fi
30a4f2a8 123fi
124
d2e3605e 125dnl set squid required flags
126if test "$GCC" = "yes"; then
127 SQUID_CFLAGS="-Werror -Wall -Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wcomments"
12776987 128 SQUID_CXXFLAGS="-Werror -Wall -Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wcomments"
d2e3605e 129else
130 SQUID_CFLAGS=
131 SQUID_CXXFLAGS=
132fi
133AC_SUBST(SQUID_CFLAGS)
134AC_SUBST(SQUID_CXXFLAGS)
135
30a4f2a8 136dnl Set LDFLAGS
137if test -z "$PRESET_LDFLAGS"; then
138 if test "$GCC" = "yes"; then
139 case "$host" in
140 *)
141 # nothing
142 ;;
143 esac
81a820c6 144 else
145 case "$host" in
c415c128 146 *mips-sgi-irix6.*)
81a820c6 147 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
c415c128 148 LDFLAGS="-n32 -mips3 -nostdlib -L/usr/lib32"
81a820c6 149 ;;
150 esac
30a4f2a8 151 fi
152fi
2060fa9a 153
e5f4e1b0 154dnl Enable optional modules
155AC_ARG_ENABLE(dlmalloc,
94d48591 156[ --enable-dlmalloc[=LIB] Compile & use the malloc package by Doug Lea],
e5f4e1b0 157[
94d48591 158 case "$enableval" in
159 'yes')
029ce4ae 160 use_dlmalloc="yes"
94d48591 161 LIBDLMALLOC="libdlmalloc.a"
162 LIB_MALLOC="-L../lib -ldlmalloc"
029ce4ae 163 echo "dlmalloc enabled"
94d48591 164 ;;
165 'no')
029ce4ae 166 use_dlmalloc="no"
167 echo "dlmalloc disabled"
94d48591 168 ;;
029ce4ae 169 *) use_dlmalloc="yes"
170 LIB_MALLOC="$enableval"
171 echo "dlmalloc enabled with $LIB_MALLOC"
172 esac
173])
174if test "${use_dlmalloc-unset}" = unset; then
175 case "$host" in
176 i386-*-solaris2.*)
177 echo "Enabling dlmalloc for $host"
178 use_dlmalloc="yes"
d20b1cd0 179 LIBDLMALLOC="libdlmalloc.a"
180 LIB_MALLOC="-L../lib -ldlmalloc"
029ce4ae 181 ;;
e8dbaa90 182 *-sgi-irix*)
183 echo "Enabling dlmalloc for $host"
184 use_dlmalloc="yes"
185 LIBDLMALLOC="libdlmalloc.a"
186 LIB_MALLOC="-L../lib -ldlmalloc"
187 ;;
029ce4ae 188 esac
189fi
190if test "x$ac_cv_enabled_dlmalloc" = "xyes"; then
191 # Ok. dlmalloc was enabled before, but state may be changed.
192 # we have to test these again
193 unset ac_cv_func_mallinfo
194 unset ac_cv_func_mallocblksize
195 unset ac_cv_func_free
196 unset ac_cv_func_realloc
197 unset ac_cv_func_memalign
198 unset ac_cv_func_valloc
199 unset ac_cv_func_pvalloc
200 unset ac_cv_func_calloc
201 unset ac_cv_func_cfree
202 unset ac_cv_func_malloc_trim
203 unset ac_cv_func_malloc_usable_size
204 unset ac_cv_func_malloc_stats
205 unset ac_cv_func_mallinfo
206 unset ac_cv_func_mallopt
207 unset ac_cv_lib_gnumalloc
208 unset ac_cv_header_gnumalloc_h
209 unset ac_cv_lib_malloc
210 unset ac_cv_enabled_dlmalloc
211fi
212if test "$use_dlmalloc" = yes; then
94d48591 213 ac_cv_func_mallinfo="yes"
214 ac_cv_func_mallocblksize="no"
215 ac_cv_func_free="yes"
216 ac_cv_func_realloc="yes"
217 ac_cv_func_memalign="yes"
218 ac_cv_func_valloc="yes"
219 ac_cv_func_pvalloc="yes"
220 ac_cv_func_calloc="yes"
221 ac_cv_func_cfree="yes"
222 ac_cv_func_malloc_trim="yes"
223 ac_cv_func_malloc_usable_size="yes"
224 ac_cv_func_malloc_stats="yes"
94d48591 225 ac_cv_func_mallopt="yes"
226 ac_cv_lib_gnumalloc="no"
85efe3ec 227 ac_cv_header_gnumalloc_h="no"
94d48591 228 ac_cv_lib_malloc="no"
229 ac_cv_enabled_dlmalloc="yes"
6a9f6389 230 AC_DEFINE(USE_DLMALLOC, 1, [Compile & use the malloc package by Doug Lea])
029ce4ae 231fi
232
e5f4e1b0 233AC_SUBST(LIBDLMALLOC)
234AC_SUBST(LIB_MALLOC)
235
236AC_ARG_ENABLE(gnuregex,
237[ --enable-gnuregex Compile GNUregex],
238[USE_GNUREGEX=$enableval])
239
6c0c04db 240SquidInline="yes"
83079644 241
242AC_ARG_ENABLE(optimizations,
243[ --disable-optimizations Don't compile Squid with compiler optimizations enabled.
244 Optimization is good for production builds, but not
245 good for debugging. During development, use
246 --disable-optimizations to reduce compilation times
247 and allow easier debugging. This option implicitly
248 also enabled --disable-inline],
249[ if test "$enableval" = "no" ; then
250 echo "Disabling compiler optimizations (-O flag)"
251 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
252 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-O[[0-9]]*//'`"
253 SquidInline="no"
254 fi
255])
256
6c0c04db 257AC_ARG_ENABLE(inline,
258[ --disable-inline Don't compile trivial methods as inline. Squid
83079644 259 is coded with much of the code able to be inlined.
260 Inlining is good for production builds, but not
6c0c04db 261 good for development. During development, use
262 --disable-inline to reduce compilation times and
263 allow incremental builds to be quick. For
264 production builds, or load tests, use
265 --enable-inline to have squid make all trivial
266 methods inlinable by the compiler.],
267[ if test "$enableval" = "no" ; then
268 SquidInline="no"
269 fi
270])
271
272if test "$SquidInline" = "yes" ; then
273 AC_DEFINE(_SQUID_INLINE_, inline, [Keyword used by squid for inlining methods])
274 AC_DEFINE(_USE_INLINE_,, [Include inline methods into header file])
275else
83079644 276 echo "Inlining optimization disabled"
6c0c04db 277 AC_DEFINE(_SQUID_INLINE_,, [Keyword used by squid for inlining methods])
278fi
279
fa80a8ef 280AC_ARG_ENABLE(debug-cbdata,
281[ --enable-debug-cbdata Provide some debug information in cbdata],
282[ if test "$enableval" = "yes" ; then
283 echo "cbdata debugging enabled"
6a9f6389 284 AC_DEFINE(CBDATA_DEBUG,1,[Enable for cbdata debug information])
fa80a8ef 285 fi
286])
287
0961c811 288dnl This is a developer only option.. developers know how to set defines
289dnl
290dnl AC_ARG_ENABLE(xmalloc-debug,
291dnl [ --enable-xmalloc-debug Do some simple malloc debugging],
292dnl [ if test "$enableval" = "yes" ; then
293dnl echo "Malloc debugging enabled"
6a9f6389 294dnl AC_DEFINE(XMALLOC_DEBUG,1,[Define to do simple malloc debugging])
0961c811 295dnl fi
296dnl ])
297
298dnl This is a developer only option.. developers know how to set defines
299dnl
300dnl AC_ARG_ENABLE(xmalloc-debug-trace,
301dnl [ --enable-xmalloc-debug-trace
302dnl Detailed trace of memory allocations],
303dnl [ if test "$enableval" = "yes" ; then
304dnl echo "Malloc debug trace enabled"
6a9f6389 305dnl AC_DEFINE(XMALLOC_TRACE,1,[Define to have a detailed trace of memory allocations])
306dnl AC_DEFINE(XMALLOC_DEBUG,1)
0961c811 307dnl fi
308dnl ])
e5f4e1b0 309
d9180414 310AC_ARG_ENABLE(xmalloc-statistics,
e5f4e1b0 311[ --enable-xmalloc-statistics
312 Show malloc statistics in status page],
313[ if test "$enableval" = "yes" ; then
314 echo "Malloc statistics enabled"
6a9f6389 315 AC_DEFINE(XMALLOC_STATISTICS,1,[Define to have malloc statistics])
e5f4e1b0 316 fi
317])
318
14b32873 319use_carp=1
323fe0d4 320AC_ARG_ENABLE(carp,
f7c8dc02 321[ --disable-carp Disable CARP support],
322[ if test "$enableval" = "no" ; then
323 echo "CARP disabled"
14b32873 324 use_carp=0
323fe0d4 325 fi
f7c8dc02 326])
14b32873 327if test $use_carp = 1; then
328 AC_DEFINE(USE_CARP, 1, [Cache Array Routing Protocol])
329else
330 AC_DEFINE(USE_CARP, 1)
331fi
323fe0d4 332
cd748f27 333AC_ARG_ENABLE(async-io,
9bc73deb 334[ --enable-async-io[=N_THREADS]
cd748f27 335 Shorthand for
f85c88f3 336 --with-aufs-threads=N_THREADS
cd748f27 337 --with-pthreads
338 --enable-storeio=ufs,aufs],
339[ case $enableval in
9bc73deb 340 yes)
69144041 341 with_pthreads="yes"
cd748f27 342 STORE_MODULES="ufs aufs"
9bc73deb 343 ;;
344 no)
9bc73deb 345 ;;
346 *)
f85c88f3 347 aufs_io_threads=$enableval
69144041 348 with_pthreads="yes"
cd748f27 349 STORE_MODULES="ufs aufs"
9bc73deb 350 ;;
351 esac
352])
353
f85c88f3 354AC_ARG_WITH(aufs-threads,
355[ --with-aufs-threads=N_THREADS
cd748f27 356 Tune the number of worker threads for the aufs object
357 store.],
a3310b77 358[ case $withval in
359 [[0-9]]*)
360 aufs_io_threads=$withval
361 ;;
362 *)
363 echo "ERROR: Invalid --with-aufs-threads argument"
364 exit 1
365 ;;
366 esac
367])
f85c88f3 368if test "$aufs_io_threads"; then
369 echo "With $aufs_io_threads aufs threads"
6a9f6389 370 AC_DEFINE_UNQUOTED(AUFS_IO_THREADS,$aufs_io_threads,
371 [Defines how many threads aufs uses for I/O])
cd748f27 372fi
373
374AC_ARG_WITH(pthreads,
8154dd82 375[ --with-pthreads Use POSIX Threads])
376if test "$with_pthreads" = "yes"; then
cd748f27 377 echo "With pthreads"
9bc73deb 378fi
e5f4e1b0 379
f85c88f3 380AC_ARG_WITH(aio,
8154dd82 381[ --with-aio Use POSIX AIO])
382if test "$with_aio" = "yes"; then
f85c88f3 383 echo "With aio"
f85c88f3 384fi
8154dd82 385
386AC_ARG_WITH(dl,
387[ --with-dl Use dynamic linking])
388if test "$with_dl" = "yes"; then
389 echo "With dl"
390fi
f85c88f3 391
cd748f27 392AC_ARG_ENABLE(storeio,
393[ --enable-storeio=\"list of modules\"
394 Build support for the list of store I/O modules.
395 The default is only to build the "ufs" module.
396 See src/fs for a list of available modules, or
397 Programmers Guide section <not yet written>
398 for details on how to build your custom store module],
399[ case $enableval in
400 yes)
1c690e30 401 for dir in $srcdir/src/fs/*; do
402 module="`basename $dir`"
403 if test -d "$dir" && test "$module" != CVS; then
404 STORE_MODULES="$STORE_MODULES $module"
8154dd82 405 fi
cd748f27 406 done
407 ;;
408 no)
409 ;;
1c690e30 410 *)
411 STORE_MODULES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
cd748f27 412 ;;
413 esac
414],
415[ if test -z "$STORE_MODULES"; then
416 STORE_MODULES="ufs"
417 fi
418])
1c690e30 419if test -n "$STORE_MODULES"; then
420 for module in $STORE_MODULES; do
421 if test -d $srcdir/src/fs/$module; then
422 :
423 else
424 echo "ERROR: storeio $module does not exists"
425 exit 1
426 fi
427 done
428 echo "Store modules built: $STORE_MODULES"
429 STORE_OBJS="fs/lib`echo $STORE_MODULES|sed -e 's% %.a fs/lib%g'`.a"
430 STORE_LIBS="`echo $STORE_OBJS|sed -e 's%fs/%%g'`"
59b2d47f 431 STORE_LINKOBJS=
432 for module in $STORE_MODULES; do
433 STORE_LINKOBJS="$STORE_LINKOBJS fs/${module}/StoreFS${module}.o"
434 done
1c690e30 435fi
a2794549 436dnl remove all but diskd - its the only module that needs to recurse
437dnl into the sub directory
438STORE_MODULE_SUBDIRS=
d3b3ab85 439UFS_FOUND=
1c690e30 440NEED_UFS=
a2794549 441for fs in $STORE_MODULES none; do
8154dd82 442 case "$fs" in
443 diskd)
a2794549 444 STORE_MODULE_SUBDIRS="$STORE_MODULE_SUBDIRS $fs"
4f46650a 445 STORE_PROGRAMS="$STORE_PROGRAMS diskd/diskd"
1c690e30 446 NEED_UFS="true"
8154dd82 447 ;;
448 aufs)
449 if test -z "$with_pthreads"; then
450 echo "aufs store used, pthreads support automatically enabled"
451 with_pthreads=yes
452 fi
1c690e30 453 NEED_UFS="true"
8154dd82 454 ;;
455 coss)
456 if test -z "$with_aio"; then
457 echo "coss store used, aio support automatically enabled"
458 with_aio=yes
459 fi
460 ;;
d3b3ab85 461 ufs)
462 UFS_FOUND="true"
8154dd82 463 esac
a2794549 464done
d3b3ab85 465
1c690e30 466if test -z "$UFS_FOUND" && test -n "$NEED_UFS"; then
d3b3ab85 467 echo "adding UFS, as it contains core logic for diskd and aufs"
468 STORE_OBJS="$STORE_OBJS fs/libufs.a"
d3b3ab85 469 STORE_LIBS="$STORE_LIBS libufs.a"
d3b3ab85 470 STORE_MODULES="$STORE_MODULES ufs"
59b2d47f 471 STORE_LINKOBJS="$STORE_SOURCE fs/ufs/StoreFSufs.o"
d3b3ab85 472fi
473
1c690e30 474AC_SUBST(STORE_OBJS)
475AC_SUBST(STORE_LIBS)
4f46650a 476AC_SUBST(STORE_PROGRAMS)
a2794549 477AC_SUBST(STORE_MODULE_SUBDIRS)
59b2d47f 478AC_SUBST(STORE_LINKOBJS)
a2794549 479
d9180414 480AC_ARG_ENABLE(removal-policies,
6a566b9c 481[ --enable-removal-policies=\"list of policies\"
482 Build support for the list of removal policies.
483 The default is only to build the "lru" module.
484 See src/repl for a list of available modules, or
485 Programmers Guide section 9.9 for details on how
486 to build your custom policy],
487[ case $enableval in
488 yes)
1c690e30 489 for dir in $srcdir/src/repl/*; do
490 module="`basename $dir`"
491 if test -d "$dir" && test "$module" != CVS; then
492 REPL_POLICIES="$REPL_POLICIES $module"
6a566b9c 493 fi
494 done
495 ;;
496 no)
497 ;;
1c690e30 498 *)
499 REPL_POLICIES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
6a566b9c 500 ;;
501 esac
502],
503[ if test -z "$REPL_POLICIES"; then
504 REPL_POLICIES="lru"
505 fi
506])
1c690e30 507if test -n "$REPL_POLICIES"; then
508 for module in $REPL_POLICIES; do
509 if test -d $srcdir/src/repl/$module; then
510 :
511 else
512 echo "ERROR: Removal policy $module does not exists"
513 exit 1
514 fi
515 done
516 echo "Removal policies built: $REPL_POLICIES"
517 REPL_OBJS="repl/lib`echo $REPL_POLICIES|sed -e 's% %.a repl/lib%g'`.a"
518 REPL_LIBS="`echo $REPL_OBJS|sed -e 's%repl/%%g'`"
519fi
6a566b9c 520AC_SUBST(REPL_POLICIES)
6a566b9c 521AC_SUBST(REPL_OBJS)
f71946fc 522AC_SUBST(REPL_LIBS)
6a566b9c 523
d1da2d1f 524AM_CONDITIONAL(ENABLE_PINGER, false)
e5f4e1b0 525AC_ARG_ENABLE(icmp,
526[ --enable-icmp Enable ICMP pinging],
527[ if test "$enableval" = "yes" ; then
528 echo "ICMP enabled"
6a9f6389 529 AC_DEFINE(USE_ICMP,1,
530 [If you want to use Squid's ICMP features (highly recommended!) then
531 define this. When USE_ICMP is defined, Squid will send ICMP pings
532 to origin server sites. This information is used in numerous ways:
533 - Sent in ICP replies so neighbor caches know how close
534 you are to the source.
535 - For finding the closest instance of a URN.
536 - With the 'test_reachability' option. Squid will return
537 ICP_OP_MISS_NOFETCH for sites which it cannot ping.])
d1da2d1f 538 AM_CONDITIONAL(ENABLE_PINGER, true)
e5f4e1b0 539 fi
540])
541
a2794549 542AM_CONDITIONAL(USE_DELAY_POOLS, false)
d9180414 543AC_ARG_ENABLE(delay-pools,
76d83c52 544[ --enable-delay-pools Enable delay pools to limit bandwidth usage],
e5f4e1b0 545[ if test "$enableval" = "yes" ; then
95e36d02 546 echo "Delay pools enabled"
6a9f6389 547 AC_DEFINE([DELAY_POOLS],1,[Traffic management via "delay pools".])
548 AM_CONDITIONAL(USE_DELAY_POOLS, true,)
e5f4e1b0 549 fi
550])
551
43ae1d95 552AM_CONDITIONAL(USE_ESI, false)
553AC_ARG_ENABLE(esi,
554 AC_HELP_STRING([--enable-esi],[Enable ESI for accelerators. Requires libexpat. Enabling ESI will cause squid to follow the Edge Acceleration Specification (www.esi.org). This causes squid to IGNORE client Cache-Control headers. DO NOT use this in a squid configured as a web proxy, ONLY use it in a squid configured for webserver acceleration.]),
555 ac_cv_use_esi=$enableval, ac_cv_use_esi=no)
556AC_CACHE_CHECK(whether to enable ESI,ac_cv_use_esi, ac_cv_use_esi=no)
557if test "$ac_cv_use_esi" = "yes" ; then
558 AC_DEFINE(ESI,1,[Compile the ESI processor and Surrogate header support])
559 AM_CONDITIONAL(USE_ESI, true)
560 XTRA_LIBS="$XTRA_LIBS -lexpat"
a787b56a 561else
562 AC_DEFINE(ESI,0,[Compile the ESI processor and Surrogate header support])
43ae1d95 563fi
564
0961c811 565dnl This is a developer only option. Developers know how to set defines
566dnl
567dnl AC_ARG_ENABLE(mem-gen-trace,
568dnl [ --enable-mem-gen-trace Do trace of memory stuff],
569dnl [ if test "$enableval" = "yes" ; then
570dnl echo "Memory trace (to file) enabled"
6a9f6389 571dnl AC_DEFINE(MEM_GEN_TRACE,1,[Define for log file trace of mem alloc/free])
0961c811 572dnl fi
573dnl ])
36a97e19 574
d9180414 575AC_ARG_ENABLE(useragent-log,
e5f4e1b0 576[ --enable-useragent-log Enable logging of User-Agent header],
577[ if test "$enableval" = "yes" ; then
578 echo "User-Agent logging enabled"
6a9f6389 579 AC_DEFINE(USE_USERAGENT_LOG,1,[If you want to log User-Agent request header values, define this.
580 By default, they are written to useragent.log in the Squid log
581 directory.])
e5f4e1b0 582 fi
583])
584
dfca7e1a 585AC_ARG_ENABLE(referer-log,
0961c811 586[ --enable-referer-log Enable logging of Referer header],
dfca7e1a 587[ if test "$enableval" = "yes" ; then
588 echo "Referer logging enabled"
6a9f6389 589 AC_DEFINE(USE_REFERER_LOG,1,[If you want to log Referer request header values, define this.
590 By default, they are written to referer.log in the Squid log
591 directory.])
dfca7e1a 592 fi
593])
594
14b32873 595use_wccp=1
320e9f36 596AC_ARG_ENABLE(wccp,
0961c811 597[ --disable-wccp Disable Web Cache Coordination Protocol],
eb824054 598[ if test "$enableval" = "no" ; then
599 echo "Web Cache Coordination Protocol disabled"
14b32873 600 use_wccp=0
320e9f36 601 fi
602])
14b32873 603if test $use_wccp = 1; then
604 AC_DEFINE(USE_WCCP, 1,[Define to enable WCCP])
605else
606 AC_DEFINE(USE_WCCP, 0)
607fi
320e9f36 608
d9180414 609AC_ARG_ENABLE(kill-parent-hack,
9fc0b4b8 610[ --enable-kill-parent-hack
611 Kill parent on shutdown],
e5f4e1b0 612[ if test "$enableval" = "yes" ; then
613 echo "Kill parent on shutdown"
6a9f6389 614 AC_DEFINE(KILL_PARENT_OPT,1,[A dangerous feature which causes Squid to kill its parent process
615 (presumably the RunCache script) upon receipt of SIGTERM or SIGINT.
616 Use with caution.])
e5f4e1b0 617 fi
618])
619
a2794549 620AM_CONDITIONAL(USE_SNMP, false)
e5f4e1b0 621AC_ARG_ENABLE(snmp,
622[ --enable-snmp Enable SNMP monitoring],
623[ if test "$enableval" = "yes" ; then
624 echo "SNMP monitoring enabled"
6a9f6389 625 AC_DEFINE(SQUID_SNMP,1,[Define to enable SNMP monitoring of Squid])
e5f4e1b0 626 SNMPLIB='-L../snmplib -lsnmp'
a2794549 627 AM_CONDITIONAL(USE_SNMP, true)
8a7f0105 628 SNMP_MAKEFILE=./snmplib/Makefile
e5f4e1b0 629 makesnmplib=snmplib
630 fi
631])
632AC_SUBST(SNMPLIB)
e5f4e1b0 633AC_SUBST(makesnmplib)
634
d9180414 635AC_ARG_ENABLE(cachemgr-hostname,
e5f4e1b0 636[ --enable-cachemgr-hostname[=hostname]
637 Make cachemgr.cgi default to this host],
638[ case $enableval in
639 yes)
6a9f6389 640 AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()],
641 [If you are upset that the cachemgr.cgi form comes up with the hostname field blank, then define this to getfullhostname()])
e5f4e1b0 642 echo "Cachemgr default hostname == host where cachemgr runs"
643 ;;
644 no)
645 : # Nothing to do..
646 ;;
647 *)
648 AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
649 echo "Cachemgr default hostname set to ${enableval}"
650 ;;
651 esac
652])
653
b0dd28ba 654AM_CONDITIONAL(ENABLE_ARP_ACL, false)
d9180414 655AC_ARG_ENABLE(arp-acl,
e5f4e1b0 656[ --enable-arp-acl Enable use of ARP ACL lists (ether address)],
657[ if test "$enableval" = "yes" ; then
658 echo "ARP ACL lists enabled (ether address)"
933cc58d 659 case "$host" in
ef614b1c 660 *-linux-*)
661 ;;
662 *-solaris-*)
a931a29b 663 ;;
933cc58d 664 *)
ef614b1c 665 echo "WARNING: ARP ACL support probably won't work on $host."
933cc58d 666 sleep 10
667 ;;
668 esac
6a9f6389 669 AC_DEFINE(USE_ARP_ACL,1,[Define this to include code which lets you specify access control elements based on ethernet hardware addresses. This code uses functions found in 4.4 BSD derviations (e.g. FreeBSD, ?).])
b0dd28ba 670 AM_CONDITIONAL(ENABLE_ARP_ACL, true)
e5f4e1b0 671 fi
672])
673
a2794549 674AM_CONDITIONAL(ENABLE_HTCP, false)
74075210 675AC_ARG_ENABLE(htcp,
88b7de25 676[ --enable-htcp Enable HTCP protocol],
b4b8b6da 677[ if test "$enableval" = "yes" ; then
678 echo "HTCP enabled"
6a9f6389 679 AC_DEFINE(USE_HTCP,1, [Define this to include code for the Hypertext Cache Protocol (HTCP)])
a2794549 680 AM_CONDITIONAL(ENABLE_HTCP, true)
b4b8b6da 681 fi
74075210 682])
a2794549 683
684AM_CONDITIONAL(ENABLE_SSL, false)
74075210 685
1f7c9178 686AC_ARG_ENABLE(ssl,
687[ --enable-ssl Enable ssl gatewaying support using OpenSSL],
688[ if test "$enableval" != "no"; then
3dff197f 689 echo "SSL gatewaying using OpenSSL enabled"
6a9f6389 690 AC_DEFINE(USE_SSL,1,[Define this to include code for SSL encryption.])
a2794549 691 AM_CONDITIONAL(ENABLE_SSL, true)
1f7c9178 692 SSLLIB='-lssl -lcrypto'
693 USE_OPENSSL=1
694 fi
695])
696
3dff197f 697AM_CONDITIONAL(NEED_OWN_MD5, true)
698
1f7c9178 699AC_ARG_WITH(openssl,
700[ --with-openssl[=prefix]
701 Compile with the OpenSSL libraries. The path to
702 the OpenSSL development libraries and headers
703 installation can be specified if outside of the
704 system standard directories],
705[
46ce628c 706 case "$with_openssl" in
1f7c9178 707 yes)
708 USE_OPENSSL=1
709 ;;
710 no)
711 USE_OPENSSL=
712 ;;
713 *)
46ce628c 714 SSLLIBDIR="$with_openssl/lib"
bcce53ce 715 CPPFLAGS="-I$with_openssl/include $CPPFLAGS"
1f7c9178 716 USE_OPENSSL=1
717 esac
718])
719
720if test -n "$USE_OPENSSL"; then
3dff197f 721 echo "Using OpenSSL MD5 implementation"
6a9f6389 722 AC_DEFINE(USE_OPENSSL,1,[Define this to make use of the OpenSSL libraries for MD5 calculation rather than Squid's own MD5 implementation or if building with SSL encryption (USE_SSL)])
3dff197f 723 AM_CONDITIONAL(NEED_OWN_MD5, false)
1f7c9178 724 if test -z "$SSLLIB"; then
725 SSLLIB="-lcrypto" # for MD5 routines
726 fi
f11555e0 727 dnl This is a workaround for RedHat 9 brain damage..
728 if test -d /usr/kerberos/include && test -z "$SSLLIBDIR" && test -f /usr/include/openssl/kssl.h; then
729 echo "OpenSSL depends on Kerberos"
730 SSLLIBDIR="/usr/kerberos/lib"
731 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
732 fi
1f7c9178 733fi
734if test -n "$SSLLIBDIR"; then
735 SSLLIB="-L$SSLLIBDIR $SSLLIB"
736fi
1f7c9178 737AC_SUBST(SSLLIB)
738
02749868 739AC_ARG_ENABLE(forw-via-db,
740[ --enable-forw-via-db Enable Forw/Via database],
741[ if test "$enableval" = "yes" ; then
742 echo "FORW-VIA enabled"
6a9f6389 743 AC_DEFINE(FORW_VIA_DB,1,[Enable Forw/Via database])
02749868 744 fi
745])
746
6cfa8966 747AC_ARG_ENABLE(cache-digests,
22df58ea 748[ --enable-cache-digests Use Cache Digests
2b6662ba 749 see http://www.squid-cache.org/FAQ/FAQ-16.html],
484f2ebc 750[ if test "$enableval" = "yes" ; then
6cfa8966 751 echo "USE_CACHE_DIGESTS enabled"
6a9f6389 752 AC_DEFINE(USE_CACHE_DIGESTS,1,[Use Cache Digests for locating objects in neighbor caches. This code is still semi-experimental.])
484f2ebc 753 fi
754])
755
8c3926c5 756dnl Select Default Error language
757AC_ARG_ENABLE(default-err-language,
758[ --enable-default-err-language=lang
0961c811 759 Select default language for Error pages (see
760 errors directory) ],
933cc58d 761[
cf9d704a 762 if test -d $srcdir/errors/$enableval; then
8c3926c5 763 ERR_DEFAULT_LANGUAGE=$enableval
933cc58d 764 else
0961c811 765 echo "ERROR! Unknown language $enableval, see errors/ directory"
933cc58d 766 exit 1
767 fi
8c3926c5 768],[ERR_DEFAULT_LANGUAGE="English"])
769AC_SUBST(ERR_DEFAULT_LANGUAGE)
770
771dnl Select languages to be installed
772AC_ARG_ENABLE(err-languages,
773[ --enable-err-languages=\"lang1 lang2..\"
0961c811 774 Select languages to be installed. (All will be
775 installed by default) ],
8c3926c5 776[
777 for l in $enableval; do
778 if test -d $srcdir/errors/$l; then :; else
779 echo "ERROR! Unknown language $$l, see errors/"
780 exit 1
781 fi
782 done
783 ERR_LANGUAGES=$enableval
784],[
785 ERR_LANGUAGES=
786 for l in $srcdir/errors/*; do
cbbe101f 787 if test -f $l/ERR_ACCESS_DENIED; then
8c3926c5 788 ERR_LANGUAGES="$ERR_LANGUAGES `basename $l`"
789 fi
790 done
791])
792AC_SUBST(ERR_LANGUAGES)
933cc58d 793
cd748f27 794dnl Size of COSS memory buffer
795AC_ARG_WITH(coss-membuf-size,
796[ --with-coss-membuf-size COSS membuf size (default 1048576 bytes) ],
797[ if test "$with_coss_membuf_size"; then
798 echo "Setting COSS membuf size to $with_coss_membuf_size bytes"
6a9f6389 799 AC_DEFINE_UNQUOTED(COSS_MEMBUF_SZ, $with_coss_membuf_size,[Define if you want to set the COSS membuf size])
cd748f27 800 fi
801])
802
1b3db6d9 803dnl check for netio plugin stuff
9bb83c8b 804dnl Enable poll()
805AC_ARG_ENABLE(poll,
0961c811 806[ --enable-poll Enable poll() support.
807 --disable-poll Disable poll() support. ],
1b3db6d9 808
809[
c68e9c6b 810 case "$enableval" in
811 yes)
9bb83c8b 812 echo "Forcing poll() to be enabled"
813 ac_cv_func_poll='yes'
c68e9c6b 814 ;;
815 no)
816 echo "Forcing poll() to be disabled"
817 ac_cv_func_poll='no'
818 ;;
819 esac
9bb83c8b 820])
821
1b3db6d9 822dnl Enable select()
823AC_ARG_ENABLE(select,
0961c811 824[ --enable-select Enable select() support.
825 --disable-select Disable select() support. ],
1b3db6d9 826
827[
828 case "$enableval" in
829 yes)
830 echo "Forcing select() to be enabled"
831 ac_cv_func_select='yes'
832 ;;
833 no)
834 echo "Forcing select() to be disabled"
835 ac_cv_func_select='no'
836 ;;
837 esac
838])
839
840dnl Enable kqueue()
841AC_ARG_ENABLE(kqueue,
0961c811 842[ --enable-kqueue Enable kqueue() support.
843 --disable-kqueue Disable kqueue() support. ],
1b3db6d9 844
845[
846 case "$enableval" in
847 yes)
848 echo "Forcing kqueue() to be enabled"
849 ac_cv_func_kqueue='yes'
850 ;;
851 no)
852 echo "Forcing kqueue() to be disabled"
853 ac_cv_func_kqueue='no'
854 ;;
855esac
856])
857
a46d2c0e 858dnl Enable epoll()
859AM_CONDITIONAL(USE_EPOLL, false)
46f849f7 860AC_DEFINE(USE_EPOLL,0,[Use epoll type polling])
a46d2c0e 861AC_ARG_ENABLE(epoll,
862[ --enable-epoll Enable epoll() support.
863 --disable-epoll Disable epoll() support. ],
864
865[
866 case "$enableval" in
867 yes)
868 echo "Forcing epoll() to be enabled"
869 ac_cv_func_epoll='yes'
870 if test -z "$EPOLL_LIBS"; then
871 EPOLL_LIBS="-lepoll"
872 fi
873 AC_SUBST(EPOLL_LIBS)
46f849f7 874 AM_CONDITIONAL(USE_EPOLL, true)
a46d2c0e 875 ;;
876 no)
877 echo "Forcing epoll() to be disabled"
878 ac_cv_func_epoll='no'
879 ;;
880esac
881])
882
883
72fd085a 884dnl Disable HTTP violations
14b32873 885http_violations=1
72fd085a 886AC_ARG_ENABLE(http-violations,
887[ --disable-http-violations
888 This allows you to remove code which is known to
c68e9c6b 889 violate the HTTP protocol specification.],
72fd085a 890[ if test "$enableval" = "no" ; then
891 echo "Disabling HTTP Violations"
14b32873 892 http_violations=0
72fd085a 893 fi
894])
14b32873 895if test $http_violations = 1; then
896 AC_DEFINE(HTTP_VIOLATIONS, 1,[By default (for now anyway) Squid includes options which allows the cache administrator to violate the HTTP protocol specification in terms of cache behaviour. Setting this to '0' will disable such code.])
897else
898 AC_DEFINE(HTTP_VIOLATIONS, 0)
899fi
72fd085a 900
5cafc1d6 901dnl Enable IP-Filter Transparent Proxy
902AC_ARG_ENABLE(ipf-transparent,
903[ --enable-ipf-transparent
904 Enable Transparent Proxy support for systems
c68e9c6b 905 using IP-Filter network address redirection.],
5cafc1d6 906[ if test "$enableval" = "yes" ; then
907 echo "IP-Filter Transparent Proxy enabled"
6a9f6389 908 AC_DEFINE(IPF_TRANSPARENT,1,[Enable support for Transparent Proxy on systems using IP-Filter address redirection. This provides "masquerading" support for non Linux system.])
5cafc1d6 909 IPF_TRANSPARENT="yes"
910 fi
911])
912
2b0dd4ac 913dnl Enable PF Transparent Proxy
914AC_ARG_ENABLE(pf-transparent,
915[ --enable-pf-transparent
916 Enable Transparent Proxy support for systems
917 using PF network address redirection.],
918[ if test "$enableval" = "yes" ; then
919 echo "PF Transparent Proxy enabled"
6a9f6389 920 AC_DEFINE(PF_TRANSPARENT,1,[Enable support for Transparent Proxy on systems using PF address redirection. This provides "masquerading" support for OpenBSD.])
2b0dd4ac 921 PF_TRANSPARENT="yes"
922 fi
923])
924
d852fbad 925dnl Enable Linux Netfilter (2.4) Transparent Proxy
926AC_ARG_ENABLE(linux-netfilter,
927[ --enable-linux-netfilter
928 Enable Transparent Proxy support for Linux 2.4.],
929[ if test "$enableval" = "yes" ; then
930 echo "Linux-Netfilter Transparent Proxy enabled"
6a9f6389 931 AC_DEFINE(LINUX_NETFILTER,1,[Enable support for Transparent Proxy on Linux 2.4 systems])
d852fbad 932 LINUX_NETFILTER="yes"
933 fi
934])
935
bb7b5fd0 936dnl Enable Large file support
937AC_ARG_ENABLE(large-files,
938[ --enable-large-files Enable support for large files (>2GB). Still
939 experimental.],
940[ if test "$enableval" = "yes" ; then
941 echo "Large file support enabled"
942 CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64"
680ae450 943 CXXFLAGS="$CXXFLAGS -D_FILE_OFFSET_BITS=64"
bb7b5fd0 944 fi
945])
946
a2794549 947AM_CONDITIONAL(MAKE_LEAKFINDER, false)
5d620373 948dnl Enable Leak Finding Functions
949AC_ARG_ENABLE(leakfinder,
950[ --enable-leakfinder
951 Enable Leak Finding code. Enabling this alone
952 does nothing; you also have to modify the source
953 code to use the leak finding functions. Probably
954 Useful for hackers only.],
955[ if test "$enableval" = "yes" ; then
956 echo "Leak-Finding enabled"
6a9f6389 957 AC_DEFINE(USE_LEAKFINDER,1,[Enable code for assisting in finding memory leaks. Hacker stuff only.])
5d620373 958 USE_LEAKFINDER="yes"
a2794549 959 AM_CONDITIONAL(MAKE_LEAKFINDER, true)
5d620373 960 fi
961])
5d620373 962
14b32873 963use_ident=1
3898f57f 964AC_ARG_ENABLE(ident-lookups,
965[ --disable-ident-lookups
966 This allows you to remove code that performs
967 Ident (RFC 931) lookups.],
968[ if test "$enableval" = "no" ; then
969 echo "Disabling Ident Lookups"
14b32873 970 use_ident=0
3898f57f 971 fi
972])
14b32873 973if test $use_ident = 1; then
974 AC_DEFINE(USE_IDENT, 1,[Compile in support for Ident (RFC 931) lookups? Enabled by default.])
8000a965 975 AM_CONDITIONAL(ENABLE_IDENT, true)
14b32873 976else
977 AC_DEFINE(USE_IDENT, 0)
8000a965 978 AM_CONDITIONAL(ENABLE_IDENT, false)
14b32873 979fi
3898f57f 980
a2794549 981AM_CONDITIONAL(USE_DNSSERVER, false)
3c573763 982use_dnsserver=
eb824054 983AC_ARG_ENABLE(internal-dns,
7e3ce7b9 984[ --disable-internal-dns This prevents Squid from directly sending and
eb824054 985 receiving DNS messages, and instead enables the
986 old external 'dnsserver' processes.],
987[ if test "$enableval" = "no" ; then
988 echo "Disabling Internal DNS queries"
3c573763 989 use_dnsserver="yes"
eb824054 990 fi
991])
3c573763 992if test "$use_dnsserver" = "yes"; then
6a9f6389 993 AC_DEFINE(USE_DNSSERVERS,1,[Use dnsserver processes instead of the internal DNS protocol support])
a2794549 994 AM_CONDITIONAL(USE_DNSSERVER, true)
3c573763 995fi
eb824054 996
997AC_ARG_ENABLE(truncate,
7e3ce7b9 998[ --enable-truncate This uses truncate() instead of unlink() when
eb824054 999 removing cache files. Truncate gives a little
1000 performance improvement, but may cause problems
1001 when used with async I/O. Truncate uses more
1002 filesystem inodes than unlink..],
1003[ if test "$enableval" = "yes" ; then
1004 echo "Enabling truncate instead of unlink"
6a9f6389 1005 AC_DEFINE(USE_TRUNCATE,1,[Do we want to use truncate(2) or unlink(2)?])
eb824054 1006 fi
1007])
1008
4fa7a4ba 1009dnl Disable hostname checks
8fca0346 1010enable_hostname_checks=0
4fa7a4ba 1011AC_ARG_ENABLE(hostname_checks,
8fca0346 1012[ --enable-hostname-checks
1013 Tells Squid to rejects any host names with
4fa7a4ba 1014 odd characters in their name to conform with
8fca0346 1015 internet standards. This was the default in
1016 prior Squid versions, but since Squid-3 Squid
1017 no longer tries to police the use of DNS],
1018[ if test "$enableval" = "yes"; then
801d5137 1019 echo "Enabling hostname sanity checks"
8fca0346 1020 enable_hostname_checks=1
4fa7a4ba 1021 fi
1022])
1023if test "$enable_hostname_checks" = 1; then
1024 AC_DEFINE(CHECK_HOSTNAMES, 1, [Enable hostname sanity checks])
1025fi
1026
9bc73deb 1027dnl Enable underscore in hostnames
1028AC_ARG_ENABLE(underscores,
1029[ --enable-underscores Squid by default rejects any host names with _
76d83c52 1030 in their name to conform with internet standards.
9bc73deb 1031 If you disagree with this you may allow _ in
1032 hostnames by using this switch, provided that
1033 the resolver library on the host where Squid runs
1034 does not reject _ in hostnames...],
1035[ if test "$enableval" = "yes" ; then
1036 echo "Enabling the use of underscores in host names"
6a9f6389 1037 AC_DEFINE(ALLOW_HOSTNAME_UNDERSCORES, 1,[Allow underscores in host names])
9bc73deb 1038 fi
1039])
1040
9d798391 1041dnl Select Default hosts file location
1042AC_ARG_ENABLE(default-hostsfile,
1043[ --enable-default-hostsfile=path
1044 Select default location for hosts file.
1045 See hosts_file directive in squid.conf for details],
1046[
1047 if test "$enableval" != "none" ; then
1048 if test -f $enableval; then
1049 OPT_DEFAULT_HOSTS=$enableval
1050 else
1051 echo "Warning Unable to find $enableval"
1052 sleep 5
1053 fi
1054 else
1055 OPT_DEFAULT_HOSTS="none"
1056 fi
1057 echo "Default hosts file set to: $enableval"
1058],[OPT_DEFAULT_HOSTS="/etc/hosts"])
1059AC_SUBST(OPT_DEFAULT_HOSTS)
1060
94439e4e 1061dnl Select auth schemes modules to build
1062AC_ARG_ENABLE(auth,
1063[ --enable-auth=\"list of auth scheme modules\"
1064 Build support for the list of authentication schemes.
1065 The default is to build support for the Basic scheme.
1066 See src/auth for a list of available modules, or
1067 Programmers Guide section authentication schemes
1068 for details on how to build your custom auth scheme
1069 module],
1070[ case $enableval in
1071 yes)
1c42c4a1 1072 for dir in $srcdir/src/auth/*; do
1073 module="`basename $dir`"
1c690e30 1074 if test -d "$dir" && test "$module" != CVS; then
1c42c4a1 1075 AUTH_MODULES="$AUTH_MODULES $module"
94439e4e 1076 fi
1077 done
1078 ;;
1079 no)
1080 ;;
1c690e30 1081 *)
1082 AUTH_MODULES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1083 ;;
94439e4e 1084 esac
1085],
1086[ if test -z "$AUTH_MODULES"; then
1087 AUTH_MODULES="basic"
1088 fi
1089])
1c690e30 1090if test -n "$AUTH_MODULES"; then
1091 for module in $AUTH_MODULES; do
1092 if test -d $srcdir/src/auth/$module; then
1093 :
1094 else
1095 echo "ERROR: Auth scheme $module does not exists"
1096 exit 1
1097 fi
1098 done
1099 echo "Auth scheme modules built: $AUTH_MODULES"
1100 AUTH_OBJS="auth/lib`echo $AUTH_MODULES|sed -e 's% %.a auth/lib%g'`.a"
1101 AUTH_LIBS="`echo $AUTH_OBJS|sed -e 's%auth/%%g'`"
1102fi
94439e4e 1103AC_SUBST(AUTH_MODULES)
94439e4e 1104AC_SUBST(AUTH_OBJS)
94439e4e 1105AC_SUBST(AUTH_LIBS)
1106
1107dnl Select basic auth scheme helpers to build
1108BASIC_AUTH_HELPERS=""
94439e4e 1109AC_ARG_ENABLE(basic-auth-helpers,
1110[ --enable-basic-auth-helpers=\"list of helpers\"
1111 This option selects which basic scheme proxy_auth
1112 helpers to build and install as part of the normal
1113 build process. For a list of available
0c510f3c 1114 helpers see the helpers/basic_auth directory.],
94439e4e 1115[ case "$enableval" in
1116 yes)
1c690e30 1117 for dir in $srcdir/helpers/basic_auth/*; do
1118 helper="`basename $dir`"
1119 if test -d "$dir" && test "$helper" != CVS; then
1120 BASIC_AUTH_HELPERS="$BASIC_AUTH_HELPERS $helper"
1121 fi
1122 done
1123 ;;
94439e4e 1124 no)
1c690e30 1125 ;;
94439e4e 1126 *)
1c690e30 1127 BASIC_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1128 ;;
94439e4e 1129 esac
1130])
fc83a946 1131if test -n "$BASIC_AUTH_HELPERS"; then
20d8bfe4 1132 for helper in $BASIC_AUTH_HELPERS; do
1c690e30 1133 if test -d $srcdir/helpers/basic_auth/$helper; then
1134 :
20d8bfe4 1135 else
1c690e30 1136 echo "ERROR: Basic auth helper $helper does not exists"
1137 exit 1
20d8bfe4 1138 fi
1139 done
fc83a946 1140 echo "Basic auth helpers built: $BASIC_AUTH_HELPERS"
94439e4e 1141fi
fc83a946 1142AC_SUBST(BASIC_AUTH_HELPERS)
94439e4e 1143
1144dnl Select ntlm auth helpers to build
1145NTLM_AUTH_HELPERS=
1146AC_ARG_ENABLE(ntlm-auth-helpers,
1147[ --enable-ntlm-auth-helpers=\"list of helpers\"
1148 This option selects which proxy_auth ntlm helpers
1149 to build and install as part of the normal build
0c510f3c 1150 process. For a list of available helpers see
1151 the helpers/ntlm_auth directory.],
380f0a87 1152[ case "$enableval" in
1153 yes)
1c690e30 1154 for dir in $srcdir/helpers/ntlm_auth/*; do
1155 helper="`basename $dir`"
1156 if test -d "$dir" && test "$helper" != CVS; then
1157 NTLM_AUTH_HELPERS="$NTLM_AUTH_HELPERS $helper"
1158 fi
1159 done
1160 ;;
380f0a87 1161 no)
1c690e30 1162 ;;
380f0a87 1163 *)
1c690e30 1164 NTLM_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1165 ;;
380f0a87 1166 esac
1167])
94439e4e 1168if test -n "$NTLM_AUTH_HELPERS"; then
20d8bfe4 1169 for helper in $NTLM_AUTH_HELPERS; do
1c690e30 1170 if test -d $srcdir/helpers/ntlm_auth/$helper; then
1171 :
20d8bfe4 1172 else
1c690e30 1173 echo "ERROR: NTLM Auth helper $helper does not exists"
1174 exit 1
20d8bfe4 1175 fi
1176 done
94439e4e 1177 echo "NTLM auth helpers built: $NTLM_AUTH_HELPERS"
380f0a87 1178fi
94439e4e 1179AC_SUBST(NTLM_AUTH_HELPERS)
1180
2d70df72 1181dnl Select digest auth scheme helpers to build
1182DIGEST_AUTH_HELPERS=
1183AC_ARG_ENABLE(digest-auth-helpers,
1184[ --enable-digest-auth-helpers=\"list of helpers\"
1185 This option selects which digest scheme authentication
1186 helpers to build and install as part of the normal build
0c510f3c 1187 process. For a list of available helpers see the
1188 helpers/digest_auth directory.],
2d70df72 1189[ case "$enableval" in
1190 yes)
1c690e30 1191 for dir in $srcdir/helpers/digest_auth/*; do
1192 helper="`basename $dir`"
1193 if test -d "$dir" && test "$helper" != CVS; then
1194 DIGEST_AUTH_HELPERS="$DIGEST_AUTH_HELPERS $helper"
1195 fi
1196 done
1197 ;;
2d70df72 1198 no)
1c690e30 1199 ;;
2d70df72 1200 *)
1c690e30 1201 DIGEST_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1202 ;;
2d70df72 1203 esac
1204])
1205if test -n "$DIGEST_AUTH_HELPERS"; then
1daefc1a 1206 for helper in $DIGEST_AUTH_HELPERS; do
1207 if test -f $srcdir/helpers/digest_auth/$helper/Makefile.in; then
1208 :
1209 else
1210 echo "ERROR: digest auth helper $helper does not exists"
1211 exit 1
1212 fi
1213 done
2d70df72 1214 echo "Digest auth helpers built: $DIGEST_AUTH_HELPERS"
1215fi
1216AC_SUBST(DIGEST_AUTH_HELPERS)
380f0a87 1217
6437ac71 1218dnl Enable "NTLM fail open"
1219AC_ARG_ENABLE(ntlm-fail-open,
1220[ --enable-ntlm-fail-open Enable NTLM fail open, where a helper that fails one of the
0961c811 1221 Authentication steps can allow squid to still authenticate
1222 the user.],
6437ac71 1223[ if test "$enableval" = "yes" ; then
6a9f6389 1224 AC_DEFINE(NTLM_FAIL_OPEN,1,[Define if NTLM is allowed to fail gracefully when a helper has problems. WARNING: This has security implications. DO NOT enable unless you KNOW you need it.])
6437ac71 1225 fi
1226])
1227
c6588c68 1228dnl Select external_acl helpers to build
1229EXTERNAL_ACL_HELPERS=
1230AC_ARG_ENABLE(external-acl-helpers,
1231[ --enable-external-acl-helpers=\"list of helpers\"
1232 This option selects which external_acl helpers to
1233 build and install as part of the normal build
1234 process. For a list of available helpers see the
1235 helpers/external_acl directory.],
1236[ case "$enableval" in
1237 yes)
1c690e30 1238 for dir in $srcdir/helpers/external_acl/*; do
1239 helper="`basename $dir`"
1240 if test -d "$dir" && test "$helper" != CVS; then
1241 EXTERNAL_ACL_HELPERS="$EXTERNAL_ACL_HELPERS $helper"
1242 fi
1243 done
1244 ;;
c6588c68 1245 no)
1c690e30 1246 ;;
c6588c68 1247 *)
1c690e30 1248 EXTERNAL_ACL_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1249 ;;
c6588c68 1250 esac
1251])
1252if test -n "$EXTERNAL_ACL_HELPERS"; then
20d8bfe4 1253 for helper in $EXTERNAL_ACL_HELPERS; do
1254 if test -f $srcdir/helpers/external_acl/$helper/Makefile.in; then
1255 :
1256 else
1daefc1a 1257 echo "ERROR: external acl helper $helper does not exists"
20d8bfe4 1258 exit 1
1259 fi
1260 done
c6588c68 1261 echo "External acl helpers built: $EXTERNAL_ACL_HELPERS"
1262fi
1263AC_SUBST(EXTERNAL_ACL_HELPERS)
1264
d96ceb8e 1265dnl Disable "memPools" code
1266AC_ARG_ENABLE(mempools,
1267[ --disable-mempools Disable memPools],
1268[ if test "$enableval" = "no" ; then
1269 echo "memPools disabled"
6a9f6389 1270 AC_DEFINE(DISABLE_POOLS, 1, [Define if you have problems with memPools and want to disable Pools])
d96ceb8e 1271 fi
1272])
1273
0e657244 1274dnl Enable WIN32 Service compile mode
1275AC_ARG_ENABLE(win32-service,
1276[ --enable-win32-service Compile Squid as a WIN32 Service
1277 Works only on Windows NT and Windows 2000 Platforms.],
1278[ if test "$enableval" = "yes" ; then
1279 echo "Enabling WIN32 run service mode"
1280 AC_DEFINE(USE_WIN32_SERVICE,1,[Define Windows NT & Windows 2000 run service mode])
1281 fi
1282])
1283
b1485ff8 1284
1285SAMBASOURCES='$(top_srcdir)/include/samba'
1286AC_ARG_WITH(samba-sources,
1287[ --with-samba-sources=/path/to/samba-source-tree
1288 Path where the correct Samba source files can be
1289 found while building winbind helpers. (defaults to
1290 use internal copies of the headers from Samba-2.2.7)
1291 ],
1292[ if test -f $withval/source/nsswitch/winbind_nss_config.h; then
1293 echo "Using Samba sources from $withval"
1294 SAMBASOURCES="$withval/source"
1295 else
1296 echo "ERROR: Cannot find Samba sources at $withval"
1297 exit 1
1298 fi
1299])
1300AC_SUBST(SAMBASOURCES)
1301
3c573763 1302dnl Disable "unlinkd" code
fe0810ac 1303AC_ARG_ENABLE(unlinkd,
1304[ --disable-unlinkd Do not use unlinkd],
1305[ if test "$enableval" = "no" ; then
3c573763 1306 use_unlinkd=no
fe0810ac 1307 else
3c573763 1308 use_unlinkd=yes
fe0810ac 1309 fi
1310],[
1311 # Here we should probably use some magic depending on the selected
1312 # storage models
3c573763 1313 use_unlinkd=yes
fe0810ac 1314])
3c573763 1315if test "$use_unlinkd" = "yes"; then
fe0810ac 1316 echo "unlinkd enabled"
6a9f6389 1317 AC_DEFINE(USE_UNLINKD,1,[Define this if unlinkd is required (strongly recommended for ufs storage type)])
a2794549 1318 AM_CONDITIONAL(ENABLE_UNLINKD, true)
fe0810ac 1319else
1320 echo "unlinkd disabled"
a2794549 1321 AM_CONDITIONAL(ENABLE_UNLINKD, false)
fe0810ac 1322fi
fe0810ac 1323
ce3d30fb 1324dnl Enable backtraces on fatal errors
1325AC_ARG_ENABLE(stacktraces,
1326[ --enable-stacktraces Enable automatic call backtrace on fatal errors],
1327[ if test "$enableval" = "yes" ; then
1328 echo "Enabling automatic stack backtraces on fatal errors"
6a9f6389 1329 AC_DEFINE(PRINT_STACK_TRACE, 1,[Print stacktraces on fatal errors])
ce3d30fb 1330 fi
1331])
1332
88bfe092 1333AM_CONDITIONAL(ENABLE_XPROF_STATS, false)
1334dnl Enable USE_XPROF_STATS
1335AC_ARG_ENABLE(cpu-profiling,
1336[ --enable-cpu-profiling
1337 This option allows you to see which internal functions
1338 in Squid are consuming how much CPU. Compiles in probes
1339 that measure time spent in probed functions. Needs
1340 source modifications to add new probes. This is meant
1341 for developers to assist in performance optimisations
1342 of Squid internal functions.
1343 If you are not developer and not interested in the stats
1344 you shouldn't enable this, as overhead added, although
1345 small, is still overhead. See lib/Profiler.c for more.
1346 ],
1347[ if test "$enableval" = "yes" ; then
1348 echo "Enabling cpu-profiling"
6a9f6389 1349 AC_DEFINE(USE_XPROF_STATS, 1,[Define to enable CPU profiling within Squid])
88bfe092 1350 AM_CONDITIONAL(ENABLE_XPROF_STATS, true)
1351 fi
1352])
1353
f66a9ef4 1354dnl Enable X-Accelerator-Vary for Vary support within an accelerator setup
1355AC_ARG_ENABLE(x_accelerator_vary,
0961c811 1356[ --enable-x-accelerator-vary
1357 Enable support for the X-Accelerator-Vary
1358 HTTP header. Can be used to indicate
1359 variance within an accelerator setup.
1360 Typically used together with other code
1361 that adds custom HTTP headers to the requests.],
f66a9ef4 1362[ if test "$enableval" = "yes" ; then
1363 echo "Enabling support for X-Accelerator-Vary"
6a9f6389 1364 AC_DEFINE(X_ACCELERATOR_VARY, 1, [Enable support for the X-Accelerator-Vary HTTP header])
f66a9ef4 1365 fi
1366])
1367
f49be7d1 1368AC_ARG_WITH(filedescriptors,
1369[ --with-filedescriptors=NUMBER Force squid to support NUMBER filedescriptors],
1370[ squid_filedescriptors_num=$withval ])
1371
fd9aaa3e 1372# Force some compilers to use ANSI features
1373#
1374case "$host" in
1375 alpha-dec-osf*)
1376 if test "$ac_cv_prog_CC" = "cc" ; then
1377 echo "adding '-std1' to cc args for $host"
1378 CC="cc -std1";
1379 ac_cv_prog_CC="$CC"
1380 fi
1381 ;;
c68e9c6b 1382 *-hp-hpux*)
1383 if test "$ac_cv_prog_CC" = "cc" ; then
1384 echo "adding '-Ae' to cc args for $host"
1385 CC="cc -Ae";
1386 ac_cv_prog_CC="$CC"
1387 fi
1388 ;;
fd9aaa3e 1389esac
1390
090089c4 1391dnl Check for programs
1392AC_PROG_CPP
1393AC_PROG_INSTALL
1394AC_PROG_RANLIB
1395AC_PROG_LN_S
81280a96 1396AC_PATH_PROG(SH, sh, /bin/sh)
d9f67e6f 1397AC_PATH_PROG(FALSE, false, /usr/bin/false)
1398AC_PATH_PROG(TRUE, true, /usr/bin/true)
1399AC_PATH_PROG(RM, rm, $FALSE)
1400AC_PATH_PROG(MV, mv, $FALSE)
1401AC_PATH_PROG(MKDIR, mkdir, $FALSE)
090089c4 1402AC_PATH_PROG(LN, ln, cp)
4e9d8e26 1403AC_PATH_PROG(PERL, perl, none)
a2794549 1404dnl automake handles this AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
6ad85e8a 1405AC_PATH_PROG(AR, ar, $FALSE)
1406
4e9d8e26 1407if test "$ac_cv_path_PERL" = "none"; then
1408 echo "Perl is required to compile Squid"
1409 echo "Please install Perl and then re-run configure"
1410 exit 1
1411fi
1412
6ad85e8a 1413case "$host" in
1414 *-hp-hpux*)
1415 echo "Disabling 'ranlib' for HP-UX..."
1416 RANLIB=":"
1417 ;;
1418esac
1419
1420dnl set $(AR)
1421AR_R="$AR r"
1422case "$host" in
1423 *-next-nextstep3)
1424 AR="libtool -o"
1425 ;;
1426esac
1427AC_SUBST(AR_R)
090089c4 1428
1429dnl Check for headers
1430AC_HEADER_DIRENT
1431AC_HEADER_STDC
db40ae20 1432
1433AC_CHECK_HEADERS( \
db40ae20 1434 arpa/inet.h \
30a4f2a8 1435 arpa/nameser.h \
9441aa34 1436 assert.h \
db40ae20 1437 bstring.h \
db40ae20 1438 crypt.h \
30a4f2a8 1439 ctype.h \
1440 errno.h \
ce3d30fb 1441 execinfo.h \
db40ae20 1442 fcntl.h \
9c1d8929 1443 getopt.h \
88738790 1444 gnumalloc.h \
30a4f2a8 1445 grp.h \
5cafc1d6 1446 ip_compat.h \
42b51993 1447 ip_fil_compat.h \
5cafc1d6 1448 ip_fil.h \
1449 ip_nat.h \
30a4f2a8 1450 libc.h \
6ad85e8a 1451 limits.h \
30a4f2a8 1452 malloc.h \
e0bddc45 1453 math.h \
db40ae20 1454 memory.h \
b075cbb1 1455 mount.h \
2b0dd4ac 1456 net/pfvar.h \
30a4f2a8 1457 netdb.h \
db40ae20 1458 netinet/in.h \
30a4f2a8 1459 netinet/tcp.h \
42b51993 1460 netinet/ip_fil_compat.h \
1f7c9178 1461 openssl/err.h \
1462 openssl/md5.h \
1463 openssl/ssl.h \
a7ad6e4e 1464 openssl/engine.h \
dcfe6390 1465 poll.h \
30a4f2a8 1466 pwd.h \
1467 regex.h \
c68e9c6b 1468 sched.h \
30a4f2a8 1469 signal.h \
1470 stdarg.h \
1471 stddef.h \
1472 stdio.h \
db40ae20 1473 stdlib.h \
1474 string.h \
1475 strings.h \
0a4e8536 1476 sys/bitypes.h \
f9576890 1477 sys/bswap.h \
1478 sys/endian.h \
db40ae20 1479 sys/file.h \
5cafc1d6 1480 sys/ioctl.h \
30a4f2a8 1481 sys/param.h \
77e4c0c9 1482 sys/msg.h \
30a4f2a8 1483 sys/resource.h \
db40ae20 1484 sys/select.h\
30a4f2a8 1485 sys/socket.h \
1486 sys/stat.h \
b075cbb1 1487 sys/statvfs.h \
3c641669 1488 syscall.h \
30a4f2a8 1489 sys/syscall.h \
db40ae20 1490 sys/time.h \
1491 sys/types.h \
30a4f2a8 1492 sys/un.h \
b075cbb1 1493 sys/vfs.h \
30a4f2a8 1494 sys/wait.h \
db40ae20 1495 syslog.h \
30a4f2a8 1496 time.h \
1497 unistd.h \
3c641669 1498 utime.h \
30a4f2a8 1499 varargs.h \
77d6bd88 1500 byteswap.h \
1501 glib.h \
60d096f4 1502 stdint.h \
1503 inttypes.h \
3c641669 1504 grp.h \
1505 nss_common.h \
1506 nss.h
db40ae20 1507)
1508
5a3237b0 1509AC_CHECK_HEADERS(linux/netfilter_ipv4.h,,,
dcd1dc78 1510SQUID_DEFAULT_INCLUDES
1511#if HAVE_LIMITS_H
1512#include <limits.h>
1513#endif
1514)
1515
5a3237b0 1516AC_CHECK_HEADERS(net/if.h \
1517 netinet/if_ether.h\
1518 netinet/ip_compat.h\
1519 netinet/ip_fil.h\
77e4c0c9 1520 netinet/ip_nat.h\
1521 sys/mount.h\
1522 resolv.h,,,SQUID_BSDNET_INCLUDES)
5a3237b0 1523
aee0606f 1524AC_C_CONST
d57288d2 1525AC_C_BIGENDIAN
aee0606f 1526
5c51415d 1527AC_CACHE_CHECK(if ANSI prototypes work,ac_cv_have_ansi_prototypes, [
1528 AC_TRY_COMPILE([int foo(char *); int foo (char *bar) {return 1;}],
1529 [foo("bar")],
1530 ac_cv_have_ansi_prototypes="yes",
1531 ac_cv_have_ansi_prototypes="no")
1532])
1533if test $ac_cv_have_ansi_prototypes = "yes" ; then
6a9f6389 1534 AC_DEFINE(HAVE_ANSI_PROTOTYPES,1,[Define if your compiler supports prototyping])
5c51415d 1535fi
20a50bb9 1536
6a9f6389 1537AC_STRUCT_TM
1538AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
1539#if TM_IN_SYS_TIME
1540#if HAVE_SYS_TIME_H
1541#include <sys/time.h>
1542#endif
1543#elif HAVE_TIME_H
1544#include <time.h>
1545#endif
5c51415d 1546])
46c883ed 1547
6a9f6389 1548AC_CHECK_TYPE(struct mallinfo,AC_DEFINE(HAVE_STRUCT_MALLINFO,1,[The system provides struct mallinfo]),,[
1549#if HAVE_SYS_TYPES_H
1550#include <sys/types.h>
1551#endif
eb824054 1552#if HAVE_MALLOC_H
1553#include <malloc.h>
6a9f6389 1554#endif])
eb824054 1555
6a9f6389 1556AC_CHECK_MEMBERS([struct mallinfo.mxfast],,,[
1557#if HAVE_SYS_TYPES_H
1558#include <sys/types.h>
1559#endif
1560#if HAVE_MALLOC_H
1561#include <malloc.h>
1562#endif])
090089c4 1563
6a9f6389 1564AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
8ff51bba 1565#if HAVE_SYS_TIME_H
1566#include <sys/time.h>
1567#endif
b54a6789 1568#if HAVE_SYS_RESOURCE_H
1569#include <sys/resource.h>
6a9f6389 1570#endif])
b54a6789 1571
6a9f6389 1572AC_CHECK_MEMBERS([struct iphdr.ip_hl],,,[
1573#if HAVE_SYS_TYPES_H
1574#include <sys/types.h>
1575#endif
a025a745 1576#include <netinet/in.h>
1577#include <netinet/in_systm.h>
6ad85e8a 1578#include <netinet/ip.h>
b05490a8 1579#if defined (__linux__) || defined (__CYGWIN__)
6ad85e8a 1580#define ip_hl ihl
1581#endif
1582#ifndef __linux__
b05490a8 1583#ifndef __CYGWIN__
6ad85e8a 1584#define iphdr ip
b05490a8 1585#endif
6a9f6389 1586#endif])
a025a745 1587
090089c4 1588dnl Check for typedefs
77d6bd88 1589AC_CHECK_SIZEOF(void *)
090089c4 1590
6a9f6389 1591dnl 16 bit integers - int16_t and u_int16_t
1592dnl if this is defined we trust it to be 16 bits
1593AC_CHECK_TYPE(int16_t,
1594 AC_DEFINE(HAVE_INT16_T,1,[int16_t is defined in system headers]),
1595 ,SQUID_DEFAULT_INCLUDES)
1596
1597dnl fallback #1
1598AC_CHECK_TYPE(short,[
856e69c5 1599 AC_CHECK_SIZEOF(short,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 1600 AC_DEFINE(HAVE_SHORT,1,[short is defined in system headers])
1601 ],,SQUID_DEFAULT_INCLUDES)
1602
1603dnl fallback #2
1604AC_CHECK_TYPE(int,[
856e69c5 1605 AC_CHECK_SIZEOF(int,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 1606 AC_DEFINE(HAVE_INT,1,[int is defined in system headers])
1607 ],,SQUID_DEFAULT_INCLUDES)
1608
1609dnl unsigned 16 bit ints - u_int16_t
1610dnl if this is defined we trust it to be 16 bits
1611AC_CHECK_TYPE(u_int16_t,
1612 AC_DEFINE(HAVE_U_INT16_T,1,[u_int16_t is defined in system headers]),
1613 ,SQUID_DEFAULT_INCLUDES)
1614
1615dnl fallback #1
1616dnl if this is defined we trust it to be 16 bits
1617AC_CHECK_TYPE(uint16_t,
1618 AC_DEFINE(HAVE_UINT16_T,1,[uint16_t is defined in system headers]),
1619 ,SQUID_DEFAULT_INCLUDES)
1620
1621dnl 32 bit signed int - int32_t
1622dnl if this is defined we trust it to be 32 bits
1623AC_CHECK_TYPE(int32_t,
1624 AC_DEFINE(HAVE_INT32_T,1,[int32_t is defined in system headers]),
1625 ,SQUID_DEFAULT_INCLUDES)
1626
1627dnl fallback #1
1628AC_CHECK_TYPE(long,[
856e69c5 1629 AC_CHECK_SIZEOF(long,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 1630 AC_DEFINE(HAVE_LONG,1,[long is defined in system headers])
1631 ],,SQUID_DEFAULT_INCLUDES)
1632
1633dnl 32 bit unsigned int - u_int32_t
1634dnl if this is defined we trust it to be 32 bits
1635AC_CHECK_TYPE(u_int32_t,
1636 AC_DEFINE(HAVE_U_INT32_T,1,[u_int32_t is defined in system headers]),
1637 ,SQUID_DEFAULT_INCLUDES)
1638
1639dnl fallback #1
1640dnl if this is defined we trust it to be 32 bits
1641AC_CHECK_TYPE(uint32_t,
1642 AC_DEFINE(HAVE_UINT32_T,1,[uint32_t is defined in system headers]),
1643 ,SQUID_DEFAULT_INCLUDES)
1644
1645dnl 64 bit signed - int64_t
1646dnl if this is defind we trust it to be 64 bits
1647AC_CHECK_TYPE(int64_t,
1648 AC_DEFINE(HAVE_INT64_T,1,[int64_t is defined in system headers]),
1649 ,SQUID_DEFAULT_INCLUDES)
1650
1651dnl fallback #1
1652dnl if this is defind we trust it to be 64 bits
1653AC_CHECK_TYPE(__int64,
1654 AC_DEFINE(HAVE___INT64,1,[__int64 is defined in system headers]),
1655 ,SQUID_DEFAULT_INCLUDES)
1656
1657dnl fallback #2
1658AC_CHECK_TYPE(long long,[
856e69c5 1659 AC_CHECK_SIZEOF(long long,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 1660 AC_DEFINE(HAVE_LONG_LONG,1,[long long is defined in system headers])
1661 ],,SQUID_DEFAULT_INCLUDES)
1662
1663dnl 64 bit unsigned - u_int64_t
1664dnl if this is defind we trust it to be 64 bits
1665AC_CHECK_TYPE(u_int64_t,
1666 AC_DEFINE(HAVE_U_INT64_T,1,[u_int64_t is defined in system headers]),
1667 ,SQUID_DEFAULT_INCLUDES)
1668
1669dnl fallback #1
1670dnl if this is defind we trust it to be 64 bits
1671AC_CHECK_TYPE(uint64_t,
1672 AC_DEFINE(HAVE_UINT64_T,1,[uint64_t is defined in system headers]),
1673 ,SQUID_DEFAULT_INCLUDES)
1674
1675AC_CHECK_TYPE(pid_t, AC_DEFINE(HAVE_PID_T,1,[pid_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
856e69c5 1676AC_CHECK_TYPE(size_t, [AC_CHECK_SIZEOF(size_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 1677 AC_DEFINE(HAVE_SIZE_T,1,[size_t is defined by the system headers])],,SQUID_DEFAULT_INCLUDES)
1678AC_CHECK_TYPE(ssize_t, AC_DEFINE(HAVE_SSIZE_T,1,[ssize_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
856e69c5 1679AC_CHECK_TYPE(off_t,[ AC_CHECK_SIZEOF(off_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 1680 AC_DEFINE(HAVE_OFF_T,1,[off_t is defined by the system headers])],,SQUID_DEFAULT_INCLUDES)
1681AC_CHECK_TYPE(mode_t, AC_DEFINE(HAVE_MODE_T,1,[mode_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
1682AC_CHECK_TYPE(fd_mask, AC_DEFINE(HAVE_FD_MASK,1,[fd_mask is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
adcceb47 1683
77d6bd88 1684dnl Check for special functions
1685AC_FUNC_ALLOCA
1686
6a9f6389 1687AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the system headers]),,[
1688#include <sys/types.h>
6637e3a5 1689#include <sys/socket.h>
1690#if STDC_HEADERS
1691#include <stdlib.h>
1692#include <stddef.h>
6a9f6389 1693#endif])
6637e3a5 1694
6a9f6389 1695AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,[mtyp_t is defined by the system headers]),,[#include <sys/types.h>
aea1be68 1696#include <sys/ipc.h>
6a9f6389 1697#include <sys/msg.h>])
aea1be68 1698
090089c4 1699dnl Check for needed libraries
30a4f2a8 1700AC_CHECK_LIB(nsl, main)
6716b242 1701AC_CHECK_LIB(socket, main)
94d48591 1702
3c641669 1703dnl Ripped from the Samba sources
1704AC_CACHE_CHECK([for unix domain sockets],squid_cv_unixsocket, [
1705 AC_TRY_COMPILE([
1706#include <sys/types.h>
1707#include <stdlib.h>
1708#include <stddef.h>
1709#include <sys/socket.h>
1710#include <sys/un.h>],
1711[
1712 struct sockaddr_un sunaddr;
1713 sunaddr.sun_family = AF_UNIX;
1714],
1715 squid_cv_unixsocket=yes,squid_cv_unixsocket=no)])
1716if test x"$squid_cv_unixsocket" = x"yes"; then
6a9f6389 1717 AC_DEFINE(HAVE_UNIXSOCKET,1,[Do we have unix sockets? (required for the winbind ntlm helper])
3c641669 1718fi
1719dnl end rip
1720
94d48591 1721if test "x$ac_cv_enabled_dlmalloc" = "xyes" ; then
1722 echo "skipping libmalloc check (--enable-dlmalloc specified)"
5c51415d 1723else
94d48591 1724 AC_CHECK_LIB(gnumalloc, main)
1725 if test "$ac_cv_lib_gnumalloc_main" = "yes"; then
1726 echo "Disabling extended malloc functions when using gnumalloc"
1727 ac_cv_func_mallinfo=no
1728 ac_cv_func_mallocblksize=no
1729 ac_cv_func_mallopt=no
1730 else
1731 case "$host" in
1732 *-sun-solaris*)
1733 echo "skipping libmalloc check for $host"
1734 ;;
1735 i386-*-freebsd*)
1736 echo "skipping libmalloc check for $host"
1737 ;;
1738 *)
1739
1740 AC_CHECK_LIB(malloc, main)
1741 ;;
1742 esac
1743 fi
8a15e65e 1744fi
94d48591 1745
6716b242 1746AC_CHECK_LIB(bsd, main)
be79ade0 1747AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"])
04a56fa3 1748AC_CHECK_LIB(bind, gethostbyname)
1749if test $ac_cv_lib_bind_gethostbyname = "no" ; then
1750 case "$host" in
78743365 1751 i386-*-freebsd*)
1752 echo "skipping libresolv checks for $host"
1753 ;;
1754 *)
1755 AC_CHECK_LIB(resolv, inet_aton, AC_CHECK_LIB(44bsd, inet_aton))
1756 AC_CHECK_LIB(resolv, main)
1757 ;;
04a56fa3 1758 esac
1759fi
e0bddc45 1760AC_CHECK_LIB(m, main)
090089c4 1761
1762dnl Check for libcrypt
8154dd82 1763dnl Some of our helpers use crypt(3) which may be in libc, or in
1764dnl libcrypt (eg FreeBSD)
042b1f8a 1765AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
be79ade0 1766AC_SUBST(CRYPTLIB)
77f675ad 1767
042b1f8a 1768dnl Check for libdl, used by auth_modules/PAM
8154dd82 1769if test "$with_dl" = "yes"; then
1770 AC_CHECK_LIB(dl, dlopen)
1771fi
042b1f8a 1772
e5f4e1b0 1773dnl Check for pthreads
1774dnl We use pthreads when doing ASYNC I/O
8154dd82 1775if test "$with_pthreads" = "yes"; then
e685e3c6 1776 CFLAGS="$CFLAGS -D_REENTRANT"
1777 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
1778 case "$host" in
1779 i386-unknown-freebsd*)
1780 if test "$GCC" = "yes" ; then
1781 if test -z "$PRESET_LDFLAGS"; then
1782 LDFLAGS="$LDFLAGS -pthread"
1783 fi
1784 fi
1785 ;;
1786 *-solaris2.*)
1787 if test "$GCC" = "yes" ; then
1788 CFLAGS="$CFLAGS -pthreads"
1789 CXXFLAGS="$CXXFLAGS -pthreads"
1790 else
1791 CFLAGS="$CFLAGS -mt"
1792 CXXFLAGS="$CXXFLAGS -mt"
1793 fi
1794 ;;
1795 esac
8154dd82 1796 AC_CHECK_LIB(pthread, main)
1797fi
71f8abc8 1798
f85c88f3 1799dnl Check for librt
1800dnl We use AIO in the coss store
8154dd82 1801if test "$with_aio" = "yes"; then
1802 AC_CHECK_LIB(rt, aio_read)
1803fi
f85c88f3 1804
86ec11aa 1805dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
1806dnl Robert Side <rside@aiinc.bc.ca>
1807dnl Mon, 18 Jan 1999 17:48:00 GMT
1808case "$host" in
1809 *-pc-sco3.2*)
1810 AC_CHECK_LIB(intl, strftime)
1811 ;;
1812esac
1813
77f675ad 1814dnl System-specific library modifications
1815dnl
1816case "$host" in
88738790 1817 i386-*-solaris2.*)
7149a49f 1818 if test "$GCC" = "yes"; then
1819 echo "Removing -O for gcc on $host"
80e92d6d 1820 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
7149a49f 1821 fi
1822 ;;
77f675ad 1823 *-sgi-irix*)
1824 echo "Removing -lsocket for IRIX..."
6716b242 1825 LIBS=`echo $LIBS | sed -e s/-lsocket//`
77f675ad 1826 echo "Removing -lnsl for IRIX..."
6716b242 1827 LIBS=`echo $LIBS | sed -e s/-lnsl//`
c415c128 1828 ac_cv_lib_nsl_main=no
b44c0fb4 1829 echo "Removing -lbsd for IRIX..."
1830 LIBS=`echo $LIBS | sed -e s/-lbsd//`
77f675ad 1831 ;;
4ba0bd0e 1832dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
1833dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
1834dnl Please change your configure script. AIX doesn't need -lbsd.
1835 *-ibm-aix*)
1836 echo "Removing -lbsd for AIX..."
1837 LIBS=`echo $LIBS | sed -e s/-lbsd//`
a6e0ad1e 1838 case "$host" in
c68e9c6b 1839dnl From: mlaster@metavillage.com (Mike Laster)
1840dnl AIX 4.1.4.x does not have header files for snprintf/vsnprintf
1841dnl So using the internal versions generates a load of warnings
1842dnl during compile.
a6e0ad1e 1843 *-ibm-aix4*)
1844 echo "disabling snprintf/vsnprintf for $host"
1845 ac_cv_func_snprintf=no
1846 ac_cv_func_vsnprintf=no
1847 ;;
1848 esac
4ba0bd0e 1849 ;;
30a4f2a8 1850 *m88k*)
1851 CFLAGS="$CFLAGS -D_SQUID_MOTOROLA_"
680ae450 1852 CXXFLAGS="$CXXFLAGS -D_SQUID_MOTOROLA_"
6a9f6389 1853 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1,[If gettimeofday is known to take only one argument])
7149a49f 1854 ;;
580ce039 1855 [*-*-solaris2.[0-4]])
6a9f6389 1856 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
30a4f2a8 1857 ;;
711fa75e 1858 [*-sony-newsos[56]*])
6a9f6389 1859 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
f62c73dc 1860 ;;
77f675ad 1861esac
090089c4 1862
57faa85a 1863# Remove optimization for GCC 2.95.[123]
d20b1cd0 1864# gcc -O[2] on *BSD and Linux (x86) causes pointers to magically become NULL
1865if test "$GCC" = "yes"; then
1866 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
1867 case "$GCCVER" in
57faa85a 1868 [2.95.[123]])
d20b1cd0 1869 echo "Removing -O for gcc on $host with GCC $GCCVER"
1870 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
1871 ;;
1872 esac
1873fi
1874
176d10ee 1875# Recommended by Balint Nagy Endre <bne@CareNet.hu>
1876case "$host" in
1877 *-univel-sysv4.2MP)
1878 if test `uname -v` = "2.03"; then
1879 echo "disabling mallinfo for $host"
1880 ac_cv_func_mallinfo=no
1881 fi
1882 ;;
1883esac
1884
84cecfd2 1885dnl This has to be before AC_CHECK_FUNCS
1886# Disable poll() on certain platforms. Override by setting ac_cv_func_poll
1887# when running configure.
1888if test -z "$ac_cv_func_poll"; then
1889 case "$host" in
1890 [alpha-dec-osf3.*])
1891 # John Kay (jkay@nlanr.net) 19970818
1892 echo "disabling poll for $host..."
1893 ac_cv_func_poll='no'
1894 ;;
1895 [*-hp-hpux*.*])
1896 # Duane Wessels
1897 echo "disabling poll for $host..."
1898 ac_cv_func_poll='no'
1899 ;;
1900 [*-linux-*])
f5cec332 1901 # Henrik Nordstrom (hno@squid-cache.org) 19980817
9bb83c8b 1902 # poll is problematic on Linux. We disable it
1903 # by default until Linux gets it right.
b6a2f15e 1904 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
1905 if test $rev -lt 002002; then
1906 echo "disabling poll for $host < 2.2..."
1907 ac_cv_func_poll='no'
1908 fi
84cecfd2 1909 ;;
c68e9c6b 1910 [powerpc-ibm-aix4.1.*])
1911 # Mike Laster (mlaster@metavillage.com) 19981021
1912 echo "disabling poll for $host..."
1913 ac_cv_func_poll='no'
1914 ;;
86ec11aa 1915 [*-pc-sco3.2*])
1916 # Robert Side <rside@aiinc.bc.ca>
1917 # Mon, 18 Jan 1999 17:48:00 GMT
1918 echo "disabling poll for $host..."
1919 ac_cv_func_poll='no'
1920 ;;
84cecfd2 1921 esac
1922fi
176d10ee 1923
6716b242 1924dnl Check for library functions
1925AC_CHECK_FUNCS(\
ce3d30fb 1926 backtrace_symbols_fd \
3a144521 1927 bcopy \
1928 bswap_16 \
1929 bswap_32 \
f9576890 1930 bswap16 \
1931 bswap32 \
df087e68 1932 crypt \
4ac29a5b 1933 fchmod \
6716b242 1934 getdtablesize \
8505e57b 1935 getpagesize \
230c091c 1936 getpass \
3a144521 1937 getrlimit \
30a4f2a8 1938 getrusage \
9c1d8929 1939 getspnam \
f9576890 1940 htobe16 \
1941 htole16 \
30a4f2a8 1942 lrand48 \
6716b242 1943 mallinfo \
0f5efab0 1944 mallocblksize \
6716b242 1945 mallopt \
2ae6b9b0 1946 memcpy \
30a4f2a8 1947 memmove \
dac27377 1948 memset \
b99a6dec 1949 mkstemp \
1812b6c7 1950 mktime \
88738790 1951 mstats \
84cecfd2 1952 poll \
3a144521 1953 pthread_attr_setschedparam \
cd748f27 1954 pthread_attr_setscope \
1955 pthread_setschedparam \
42b51993 1956 pthread_sigmask \
c68e9c6b 1957 putenv \
b1e77ec1 1958 random \
6716b242 1959 regcomp \
1960 regexec \
1961 regfree \
30a4f2a8 1962 res_init \
4915be3b 1963 rint \
a4ba1105 1964 sbrk \
3a144521 1965 select \
234967c9 1966 seteuid \
c415c128 1967 setgroups \
30a4f2a8 1968 setpgrp \
6716b242 1969 setrlimit \
30a4f2a8 1970 setsid \
1971 sigaction \
11430c03 1972 snprintf \
1ccc0d40 1973 socketpair \
30a4f2a8 1974 srand48 \
b1e77ec1 1975 srandom \
0343b99c 1976 statfs \
6716b242 1977 sysconf \
1978 syslog \
234967c9 1979 timegm \
28da5e0d 1980 vsnprintf \
6716b242 1981)
1982
1b3db6d9 1983dnl Magic which checks whether we are forcing a type of comm loop we
1984dnl are actually going to (ab)use
1985
1986dnl Actually do the define magic now
1987dnl mostly ripped from squid-commloops, thanks to adrian and benno
1988
1989if test "$ac_cv_func_poll" = "yes" ; then
1990 SELECT_TYPE="poll"
6a9f6389 1991 AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop])
1b3db6d9 1992elif test "$ac_cv_func_select" = "yes" ; then
1993 SELECT_TYPE="select"
6a9f6389 1994 AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop])
92b9f1fd 1995elif test "$ac_cv_func_kqueue" = "yes" ; then
1996 SELECT_TYPE="kqueue"
6a9f6389 1997 AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop])
a46d2c0e 1998elif test "$ac_cv_func_epoll" = "yes" ; then
1999 SELECT_TYPE="epoll"
2000 AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop])
1b3db6d9 2001else
a46d2c0e 2002 echo "Eep! Can't find poll, kqueue, epoll, or select!"
1b3db6d9 2003 echo "I'll try select and hope for the best."
2004 SELECT_TYPE="select"
6a9f6389 2005 AC_DEFINE(USE_SELECT,1)
1b3db6d9 2006fi
2007echo "Using ${SELECT_TYPE} for select loop."
1b3db6d9 2008
2009
60939927 2010dnl Yay! Another Linux brokenness. Its not good enough
2011dnl to know that setresuid() exists, because RedHat 5.0 declares
2012dnl setresuid() but doesn't implement it.
2013dnl
2014AC_CACHE_CHECK(if setresuid is implemented, ac_cv_func_setresuid,
5c51415d 2015 AC_TRY_RUN([
60939927 2016#include <stdlib.h>
5c51415d 2017 int main() {
2018 if(setresuid(-1,-1,-1)) {
2019 perror("setresuid:");
2020 exit(1);
60939927 2021 }
2022 exit(0);
5c51415d 2023 }
2024 ],ac_cv_func_setresuid="yes",ac_cv_func_setresuid="no")
60939927 2025)
5c51415d 2026if test "$ac_cv_func_setresuid" = "yes" ; then
6a9f6389 2027 AC_DEFINE(HAVE_SETRESUID,1,[Yay! Another Linux brokenness. Its not good enough to know that setresuid() exists, because RedHat 5.0 declare setresuid() but doesn't implement it.])
5c51415d 2028fi
60939927 2029
c3d0c8b5 2030AM_CONDITIONAL(NEED_OWN_SNPRINTF, false)
2031if test "$ac_cv_func_snprintf" = "no" || test "$ac_cv_func_vsnprintf" = "no" ; then
2032 AM_CONDITIONAL(NEED_OWN_SNPRINTF, true)
2033fi
2034
5cafc1d6 2035dnl IP-Filter support requires ipf header files. These aren't
2036dnl installed by default, so we need to check for them
2037if test "$IPF_TRANSPARENT" ; then
2038 AC_MSG_CHECKING(if IP-Filter header files are installed)
42b51993 2039 # hold on to your hats...
2040 if test "$ac_cv_header_ip_compat_h" = "yes" ||
2041 test "$ac_cv_header_ip_fil_compat_h" = "yes" ||
87d21d8b 2042 test "$ac_cv_header_netinet_ip_compat_h" = "yes" ||
2043 test "$ac_cv_header_netinet_ip_fil_compat_h" = "yes" ; then
42b51993 2044 have_ipfilter_compat_header="yes"
2045 fi
2046 if test "x$have_ipfilter_compat_header" = "xyes" &&
eb824054 2047 test "$ac_cv_header_ip_fil_h" = "yes" &&
2048 test "$ac_cv_header_ip_nat_h" = "yes" ; then
2049 IPF_TRANSPARENT="yes"
2050 AC_DEFINE(IPF_TRANSPARENT, 1)
42b51993 2051 elif test "$have_ipfilter_compat_header" = "yes" &&
eb824054 2052 test "$ac_cv_header_netinet_ip_fil_h" = "yes" &&
2053 test "$ac_cv_header_netinet_ip_nat_h" = "yes" ; then
2054 IPF_TRANSPARENT="yes"
2055 AC_DEFINE(IPF_TRANSPARENT, 1)
2056 else
5cafc1d6 2057 IPF_TRANSPARENT="no"
2058 AC_DEFINE(IPF_TRANSPARENT, 0)
5cafc1d6 2059 fi
2060 AC_MSG_RESULT($IPF_TRANSPARENT)
2061fi
2062if test "$IPF_TRANSPARENT" = "no" ; then
2063 echo "WARNING: Cannot find necessary IP-Filter header files"
2064 echo " Transparent Proxy support WILL NOT be enabled"
2065 sleep 10
2066fi
2067
2b0dd4ac 2068dnl PF support requires a header file.
2069if test "$PF_TRANSPARENT" ; then
2070 AC_MSG_CHECKING(if PF header file is installed)
2071 # hold on to your hats...
2072 if test "$ac_cv_header_net_pfvar_h" = "yes"; then
2073 PF_TRANSPARENT="yes"
2074 AC_DEFINE(PF_TRANSPARENT, 1)
2075 else
2076 PF_TRANSPARENT="no"
2077 AC_DEFINE(PF_TRANSPARENT, 0)
2078 fi
2079 AC_MSG_RESULT($PF_TRANSPARENT)
2080fi
2081if test "$PF_TRANSPARENT" = "no" ; then
2082 echo "WARNING: Cannot find necessary PF header file"
2083 echo " Transparent Proxy support WILL NOT be enabled"
2084 sleep 10
2085fi
2086
d852fbad 2087dnl Linux-Netfilter support requires Linux 2.4 kernel header files.
2088dnl Shamelessly copied from above
2089if test "$LINUX_NETFILTER" ; then
2090 AC_MSG_CHECKING(if Linux 2.4 kernel header files are installed)
2091 # hold on to your hats...
2092 if test "$ac_cv_header_linux_netfilter_ipv4_h" = "yes"; then
2093 LINUX_NETFILTER="yes"
2094 AC_DEFINE(LINUX_NETFILTER, 1)
2095 else
2096 LINUX_NETFILTER="no"
2097 AC_DEFINE(LINUX_NETFILTER, 0)
2098 fi
2099 AC_MSG_RESULT($LINUX_NETFILTER)
2100fi
2101if test "$LINUX_NETFILTER" = "no" ; then
2102 echo "WARNING: Cannot find necessary Linux 2.4 kernel header files"
2103 echo " Linux 2.4 Transparent Proxy support WILL NOT be enabled"
2104 sleep 10
2105fi
2106
91bc414e 2107if test -z "$USE_GNUREGEX" ; then
2108 case "$host" in
2109 *-sun-solaris2.[[0-4]])
2110 USE_GNUREGEX="yes"
2111 ;;
2112 *-next-nextstep*)
2113 USE_GNUREGEX="yes"
2114 ;;
2115 esac
2116fi
7a081912 2117AC_MSG_CHECKING(if GNUregex needs to be compiled)
91bc414e 2118if test -z "$USE_GNUREGEX"; then
55878dfd 2119if test "$ac_cv_func_regcomp" = "no" || test "$USE_GNUREGEX" = "yes" ; then
74946a0f 2120 USE_GNUREGEX="yes"
00fa2c12 2121else
0cccc031 2122 AC_TRY_COMPILE([#include <sys/types.h>
2123#include <regex.h>],[regex_t t; regcomp(&t,"",0);],
91bc414e 2124 USE_GNUREGEX="no",
2125 USE_GNUREGEX="yes")
2126fi
00fa2c12 2127fi
74946a0f 2128AC_MSG_RESULT($USE_GNUREGEX)
2129if test "$USE_GNUREGEX" = "yes"; then
26675bf4 2130 REGEXLIB="-lregex"
7a081912 2131 LIBREGEX="libregex.a"
6a9f6389 2132 AC_DEFINE(USE_GNUREGEX,1,[Define if we should use GNU regex])
7a081912 2133fi
26675bf4 2134AC_SUBST(REGEXLIB)
00fa2c12 2135AC_SUBST(LIBREGEX)
7a081912 2136
3f6fcd8a 2137AC_REPLACE_FUNCS(\
3d0cf10e 2138 drand48 \
3f6fcd8a 2139 tempnam \
4d38fc7e 2140 strerror \
3f6fcd8a 2141)
2142
5c51415d 2143dnl Not cached since people are likely to tune this
e924600d 2144AC_MSG_CHECKING(Default FD_SETSIZE value)
2145AC_TRY_RUN([
2146#if HAVE_STDIO_H
2147#include <stdio.h>
2148#endif
2149#if HAVE_UNISTD_H
2150#include <unistd.h>
2151#endif
2152#if HAVE_SYS_TIME_H
2153#include <sys/time.h>
2154#endif
2155#if HAVE_SYS_SELECT_H
2156#include <sys/select.h>
2157#endif
2158#if HAVE_SYS_TYPES_H
2159#include <sys/types.h>
2160#endif
2161main() {
635e6242 2162 FILE *fp = fopen("conftestval", "w");
2163 fprintf (fp, "%d\n", FD_SETSIZE);
e924600d 2164 exit(0);
2165}
2166],
2167DEFAULT_FD_SETSIZE=`cat conftestval`,
2168DEFAULT_FD_SETSIZE=256,
2169DEFAULT_FD_SETSIZE=256)
2170AC_MSG_RESULT($DEFAULT_FD_SETSIZE)
6a9f6389 2171AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE, [Default FD_SETSIZE value])
e924600d 2172
f49be7d1 2173
5c51415d 2174dnl Not cached since people are likely to tune this
234967c9 2175AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
c76d8acc 2176dnl damn! FreeBSD's pthreads breaks dup2().
f49be7d1 2177if test -n "$squid_filedescriptors_num" ; then
2178 SQUID_MAXFD=$squid_filedescriptors_num
2179 AC_MSG_RESULT($SQUID_MAXFD (user-forced))
2180else
2181 TLDFLAGS="$LDFLAGS"
2182 case $host in
2183 i386-unknown-freebsd*)
2184 if echo "$LDFLAGS" | grep -q pthread; then
2185 LDFLAGS=`echo $LDFLAGS | sed -e "s/-pthread//"`
2186 fi
2187 esac
2188 AC_TRY_RUN([
8cca06da 2189#include <stdio.h>
234967c9 2190#include <unistd.h>
30a4f2a8 2191#include <sys/time.h> /* needed on FreeBSD */
234967c9 2192#include <sys/param.h>
2193#include <sys/resource.h>
2194main() {
635e6242 2195 FILE *fp;
234967c9 2196 int i,j;
42b51993 2197#if defined(__CYGWIN32__) || defined (__CYGWIN__)
b05490a8 2198 /* getrlimit and sysconf returns bogous values on cygwin32.
df087e68 2199 * Number of fds is virtually unlimited in cygwin (sys/param.h)
b05490a8 2200 * __CYGWIN32__ is deprecated.
df087e68 2201 */
2202 i = NOFILE;
b05490a8 2203#else
2204#if HAVE_SETRLIMIT
234967c9 2205 struct rlimit rl;
2206#if defined(RLIMIT_NOFILE)
2207 if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
2208 perror("getrlimit: RLIMIT_NOFILE");
2209 } else {
2210 rl.rlim_cur = rl.rlim_max; /* set it to the max */
2211 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
2212 perror("setrlimit: RLIMIT_NOFILE");
2213 }
2214 }
2215#elif defined(RLIMIT_OFILE)
2216 if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
2217 perror("getrlimit: RLIMIT_OFILE");
2218 } else {
2219 rl.rlim_cur = rl.rlim_max; /* set it to the max */
2220 if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
2221 perror("setrlimit: RLIMIT_OFILE");
2222 }
2223 }
2224#endif /* RLIMIT_NOFILE */
2225#endif /* HAVE_SETRLIMIT */
d9399075 2226 /* by starting at 2^14, we will never get higher
2227 than 2^15 for SQUID_MAXFD */
2228 i = j = 1<<14;
2229 while (j) {
2230 j >>= 1;
2231 if (dup2(0, i) < 0) {
2232 i -= j;
2233 } else {
2234 close(i);
2235 i += j;
2236 }
2237 }
2238 i++;
b05490a8 2239#endif /* IF !DEF CYGWIN */
635e6242 2240 fp = fopen("conftestval", "w");
2241 fprintf (fp, "%d\n", i);
234967c9 2242 exit(0);
2243}
f49be7d1 2244 ],
2245 SQUID_MAXFD=`cat conftestval`,
2246 SQUID_MAXFD=256,
2247 SQUID_MAXFD=256)
2248 AC_MSG_RESULT($SQUID_MAXFD)
2249fi
6a9f6389 2250AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD,[Maximum number of open filedescriptors])
b9cc811d 2251if test "$SQUID_MAXFD" -lt 512 ; then
80ab193b 2252 echo "WARNING: $SQUID_MAXFD may not be enough filedescriptors if your"
2253 echo " cache will be very busy. Please see the FAQ page"
2b6662ba 2254 echo " http://www.squid-cache.org/FAQ/FAQ-11.html#filedescriptors"
e692ff35 2255 echo " on how to increase your filedescriptor limit"
933cc58d 2256 sleep 10
80ab193b 2257fi
c76d8acc 2258LDFLAGS="$TLDFLAGS"
234967c9 2259
5c51415d 2260dnl Not cached since people are likely to tune this
30a4f2a8 2261AC_MSG_CHECKING(Default UDP send buffer size)
2262AC_TRY_RUN([
8cca06da 2263#include <stdlib.h>
2264#include <stdio.h>
30a4f2a8 2265#include <sys/types.h>
2266#include <sys/socket.h>
2267#include <netinet/in.h>
2268main ()
2269{
635e6242 2270 FILE *fp;
30a4f2a8 2271 int fd,val=0,len=sizeof(int);
2272 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
2273 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
2274 if (val<=0) exit(1);
635e6242 2275 fp = fopen("conftestval", "w");
2276 fprintf (fp, "%d\n", val);
30a4f2a8 2277 exit(0);
2278}
2279],
6a9f6389 2280SQUID_DETECT_UDP_SO_SNDBUF=`cat conftestval`,
2281SQUID_DETECT_UDP_SO_SNDBUF=16384,
2282SQUID_DETECT_UDP_SO_SNDBUF=16384)
2283AC_MSG_RESULT($SQUID_DETECT_UDP_SO_SNDBUF)
2284AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_SNDBUF, $SQUID_DETECT_UDP_SO_SNDBUF,[UDP send buffer size])
30a4f2a8 2285
5c51415d 2286dnl Not cached since people are likely to tune this
30a4f2a8 2287AC_MSG_CHECKING(Default UDP receive buffer size)
2288AC_TRY_RUN([
8cca06da 2289#include <stdlib.h>
2290#include <stdio.h>
30a4f2a8 2291#include <sys/types.h>
2292#include <sys/socket.h>
2293#include <netinet/in.h>
2294main ()
2295{
635e6242 2296 FILE *fp;
30a4f2a8 2297 int fd,val=0,len=sizeof(int);
2298 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
2299 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
2300 if (val <= 0) exit(1);
635e6242 2301 fp = fopen("conftestval", "w");
2302 fprintf (fp, "%d\n", val);
30a4f2a8 2303 exit(0);
2304}
2305],
6a9f6389 2306SQUID_DETECT_UDP_SO_RCVBUF=`cat conftestval`,
2307SQUID_DETECT_UDP_SO_RCVBUF=16384,
2308SQUID_DETECT_UDP_SO_RCVBUF=16384)
2309AC_MSG_RESULT($SQUID_DETECT_UDP_SO_RCVBUF)
2310AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_RCVBUF, $SQUID_DETECT_UDP_SO_RCVBUF,[UDP receive buffer size])
30a4f2a8 2311
5c51415d 2312dnl Not cached since people are likely to tune this
30a4f2a8 2313AC_MSG_CHECKING(Default TCP send buffer size)
2314AC_TRY_RUN([
8cca06da 2315#include <stdlib.h>
2316#include <stdio.h>
30a4f2a8 2317#include <sys/types.h>
2318#include <sys/socket.h>
2319#include <netinet/in.h>
2320main ()
2321{
635e6242 2322 FILE *fp;
30a4f2a8 2323 int fd,val=0,len=sizeof(int);
2324 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
2325 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
2326 if (val <= 0) exit(1);
635e6242 2327 fp = fopen("conftestval", "w");
2328 fprintf (fp, "%d\n", val);
30a4f2a8 2329 exit(0);
2330}
2331],
2332SQUID_TCP_SO_SNDBUF=`cat conftestval`,
1c481e00 2333SQUID_TCP_SO_SNDBUF=16384,
2334SQUID_TCP_SO_SNDBUF=16384)
30a4f2a8 2335AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF)
6a9f6389 2336AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF,[TCP send buffer size])
30a4f2a8 2337
5c51415d 2338dnl Not cached since people are likely to tune this
30a4f2a8 2339AC_MSG_CHECKING(Default TCP receive buffer size)
2340AC_TRY_RUN([
8cca06da 2341#include <stdlib.h>
2342#include <stdio.h>
30a4f2a8 2343#include <sys/types.h>
2344#include <sys/socket.h>
2345#include <netinet/in.h>
2346main ()
2347{
635e6242 2348 FILE *fp;
30a4f2a8 2349 int fd,val=0,len=sizeof(int);
2350 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
2351 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
2352 if (val <= 0) exit(1);
635e6242 2353 fp = fopen("conftestval", "w");
2354 fprintf (fp, "%d\n", val);
30a4f2a8 2355 exit(0);
2356}
2357],
2358SQUID_TCP_SO_RCVBUF=`cat conftestval`,
1c481e00 2359SQUID_TCP_SO_RCVBUF=16384,
2360SQUID_TCP_SO_RCVBUF=16384)
30a4f2a8 2361AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF)
6a9f6389 2362AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF,[TCP receive buffer size])
30a4f2a8 2363
5c51415d 2364AC_CACHE_CHECK(if sys_errlist is already defined, ac_cv_needs_sys_errlist,
9bc73deb 2365 AC_TRY_COMPILE([#include <stdio.h>],[char *s = sys_errlist;],
5c51415d 2366 ac_cv_needs_sys_errlist="no",
2367 ac_cv_needs_sys_errlist="yes")
2368)
2369if test "$ac_cv_needs_sys_errlist" = "yes" ; then
6a9f6389 2370 AC_DEFINE(NEED_SYS_ERRLIST,1,[If we need to declare sys_errlist[] as external])
5c51415d 2371fi
30a4f2a8 2372
5c51415d 2373dnl Not cached since people are likely to change this
6bf65235 2374AC_MSG_CHECKING(for libresolv _dns_ttl_ hack)
2375AC_TRY_LINK(extern int _dns_ttl_;,return _dns_ttl_;,
2376[AC_MSG_RESULT(yes)
6a9f6389 2377AC_DEFINE(LIBRESOLV_DNS_TTL_HACK,1,[If libresolv.a has been hacked to export _dns_ttl_])],
6bf65235 2378AC_MSG_RESULT(no))
2379
a937d5e3 2380AC_MSG_CHECKING(if inet_ntoa() actually works)
2381AC_TRY_RUN([
2382#include <stdlib.h>
2383#include <stdio.h>
2384#include <sys/types.h>
2385#include <netinet/in.h>
2386#include <arpa/inet.h>
2387main ()
2388{
635e6242 2389 FILE *fp;
a937d5e3 2390 struct in_addr in;
2391 in.s_addr = inet_addr("1.2.3.4");
635e6242 2392 fp = fopen("conftestval", "w");
2393 fprintf (fp, "%s\n", inet_ntoa(in));
a937d5e3 2394 exit(0);
2395}
2396],
2397INET_NTOA_RESULT=`cat conftestval`,
2398INET_NTOA_RESULT="broken",
2399INET_NTOA_RESULT="broken")
2400if test "$INET_NTOA_RESULT" = "1.2.3.4" ; then
2401 AC_MSG_RESULT("yes")
2402else
2403 AC_MSG_RESULT("no")
b6a2f15e 2404 echo "Will use our own inet_ntoa()."
33f5f8b9 2405 AC_LIBOBJ(inet_ntoa)
b6a2f15e 2406# echo "WARNING: This looks bad, and probably prevents Squid from working."
2407# echo " If you're on IRIX and using GCC 2.8, you probably need"
2408# echo " to use the IRIX C compiler instead."
2409# sleep 10
a937d5e3 2410fi
2411
b6a2f15e 2412if test "$ac_cv_header_sys_statvfs_h" = "yes" ; then
c68e9c6b 2413AC_MSG_CHECKING(for working statvfs() interface)
2414AC_TRY_COMPILE([
2415#include <stdlib.h>
2416#include <stdio.h>
2417#include <sys/types.h>
2418#include <sys/statvfs.h>
2419],
2420[
2421struct statvfs sfs;
2422sfs.f_blocks = sfs.f_bfree = sfs.f_frsize =
2423sfs.f_files = sfs.f_ffree = 0;
2424statvfs("/tmp", &sfs);
2425],
2426 ac_cv_func_statvfs=yes,
2427 ac_cv_func_statvfs=no)
2428AC_MSG_RESULT($ac_cv_func_statvfs)
6b8e7481 2429if test "$ac_cv_func_statvfs" = "yes" ; then
6a9f6389 2430 AC_DEFINE(HAVE_STATVFS,1,[If your system has statvfs(), and if it actually works!])
b6a2f15e 2431fi
6b8e7481 2432fi
c68e9c6b 2433
2434AC_CACHE_CHECK(for _res.nsaddr_list, ac_cv_have_res_nsaddr_list,
2435AC_TRY_COMPILE([
2436#if HAVE_SYS_TYPES_H
2437#include <sys/types.h>
2438#endif
2439#if HAVE_NETINET_IN_H
2440#include <netinet/in.h>
2441#endif
2442#if HAVE_ARPA_INET_H
2443#include <arpa/inet.h>
2444#endif
2445#if HAVE_ARPA_NAMESER_H
2446#include <arpa/nameser.h>
2447#endif
2448#if HAVE_RESOLV_H
2449#include <resolv.h>
2450#endif
2451],
2452[_res.nsaddr_list[[0]];],
2453ac_cv_have_res_nsaddr_list="yes",
2454ac_cv_have_res_nsaddr_list="no"))
2455if test $ac_cv_have_res_nsaddr_list = "yes" ; then
6a9f6389 2456 AC_DEFINE(HAVE_RES_NSADDR_LIST,1,[If _res structure has nsaddr_list member])
c68e9c6b 2457fi
2458
2459if test $ac_cv_have_res_nsaddr_list = "no" ; then
2460AC_CACHE_CHECK(for _res.ns_list, ac_cv_have_res_ns_list,
2461AC_TRY_COMPILE([
2462#if HAVE_SYS_TYPES_H
2463#include <sys/types.h>
2464#endif
2465#if HAVE_NETINET_IN_H
2466#include <netinet/in.h>
2467#endif
2468#if HAVE_ARPA_INET_H
2469#include <arpa/inet.h>
2470#endif
2471#if HAVE_ARPA_NAMESER_H
2472#include <arpa/nameser.h>
2473#endif
2474#if HAVE_RESOLV_H
2475#include <resolv.h>
2476#endif
2477],
2478[_res.ns_list[[0]].addr;],
2479ac_cv_have_res_ns_list="yes",
2480ac_cv_have_res_ns_list="no"))
2481if test $ac_cv_have_res_ns_list = "yes" ; then
6a9f6389 2482 AC_DEFINE(HAVE_RES_NS_LIST,1,[If _res structure has ns_list member])
c68e9c6b 2483fi
2484fi
2485
090089c4 2486dnl Need the debugging version of malloc if available
2487XTRA_OBJS=''
6509a1a0 2488if test "$ac_cv_lib_malloc_main" = "yes" ; then
090089c4 2489 if test -r /usr/lib/debug/malloc.o ; then
2490 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
2491 fi
2492 if test -r /usr/lib/debug/mallocmap.o ; then
2493 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
2494 fi
2495fi
2bbd722b 2496
090089c4 2497AC_SUBST(XTRA_OBJS)
2498
38fea766 2499if test -z "$XTRA_LIBS"; then
2500 XTRA_LIBS="$LIBS"
0f5a16f8 2501 dnl minor cleanup
2502 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
38fea766 2503 LIBS=''
2504fi
090089c4 2505AC_SUBST(XTRA_LIBS)
2506
090089c4 2507dnl Clean up after OSF/1 core dump bug
2508rm -f core
2509
6a9f6389 2510AC_CONFIG_FILES([\
a2794549 2511 Makefile \
2512 lib/Makefile \
a2794549 2513 scripts/Makefile \
2514 scripts/RunCache \
2515 scripts/RunAccel \
2516 src/Makefile \
2517 src/fs/Makefile \
2518 src/repl/Makefile \
2519 src/auth/Makefile \
a2794549 2520 contrib/Makefile \
2521 snmplib/Makefile \
2522 icons/Makefile \
2523 errors/Makefile \
1077c1b8 2524 test-suite/Makefile \
99db07b3 2525 doc/Makefile \
0c510f3c 2526 helpers/Makefile \
2527 helpers/basic_auth/Makefile \
2528 helpers/basic_auth/LDAP/Makefile \
2529 helpers/basic_auth/MSNT/Makefile \
2530 helpers/basic_auth/NCSA/Makefile \
2531 helpers/basic_auth/PAM/Makefile \
2532 helpers/basic_auth/SMB/Makefile \
2533 helpers/basic_auth/YP/Makefile \
2534 helpers/basic_auth/getpwnam/Makefile \
2535 helpers/basic_auth/multi-domain-NTLM/Makefile \
2536 helpers/basic_auth/SASL/Makefile \
2537 helpers/basic_auth/winbind/Makefile \
2538 helpers/digest_auth/Makefile \
2539 helpers/digest_auth/password/Makefile \
2540 helpers/ntlm_auth/Makefile \
2541 helpers/ntlm_auth/fakeauth/Makefile \
2542 helpers/ntlm_auth/no_check/Makefile \
2543 helpers/ntlm_auth/SMB/Makefile \
2544 helpers/ntlm_auth/SMB/smbval/Makefile \
2545 helpers/ntlm_auth/winbind/Makefile \
c6588c68 2546 helpers/external_acl/Makefile \
2547 helpers/external_acl/ip_user/Makefile \
2548 helpers/external_acl/ldap_group/Makefile \
2549 helpers/external_acl/unix_group/Makefile \
2550 helpers/external_acl/wbinfo_group/Makefile \
aa0f9348 2551 helpers/external_acl/winbind_group/Makefile
53cbe3e4 2552])
43ae1d95 2553
2554AC_CONFIG_SUBDIRS(lib/libTrie)
2555
6a9f6389 2556AC_OUTPUT