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