]> git.ipfire.org Git - thirdparty/squid.git/blame - configure.in
Make --with-large-files and --with-build-envirnment=default play nice together
[thirdparty/squid.git] / configure.in
CommitLineData
1b3db6d9 1
2877b8a9 2dnl Configuration input file for Squid
090089c4 3dnl
52303a3d 4dnl $Id: configure.in,v 1.497 2008/02/17 09:24:49 serassio Exp $
090089c4 5dnl
090089c4 6dnl
7dnl
39e4ea99 8AC_INIT(Squid Web Proxy, 3.HEAD-BZR, http://www.squid-cache.org/bugs/, squid)
856e69c5 9AC_PREREQ(2.52)
8d9ce05e 10AM_CONFIG_HEADER(include/autoconf.h)
71b12d7c 11AC_CONFIG_AUX_DIR(cfgaux)
8d9ce05e 12AC_CONFIG_SRCDIR([src/main.cc])
25b6a907 13AM_INIT_AUTOMAKE([tar-ustar])
52303a3d 14AC_REVISION($Revision: 1.497 $)dnl
a2794549 15AC_PREFIX_DEFAULT(/usr/local/squid)
246d7ffc 16AM_MAINTAINER_MODE
a2794549 17
63e02610 18PRESET_CFLAGS="$CFLAGS"
19PRESET_LDFLAGS="$LDFLAGS"
20
a2794549 21dnl Set default LDFLAGS
22if test -z "$LDFLAGS"; then
23 LDFLAGS="-g"
24fi
25
a2794549 26dnl Check for GNU cc
27AC_PROG_CC
e6c4cdd6 28AM_PROG_CC_C_O
c4b0db82 29AC_LANG_C
29b8d8d6 30AC_PROG_CXX
88d50a22 31AC_CANONICAL_HOST
3e7b6055
AR
32
33
34use_loadable_modules=1
35AC_MSG_CHECKING(whether to use loadable modules)
36AC_ARG_ENABLE(loadable-modules,
37 [
38 AC_HELP_STRING(
39 [--disable-loadable-modules],
40 [do not support loadable modules])
41 ],
42 [
43 case "${enableval}" in
44 yes) use_loadable_modules=yes ;;
45 no) use_loadable_modules=no ;;
46 *) AC_MSG_ERROR(bad value ${enableval} for --disable-loadable-modules) ;;
47 esac
48 AC_MSG_RESULT([$use_loadable_modules, explicitly])
49 ],
50 [
51 use_loadable_modules=yes;
52 AC_MSG_RESULT([$use_loadable_modules, implicitly])
53 ]
54)
55
56AM_CONDITIONAL(USE_LOADABLE_MODULES, test $use_loadable_modules = yes)
57
58if test $use_loadable_modules = yes;
59then
60 AC_DEFINE(USE_LOADABLE_MODULES, 1, [Support Loadable Modules])
61 AC_ENABLE_SHARED
62else
63 AC_DISABLE_SHARED
64fi
65
66AC_LIBTOOL_DLOPEN
67if test $use_loadable_modules = yes;
68then
69 AC_LIBLTDL_CONVENIENCE(lib/libLtdl)
70fi
645aa936 71AC_PROG_LIBTOOL
f5691f9c 72AC_LTDL_DLLIB
3e7b6055
AR
73
74# Do we need these unconditionally for "make distcheck" to work?
75AC_SUBST(INCLTDL)
76AC_SUBST(LIBLTDL)
77
78if test $use_loadable_modules = yes;
79then
80 # Why is this needed? Should not libtool's AC_LIBTOOL_DLOPEN do that?
81 LIBADD_DL=${lt_cv_dlopen_libs}
82 AC_SUBST([LIBADD_DL])
83fi
84
645aa936 85AC_PROG_RANLIB
88d50a22 86
a2794549 87
26675bf4 88CRYPTLIB=''
00fa2c12 89REGEXLIB='' # -lregex
90LIBREGEX='' # libregex.a
090089c4 91
a2794549 92dnl find out the exe extension for this platform. If it's not empty, use it for CGI's as well.
93AC_EXEEXT
94AC_OBJEXT
95
96if test -z "$EXEEXT"; then
97 CGIEXT=".cgi"
98else
7aeb8001 99 # automake automatically adds .exe when installing binaries
100 CGIEXT=""
a2794549 101fi
7aeb8001 102AC_SUBST(CGIEXT)
a2794549 103
0e6d05ef 104dnl this should be expanded to a list of platform sensible support requirements.
105dnl (adding an option like --enable-cygwin-support doesn't make sense :]) - R Collins 2001
df087e68 106case "$host_os" in
4b26fae9 107mingw|mingw32|cygwin|cygwin32)
a2794549 108 AM_CONDITIONAL(ENABLE_WIN32SPECIFIC, true)
df087e68 109 ;;
110*)
a2794549 111 AM_CONDITIONAL(ENABLE_WIN32SPECIFIC, false)
df087e68 112 ;;
113esac
df087e68 114
4b26fae9 115case "$host_os" in
116mingw|mingw32)
117 AC_PATH_PROG(WIN32_PSAPI, psapi.dll, none)
118 CFLAGS="$CFLAGS -mthreads"
119 CXXFLAGS="$CXXFLAGS -mthreads"
120 if test "$ac_cv_path_WIN32_PSAPI" = "none"; then
121 echo "PSAPI.DLL is recommended to run Squid on Windows NT Platform"
122 echo "Please see PSAPI.DLL section on doc/win32-relnotes.html."
123 else
124 AC_DEFINE(HAVE_WIN32_PSAPI,1,[Define if you have PSAPI.DLL on Windows systems])
125 LIBS="$LIBS -lpsapi"
126 fi
790ebe36 127 MINGW_LIBS="-lmingwex"
b5d712b5 128 AM_CONDITIONAL(USE_IPC_WIN32, true)
790ebe36 129 AC_SUBST(MINGW_LIBS)
4b26fae9 130 ;;
b5d712b5 131*)
132 AM_CONDITIONAL(USE_IPC_WIN32, false)
133 ;;
4b26fae9 134esac
135
a26bdc75 136if test -z "$CACHE_HTTP_PORT"; then
137 CACHE_HTTP_PORT="3128"
138fi
139if test -z "$CACHE_ICP_PORT"; then
140 CACHE_ICP_PORT="3130"
141fi
a26bdc75 142
f4aaf39c 143dnl Substitutions
6a9f6389 144AC_DEFINE_UNQUOTED(CACHE_HTTP_PORT, $CACHE_HTTP_PORT,
145[What default TCP port to use for HTTP listening?])
58c1507a 146AC_SUBST(CACHE_HTTP_PORT)
6a9f6389 147AC_DEFINE_UNQUOTED(CACHE_ICP_PORT, $CACHE_ICP_PORT,
148[What default UDP port to use for ICP listening?])
f5e5c4cf 149AC_SUBST(CACHE_ICP_PORT)
090089c4 150
6a9f6389 151AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host",[Host type from configure])
30a4f2a8 152
6a9f6389 153AC_DEFINE_UNQUOTED(SQUID_CONFIGURE_OPTIONS, "$ac_configure_args", [configure command line used to configure Squid])
090089c4 154
5483d916 155CACHE_EFFECTIVE_USER="nobody"
156AC_ARG_WITH(default-user,
157 [ --with-default-user=USER System user account for squid permissions.
158 default: nobody],
159 [ CACHE_EFFECTIVE_USER="$withval" ]
160)
161AC_SUBST(CACHE_EFFECTIVE_USER)
162
6ad85e8a 163dnl Gerben Wierda <Gerben_Wierda@RnA.nl>
164case "$host" in
165 mab-next-nextstep3)
166 CC="$CC -arch m68k -arch i486 -arch hppa -arch sparc"
167 ;;
168esac
169
4c43504f 170if test "$GCC" = "yes"; then
171 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
172 GCCVER2=`echo $GCCVER | awk '{print $1 * 100}'`
173 case "$host" in
174 i386-*-freebsd*)
175 if test $GCCVER2 -lt 300 ; then
176 echo "ERROR: GCC $GCCVER causes a coredump on $host"
177 echo "ERROR: Try a more recent GCC version"
dd81cb63 178 sleep 5
4c43504f 179 fi
180 ;;
181 esac
182 unset GCCVER
183 unset GCCVER2
184fi
185
30a4f2a8 186dnl Set Default CFLAGS
187if test -z "$PRESET_CFLAGS"; then
188 if test "$GCC" = "yes"; then
189 case "$host" in
97b12a5b 190 *-sun-sunos*)
30a4f2a8 191 # sunos has too many warnings for this to be useful
192 # motorola too
193 ;;
97b12a5b 194 *m88k*)
195 # Motorola cc/ld does not like -02 but is ok on -O
196 CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]/-O/'`
197 ;;
30a4f2a8 198 *)
63e02610 199 CFLAGS="-Wall $CFLAGS"
30a4f2a8 200 ;;
201 esac
81a820c6 202 else
203 case "$host" in
c415c128 204 *mips-sgi-irix6.*)
81a820c6 205 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
63e02610 206 CFLAGS="-O3 -OPT:Olimit=0:space=OFF \
776b0191 207 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
81a820c6 208 -Wl,-woff,85,-woff,84,-woff,134 \
63e02610 209 -nostdinc -I/usr/include -D_BSD_SIGNALS $CFLAGS"
776b0191 210 CXXFLAGS="-O3 -OPT:Olimit=0:space=OFF \
211 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
212 -Wl,-woff,85,-woff,84,-woff,134 \
213 -nostdinc -I/usr/include -D_BSD_SIGNALS $CXXFLAGS"
81a820c6 214 ;;
e8f5fb18 215 alpha-dec-osf4.*)
553c24ae 216 # Mogul says DEC compilers take both -g and -O2
b6a2f15e 217 CFLAGS=`echo $CFLAGS | sed -e 's/-g/-g3/'`
63e02610 218 CFLAGS="-O2 $CFLAGS"
553c24ae 219 ;;
81a820c6 220 *)
221 ;;
222 esac
30a4f2a8 223 fi
30a4f2a8 224fi
225
d2e3605e 226dnl set squid required flags
227if test "$GCC" = "yes"; then
9f68fb10 228dnl Guido Serassio (serassio@squid-cache.org) 20070811
229dnl Using the latest MinGW (gcc 3.4.5 + mingw-runtime 3.13) cannot build with
230dnl -Wmissing-prototypes -Wmissing-declarations
231dnl TODO: check if the problem will be present in any other newer MinGW release.
232 case "$host_os" in
233 mingw|mingw32)
234 SQUID_CFLAGS="-Werror -Wall -Wpointer-arith -Wwrite-strings -Wcomments"
235 ;;
236 *)
237 SQUID_CFLAGS="-Werror -Wall -Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wcomments"
238 ;;
239 esac
240 SQUID_CXXFLAGS="-Werror -Wall -Wpointer-arith -Wwrite-strings -Wcomments"
d2e3605e 241else
9f68fb10 242 SQUID_CFLAGS=
243 SQUID_CXXFLAGS=
d2e3605e 244fi
245AC_SUBST(SQUID_CFLAGS)
246AC_SUBST(SQUID_CXXFLAGS)
247
d7c59e37 248AC_TEST_CHECKFORHUGEOBJECTS
249SQUID_CXXFLAGS="$SQUID_CXXFLAGS $HUGE_OBJECT_FLAG"
250
30a4f2a8 251dnl Set LDFLAGS
252if test -z "$PRESET_LDFLAGS"; then
253 if test "$GCC" = "yes"; then
254 case "$host" in
63e02610 255 *mips-sgi-irix6.*)
256 # Silence Linker warnings 84, 85 and 134
257 LDFLAGS="-Wl,-woff,85 -Wl,-woff,84 -Wl,-woff,134 $LDFLAGS"
258 ;;
30a4f2a8 259 *)
260 # nothing
261 ;;
262 esac
81a820c6 263 else
264 case "$host" in
63e02610 265 *)
266 # nothing
81a820c6 267 ;;
268 esac
30a4f2a8 269 fi
270fi
2060fa9a 271
e5f4e1b0 272AC_ARG_ENABLE(gnuregex,
2c5d82f9 273[ --enable-gnuregex Compile GNUregex. Unless you have reason to use this
2df6213e 274 option, you should not enable it. This library file
275 is usually only required on Windows and very old
276 Unix boxes which do not have their own regex library
277 built in.],
e5f4e1b0 278[USE_GNUREGEX=$enableval])
279
6c0c04db 280SquidInline="yes"
83079644 281
282AC_ARG_ENABLE(optimizations,
283[ --disable-optimizations Don't compile Squid with compiler optimizations enabled.
2df6213e 284 Optimization is good for production builds, but not
285 good for debugging. During development, use
286 --disable-optimizations to reduce compilation times
287 and allow easier debugging. This option implicitly
288 also enabled --disable-inline],
83079644 289[ if test "$enableval" = "no" ; then
290 echo "Disabling compiler optimizations (-O flag)"
291 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
292 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-O[[0-9]]*//'`"
293 SquidInline="no"
294 fi
295])
296
6c0c04db 297AC_ARG_ENABLE(inline,
298[ --disable-inline Don't compile trivial methods as inline. Squid
2df6213e 299 is coded with much of the code able to be inlined.
300 Inlining is good for production builds, but not
301 good for development. During development, use
302 --disable-inline to reduce compilation times and
303 allow incremental builds to be quick. For
304 production builds, or load tests, use
305 --enable-inline to have squid make all trivial
306 methods inlinable by the compiler.],
6c0c04db 307[ if test "$enableval" = "no" ; then
308 SquidInline="no"
309 fi
310])
311
312if test "$SquidInline" = "yes" ; then
313 AC_DEFINE(_SQUID_INLINE_, inline, [Keyword used by squid for inlining methods])
314 AC_DEFINE(_USE_INLINE_,, [Include inline methods into header file])
315else
83079644 316 echo "Inlining optimization disabled"
6c0c04db 317 AC_DEFINE(_SQUID_INLINE_,, [Keyword used by squid for inlining methods])
318fi
319
fa80a8ef 320AC_ARG_ENABLE(debug-cbdata,
321[ --enable-debug-cbdata Provide some debug information in cbdata],
322[ if test "$enableval" = "yes" ; then
323 echo "cbdata debugging enabled"
6a9f6389 324 AC_DEFINE(CBDATA_DEBUG,1,[Enable for cbdata debug information])
fa80a8ef 325 fi
326])
327
0961c811 328dnl This is a developer only option.. developers know how to set defines
329dnl
330dnl AC_ARG_ENABLE(xmalloc-debug,
331dnl [ --enable-xmalloc-debug Do some simple malloc debugging],
332dnl [ if test "$enableval" = "yes" ; then
333dnl echo "Malloc debugging enabled"
6a9f6389 334dnl AC_DEFINE(XMALLOC_DEBUG,1,[Define to do simple malloc debugging])
0961c811 335dnl fi
336dnl ])
337
338dnl This is a developer only option.. developers know how to set defines
339dnl
340dnl AC_ARG_ENABLE(xmalloc-debug-trace,
341dnl [ --enable-xmalloc-debug-trace
342dnl Detailed trace of memory allocations],
343dnl [ if test "$enableval" = "yes" ; then
344dnl echo "Malloc debug trace enabled"
6a9f6389 345dnl AC_DEFINE(XMALLOC_TRACE,1,[Define to have a detailed trace of memory allocations])
346dnl AC_DEFINE(XMALLOC_DEBUG,1)
0961c811 347dnl fi
348dnl ])
e5f4e1b0 349
d9180414 350AC_ARG_ENABLE(xmalloc-statistics,
e5f4e1b0 351[ --enable-xmalloc-statistics
352 Show malloc statistics in status page],
353[ if test "$enableval" = "yes" ; then
354 echo "Malloc statistics enabled"
6a9f6389 355 AC_DEFINE(XMALLOC_STATISTICS,1,[Define to have malloc statistics])
e5f4e1b0 356 fi
357])
358
14b32873 359use_carp=1
323fe0d4 360AC_ARG_ENABLE(carp,
f5e5c4cf 361[ --disable-carp Disable CARP support],
f7c8dc02 362[ if test "$enableval" = "no" ; then
363 echo "CARP disabled"
14b32873 364 use_carp=0
323fe0d4 365 fi
f7c8dc02 366])
14b32873 367if test $use_carp = 1; then
368 AC_DEFINE(USE_CARP, 1, [Cache Array Routing Protocol])
14b32873 369fi
323fe0d4 370
cd748f27 371AC_ARG_ENABLE(async-io,
9bc73deb 372[ --enable-async-io[=N_THREADS]
cd748f27 373 Shorthand for
f85c88f3 374 --with-aufs-threads=N_THREADS
cd748f27 375 --with-pthreads
376 --enable-storeio=ufs,aufs],
377[ case $enableval in
9bc73deb 378 yes)
69144041 379 with_pthreads="yes"
cd748f27 380 STORE_MODULES="ufs aufs"
9bc73deb 381 ;;
382 no)
9bc73deb 383 ;;
384 *)
f85c88f3 385 aufs_io_threads=$enableval
69144041 386 with_pthreads="yes"
cd748f27 387 STORE_MODULES="ufs aufs"
9bc73deb 388 ;;
389 esac
390])
391
f85c88f3 392AC_ARG_WITH(aufs-threads,
393[ --with-aufs-threads=N_THREADS
cd748f27 394 Tune the number of worker threads for the aufs object
395 store.],
a3310b77 396[ case $withval in
397 [[0-9]]*)
398 aufs_io_threads=$withval
399 ;;
400 *)
401 echo "ERROR: Invalid --with-aufs-threads argument"
402 exit 1
403 ;;
404 esac
405])
f85c88f3 406if test "$aufs_io_threads"; then
407 echo "With $aufs_io_threads aufs threads"
6a9f6389 408 AC_DEFINE_UNQUOTED(AUFS_IO_THREADS,$aufs_io_threads,
409 [Defines how many threads aufs uses for I/O])
cd748f27 410fi
411
412AC_ARG_WITH(pthreads,
8154dd82 413[ --with-pthreads Use POSIX Threads])
414if test "$with_pthreads" = "yes"; then
cd748f27 415 echo "With pthreads"
9bc73deb 416fi
e5f4e1b0 417
f85c88f3 418AC_ARG_WITH(aio,
8154dd82 419[ --with-aio Use POSIX AIO])
420if test "$with_aio" = "yes"; then
f85c88f3 421 echo "With aio"
f85c88f3 422fi
8154dd82 423
424AC_ARG_WITH(dl,
425[ --with-dl Use dynamic linking])
426if test "$with_dl" = "yes"; then
427 echo "With dl"
428fi
f85c88f3 429
cd748f27 430AC_ARG_ENABLE(storeio,
431[ --enable-storeio=\"list of modules\"
432 Build support for the list of store I/O modules.
433 The default is only to build the "ufs" module.
434 See src/fs for a list of available modules, or
435 Programmers Guide section <not yet written>
436 for details on how to build your custom store module],
437[ case $enableval in
438 yes)
1c690e30 439 for dir in $srcdir/src/fs/*; do
440 module="`basename $dir`"
441 if test -d "$dir" && test "$module" != CVS; then
442 STORE_MODULES="$STORE_MODULES $module"
8154dd82 443 fi
cd748f27 444 done
445 ;;
446 no)
447 ;;
1c690e30 448 *)
449 STORE_MODULES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
cd748f27 450 ;;
451 esac
452],
453[ if test -z "$STORE_MODULES"; then
454 STORE_MODULES="ufs"
455 fi
456])
1c690e30 457if test -n "$STORE_MODULES"; then
458 for module in $STORE_MODULES; do
459 if test -d $srcdir/src/fs/$module; then
460 :
461 else
462 echo "ERROR: storeio $module does not exists"
463 exit 1
464 fi
465 done
466 echo "Store modules built: $STORE_MODULES"
59b2d47f 467 STORE_LINKOBJS=
468 for module in $STORE_MODULES; do
469 STORE_LINKOBJS="$STORE_LINKOBJS fs/${module}/StoreFS${module}.o"
470 done
1c690e30 471fi
a2794549 472dnl remove all but diskd - its the only module that needs to recurse
473dnl into the sub directory
d3b3ab85 474UFS_FOUND=
1c690e30 475NEED_UFS=
b9ae18aa 476NEED_BLOCKING=
477NEED_DISKDAEMON=
478NEED_DISKTHREADS=
479NEED_AIO=
082a5e7a 480STORE_TESTS=
a2794549 481for fs in $STORE_MODULES none; do
8154dd82 482 case "$fs" in
483 diskd)
1c690e30 484 NEED_UFS="true"
b9ae18aa 485 NEED_BLOCKING="true"
486 NEED_DISKDAEMON="true"
8154dd82 487 ;;
488 aufs)
1c690e30 489 NEED_UFS="true"
b9ae18aa 490 NEED_BLOCKING="true"
491 NEED_DISKTHREADS="true"
8154dd82 492 ;;
493 coss)
082a5e7a 494 NEED_AIO="true"
3256ae73 495 dnl
496 dnl Automake om MinGW needs explicit exe extension
497 dnl for STORE_TESTS substition
498 dnl
082a5e7a 499 STORE_TESTS="$STORE_TESTS tests/testCoss$EXEEXT"
500 ;;
d3b3ab85 501 ufs)
082a5e7a 502 UFS_FOUND="true"
503 STORE_TESTS="$STORE_TESTS tests/testUfs$EXEEXT"
8154dd82 504 esac
a2794549 505done
b9ae18aa 506STORE_OBJS=
507STORE_LIBS=
508dnl We have 'fake' modules - aufs and diskd - legacy.
509for fs in $STORE_MODULES; do
510 case "$fs" in
511 diskd);;
512 aufs);;
513 *)
514 STORE_OBJS="$STORE_OBJS fs/lib${fs}.a"
515 STORE_LIBS="$STORE_LIBS lib${fs}.a"
516 ;;
517 esac
518done
d3b3ab85 519
1c690e30 520if test -z "$UFS_FOUND" && test -n "$NEED_UFS"; then
3256ae73 521 echo "adding UFS, as it contains core logic for diskd and aufs"
522 STORE_OBJS="$STORE_OBJS fs/libufs.a"
523 STORE_LIBS="$STORE_LIBS libufs.a"
524 STORE_MODULES="$STORE_MODULES ufs"
525 STORE_LINKOBJS="$STORE_LINKOBJS fs/ufs/StoreFSufs.o"
526 dnl
527 dnl Automake om MinGW needs explicit exe extension
528 dnl for STORE_TESTS substition
529 dnl
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
abb2a3d9 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"
b9ae18aa 602fi
603
604if test -z "$FOUND_DISKDAEMON" && test -n "$NEED_DISKDAEMON"; then
abb2a3d9 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"
b9ae18aa 610fi
611
612if test -z "$FOUND_DISKTHREADS" && test -n "$NEED_DISKTHREADS"; then
abb2a3d9 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"
b9ae18aa 617fi
595c7973 618
b9ae18aa 619if test -z "$FOUND_AIO" && test -n "$NEED_AIO"; then
abb2a3d9 620 echo "adding AIO, as it is used by an active, legacy Store Module"
621 DISK_LIBS="$DISK_LIBS libAIO.a"
622 DISK_MODULES="$DISK_MODULES AIO"
623 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/AIO/AIODiskIOModule.o"
b9ae18aa 624fi
625echo "IO Modules built: $DISK_MODULES"
00dae584 626USE_AIOPS_WIN32=0
627USE_AIO_WIN32=0
b9ae18aa 628dnl we know what is being built. now add dependencies.
629for fs in $DISK_MODULES none; do
630 case "$fs" in
631 DiskThreads)
632 if test -z "$with_pthreads"; then
595c7973 633 case "$host_os" in
61163411 634 mingw|mingw32)
00dae584 635 USE_AIOPS_WIN32=1
595c7973 636 echo "DiskThreads IO Module used, Windows threads support automatically enabled"
637 ;;
638 *)
595c7973 639 echo "DiskThreads IO Module used, pthreads support automatically enabled"
640 with_pthreads=yes
641 ;;
642 esac
b9ae18aa 643 fi
644 ;;
645 AIO)
646 if test -z "$with_aio"; then
abb2a3d9 647 case "$host_os" in
61163411 648 mingw|mingw32)
00dae584 649 USE_AIO_WIN32=1
abb2a3d9 650 echo "Aio IO Module used, Windows overlapped I/O support automatically enabled"
651 ;;
652 *)
abb2a3d9 653 echo "Aio IO Module used, aio support automatically enabled"
654 with_aio=yes
655 ;;
656 esac
b9ae18aa 657 fi
658 ;;
659 esac
660done
661
662AC_SUBST(DISK_LIBS)
663AC_SUBST(DISK_PROGRAMS)
664AC_SUBST(DISK_LINKOBJS)
00dae584 665AM_CONDITIONAL([USE_AIOPS_WIN32], [test "$USE_AIOPS_WIN32" = 1])
666AM_CONDITIONAL([USE_AIO_WIN32], [test "$USE_AIO_WIN32" = 1])
b9ae18aa 667
d9180414 668AC_ARG_ENABLE(removal-policies,
6a566b9c 669[ --enable-removal-policies=\"list of policies\"
670 Build support for the list of removal policies.
671 The default is only to build the "lru" module.
672 See src/repl for a list of available modules, or
673 Programmers Guide section 9.9 for details on how
674 to build your custom policy],
675[ case $enableval in
676 yes)
1c690e30 677 for dir in $srcdir/src/repl/*; do
678 module="`basename $dir`"
679 if test -d "$dir" && test "$module" != CVS; then
680 REPL_POLICIES="$REPL_POLICIES $module"
6a566b9c 681 fi
682 done
683 ;;
684 no)
685 ;;
1c690e30 686 *)
687 REPL_POLICIES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
6a566b9c 688 ;;
689 esac
690],
691[ if test -z "$REPL_POLICIES"; then
692 REPL_POLICIES="lru"
693 fi
694])
1c690e30 695if test -n "$REPL_POLICIES"; then
696 for module in $REPL_POLICIES; do
697 if test -d $srcdir/src/repl/$module; then
698 :
699 else
700 echo "ERROR: Removal policy $module does not exists"
701 exit 1
702 fi
703 done
704 echo "Removal policies built: $REPL_POLICIES"
705 REPL_OBJS="repl/lib`echo $REPL_POLICIES|sed -e 's% %.a repl/lib%g'`.a"
706 REPL_LIBS="`echo $REPL_OBJS|sed -e 's%repl/%%g'`"
707fi
6a566b9c 708AC_SUBST(REPL_POLICIES)
6a566b9c 709AC_SUBST(REPL_OBJS)
f71946fc 710AC_SUBST(REPL_LIBS)
6a566b9c 711
d1da2d1f 712AM_CONDITIONAL(ENABLE_PINGER, false)
e5f4e1b0 713AC_ARG_ENABLE(icmp,
714[ --enable-icmp Enable ICMP pinging],
715[ if test "$enableval" = "yes" ; then
716 echo "ICMP enabled"
6a9f6389 717 AC_DEFINE(USE_ICMP,1,
cc192b50 718 [ Defined this to use Squid's ICMP features (highly recommended!)
719 When USE_ICMP is defined, Squid will send ICMP pings to origin server sites.])
d1da2d1f 720 AM_CONDITIONAL(ENABLE_PINGER, true)
e5f4e1b0 721 fi
722])
723
a2794549 724AM_CONDITIONAL(USE_DELAY_POOLS, false)
d9180414 725AC_ARG_ENABLE(delay-pools,
76d83c52 726[ --enable-delay-pools Enable delay pools to limit bandwidth usage],
e5f4e1b0 727[ if test "$enableval" = "yes" ; then
95e36d02 728 echo "Delay pools enabled"
6a9f6389 729 AC_DEFINE([DELAY_POOLS],1,[Traffic management via "delay pools".])
730 AM_CONDITIONAL(USE_DELAY_POOLS, true,)
e5f4e1b0 731 fi
732])
733
5fa840c3
AR
734dnl disable generic/common adaptation support by default
735use_adaptation=no
736
43ae1d95 737AM_CONDITIONAL(USE_ESI, false)
738AC_ARG_ENABLE(esi,
739 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.]),
328c40de 740 use_esi=$enableval, use_esi=no)
741if test "$use_esi" = "yes" ; then
f41735ea 742 AC_DEFINE(USE_SQUID_ESI,1,[Compile the ESI processor and Surrogate header support])
43ae1d95 743 AM_CONDITIONAL(USE_ESI, true)
964b44c3 744 XTRA_LIBS="$XTRA_LIBS -lexpat -lxml2"
a787b56a 745else
f41735ea 746 AC_DEFINE(USE_SQUID_ESI,0,[Compile the ESI processor and Surrogate header support])
43ae1d95 747fi
748
51952383 749AM_CONDITIONAL(USE_ICAP_CLIENT, false)
750AC_ARG_ENABLE(icap-client,
751 AC_HELP_STRING([--enable-icap-client],[Enable the ICAP client.]),
328c40de 752 use_icap_client=$enableval, use_icap_client=no)
753if test "$use_icap_client" = "yes" ; then
51952383 754 AC_DEFINE(ICAP_CLIENT,1,[Enable ICAP client features in Squid])
755 AM_CONDITIONAL(USE_ICAP_CLIENT, true)
5fa840c3
AR
756 ICAP_LIBS="ICAP/libicap.la"
757 use_adaptation=yes
51952383 758else
759 AC_DEFINE(ICAP_CLIENT,0,[Enable ICAP client features in Squid])
c21ad0f5 760 ICAP_LIBS=""
51952383 761fi
c21ad0f5 762AC_SUBST(ICAP_LIBS)
51952383 763
3e7b6055
AR
764use_ecap=1
765AC_MSG_CHECKING(whether to support eCAP)
766AC_ARG_ENABLE(ecap,
767 [
768 AC_HELP_STRING(
769 [--enable-ecap],
770 [support loadable content adaptation modules])
771 ],
772 [
773 case "${enableval}" in
774 yes) use_ecap=yes ;;
775 no) use_ecap=no ;;
776 *) AC_MSG_ERROR(bad value ${enableval} for --enable-ecap) ;;
777 esac
778 AC_MSG_RESULT([$use_ecap, explicitly])
779 ],
780 [
781 use_ecap=no;
782 AC_MSG_RESULT([$use_ecap, implicitly])
783 ]
784)
785
786dnl Perform configuration consistency checks for eCAP
3e7b6055
AR
787if test $use_ecap = yes;
788then
5fa840c3 789 dnl eCAP support requires loadable modules, which are enabled by default
3e7b6055
AR
790 if test "$use_loadable_modules" != "yes"
791 then
792 AC_MSG_ERROR([
793 eCAP support requires loadable modules. Please do not use
794 --disable-loadable-modules with --enable-ecap.]);
795 fi
3e7b6055
AR
796fi
797
798AM_CONDITIONAL(USE_ECAP, test $use_ecap = yes)
799if test $use_ecap = yes;
800then
801 AC_DEFINE(USE_ECAP,1,[Enable eCAP support])
802 ECAP_LIBS="eCAP/libeCAP.la"
5fa840c3 803 use_adaptation=yes
3e7b6055 804else
5fa840c3 805 AC_DEFINE(USE_ECAP,0,[Disable eCAP support])
3e7b6055
AR
806 ECAP_LIBS=""
807fi
808AC_SUBST(ECAP_LIBS)
809
3e7b6055 810
5fa840c3
AR
811dnl enable adaptation if requested by specific adaptation mechanisms
812AM_CONDITIONAL(USE_ADAPTATION, test $use_adaptation = yes)
813if test $use_adaptation = yes
814then
815 AC_DEFINE(USE_ADAPTATION,1,[common adaptation support])
816 ADAPTATION_LIBS="adaptation/libadaptation.la"
51952383 817else
5fa840c3
AR
818 AC_DEFINE(USE_ADAPTATION,0,[common adaptation support])
819 ADAPTATION_LIBS=""
51952383 820fi
5fa840c3 821AC_SUBST(ADAPTATION_LIBS)
3e7b6055
AR
822
823
0961c811 824dnl This is a developer only option. Developers know how to set defines
825dnl
826dnl AC_ARG_ENABLE(mem-gen-trace,
827dnl [ --enable-mem-gen-trace Do trace of memory stuff],
828dnl [ if test "$enableval" = "yes" ; then
829dnl echo "Memory trace (to file) enabled"
6a9f6389 830dnl AC_DEFINE(MEM_GEN_TRACE,1,[Define for log file trace of mem alloc/free])
0961c811 831dnl fi
832dnl ])
36a97e19 833
d9180414 834AC_ARG_ENABLE(useragent-log,
e5f4e1b0 835[ --enable-useragent-log Enable logging of User-Agent header],
836[ if test "$enableval" = "yes" ; then
837 echo "User-Agent logging enabled"
6a9f6389 838 AC_DEFINE(USE_USERAGENT_LOG,1,[If you want to log User-Agent request header values, define this.
839 By default, they are written to useragent.log in the Squid log
840 directory.])
e5f4e1b0 841 fi
842])
843
dfca7e1a 844AC_ARG_ENABLE(referer-log,
0961c811 845[ --enable-referer-log Enable logging of Referer header],
dfca7e1a 846[ if test "$enableval" = "yes" ; then
847 echo "Referer logging enabled"
6a9f6389 848 AC_DEFINE(USE_REFERER_LOG,1,[If you want to log Referer request header values, define this.
849 By default, they are written to referer.log in the Squid log
850 directory.])
dfca7e1a 851 fi
852])
853
0b0cfcf2 854USE_WCCP=1
320e9f36 855AC_ARG_ENABLE(wccp,
0961c811 856[ --disable-wccp Disable Web Cache Coordination Protocol],
eb824054 857[ if test "$enableval" = "no" ; then
858 echo "Web Cache Coordination Protocol disabled"
0b0cfcf2 859 USE_WCCP=0
320e9f36 860 fi
861])
0b0cfcf2 862if test $USE_WCCP = 1; then
863 AC_DEFINE(USE_WCCP, 1, [Define to enable WCCP])
864fi
865
866USE_WCCPv2=1
867AC_ARG_ENABLE(wccpv2,
868[ --disable-wccpv2 Disable Web Cache Coordination V2 Protocol],
869[ if test "$enableval" = "no" ; then
870 echo "Web Cache Coordination V2 Protocol disabled"
871 USE_WCCPv2=0
872 fi
873])
874if test $USE_WCCPv2 = 1; then
875 AC_DEFINE(USE_WCCPv2, 1, [Define to enable WCCP V2])
14b32873 876fi
320e9f36 877
d9180414 878AC_ARG_ENABLE(kill-parent-hack,
9fc0b4b8 879[ --enable-kill-parent-hack
880 Kill parent on shutdown],
e5f4e1b0 881[ if test "$enableval" = "yes" ; then
882 echo "Kill parent on shutdown"
6a9f6389 883 AC_DEFINE(KILL_PARENT_OPT,1,[A dangerous feature which causes Squid to kill its parent process
884 (presumably the RunCache script) upon receipt of SIGTERM or SIGINT.
885 Use with caution.])
e5f4e1b0 886 fi
887])
888
87630341 889USE_SNMP=true
e5f4e1b0 890AC_ARG_ENABLE(snmp,
87630341 891[ --disable-snmp Disable SNMP monitoring support],
892[ if test "$enableval" = "no" ; then
893 echo "SNMP monitoring disabled"
894 USE_SNMP=
895 fi
896])
10faea39 897if test x"$USE_SNMP" = xtrue; then
6a9f6389 898 AC_DEFINE(SQUID_SNMP,1,[Define to enable SNMP monitoring of Squid])
63705952 899 SNMPLIB='../snmplib/libsnmp.a'
e5f4e1b0 900 makesnmplib=snmplib
87630341 901fi
cb50b537 902AM_CONDITIONAL(USE_SNMP, [test x$USE_SNMP = xtrue])
e5f4e1b0 903AC_SUBST(SNMPLIB)
e5f4e1b0 904AC_SUBST(makesnmplib)
905
d9180414 906AC_ARG_ENABLE(cachemgr-hostname,
e5f4e1b0 907[ --enable-cachemgr-hostname[=hostname]
908 Make cachemgr.cgi default to this host],
909[ case $enableval in
910 yes)
6a9f6389 911 AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()],
912 [If you are upset that the cachemgr.cgi form comes up with the hostname field blank, then define this to getfullhostname()])
e5f4e1b0 913 echo "Cachemgr default hostname == host where cachemgr runs"
914 ;;
915 no)
916 : # Nothing to do..
917 ;;
918 *)
919 AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
920 echo "Cachemgr default hostname set to ${enableval}"
921 ;;
922 esac
923])
924
b0dd28ba 925AM_CONDITIONAL(ENABLE_ARP_ACL, false)
d9180414 926AC_ARG_ENABLE(arp-acl,
e5f4e1b0 927[ --enable-arp-acl Enable use of ARP ACL lists (ether address)],
928[ if test "$enableval" = "yes" ; then
929 echo "ARP ACL lists enabled (ether address)"
933cc58d 930 case "$host" in
ef614b1c 931 *-linux-*)
932 ;;
9d8d033e 933 *-solaris*)
a931a29b 934 ;;
9a2f1170 935 *-freebsd*)
936 ;;
f71a524f 937 *-openbsd*)
938 ;;
074bf084 939 *-netbsd*)
940 ;;
5700029a 941 *-cygwin*)
942 LIBS="$LIBS -liphlpapi"
943 ;;
944 *-mingw*)
945 LIBS="$LIBS -liphlpapi"
946 ;;
933cc58d 947 *)
ef614b1c 948 echo "WARNING: ARP ACL support probably won't work on $host."
933cc58d 949 sleep 10
950 ;;
951 esac
6a9f6389 952 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 953 AM_CONDITIONAL(ENABLE_ARP_ACL, true)
e5f4e1b0 954 fi
955])
956
87630341 957USE_HTCP=true
a2794549 958AM_CONDITIONAL(ENABLE_HTCP, false)
74075210 959AC_ARG_ENABLE(htcp,
87630341 960[ --disable-htcp Disable HTCP protocol support],
961[ if test "$enableval" = "no" ; then
962 echo "HTCP support disabled"
b4b8b6da 963 fi
74075210 964])
87630341 965if test x$USE_HTCP = xtrue; then
966 AC_DEFINE(USE_HTCP,1, [Define this to include code for the Hypertext Cache Protocol (HTCP)])
967fi
968AM_CONDITIONAL(ENABLE_HTCP, [test x$USE_HTCP = xtrue])
a2794549 969
3d4022fa 970dnl SSL is not enabled by default.
a2794549 971AM_CONDITIONAL(ENABLE_SSL, false)
74075210 972
3d4022fa 973dnl Default is to use OpenSSL when available
1f7c9178 974AC_ARG_ENABLE(ssl,
975[ --enable-ssl Enable ssl gatewaying support using OpenSSL],
976[ if test "$enableval" != "no"; then
3dff197f 977 echo "SSL gatewaying using OpenSSL enabled"
6a9f6389 978 AC_DEFINE(USE_SSL,1,[Define this to include code for SSL encryption.])
a2794549 979 AM_CONDITIONAL(ENABLE_SSL, true)
4b26fae9 980 case "$host_os" in
981 mingw|mingw32)
982 dnl Native Windows port of OpenSSL needs -lgdi32
ee86c79b 983 SSLLIB='-lssleay32 -leay32 -lgdi32'
4b26fae9 984 ;;
985 *)
986 SSLLIB='-lssl -lcrypto'
987 ;;
988 esac
1f7c9178 989 USE_OPENSSL=1
990 fi
991])
992
3d4022fa 993dnl User may specify OpenSSL is needed from a non-standard location
1f7c9178 994AC_ARG_WITH(openssl,
995[ --with-openssl[=prefix]
996 Compile with the OpenSSL libraries. The path to
997 the OpenSSL development libraries and headers
998 installation can be specified if outside of the
999 system standard directories],
1000[
46ce628c 1001 case "$with_openssl" in
1f7c9178 1002 yes)
1003 USE_OPENSSL=1
1004 ;;
1005 no)
1006 USE_OPENSSL=
1007 ;;
1008 *)
46ce628c 1009 SSLLIBDIR="$with_openssl/lib"
bcce53ce 1010 CPPFLAGS="-I$with_openssl/include $CPPFLAGS"
1f7c9178 1011 USE_OPENSSL=1
1012 esac
1013])
1f7c9178 1014if test -n "$USE_OPENSSL"; then
3dff197f 1015 echo "Using OpenSSL MD5 implementation"
6a9f6389 1016 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)])
1f7c9178 1017 if test -z "$SSLLIB"; then
1018 SSLLIB="-lcrypto" # for MD5 routines
1019 fi
f11555e0 1020 dnl This is a workaround for RedHat 9 brain damage..
1021 if test -d /usr/kerberos/include && test -z "$SSLLIBDIR" && test -f /usr/include/openssl/kssl.h; then
1022 echo "OpenSSL depends on Kerberos"
1023 SSLLIBDIR="/usr/kerberos/lib"
1024 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
1025 fi
1f7c9178 1026fi
1027if test -n "$SSLLIBDIR"; then
1028 SSLLIB="-L$SSLLIBDIR $SSLLIB"
1029fi
1f7c9178 1030AC_SUBST(SSLLIB)
1031
3d4022fa 1032
02749868 1033AC_ARG_ENABLE(forw-via-db,
1034[ --enable-forw-via-db Enable Forw/Via database],
1035[ if test "$enableval" = "yes" ; then
1036 echo "FORW-VIA enabled"
6a9f6389 1037 AC_DEFINE(FORW_VIA_DB,1,[Enable Forw/Via database])
02749868 1038 fi
1039])
1040
6cfa8966 1041AC_ARG_ENABLE(cache-digests,
22df58ea 1042[ --enable-cache-digests Use Cache Digests
2b6662ba 1043 see http://www.squid-cache.org/FAQ/FAQ-16.html],
484f2ebc 1044[ if test "$enableval" = "yes" ; then
6cfa8966 1045 echo "USE_CACHE_DIGESTS enabled"
6a9f6389 1046 AC_DEFINE(USE_CACHE_DIGESTS,1,[Use Cache Digests for locating objects in neighbor caches. This code is still semi-experimental.])
484f2ebc 1047 fi
1048])
1049
8c3926c5 1050dnl Select Default Error language
1051AC_ARG_ENABLE(default-err-language,
1052[ --enable-default-err-language=lang
0961c811 1053 Select default language for Error pages (see
1054 errors directory) ],
933cc58d 1055[
cf9d704a 1056 if test -d $srcdir/errors/$enableval; then
8c3926c5 1057 ERR_DEFAULT_LANGUAGE=$enableval
933cc58d 1058 else
0961c811 1059 echo "ERROR! Unknown language $enableval, see errors/ directory"
933cc58d 1060 exit 1
1061 fi
8c3926c5 1062],[ERR_DEFAULT_LANGUAGE="English"])
1063AC_SUBST(ERR_DEFAULT_LANGUAGE)
1064
1065dnl Select languages to be installed
1066AC_ARG_ENABLE(err-languages,
1067[ --enable-err-languages=\"lang1 lang2..\"
0961c811 1068 Select languages to be installed. (All will be
1069 installed by default) ],
8c3926c5 1070[
1071 for l in $enableval; do
1072 if test -d $srcdir/errors/$l; then :; else
1073 echo "ERROR! Unknown language $$l, see errors/"
1074 exit 1
1075 fi
1076 done
1077 ERR_LANGUAGES=$enableval
1078],[
1079 ERR_LANGUAGES=
1080 for l in $srcdir/errors/*; do
cbbe101f 1081 if test -f $l/ERR_ACCESS_DENIED; then
8c3926c5 1082 ERR_LANGUAGES="$ERR_LANGUAGES `basename $l`"
1083 fi
1084 done
1085])
1086AC_SUBST(ERR_LANGUAGES)
933cc58d 1087
cd748f27 1088dnl Size of COSS memory buffer
1089AC_ARG_WITH(coss-membuf-size,
1090[ --with-coss-membuf-size COSS membuf size (default 1048576 bytes) ],
1091[ if test "$with_coss_membuf_size"; then
1092 echo "Setting COSS membuf size to $with_coss_membuf_size bytes"
6a9f6389 1093 AC_DEFINE_UNQUOTED(COSS_MEMBUF_SZ, $with_coss_membuf_size,[Define if you want to set the COSS membuf size])
cd748f27 1094 fi
1095])
1096
1b3db6d9 1097dnl check for netio plugin stuff
6564c397 1098
9bb83c8b 1099dnl Enable poll()
6564c397 1100disable_poll=
9bb83c8b 1101AC_ARG_ENABLE(poll,
6564c397 1102[ --disable-poll Disable poll() support. ],
1b3db6d9 1103
1104[
c68e9c6b 1105 case "$enableval" in
1106 yes)
9bb83c8b 1107 echo "Forcing poll() to be enabled"
d474c7a6 1108 SELECT_TYPE="poll"
c68e9c6b 1109 ;;
1110 no)
1111 echo "Forcing poll() to be disabled"
6564c397 1112 disable_poll=true
c68e9c6b 1113 ;;
1114 esac
9bb83c8b 1115])
1116
1b3db6d9 1117dnl Enable select()
6564c397 1118disable_select=
1b3db6d9 1119AC_ARG_ENABLE(select,
6564c397 1120[ --disable-select Disable select() support. ],
1b3db6d9 1121
1122[
1123 case "$enableval" in
1124 yes)
1125 echo "Forcing select() to be enabled"
d474c7a6 1126 SELECT_TYPE="select"
1b3db6d9 1127 ;;
1128 no)
1129 echo "Forcing select() to be disabled"
6564c397 1130 disable_select=true
1b3db6d9 1131 ;;
1132 esac
1133])
1134
1135dnl Enable kqueue()
6564c397 1136dnl kqueue support is still experiemntal and unstable. Not enabled by default.
1137disable_kqueue=true
1b3db6d9 1138AC_ARG_ENABLE(kqueue,
6564c397 1139[ --enable-kqueue Enable kqueue() support (experimental).],
1b3db6d9 1140
1141[
1142 case "$enableval" in
1143 yes)
1144 echo "Forcing kqueue() to be enabled"
d474c7a6 1145 SELECT_TYPE="kqueue"
1b3db6d9 1146 ;;
1147 no)
1148 echo "Forcing kqueue() to be disabled"
6564c397 1149 disable_kqueue=true
1b3db6d9 1150 ;;
1151esac
1152])
1153
a46d2c0e 1154dnl Enable epoll()
6564c397 1155disable_epoll=
a46d2c0e 1156AC_ARG_ENABLE(epoll,
328c40de 1157[ --disable-epoll Disable Linux epoll() support.],
a46d2c0e 1158
1159[
1160 case "$enableval" in
1161 yes)
1162 echo "Forcing epoll() to be enabled"
d474c7a6 1163 SELECT_TYPE="epoll"
a46d2c0e 1164 ;;
1165 no)
1166 echo "Forcing epoll() to be disabled"
6564c397 1167 disable_epoll=true
a46d2c0e 1168 ;;
1169esac
1170])
1171
1172
72fd085a 1173dnl Disable HTTP violations
14b32873 1174http_violations=1
72fd085a 1175AC_ARG_ENABLE(http-violations,
1176[ --disable-http-violations
1177 This allows you to remove code which is known to
c68e9c6b 1178 violate the HTTP protocol specification.],
72fd085a 1179[ if test "$enableval" = "no" ; then
1180 echo "Disabling HTTP Violations"
14b32873 1181 http_violations=0
72fd085a 1182 fi
1183])
14b32873 1184if test $http_violations = 1; then
1185 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.])
1186else
1187 AC_DEFINE(HTTP_VIOLATIONS, 0)
1188fi
72fd085a 1189
68075fad 1190dnl Enable IPFW Transparent Proxy
1191AC_ARG_ENABLE(ipfw-transparent,
1192[ --enable-ipfw-transparent
1193 Enable Transparent Proxy support for systems
1194 using FreeBSD IPFW style redirection.],
1195[ if test "$enableval" = "yes" ; then
1196 echo "IPFW Transparent Proxy enabled"
1197 AC_DEFINE(IPFW_TRANSPARENT,1,[Enable support for Transparent Proxy on systems using FreeBSD IPFW address redirection.])
1198 IPFW_TRANSPARENT="yes"
a74968c2
AJ
1199 else
1200 AC_DEFINE(IPFW_TRANSPARENT,0,[Enable support for Transparent Proxy on systems using FreeBSD IPFW address redirection.])
68075fad 1201 fi
1202])
1203
5cafc1d6 1204dnl Enable IP-Filter Transparent Proxy
1205AC_ARG_ENABLE(ipf-transparent,
1206[ --enable-ipf-transparent
1207 Enable Transparent Proxy support for systems
c68e9c6b 1208 using IP-Filter network address redirection.],
5cafc1d6 1209[ if test "$enableval" = "yes" ; then
1210 echo "IP-Filter Transparent Proxy enabled"
6a9f6389 1211 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 1212 IPF_TRANSPARENT="yes"
a74968c2
AJ
1213 else
1214 AC_DEFINE(IPF_TRANSPARENT,0,[Enable support for Transparent Proxy on systems using IP-Filter address redirection. This provides "masquerading" support for non Linux system.])
5cafc1d6 1215 fi
1216])
1217
2b0dd4ac 1218dnl Enable PF Transparent Proxy
1219AC_ARG_ENABLE(pf-transparent,
1220[ --enable-pf-transparent
1221 Enable Transparent Proxy support for systems
1222 using PF network address redirection.],
1223[ if test "$enableval" = "yes" ; then
1224 echo "PF Transparent Proxy enabled"
6a9f6389 1225 AC_DEFINE(PF_TRANSPARENT,1,[Enable support for Transparent Proxy on systems using PF address redirection. This provides "masquerading" support for OpenBSD.])
2b0dd4ac 1226 PF_TRANSPARENT="yes"
a74968c2
AJ
1227 else
1228 AC_DEFINE(PF_TRANSPARENT,0,[Enable support for Transparent Proxy on systems using PF address redirection. This provides "masquerading" support for OpenBSD.])
2b0dd4ac 1229 fi
1230])
1231
d6d62546 1232dnl Enable Linux Netfilter Transparent Proxy
d852fbad 1233AC_ARG_ENABLE(linux-netfilter,
1234[ --enable-linux-netfilter
d6d62546 1235 Enable Transparent Proxy support for Linux (Netfilter) systems.],
d852fbad 1236[ if test "$enableval" = "yes" ; then
d6d62546 1237 echo "Linux (Netfilter) Transparent Proxy enabled"
1238 AC_DEFINE(LINUX_NETFILTER,1,[Enable support for Transparent Proxy on Linux (Netfilter) systems])
d852fbad 1239 LINUX_NETFILTER="yes"
a74968c2
AJ
1240 else
1241 AC_DEFINE(LINUX_NETFILTER,0,[Enable support for Transparent Proxy on Linux (Netfilter) systems])
d852fbad 1242 fi
1243])
1244
bb7b5fd0 1245dnl Enable Large file support
2df6213e 1246buildmodel=""
1247needlargefiles=
1248
1249AC_ARG_WITH(large-files,
3a125142 1250[ --with-large-files Enable support for large files (logs etc).],
2df6213e 1251[ if test "$withval" = yes; then
1252 needlargefiles=1
bb7b5fd0 1253 fi
1254])
1255
2df6213e 1256dnl UNIX Build environment
1257AC_ARG_WITH(build-environment,
1258[ --with-build-environment=model
1259 The build environment to use. Normally one of
1260 POSIX_V6_ILP32_OFF32 32 bits
1261 POSIX_V6_ILP32_OFFBIG 32 bits with large file support
1262 POSIX_V6_LP64_OFF64 64 bits
1263 POSIX_V6_LPBIG_OFFBIG large pointers and files
1264 XBS5_ILP32_OFF32 32 bits (legacy)
1265 XBS5_ILP32_OFFBIG 32 bits with large file support (legacy)
1266 XBS5_LP64_OFF64 64 bits (legacy)
1267 XBS5_LPBIG_OFFBIG large pointers and files (legacy)
1268 default The default for your OS],
1269[ case "$withval" in
1270 yes|no)
1271 echo "--with-build-environment expects a build environment string as used by getconf"
1272 exit 1
1273 ;;
1274 *)
1275 buildmodel="$withval"
1276 ;;
1277 esac
1278])
1279
1280if test $needlargefiles && test -z "$buildmodel"; then
f6fd3d67 1281 for model in POSIX_V6_LPBIG_OFFBIG XBS5_LPBIG_OFFBIG POSIX_V6_LP64_OFF64 XBS5_LP64_OFF64 POSIX_V6_ILP32_OFFBIG XBS5_ILP32_OFFBIG; do
2df6213e 1282 if test "`getconf _$model 2>/dev/null || true`" = 1 || test "`getconf $model 2>/dev/null || true`" ; then
1283 buildmodel=$model
1284 break
1285 fi
1286 done
1287 if test -z "$buildmodel"; then
1288 echo "WARNING: No suitable build environment found for large files. Trying to use _FILE_OFFSET_BITS=64"
1289 sleep 1
9b8002de
HN
1290 fi
1291fi
1292case "$buildmodel" in
1293default|"")
1294 if test "$needlargefiles"; then
1295 echo "Enabling -D_FILE_OFFSET_BITS=64"
2df6213e 1296 CFLAGS="-D_FILE_OFFSET_BITS=64 $CFLAGS"
cca81db1 1297 CXXFLAGS="-D_FILE_OFFSET_BITS=64 $CXXFLAGS"
2df6213e 1298 fi
9b8002de
HN
1299 ;;
1300*)
2df6213e 1301 echo "Using $buildmodel build environment"
1302 if test "`getconf _$buildmodel 2>/dev/null || true`" = 1 || test "`getconf $buildmodel 2>/dev/null || true`" ; then
1303 : # All fine
1304 else
1305 echo "ERROR: Build environment $buildmodel not known to getconf."
1306 exit 1
1307 fi
1308 CFLAGS="`getconf ${buildmodel}_CFLAGS` $CFLAGS"
cca81db1 1309 CXXFLAGS="`getconf ${buildmodel}_CFLAGS` $CXXFLAGS"
2df6213e 1310 LIBS="`getconf ${buildmodel}_LIBS` $LIBS"
1311 LDFLAGS="`getconf ${buildmodel}_LDFLAGS` $LDFLAGS"
63e02610 1312 case "$host" in
2df6213e 1313dnl
a078ea4d
GS
1314dnl On Solaris getconf returns for CFLAGS -xarch=generic64, -Xa and -Usun options, and
1315dnl for LDFLAGS -xarch=generic64, but:
1316dnl "-Xa" is supported only by Sun cc, so we need to remove it when using gcc
1317dnl For gcc "-xarch=generic64" must be replaced with "-m64"
1318dnl The 'sun' define is needed by ipfilter includes, so we must remove "-Usun"
2df6213e 1319 *-solaris*)
1320 if test "$GCC" = "yes"; then
1321 echo "Removing -Xa for gcc on $host"
1322 CFLAGS="`echo $CFLAGS | sed -e 's/-Xa//'`"
cca81db1 1323 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Xa//'`"
a078ea4d
GS
1324 echo "Replacing -xarch=generic64 with -m64 for gcc on $host"
1325 CFLAGS="`echo $CFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
1326 LDFLAGS="`echo $LDFLAGS | sed -e 's/-xarch=generic64//'`"
2df6213e 1327 fi
2ddacc29 1328 echo "Removing -Usun on $host"
2df6213e 1329 CFLAGS="`echo $CFLAGS | sed -e 's/-Usun//'`"
cca81db1 1330 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Usun//'`"
2df6213e 1331 ;;
63e02610 1332dnl
1333dnl On Irix 6.x getconf returns options valid only for the SGI MipsPRO compiler,
1334dnl so we must adjust something to avoid gcc errors.
1335dnl On Irix 6.x 32/64 bit we must replace "-n32" with "-mabi=n32" in CFLAGS and
1336dnl remove "-n32" from LDFLAGS
1337dnl On Irix 6.x 64 bit we must replace "-64" with "-mabi=64" in CFLAGS and remove
1338dnl "-64" from LDFLAGS
1339 *-sgi-irix6.*)
1340 if test "$GCC" = "yes"; then
1341 CFLAGS="`echo $CFLAGS | sed -e 's/-n32/-mabi=n32/'`"
ff37fe61 1342 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-n32/-mabi=n32/'`"
63e02610 1343 LDFLAGS="`echo $LDFLAGS | sed -e 's/-n32//'`"
1344 CFLAGS="`echo $CFLAGS | sed -e 's/-64/-mabi=64/'`"
ff37fe61 1345 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-64/-mabi=64/'`"
63e02610 1346 LDFLAGS="`echo $LDFLAGS | sed -e 's/-64//'`"
1347 fi
1348 ;;
2df6213e 1349 *)
1350 ;;
1351 esac
9b8002de 1352esac
2df6213e 1353
7b0a0d1f 1354dnl Enable Linux transparent proxy support for obsolete TPROXY
e8cca4ac
AJ
1355AC_ARG_ENABLE(linux-tproxy,
1356[ --enable-linux-tproxy
f1e0717c 1357 Enable real Transparent Proxy support for Netfilter TPROXY (version 2).],
fc68f6b1 1358[ if test "$enableval" = "yes" ; then
f1e0717c
AJ
1359 echo "Linux Netfilter/TPROXY v2 enabled"
1360 AC_DEFINE(LINUX_TPROXY2, 1, [Enable real Transparent Proxy support for Netfilter TPROXY v2.])
1361 LINUX_TPROXY2="yes"
1362 if test -z "$LINUX_NETFILTER"; then
1363 echo "Linux-Netfilter Transparent Proxy automatically enabled"
1364 LINUX_NETFILTER="yes"
1365 fi
a74968c2
AJ
1366 else
1367 AC_DEFINE(LINUX_TPROXY2, 0, [Enable real Transparent Proxy support for Netfilter TPROXY v2.])
f1e0717c
AJ
1368 fi
1369])
fc68f6b1 1370
a2794549 1371AM_CONDITIONAL(MAKE_LEAKFINDER, false)
5d620373 1372dnl Enable Leak Finding Functions
1373AC_ARG_ENABLE(leakfinder,
1374[ --enable-leakfinder
1375 Enable Leak Finding code. Enabling this alone
1376 does nothing; you also have to modify the source
1377 code to use the leak finding functions. Probably
1378 Useful for hackers only.],
1379[ if test "$enableval" = "yes" ; then
1380 echo "Leak-Finding enabled"
6a9f6389 1381 AC_DEFINE(USE_LEAKFINDER,1,[Enable code for assisting in finding memory leaks. Hacker stuff only.])
5d620373 1382 USE_LEAKFINDER="yes"
a2794549 1383 AM_CONDITIONAL(MAKE_LEAKFINDER, true)
5d620373 1384 fi
1385])
5d620373 1386
3d674977
AJ
1387follow_xff=1
1388AC_ARG_ENABLE(follow-x-forwarded-for,
1389[ --enable-follow-x-forwarded-for
1390 Enable support for following the X-Forwarded-For
1391 HTTP header to try to find the IP address of the
1392 original or indirect client when a request has
1393 been forwarded through other proxies.],
1394[ if test "$enableval" = "yes" ; then
1395 echo "follow X-Forwarded-For enabled"
1396 follow_xff=1
1397 fi
1398])
1399if test $follow_xff = 1; then
1400 AC_DEFINE(FOLLOW_X_FORWARDED_FOR, 1, [Enable following X-Forwarded-For headers])
1401else
1402 AC_DEFINE(FOLLOW_X_FORWARDED_FOR, 0)
1403fi
1404
14b32873 1405use_ident=1
3898f57f 1406AC_ARG_ENABLE(ident-lookups,
1407[ --disable-ident-lookups
1408 This allows you to remove code that performs
1409 Ident (RFC 931) lookups.],
1410[ if test "$enableval" = "no" ; then
1411 echo "Disabling Ident Lookups"
14b32873 1412 use_ident=0
3898f57f 1413 fi
1414])
14b32873 1415if test $use_ident = 1; then
1416 AC_DEFINE(USE_IDENT, 1,[Compile in support for Ident (RFC 931) lookups? Enabled by default.])
8000a965 1417 AM_CONDITIONAL(ENABLE_IDENT, true)
14b32873 1418else
1419 AC_DEFINE(USE_IDENT, 0)
8000a965 1420 AM_CONDITIONAL(ENABLE_IDENT, false)
14b32873 1421fi
3898f57f 1422
a2794549 1423AM_CONDITIONAL(USE_DNSSERVER, false)
3c573763 1424use_dnsserver=
eb824054 1425AC_ARG_ENABLE(internal-dns,
7e3ce7b9 1426[ --disable-internal-dns This prevents Squid from directly sending and
eb824054 1427 receiving DNS messages, and instead enables the
1428 old external 'dnsserver' processes.],
1429[ if test "$enableval" = "no" ; then
1430 echo "Disabling Internal DNS queries"
3c573763 1431 use_dnsserver="yes"
eb824054 1432 fi
1433])
3c573763 1434if test "$use_dnsserver" = "yes"; then
6a9f6389 1435 AC_DEFINE(USE_DNSSERVERS,1,[Use dnsserver processes instead of the internal DNS protocol support])
a2794549 1436 AM_CONDITIONAL(USE_DNSSERVER, true)
3c573763 1437fi
eb824054 1438
9d798391 1439dnl Select Default hosts file location
1440AC_ARG_ENABLE(default-hostsfile,
1441[ --enable-default-hostsfile=path
1442 Select default location for hosts file.
1443 See hosts_file directive in squid.conf for details],
1444[
1445 if test "$enableval" != "none" ; then
1446 if test -f $enableval; then
1447 OPT_DEFAULT_HOSTS=$enableval
1448 else
1449 echo "Warning Unable to find $enableval"
1450 sleep 5
1451 fi
1452 else
1453 OPT_DEFAULT_HOSTS="none"
1454 fi
1455 echo "Default hosts file set to: $enableval"
1456],[OPT_DEFAULT_HOSTS="/etc/hosts"])
1457AC_SUBST(OPT_DEFAULT_HOSTS)
1458
94439e4e 1459dnl Select auth schemes modules to build
1460AC_ARG_ENABLE(auth,
1461[ --enable-auth=\"list of auth scheme modules\"
1462 Build support for the list of authentication schemes.
1463 The default is to build support for the Basic scheme.
1464 See src/auth for a list of available modules, or
1465 Programmers Guide section authentication schemes
1466 for details on how to build your custom auth scheme
1467 module],
1468[ case $enableval in
1469 yes)
1c42c4a1 1470 for dir in $srcdir/src/auth/*; do
1471 module="`basename $dir`"
1c690e30 1472 if test -d "$dir" && test "$module" != CVS; then
1c42c4a1 1473 AUTH_MODULES="$AUTH_MODULES $module"
94439e4e 1474 fi
1475 done
1476 ;;
1477 no)
1478 ;;
1c690e30 1479 *)
1480 AUTH_MODULES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1481 ;;
94439e4e 1482 esac
1483],
1484[ if test -z "$AUTH_MODULES"; then
6bf4f823 1485 AUTH_MODULES="ntlm basic digest negotiate"
94439e4e 1486 fi
1487])
1c690e30 1488if test -n "$AUTH_MODULES"; then
1489 for module in $AUTH_MODULES; do
1490 if test -d $srcdir/src/auth/$module; then
1491 :
1492 else
1493 echo "ERROR: Auth scheme $module does not exists"
1494 exit 1
1495 fi
7f18d2bd 1496 eval AUTH_MODULE_${module}=yes
1c690e30 1497 done
1498 echo "Auth scheme modules built: $AUTH_MODULES"
1499 AUTH_OBJS="auth/lib`echo $AUTH_MODULES|sed -e 's% %.a auth/lib%g'`.a"
1500 AUTH_LIBS="`echo $AUTH_OBJS|sed -e 's%auth/%%g'`"
d0571da6 1501else
1502 echo "Auth scheme modules built: None"
1c690e30 1503fi
f5691f9c 1504AUTH_LINKOBJS=
1505for module in $AUTH_MODULES; do
1506 AUTH_LINKOBJS="$AUTH_LINKOBJS auth/${module}/${module}Scheme.o"
1507done
94439e4e 1508AC_SUBST(AUTH_MODULES)
94439e4e 1509AC_SUBST(AUTH_LIBS)
f5691f9c 1510AC_SUBST(AUTH_LINKOBJS)
1511AC_SUBST(AUTH_OBJS)
94439e4e 1512
1513dnl Select basic auth scheme helpers to build
7f18d2bd 1514if test -n "$AUTH_MODULE_basic"; then
1515 BASIC_AUTH_HELPERS="all"
1516fi
94439e4e 1517AC_ARG_ENABLE(basic-auth-helpers,
1518[ --enable-basic-auth-helpers=\"list of helpers\"
1519 This option selects which basic scheme proxy_auth
1520 helpers to build and install as part of the normal
1521 build process. For a list of available
0c510f3c 1522 helpers see the helpers/basic_auth directory.],
94439e4e 1523[ case "$enableval" in
7f18d2bd 1524 yes)
1525 BASIC_AUTH_HELPERS="all"
1c690e30 1526 ;;
94439e4e 1527 no)
7f18d2bd 1528 BASIC_AUTH_HELPERS=""
1c690e30 1529 ;;
94439e4e 1530 *)
7f18d2bd 1531 if test -z "$AUTH_MODULE_basic"; then
1532 echo "WARNING: Basic auth helpers selected without the basic scheme enabled"
1533 sleep 15
1534 fi
1c690e30 1535 BASIC_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1536 ;;
94439e4e 1537 esac
1538])
7f18d2bd 1539if test "$BASIC_AUTH_HELPERS" = "all" ; then
1540 BASIC_AUTH_HELPERS=""
1541 for dir in $srcdir/helpers/basic_auth/*; do
1542 helper="`basename $dir`"
1543 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1544 BASIC_AUTH_HELPERS="$BASIC_AUTH_HELPERS $helper"
1545 fi
1546 done
1547fi
fc83a946 1548if test -n "$BASIC_AUTH_HELPERS"; then
20d8bfe4 1549 for helper in $BASIC_AUTH_HELPERS; do
1c690e30 1550 if test -d $srcdir/helpers/basic_auth/$helper; then
2adff954 1551 case $helper in
1552 SASL)
1553 require_sasl=yes
1554 ;;
1555 esac
20d8bfe4 1556 else
1c690e30 1557 echo "ERROR: Basic auth helper $helper does not exists"
1558 exit 1
20d8bfe4 1559 fi
1560 done
fc83a946 1561 echo "Basic auth helpers built: $BASIC_AUTH_HELPERS"
94439e4e 1562fi
fc83a946 1563AC_SUBST(BASIC_AUTH_HELPERS)
94439e4e 1564
1565dnl Select ntlm auth helpers to build
7f18d2bd 1566if test -n "$AUTH_MODULE_ntlm"; then
1567 NTLM_AUTH_HELPERS="all"
1568fi
94439e4e 1569AC_ARG_ENABLE(ntlm-auth-helpers,
1570[ --enable-ntlm-auth-helpers=\"list of helpers\"
1571 This option selects which proxy_auth ntlm helpers
1572 to build and install as part of the normal build
0c510f3c 1573 process. For a list of available helpers see
1574 the helpers/ntlm_auth directory.],
380f0a87 1575[ case "$enableval" in
1576 yes)
7f18d2bd 1577 NTLM_AUTH_HELPERS="all"
1c690e30 1578 ;;
380f0a87 1579 no)
7f18d2bd 1580 NTLM_AUTH_HELPERS=""
1c690e30 1581 ;;
380f0a87 1582 *)
1c690e30 1583 NTLM_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1584 ;;
380f0a87 1585 esac
1586])
7f18d2bd 1587if test "$NTLM_AUTH_HELPERS" = "all" ; then
1588 NTLM_AUTH_HELPERS=""
1589 for dir in $srcdir/helpers/ntlm_auth/*; do
1590 helper="`basename $dir`"
1591 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1592 NTLM_AUTH_HELPERS="$NTLM_AUTH_HELPERS $helper"
1593 fi
1594 done
1595fi
94439e4e 1596if test -n "$NTLM_AUTH_HELPERS"; then
20d8bfe4 1597 for helper in $NTLM_AUTH_HELPERS; do
1c690e30 1598 if test -d $srcdir/helpers/ntlm_auth/$helper; then
1599 :
20d8bfe4 1600 else
1c690e30 1601 echo "ERROR: NTLM Auth helper $helper does not exists"
1602 exit 1
20d8bfe4 1603 fi
1604 done
94439e4e 1605 echo "NTLM auth helpers built: $NTLM_AUTH_HELPERS"
380f0a87 1606fi
94439e4e 1607AC_SUBST(NTLM_AUTH_HELPERS)
1608
6e785d85 1609dnl Select negotiate auth helpers to build
7f18d2bd 1610if test -n "$AUTH_MODULE_negotiate"; then
1611 NEGOTIATE_AUTH_HELPERS="all"
1612fi
6e785d85 1613AC_ARG_ENABLE(negotiate-auth-helpers,
1614[ --enable-negotiate-auth-helpers=\"list of helpers\"
1615 This option selects which proxy_auth negotiate helpers
1616 to build and install as part of the normal build
1617 process. For a list of available helpers see
1618 the helpers/negotiate_auth directory.],
1619[ case "$enableval" in
1620 yes)
7f18d2bd 1621 NEGOTIATE_AUTH_HELPERS="all"
6e785d85 1622 ;;
1623 no)
7f18d2bd 1624 NEGOTIATE_AUTH_HELPERS=""
6e785d85 1625 ;;
1626 *)
1627 NEGOTIATE_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1628 ;;
1629 esac
1630])
7f18d2bd 1631if test "$NEGOTIATE_AUTH_HELPERS" = "all" ; then
1632 NEGOTIATE_AUTH_HELPERS=""
1633 for dir in $srcdir/helpers/negotiate_auth/*; do
1634 helper="`basename $dir`"
1635 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1636 NEGOTIATE_AUTH_HELPERS="$NEGOTIATE_AUTH_HELPERS $helper"
1637 fi
1638 done
1639fi
6e785d85 1640if test -n "$NEGOTIATE_AUTH_HELPERS"; then
1641 for helper in $NEGOTIATE_AUTH_HELPERS; do
1642 if test -d $srcdir/helpers/negotiate_auth/$helper; then
1643 :
1644 else
1645 echo "ERROR: Negotiate Auth helper $helper does not exists"
1646 exit 1
1647 fi
1648 done
1649 echo "Negotiate auth helpers built: $NEGOTIATE_AUTH_HELPERS"
1650fi
1651AC_SUBST(NEGOTIATE_AUTH_HELPERS)
1652
2d70df72 1653dnl Select digest auth scheme helpers to build
7f18d2bd 1654if test -n "$AUTH_MODULE_digest"; then
1655 DIGEST_AUTH_HELPERS=all
1656fi
2d70df72 1657AC_ARG_ENABLE(digest-auth-helpers,
1658[ --enable-digest-auth-helpers=\"list of helpers\"
1659 This option selects which digest scheme authentication
1660 helpers to build and install as part of the normal build
0c510f3c 1661 process. For a list of available helpers see the
1662 helpers/digest_auth directory.],
2d70df72 1663[ case "$enableval" in
1664 yes)
7f18d2bd 1665 DIGEST_AUTH_HELPERS="all"
1c690e30 1666 ;;
2d70df72 1667 no)
7f18d2bd 1668 DIGEST_AUTH_HELPERS=""
1c690e30 1669 ;;
2d70df72 1670 *)
1c690e30 1671 DIGEST_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1672 ;;
2d70df72 1673 esac
1674])
7f18d2bd 1675if test "$DIGEST_AUTH_HELPERS" = "all" ; then
1676 DIGEST_AUTH_HELPERS=""
1677 for dir in $srcdir/helpers/digest_auth/*; do
1678 helper="`basename $dir`"
1679 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1680 DIGEST_AUTH_HELPERS="$DIGEST_AUTH_HELPERS $helper"
1681 fi
1682 done
1683fi
2d70df72 1684if test -n "$DIGEST_AUTH_HELPERS"; then
1daefc1a 1685 for helper in $DIGEST_AUTH_HELPERS; do
1686 if test -f $srcdir/helpers/digest_auth/$helper/Makefile.in; then
1687 :
1688 else
1689 echo "ERROR: digest auth helper $helper does not exists"
1690 exit 1
1691 fi
1692 done
2d70df72 1693 echo "Digest auth helpers built: $DIGEST_AUTH_HELPERS"
1694fi
1695AC_SUBST(DIGEST_AUTH_HELPERS)
380f0a87 1696
6437ac71 1697dnl Enable "NTLM fail open"
1698AC_ARG_ENABLE(ntlm-fail-open,
1699[ --enable-ntlm-fail-open Enable NTLM fail open, where a helper that fails one of the
0961c811 1700 Authentication steps can allow squid to still authenticate
1701 the user.],
6437ac71 1702[ if test "$enableval" = "yes" ; then
6a9f6389 1703 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 1704 fi
1705])
1706
c6588c68 1707dnl Select external_acl helpers to build
7f18d2bd 1708EXTERNAL_ACL_HELPERS=all
c6588c68 1709AC_ARG_ENABLE(external-acl-helpers,
1710[ --enable-external-acl-helpers=\"list of helpers\"
1711 This option selects which external_acl helpers to
1712 build and install as part of the normal build
1713 process. For a list of available helpers see the
1714 helpers/external_acl directory.],
1715[ case "$enableval" in
1716 yes)
7f18d2bd 1717 EXTERNAL_ACL_HELPERS=all
1c690e30 1718 ;;
c6588c68 1719 no)
7f18d2bd 1720 EXTERNAL_ACL_HELPERS=""
1c690e30 1721 ;;
c6588c68 1722 *)
1c690e30 1723 EXTERNAL_ACL_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1724 ;;
c6588c68 1725 esac
1726])
7f18d2bd 1727if test "$EXTERNAL_ACL_HELPERS" = "all" ; then
39ee7289 1728 EXTERNAL_ACL_HELPERS=""
7f18d2bd 1729 for dir in $srcdir/helpers/external_acl/*; do
1730 helper="`basename $dir`"
1731 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1732 EXTERNAL_ACL_HELPERS="$EXTERNAL_ACL_HELPERS $helper"
1733 fi
1734 done
1735fi
c6588c68 1736if test -n "$EXTERNAL_ACL_HELPERS"; then
20d8bfe4 1737 for helper in $EXTERNAL_ACL_HELPERS; do
1738 if test -f $srcdir/helpers/external_acl/$helper/Makefile.in; then
1739 :
1740 else
1daefc1a 1741 echo "ERROR: external acl helper $helper does not exists"
20d8bfe4 1742 exit 1
1743 fi
1744 done
c6588c68 1745 echo "External acl helpers built: $EXTERNAL_ACL_HELPERS"
1746fi
1747AC_SUBST(EXTERNAL_ACL_HELPERS)
1748
3a125142 1749AC_ARG_WITH(valgrind-debug,
1750[ --with-valgrind-debug Include debug instrumentation for use with valgrind],
b4bab919 1751[ case $withval in
1752 yes)
1753 valgrind=1
1754 ;;
1755 no)
1756 valgrind=
1757 ;;
1758 *)
1759 CPPFLAGS="$CPPFLAGS -I${enableval}/include"
1760 valgrind=1
1761 ;;
1762 esac
1763 if test $valgrind; then
1764 AC_DEFINE(WITH_VALGRIND, 1, [Valgrind memory debugger support])
1765 echo "Valgrind debug support enabled"
1766 fi
1767])
1768
d96ceb8e 1769dnl Disable "memPools" code
1770AC_ARG_ENABLE(mempools,
b001e822 1771[ --disable-mempools Disable memPools. Note that this option now simply sets the
2df6213e 1772 default behaviour. Specific classes can override this at runtime, and
1773 only lib/MemPool.c needs to be altered to change the squid-wide
1774 default for all classes.],
d96ceb8e 1775[ if test "$enableval" = "no" ; then
1776 echo "memPools disabled"
6a9f6389 1777 AC_DEFINE(DISABLE_POOLS, 1, [Define if you have problems with memPools and want to disable Pools])
3e0dc9a8 1778 else
1779 AC_DEFINE(DISABLE_POOLS, 0, [Define if you have problems with memPools and want to disable Pools.])
d96ceb8e 1780 fi
3e0dc9a8 1781],
1782[ AC_DEFINE(DISABLE_POOLS, 0, [Define if you have problems with memPools and want to disable Pools.])
d96ceb8e 1783])
1784
0e657244 1785dnl Enable WIN32 Service compile mode
1786AC_ARG_ENABLE(win32-service,
1787[ --enable-win32-service Compile Squid as a WIN32 Service
1788 Works only on Windows NT and Windows 2000 Platforms.],
1789[ if test "$enableval" = "yes" ; then
1790 echo "Enabling WIN32 run service mode"
1791 AC_DEFINE(USE_WIN32_SERVICE,1,[Define Windows NT & Windows 2000 run service mode])
1792 fi
1793])
1794
b1485ff8 1795
2adff954 1796dnl Check for Cyrus SASL
1797if test "$require_sasl" = "yes"; then
1798 AC_CHECK_HEADERS(sasl/sasl.h sasl.h)
1799 if test "$ac_cv_header_sasl_sasl_h" = "yes"; then
1800 echo "using SASL2"
1801 LIBSASL="-lsasl2"
1802 else
1803 if test "$ac_cv_header_sasl_h" = "yes"; then
1804 echo "using SASL"
1805 LIBSASL="-lsasl"
1806 else
1807 echo "ERROR: Neither SASL nor SASL2 found"
1808 exit 1
1809 fi
1810 fi
1811 AC_SUBST(LIBSASL)
1812fi
1813
3c573763 1814dnl Disable "unlinkd" code
fe0810ac 1815AC_ARG_ENABLE(unlinkd,
1816[ --disable-unlinkd Do not use unlinkd],
1817[ if test "$enableval" = "no" ; then
3c573763 1818 use_unlinkd=no
fe0810ac 1819 else
3c573763 1820 use_unlinkd=yes
fe0810ac 1821 fi
1822],[
1823 # Here we should probably use some magic depending on the selected
1824 # storage models
3c573763 1825 use_unlinkd=yes
fe0810ac 1826])
3c573763 1827if test "$use_unlinkd" = "yes"; then
fe0810ac 1828 echo "unlinkd enabled"
6a9f6389 1829 AC_DEFINE(USE_UNLINKD,1,[Define this if unlinkd is required (strongly recommended for ufs storage type)])
a2794549 1830 AM_CONDITIONAL(ENABLE_UNLINKD, true)
fe0810ac 1831else
1832 echo "unlinkd disabled"
a2794549 1833 AM_CONDITIONAL(ENABLE_UNLINKD, false)
fe0810ac 1834fi
fe0810ac 1835
ce3d30fb 1836dnl Enable backtraces on fatal errors
1837AC_ARG_ENABLE(stacktraces,
1838[ --enable-stacktraces Enable automatic call backtrace on fatal errors],
1839[ if test "$enableval" = "yes" ; then
1840 echo "Enabling automatic stack backtraces on fatal errors"
6a9f6389 1841 AC_DEFINE(PRINT_STACK_TRACE, 1,[Print stacktraces on fatal errors])
ce3d30fb 1842 fi
1843])
1844
88bfe092 1845AM_CONDITIONAL(ENABLE_XPROF_STATS, false)
1846dnl Enable USE_XPROF_STATS
1847AC_ARG_ENABLE(cpu-profiling,
1848[ --enable-cpu-profiling
1849 This option allows you to see which internal functions
1850 in Squid are consuming how much CPU. Compiles in probes
1851 that measure time spent in probed functions. Needs
1852 source modifications to add new probes. This is meant
1853 for developers to assist in performance optimisations
1854 of Squid internal functions.
1855 If you are not developer and not interested in the stats
1856 you shouldn't enable this, as overhead added, although
1857 small, is still overhead. See lib/Profiler.c for more.
1858 ],
1859[ if test "$enableval" = "yes" ; then
1860 echo "Enabling cpu-profiling"
6a9f6389 1861 AC_DEFINE(USE_XPROF_STATS, 1,[Define to enable CPU profiling within Squid])
88bfe092 1862 AM_CONDITIONAL(ENABLE_XPROF_STATS, true)
1863 fi
1864])
1865
f66a9ef4 1866dnl Enable X-Accelerator-Vary for Vary support within an accelerator setup
1867AC_ARG_ENABLE(x_accelerator_vary,
0961c811 1868[ --enable-x-accelerator-vary
1869 Enable support for the X-Accelerator-Vary
1870 HTTP header. Can be used to indicate
1871 variance within an accelerator setup.
1872 Typically used together with other code
1873 that adds custom HTTP headers to the requests.],
f66a9ef4 1874[ if test "$enableval" = "yes" ; then
1875 echo "Enabling support for X-Accelerator-Vary"
6a9f6389 1876 AC_DEFINE(X_ACCELERATOR_VARY, 1, [Enable support for the X-Accelerator-Vary HTTP header])
f66a9ef4 1877 fi
1878])
1879
cc192b50 1880dnl Enable IPv6 support
1881AC_MSG_CHECKING([whether to enable IPv6])
7f85cca1 1882use_ipng=no
cc192b50 1883AC_ARG_ENABLE(ipv6,
7172612f 1884[ --enable-ipv6 Enable ipv6 support],
cc192b50 1885[ AC_MSG_RESULT(yes)
1886 AC_CACHE_CHECK([if PF_INET6 is available], $enableval,
1887 AC_TRY_RUN(
1888 [ /* PF_INET6 available check */
1889# include <sys/types.h>
1890# include <sys/socket.h>
1891 void main() {
1892 if (socket(PF_INET6, SOCK_STREAM, 0) < 0)
1893 exit(1);
1894 else
1895 exit(0);
1896 }
1897 ],
1898 [ AC_DEFINE(USE_IPV6,1,[Enable support for IPv6 ])
1899 AC_MSG_RESULT(yes)
7f85cca1 1900 use_ipng=yes
cc192b50 1901 ],
1902 [ AC_DEFINE(USE_IPV6,0,[0 == Disable support for IPv6])
7f85cca1
AJ
1903 AC_DEFINE(IPV6_SPECIAL_SPLITSTACK,0,[Enable support for IPv6 on split-stack implementations])
1904 AC_DEFINE(IPV6_SPECIAL_LOCALHOST,0,[Convert IPv4-localhost requests to IPv6. Default: Keep seperate.])
1905 AC_DEFINE(IPV6_SPECIAL_V4MAPPED,0,[Enable v4-mapping through v6 sockets])
cc192b50 1906 AC_MSG_RESULT(no)
1907 ])
1908 )
1909],
1910[ AC_DEFINE(USE_IPV6,0,[Disable support for IPv6])
7f85cca1
AJ
1911 AC_DEFINE(IPV6_SPECIAL_SPLITSTACK,0,[Enable support for IPv6 on split-stack implementations])
1912 AC_DEFINE(IPV6_SPECIAL_LOCALHOST,0,[Convert IPv4-localhost requests to IPv6. Default: Keep seperate.])
1913 AC_DEFINE(IPV6_SPECIAL_V4MAPPED,0,[Enable v4-mapping through v6 sockets])
cc192b50 1914 AC_MSG_RESULT(no)
1915])
7f85cca1
AJ
1916
1917if test "$use_ipng" = "yes"; then
1918
cc192b50 1919dnl Check for Windows XP option
1920AC_MSG_CHECKING([for IPv6 split-stack requirement])
1921AC_ARG_WITH(ipv6-split-stack,
7f85cca1
AJ
1922 [ --with-ipv6-split-stack Require IPv6 split-stack support. Requires IPv6 Support.],
1923 [AC_DEFINE(IPV6_SPECIAL_SPLITSTACK, 1, [Enable support for IPv6 on split-stack implementations]) AC_MSG_RESULT(yes)],
1924 [AC_DEFINE(IPV6_SPECIAL_SPLITSTACK, 0, [Enable support for IPv6 on split-stack implementations]) AC_MSG_RESULT(no)]
cc192b50 1925)
1926
1927dnl Check for IPv6 Windows Vista option
9b1f7ee8 1928dnl Also useful for other OS
cc192b50 1929AC_MSG_CHECKING([for IPv6 v4-mapping requirement])
1930AC_ARG_WITH(ipv4-mapped,
7f85cca1
AJ
1931 [ --with-ipv4-mapped Hybrid-Stack OS require Squid to do any v4-mapping. Requires IPv6 Support.],
1932 [AC_DEFINE(IPV6_SPECIAL_V4MAPPED, 1, [Enable v4-mapping through v6 sockets]) AC_MSG_RESULT(yes)],
1933 [AC_DEFINE(IPV6_SPECIAL_V4MAPPED, 0, [Enable v4-mapping through v6 sockets]) AC_MSG_RESULT(no)]
cc192b50 1934)
1935
1936dnl Check for IPv6-pure option
1937AC_MSG_CHECKING([for IPv6-Localhost requirement])
1938AC_ARG_WITH(localhost-ipv6,
7f85cca1 1939 [ --with-localhost-ipv6 Prefer IPv6 localhost address over IPv4. Requires IPv6 Support.
cc192b50 1940 Treats 127.0.0.1 and ::1 as identical and converts all inputs of to ::1
1941 This depends on Dual-Stack support in the OS and all applications
1942 squid contacts via localhost being IPv6 enabled.
1943 Default: OFF. Treats these two IP as different, squid.conf must
1944 define both 127.0.0.1 and ::1 for the localhost ACL, etc. ],
7f85cca1
AJ
1945 [AC_DEFINE(IPV6_SPECIAL_LOCALHOST, 1, [Convert IPv4-localhost requests to IPv6. Default: keep seperate.]) AC_MSG_RESULT(yes)],
1946 [AC_DEFINE(IPV6_SPECIAL_LOCALHOST, 0, [Convert IPv4-localhost requests to IPv6. Default: Keep seperate.]) AC_MSG_RESULT(no)]
cc192b50 1947)
7f85cca1 1948
cc192b50 1949# end IPv6-only options
1950fi
1951
7172612f
AJ
1952AC_ARG_ENABLE(zph-qos,
1953[ --enable-zph-qos Enable ZPH QOS support],
1954[ if test "$enableval" = "yes" ; then
1955 echo "ZPH QOS enabled"
1956 AC_DEFINE(USE_ZPH_QOS,1,
1957 [ Define this to use Squid's ZPH (Zero Penalty Hit) QOS features.
1958 When enabled, Squid will alter TOS field of HIT responses for better QOS on intermediate routing/shaping devices.])
1959 fi
1960])
1961
bae9832d 1962dnl Optional CNAME-Recursion by Internal DNS engine
1963AC_MSG_CHECKING([whether DNS CNAME recursion wanted])
1964AC_ARG_WITH(dns-cname,
1965 [ --with-dns-cname Enable CNAME-Recursion in Internal DNS stub.],
1966 [AC_DEFINE(DNS_CNAME, 1, [ 1 == Enable expermental CNAME recursion inside Squid DNS resolver stub]) AC_MSG_RESULT(yes)],
1967 [AC_DEFINE(DNS_CNAME, 0, [ 0 == Disable expermental CNAME recursion inside Squid DNS resolver stub]) AC_MSG_RESULT(no)]
1968)
1969
8c37ea44
AJ
1970dnl Check whether this OS defines ss_len as a member of sockaddr_storage
1971AC_CACHE_CHECK([for ss_len field in struct sockaddr_storage],
1972 ac_cv_have_ss_len_in_struct_ss, [
1973 AC_TRY_COMPILE([
1974#include <sys/types.h>
1975#include <sys/socket.h>
cda4116f 1976#include <netinet/in.h>
8c37ea44
AJ
1977 ],
1978 [ struct sockaddr_storage s; s.ss_len = 1; ],
1979 [ ac_cv_have_ss_len_in_struct_ss="yes" ],
1980 [ ac_cv_have_ss_len_in_struct_ss="no" ]
1981 )
1982])
1983if test "x$ac_cv_have_ss_len_in_struct_ss" = "xyes" ; then
1984 AC_DEFINE(HAVE_SS_LEN_IN_SS, 1, [Does struct sockaddr_storage have ss_len? 1: Yes, 0: No])
1985else
1986 AC_DEFINE(HAVE_SS_LEN_IN_SS, 0, [Does struct sockaddr_storage have ss_len? 1: Yes, 0: No])
1987fi
1988
1989dnl Check whether this OS defines sin_len as a member of sockaddr_in as a backup to ss_len
1990AC_CACHE_CHECK([for sin_len field in struct sockaddr_in],
1991 ac_cv_have_sin_len_in_struct_sai, [
1992 AC_TRY_COMPILE([
1993#include <sys/types.h>
1994#include <sys/socket.h>
1995 ],
1996 [ struct sockaddr_in s; s.sin_len = 1; ],
1997 [ ac_cv_have_sin_len_in_struct_sai="yes" ],
1998 [ ac_cv_have_sin_len_in_struct_sai="no" ]
1999 )
2000])
2001if test "x$ac_cv_have_sin_len_in_struct_sai" = "xyes" ; then
2002 AC_DEFINE(HAVE_SIN_LEN_IN_SAI, 1, [Does struct sockaddr_in have sin_len? 1: Yes, 0: No])
2003else
2004 AC_DEFINE(HAVE_SIN_LEN_IN_SAI, 0, [Does struct sockaddr_in have sin_len? 1: Yes, 0: No])
2005fi
2006
2007dnl Check whether this OS defines sin6_len as a member of sockaddr_in6 as a backup to ss_len
2008AC_CACHE_CHECK([for sin6_len field in struct sockaddr_in6],
2009 ac_cv_have_sin6_len_in_struct_sai, [
2010 AC_TRY_COMPILE([
2011#include <sys/types.h>
2012#include <sys/socket.h>
2013 ],
2014 [ struct sockaddr_in6 s; s.sin6_len = 1; ],
2015 [ ac_cv_have_sin6_len_in_struct_sai="yes" ],
2016 [ ac_cv_have_sin6_len_in_struct_sai="no" ]
2017 )
2018])
2019if test "x$ac_cv_have_sin6_len_in_struct_sai" = "xyes" ; then
2020 AC_DEFINE(HAVE_SIN6_LEN_IN_SAI, 1, [Does struct sockaddr_in6 have sin6_len? 1: Yes, 0: No])
2021else
2022 AC_DEFINE(HAVE_SIN6_LEN_IN_SAI, 0, [Does struct sockaddr_in6 have sin6_len? 1: Yes, 0: No])
2023fi
2024
bae9832d 2025
f49be7d1 2026AC_ARG_WITH(filedescriptors,
f5e5c4cf 2027[ --with-filedescriptors=NUMBER
2028 Force squid to support NUMBER filedescriptors],
f49be7d1 2029[ squid_filedescriptors_num=$withval ])
2030
8b5e106b 2031AC_PATH_PROG(CPPUNITCONFIG, cppunit-config, false)
2032if $CPPUNITCONFIG --help >/dev/null; then
f5691f9c 2033 echo "using system installed cppunit"
8b5e106b 2034 SQUID_CPPUNIT_LIBS="`$CPPUNITCONFIG --libs`"
2035 SQUID_CPPUNIT_LA=''
2036 SQUID_CPPUNIT_INC="`$CPPUNITCONFIG --cflags`"
2037else
f646b959 2038 echo "cppunit does not appear to be installed. squid does not require this, but code testing with 'make check' will fail."
63d03edb 2039 SQUID_CPPUNIT_LA=''
2040 SQUID_CPPUNIT_LIBS=''
2041 SQUID_CPPUNIT_INC=''
f5691f9c 2042fi
8b5e106b 2043
f5691f9c 2044AC_ARG_WITH(cppunit-basedir,
2045[ --with-cppunit-basedir=/path/to/cppunit-base
2046 Path where the cppunit headers are libraries are found
63d03edb 2047 for unit testing.
f5691f9c 2048 ],
2049[ if test -f $withval/include/cppunit/TestCase.h; then
2050 echo "Using cppunit includes from $withval"
2051 SQUID_CPPUNIT_INC="-I${withval}/include"
2052 else
2053 echo "ERROR: Cannot find cppunit at $withval"
2054 exit 1
2055 fi
2056 if test -f $withval/lib/libcppunit.la; then
2057 echo "Using cppunit lib from $withval"
549b1e60 2058 SQUID_CPPUNIT_LA="${withval}/lib/libcppunit.la"
8b5e106b 2059 SQUID_CPPUNIT_LIBS='$(SQUID_CPPUNIT_LA)'
f5691f9c 2060 else
2061 echo "ERROR: Cannot find cppunit at $withval"
2062 exit 1
2063 fi
f5691f9c 2064])
8b5e106b 2065AC_SUBST(SQUID_CPPUNIT_LIBS)
f5691f9c 2066AC_SUBST(SQUID_CPPUNIT_LA)
2067AC_SUBST(SQUID_CPPUNIT_INC)
f5691f9c 2068
fd9aaa3e 2069# Force some compilers to use ANSI features
2070#
2071case "$host" in
2072 alpha-dec-osf*)
2073 if test "$ac_cv_prog_CC" = "cc" ; then
2074 echo "adding '-std1' to cc args for $host"
2075 CC="cc -std1";
2076 ac_cv_prog_CC="$CC"
2077 fi
2078 ;;
c68e9c6b 2079 *-hp-hpux*)
2080 if test "$ac_cv_prog_CC" = "cc" ; then
2081 echo "adding '-Ae' to cc args for $host"
2082 CC="cc -Ae";
2083 ac_cv_prog_CC="$CC"
2084 fi
2085 ;;
fd9aaa3e 2086esac
2087
090089c4 2088dnl Check for programs
2089AC_PROG_CPP
2090AC_PROG_INSTALL
090089c4 2091AC_PROG_LN_S
81280a96 2092AC_PATH_PROG(SH, sh, /bin/sh)
d9f67e6f 2093AC_PATH_PROG(FALSE, false, /usr/bin/false)
2094AC_PATH_PROG(TRUE, true, /usr/bin/true)
2095AC_PATH_PROG(RM, rm, $FALSE)
2096AC_PATH_PROG(MV, mv, $FALSE)
2097AC_PATH_PROG(MKDIR, mkdir, $FALSE)
090089c4 2098AC_PATH_PROG(LN, ln, cp)
4e9d8e26 2099AC_PATH_PROG(PERL, perl, none)
a2794549 2100dnl automake handles this AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
6ad85e8a 2101AC_PATH_PROG(AR, ar, $FALSE)
2102
4e9d8e26 2103if test "$ac_cv_path_PERL" = "none"; then
2104 echo "Perl is required to compile Squid"
2105 echo "Please install Perl and then re-run configure"
2106 exit 1
2107fi
2108
6ad85e8a 2109case "$host" in
2110 *-hp-hpux*)
2111 echo "Disabling 'ranlib' for HP-UX..."
2112 RANLIB=":"
2113 ;;
2114esac
2115
2116dnl set $(AR)
2117AR_R="$AR r"
2118case "$host" in
2119 *-next-nextstep3)
2120 AR="libtool -o"
2121 ;;
2122esac
2123AC_SUBST(AR_R)
090089c4 2124
2125dnl Check for headers
2126AC_HEADER_DIRENT
2127AC_HEADER_STDC
db40ae20 2128
2129AC_CHECK_HEADERS( \
db40ae20 2130 arpa/inet.h \
30a4f2a8 2131 arpa/nameser.h \
9441aa34 2132 assert.h \
db40ae20 2133 bstring.h \
db40ae20 2134 crypt.h \
30a4f2a8 2135 ctype.h \
2136 errno.h \
ce3d30fb 2137 execinfo.h \
db40ae20 2138 fcntl.h \
42ad37af 2139 fnmatch.h \
9c1d8929 2140 getopt.h \
52303a3d 2141 glob.h \
88738790 2142 gnumalloc.h \
30a4f2a8 2143 grp.h \
5cafc1d6 2144 ip_compat.h \
42b51993 2145 ip_fil_compat.h \
5cafc1d6 2146 ip_fil.h \
2147 ip_nat.h \
dbc5782a 2148 ipl.h \
30a4f2a8 2149 libc.h \
6ad85e8a 2150 limits.h \
30a4f2a8 2151 malloc.h \
e0bddc45 2152 math.h \
db40ae20 2153 memory.h \
b075cbb1 2154 mount.h \
30a4f2a8 2155 netdb.h \
db40ae20 2156 netinet/in.h \
cc192b50 2157 netinet/in_systm.h \
42b51993 2158 netinet/ip_fil_compat.h \
1f7c9178 2159 openssl/err.h \
2160 openssl/md5.h \
2161 openssl/ssl.h \
cc192b50 2162 netinet/tcp.h \
a7ad6e4e 2163 openssl/engine.h \
4da086c4 2164 paths.h \
dcfe6390 2165 poll.h \
30a4f2a8 2166 pwd.h \
b5e4d7d4 2167 shadow.h \
30a4f2a8 2168 regex.h \
c68e9c6b 2169 sched.h \
30a4f2a8 2170 signal.h \
2171 stdarg.h \
2172 stddef.h \
2173 stdio.h \
db40ae20 2174 stdlib.h \
2175 string.h \
2176 strings.h \
0a4e8536 2177 sys/bitypes.h \
f9576890 2178 sys/bswap.h \
2179 sys/endian.h \
db40ae20 2180 sys/file.h \
5cafc1d6 2181 sys/ioctl.h \
30a4f2a8 2182 sys/param.h \
62ae0622 2183 sys/prctl.h \
3d4022fa 2184 sys/md5.h \
77e4c0c9 2185 sys/msg.h \
30a4f2a8 2186 sys/resource.h \
db40ae20 2187 sys/select.h\
30a4f2a8 2188 sys/socket.h \
2189 sys/stat.h \
b075cbb1 2190 sys/statvfs.h \
3c641669 2191 syscall.h \
30a4f2a8 2192 sys/syscall.h \
db40ae20 2193 sys/time.h \
2194 sys/types.h \
30a4f2a8 2195 sys/un.h \
b075cbb1 2196 sys/vfs.h \
30a4f2a8 2197 sys/wait.h \
db40ae20 2198 syslog.h \
30a4f2a8 2199 time.h \
2200 unistd.h \
3c641669 2201 utime.h \
30a4f2a8 2202 varargs.h \
77d6bd88 2203 byteswap.h \
2204 glib.h \
60d096f4 2205 stdint.h \
2206 inttypes.h \
3c641669 2207 grp.h \
2208 nss_common.h \
94331f58 2209 nss.h \
2210 db.h \
329ce686 2211 db_185.h \
2212 sys/capability.h
db40ae20 2213)
2214
fc68f6b1 2215AC_CHECK_HEADERS(
2216 linux/netfilter_ipv4.h \
2217 linux/netfilter_ipv4/ip_tproxy.h \
2218,,,
dcd1dc78 2219SQUID_DEFAULT_INCLUDES
2220#if HAVE_LIMITS_H
2221#include <limits.h>
2222#endif
a74968c2
AJ
2223/* Netfilter ip(6)tables v1.4.0 has broken headers */
2224#if HAVE_NETINET_IN_H
2225#include <netinet/in.h>
2226#endif
dcd1dc78 2227)
2228
d1e5191e 2229dnl *BSD dont include the depenencies for all their net/ and netinet/ files
c92b4732 2230dnl We must include a few basic type headers for them to work.
d1e5191e
AJ
2231AC_CHECK_HEADERS( \
2232 net/if.h \
5a3237b0 2233 netinet/if_ether.h\
d1e5191e
AJ
2234 netinet/icmp6.h \
2235 netinet/ip.h \
2236 netinet/ip6.h \
5a3237b0 2237 netinet/ip_compat.h\
2238 netinet/ip_fil.h\
d1e5191e 2239 netinet/ip_icmp.h \
77e4c0c9 2240 netinet/ip_nat.h\
dbc5782a 2241 netinet/ipl.h \
d1e5191e 2242 net/pfvar.h \
77e4c0c9 2243 sys/mount.h\
d1e5191e
AJ
2244 resolv.h \
2245,,,
2246SQUID_BSDNET_INCLUDES)
5a3237b0 2247
a1559187 2248AC_CHECK_HEADERS([libxml/parser.h], [], [
2249 SAVED_CPPFLAGS="$CPPFLAGS"
2250 CPPFLAGS="-I/usr/include/libxml2 $CPPFLAGS"
2251 unset ac_cv_header_libxml_parser_h
2252 AC_CHECK_HEADERS([libxml/parser.h], [], [
2253 CPPFLAGS="$SAVED_CPPFLAGS"
2254 ])
2255 ])
2256
aee0606f 2257AC_C_CONST
d57288d2 2258AC_C_BIGENDIAN
aee0606f 2259
6a9f6389 2260AC_STRUCT_TM
2261AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
2262#if TM_IN_SYS_TIME
2263#if HAVE_SYS_TIME_H
2264#include <sys/time.h>
2265#endif
2266#elif HAVE_TIME_H
2267#include <time.h>
2268#endif
5c51415d 2269])
46c883ed 2270
6a9f6389 2271AC_CHECK_TYPE(struct mallinfo,AC_DEFINE(HAVE_STRUCT_MALLINFO,1,[The system provides struct mallinfo]),,[
2272#if HAVE_SYS_TYPES_H
2273#include <sys/types.h>
2274#endif
eb824054 2275#if HAVE_MALLOC_H
2276#include <malloc.h>
6a9f6389 2277#endif])
eb824054 2278
6a9f6389 2279AC_CHECK_MEMBERS([struct mallinfo.mxfast],,,[
2280#if HAVE_SYS_TYPES_H
2281#include <sys/types.h>
2282#endif
2283#if HAVE_MALLOC_H
2284#include <malloc.h>
2285#endif])
090089c4 2286
08caf8c6 2287dnl Override rusage() detect on MinGW because is emulated in source code
2288case "$host_os" in
2289 mingw|mingw32)
2290 AC_DEFINE(HAVE_STRUCT_RUSAGE)
2291 ac_cv_func_getrusage='yes'
d750d7bf 2292 echo "Using own rusage on Windows."
08caf8c6 2293 ;;
2294 *)
2295 AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
8ff51bba 2296#if HAVE_SYS_TIME_H
2297#include <sys/time.h>
2298#endif
b54a6789 2299#if HAVE_SYS_RESOURCE_H
2300#include <sys/resource.h>
6a9f6389 2301#endif])
08caf8c6 2302 ;;
2303esac
b54a6789 2304
6a9f6389 2305AC_CHECK_MEMBERS([struct iphdr.ip_hl],,,[
2306#if HAVE_SYS_TYPES_H
2307#include <sys/types.h>
2308#endif
a025a745 2309#include <netinet/in.h>
2310#include <netinet/in_systm.h>
6ad85e8a 2311#include <netinet/ip.h>
b05490a8 2312#if defined (__linux__) || defined (__CYGWIN__)
6ad85e8a 2313#define ip_hl ihl
2314#endif
2315#ifndef __linux__
b05490a8 2316#ifndef __CYGWIN__
6ad85e8a 2317#define iphdr ip
b05490a8 2318#endif
6a9f6389 2319#endif])
a025a745 2320
090089c4 2321dnl Check for typedefs
77d6bd88 2322AC_CHECK_SIZEOF(void *)
090089c4 2323
0409a509 2324dnl 8 bit integers - int8_t
2325dnl if this is defined we trust it to be 8 bits
2326AC_CHECK_TYPE(int8_t,[
2327 AC_CHECK_SIZEOF(int8_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2328 AC_DEFINE(HAVE_INT8_T,1,[int8_t is defined in system headers])
2329 ],,SQUID_DEFAULT_INCLUDES)
2330
2331dnl fallback #1
2332AC_CHECK_TYPE(char,[
2333 AC_CHECK_SIZEOF(char,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2334 AC_DEFINE(HAVE_CHAR,1,[char is defined in system headers])
2335 ],,SQUID_DEFAULT_INCLUDES)
2336
2337dnl unsigned 8 bit ints - u_int8_t
2338dnl if this is defined we trust it to be 8 bits
2339AC_CHECK_TYPE(u_int8_t,[
2340 AC_CHECK_SIZEOF(u_int8_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2341 AC_DEFINE(HAVE_U_INT8_T,1,[u_int8_t is defined in system headers])
2342 ],,SQUID_DEFAULT_INCLUDES)
2343
2344dnl fallback #1
2345dnl if this is defined we trust it to be 8 bits
2346AC_CHECK_TYPE(uint8_t,[
2347 AC_CHECK_SIZEOF(uint8_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2348 AC_DEFINE(HAVE_UINT8_T,1,[uint8_t is defined in system headers])
2349 ],,SQUID_DEFAULT_INCLUDES)
2350
2351dnl 16 bit integers - int16_t
6a9f6389 2352dnl if this is defined we trust it to be 16 bits
62266438 2353AC_CHECK_TYPE(int16_t,[
2354 AC_CHECK_SIZEOF(int16_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2355 AC_DEFINE(HAVE_INT16_T,1,[int16_t is defined in system headers])
2356 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2357
2358dnl fallback #1
2359AC_CHECK_TYPE(short,[
856e69c5 2360 AC_CHECK_SIZEOF(short,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2361 AC_DEFINE(HAVE_SHORT,1,[short is defined in system headers])
2362 ],,SQUID_DEFAULT_INCLUDES)
2363
2364dnl fallback #2
2365AC_CHECK_TYPE(int,[
856e69c5 2366 AC_CHECK_SIZEOF(int,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2367 AC_DEFINE(HAVE_INT,1,[int is defined in system headers])
2368 ],,SQUID_DEFAULT_INCLUDES)
2369
2370dnl unsigned 16 bit ints - u_int16_t
2371dnl if this is defined we trust it to be 16 bits
62266438 2372AC_CHECK_TYPE(u_int16_t,[
2373 AC_CHECK_SIZEOF(u_int16_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2374 AC_DEFINE(HAVE_U_INT16_T,1,[u_int16_t is defined in system headers])
2375 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2376
2377dnl fallback #1
2378dnl if this is defined we trust it to be 16 bits
62266438 2379AC_CHECK_TYPE(uint16_t,[
2380 AC_CHECK_SIZEOF(uint16_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2381 AC_DEFINE(HAVE_UINT16_T,1,[uint16_t is defined in system headers])
2382 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2383
2384dnl 32 bit signed int - int32_t
2385dnl if this is defined we trust it to be 32 bits
62266438 2386AC_CHECK_TYPE(int32_t,[
2387 AC_CHECK_SIZEOF(int32_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2388 AC_DEFINE(HAVE_INT32_T,1,[int32_t is defined in system headers])
2389 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2390
2391dnl fallback #1
2392AC_CHECK_TYPE(long,[
856e69c5 2393 AC_CHECK_SIZEOF(long,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2394 AC_DEFINE(HAVE_LONG,1,[long is defined in system headers])
2395 ],,SQUID_DEFAULT_INCLUDES)
2396
2397dnl 32 bit unsigned int - u_int32_t
2398dnl if this is defined we trust it to be 32 bits
62266438 2399AC_CHECK_TYPE(u_int32_t,[
2400 AC_CHECK_SIZEOF(u_int32_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2401 AC_DEFINE(HAVE_U_INT32_T,1,[u_int32_t is defined in system headers])
2402 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2403
2404dnl fallback #1
2405dnl if this is defined we trust it to be 32 bits
62266438 2406AC_CHECK_TYPE(uint32_t,[
2407 AC_CHECK_SIZEOF(uint32_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2408 AC_DEFINE(HAVE_UINT32_T,1,[uint32_t is defined in system headers])
2409 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2410
2411dnl 64 bit signed - int64_t
2412dnl if this is defind we trust it to be 64 bits
62266438 2413AC_CHECK_TYPE(int64_t,[
2414 AC_CHECK_SIZEOF(int64_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2415 AC_DEFINE(HAVE_INT64_T,1,[int64_t is defined in system headers])
2416 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2417
2418dnl fallback #1
2419dnl if this is defind we trust it to be 64 bits
62266438 2420AC_CHECK_TYPE(__int64,[
2421 AC_CHECK_SIZEOF(__int64,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2422 AC_DEFINE(HAVE___INT64,1,[__int64 is defined in system headers])
2423 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2424
2425dnl fallback #2
2426AC_CHECK_TYPE(long long,[
856e69c5 2427 AC_CHECK_SIZEOF(long long,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2428 AC_DEFINE(HAVE_LONG_LONG,1,[long long is defined in system headers])
2429 ],,SQUID_DEFAULT_INCLUDES)
2430
2431dnl 64 bit unsigned - u_int64_t
2432dnl if this is defind we trust it to be 64 bits
62266438 2433AC_CHECK_TYPE(u_int64_t,[
2434 AC_CHECK_SIZEOF(u_int64_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2435 AC_DEFINE(HAVE_U_INT64_T,1,[u_int64_t is defined in system headers])
2436 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2437
2438dnl fallback #1
2439dnl if this is defind we trust it to be 64 bits
62266438 2440AC_CHECK_TYPE(uint64_t,[
2441 AC_CHECK_SIZEOF(uint64_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2442 AC_DEFINE(HAVE_UINT64_T,1,[uint64_t is defined in system headers])
2443 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2444
588e71df 2445dnl On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
2446dnl that is incompatible with the updated Solaris header files.
2447dnl For this reason, we must check if pad128_t and upad128_t are defined.
2448AC_CHECK_TYPE(pad128_t,
2449 AC_DEFINE(HAVE_PAD128_T,1,[pad128_t is defined in system headers]),
2450 ,SQUID_DEFAULT_INCLUDES)
2451
2452AC_CHECK_TYPE(upad128_t,
2453 AC_DEFINE(HAVE_UPAD128_T,1,[upad128_t is defined in system headers]),
2454 ,SQUID_DEFAULT_INCLUDES)
2455
6a9f6389 2456AC_CHECK_TYPE(pid_t, AC_DEFINE(HAVE_PID_T,1,[pid_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
856e69c5 2457AC_CHECK_TYPE(size_t, [AC_CHECK_SIZEOF(size_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2458 AC_DEFINE(HAVE_SIZE_T,1,[size_t is defined by the system headers])],,SQUID_DEFAULT_INCLUDES)
2459AC_CHECK_TYPE(ssize_t, AC_DEFINE(HAVE_SSIZE_T,1,[ssize_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
856e69c5 2460AC_CHECK_TYPE(off_t,[ AC_CHECK_SIZEOF(off_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2461 AC_DEFINE(HAVE_OFF_T,1,[off_t is defined by the system headers])],,SQUID_DEFAULT_INCLUDES)
2462AC_CHECK_TYPE(mode_t, AC_DEFINE(HAVE_MODE_T,1,[mode_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2463AC_CHECK_TYPE(fd_mask, AC_DEFINE(HAVE_FD_MASK,1,[fd_mask is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
adcceb47 2464
77d6bd88 2465dnl Check for special functions
2466AC_FUNC_ALLOCA
2467
6a9f6389 2468AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the system headers]),,[
2469#include <sys/types.h>
6637e3a5 2470#include <sys/socket.h>
2471#if STDC_HEADERS
2472#include <stdlib.h>
2473#include <stddef.h>
6a9f6389 2474#endif])
6637e3a5 2475
6a9f6389 2476AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,[mtyp_t is defined by the system headers]),,[#include <sys/types.h>
aea1be68 2477#include <sys/ipc.h>
6a9f6389 2478#include <sys/msg.h>])
aea1be68 2479
090089c4 2480dnl Check for needed libraries
30a4f2a8 2481AC_CHECK_LIB(nsl, main)
6716b242 2482AC_CHECK_LIB(socket, main)
bfe8dedf 2483dnl Check for Winsock only on MinGW, on Cygwin we must use emulated BSD socket API
4b26fae9 2484case "$host_os" in
2485 mingw|mingw32)
2486 AC_MSG_CHECKING(for winsock)
2487 save_LIBS="$LIBS"
2488 for curlib in ws2_32 wsock32; do
2489 LIBS="$LIBS -l$curlib"
2490 AC_TRY_LINK([
2491 char __attribute__((stdcall)) socket(int,int,int);
2492 char __attribute__((stdcall)) select(int,int,int,int,int);
2493 char __attribute__((stdcall)) closesocket(int);
2494 char __attribute__((stdcall)) gethostname(int,int);
2495 ],
2496 [
2497 socket(1,2,3);
2498 select(1,2,3,4,5);
2499 closesocket(1);
2500 gethostname(1,2);
2501 ],
2502 have_winsock=yes, have_winsock=no)
2503
2504 if test $have_winsock = yes; then
2505 ac_cv_func_select='yes'
2506 if test $curlib = ws2_32; then
2507 have_winsock=winsock2
2508 fi
2509 break
2510 fi
2511 LIBS="$save_LIBS"
2512 done
2513 AC_MSG_RESULT($have_winsock)
bfe8dedf
GS
2514 if test $have_winsock = winsock2; then
2515 AC_CHECK_HEADERS(winsock2.h)
2516 else
2517 AC_CHECK_HEADERS(winsock.h)
2518 fi
4b26fae9 2519 ;;
2520esac
94d48591 2521
3c641669 2522dnl Ripped from the Samba sources
2523AC_CACHE_CHECK([for unix domain sockets],squid_cv_unixsocket, [
2524 AC_TRY_COMPILE([
2525#include <sys/types.h>
2526#include <stdlib.h>
2527#include <stddef.h>
2528#include <sys/socket.h>
2529#include <sys/un.h>],
2530[
2531 struct sockaddr_un sunaddr;
2532 sunaddr.sun_family = AF_UNIX;
2533],
2534 squid_cv_unixsocket=yes,squid_cv_unixsocket=no)])
2535if test x"$squid_cv_unixsocket" = x"yes"; then
6a9f6389 2536 AC_DEFINE(HAVE_UNIXSOCKET,1,[Do we have unix sockets? (required for the winbind ntlm helper])
3c641669 2537fi
2538dnl end rip
2539
94d48591 2540 AC_CHECK_LIB(gnumalloc, main)
2541 if test "$ac_cv_lib_gnumalloc_main" = "yes"; then
2542 echo "Disabling extended malloc functions when using gnumalloc"
2543 ac_cv_func_mallinfo=no
2544 ac_cv_func_mallocblksize=no
2545 ac_cv_func_mallopt=no
2546 else
2547 case "$host" in
2548 *-sun-solaris*)
2549 echo "skipping libmalloc check for $host"
2550 ;;
2551 i386-*-freebsd*)
2552 echo "skipping libmalloc check for $host"
2553 ;;
2554 *)
2555
2556 AC_CHECK_LIB(malloc, main)
2557 ;;
2558 esac
2559 fi
94d48591 2560
6716b242 2561AC_CHECK_LIB(bsd, main)
be79ade0 2562AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"])
04a56fa3 2563AC_CHECK_LIB(bind, gethostbyname)
2564if test $ac_cv_lib_bind_gethostbyname = "no" ; then
2565 case "$host" in
78743365 2566 i386-*-freebsd*)
2567 echo "skipping libresolv checks for $host"
2568 ;;
2569 *)
78743365 2570 AC_CHECK_LIB(resolv, main)
2571 ;;
04a56fa3 2572 esac
2573fi
08caf8c6 2574case "$host_os" in
2575mingw|mingw32)
2576 echo "Use MSVCRT for math functions."
2577 ;;
2578 *)
2579 AC_CHECK_LIB(m, main)
2580 ;;
2581esac
090089c4 2582
2583dnl Check for libcrypt
8154dd82 2584dnl Some of our helpers use crypt(3) which may be in libc, or in
2585dnl libcrypt (eg FreeBSD)
c1dc012a 2586AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
3d4022fa 2587
2588dnl Solaris10 provides MD5 natively through libmd5
c1dc012a 2589AC_CHECK_LIB(md5, MD5Init, [CRYPTLIB="$CRYPTLIB -lmd5"])
3d4022fa 2590
be79ade0 2591AC_SUBST(CRYPTLIB)
77f675ad 2592
042b1f8a 2593dnl Check for libdl, used by auth_modules/PAM
8154dd82 2594if test "$with_dl" = "yes"; then
2595 AC_CHECK_LIB(dl, dlopen)
2596fi
042b1f8a 2597
e5f4e1b0 2598dnl Check for pthreads
2599dnl We use pthreads when doing ASYNC I/O
8154dd82 2600if test "$with_pthreads" = "yes"; then
fa035612 2601 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
2602 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
e685e3c6 2603 case "$host" in
2604 i386-unknown-freebsd*)
2605 if test "$GCC" = "yes" ; then
2606 if test -z "$PRESET_LDFLAGS"; then
2607 LDFLAGS="$LDFLAGS -pthread"
2608 fi
2609 fi
2610 ;;
2611 *-solaris2.*)
2612 if test "$GCC" = "yes" ; then
fa035612 2613 SQUID_CFLAGS="$SQUID_CFLAGS -pthreads"
2614 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -pthreads"
e685e3c6 2615 else
fa035612 2616 SQUID_CFLAGS="$SQUID_CFLAGS -mt"
2617 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -mt"
e685e3c6 2618 fi
2619 ;;
2620 esac
8154dd82 2621 AC_CHECK_LIB(pthread, main)
2622fi
71f8abc8 2623
f85c88f3 2624dnl Check for librt
2625dnl We use AIO in the coss store
8154dd82 2626if test "$with_aio" = "yes"; then
580e2134 2627 dnl On some systems POSIX AIO functions are in libaio
2628 AC_CHECK_LIB(rt, aio_read,,AC_CHECK_LIB(aio, aio_read))
8154dd82 2629fi
f85c88f3 2630
86ec11aa 2631dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
2632dnl Robert Side <rside@aiinc.bc.ca>
2633dnl Mon, 18 Jan 1999 17:48:00 GMT
2634case "$host" in
2635 *-pc-sco3.2*)
2636 AC_CHECK_LIB(intl, strftime)
2637 ;;
2638esac
2639
20e869bf 2640dnl On MinGW OpenLDAP is not available, so LDAP helpers can be linked
2641dnl only with Windows LDAP libraries using -lwldap32
2642case "$host_os" in
2643mingw|mingw32)
2644 LIB_LDAP="-lwldap32"
2645 LIB_LBER=""
2646 ;;
2647*)
2648 LIB_LDAP="-lldap"
2649 dnl LDAP helpers need to know if -llber is needed or not
2650 AC_CHECK_LIB(lber, main, [LIB_LBER="-llber"])
2651 ;;
2652esac
2653AC_SUBST(LIB_LDAP)
2654AC_SUBST(LIB_LBER)
2655
b7a1c19e 2656dnl Check for libdb
2657DBLIB=
01b4931d 2658dnl 1.85
a258dfca 2659AC_CACHE_CHECK(if dbopen needs -ldb,ac_cv_dbopen_libdb, [
32d0bbd7 2660SAVED_LIBS="$LIBS"; LIBS="$LIBS -ldb"
2661 AC_TRY_LINK([
a258dfca 2662#if HAVE_SYS_TYPES_H
2663#include <sys/types.h>
2664#endif
2665#if HAVE_LIMITS_H
2666#include <limits.h>
2667#endif
2668#if HAVE_DB_185_H
2669#include <db_185.h>
2670#elif HAVE_DB_H
2671#include <db.h>
2672#endif],
2673 [dbopen((void *)0L, 0, 0, DB_HASH, (void *)0L)],
a258dfca 2674 ac_cv_dbopen_libdb="yes",
2675 ac_cv_dbopen_libdb="no")
32d0bbd7 2676LIBS="$SAVED_LIBS"
a258dfca 2677])
2b2161bb 2678if test $ac_cv_dbopen_libdb = yes; then
32d0bbd7 2679 LIB_DB="-ldb"
2680fi
01b4931d 2681AC_SUBST(LIB_DB)
b7a1c19e 2682
77f675ad 2683dnl System-specific library modifications
2684dnl
2685case "$host" in
88738790 2686 i386-*-solaris2.*)
7149a49f 2687 if test "$GCC" = "yes"; then
2688 echo "Removing -O for gcc on $host"
80e92d6d 2689 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
7149a49f 2690 fi
2691 ;;
77f675ad 2692 *-sgi-irix*)
2693 echo "Removing -lsocket for IRIX..."
6716b242 2694 LIBS=`echo $LIBS | sed -e s/-lsocket//`
77f675ad 2695 echo "Removing -lnsl for IRIX..."
6716b242 2696 LIBS=`echo $LIBS | sed -e s/-lnsl//`
c415c128 2697 ac_cv_lib_nsl_main=no
b44c0fb4 2698 echo "Removing -lbsd for IRIX..."
2699 LIBS=`echo $LIBS | sed -e s/-lbsd//`
77f675ad 2700 ;;
4ba0bd0e 2701dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
2702dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
2703dnl Please change your configure script. AIX doesn't need -lbsd.
2704 *-ibm-aix*)
2705 echo "Removing -lbsd for AIX..."
2706 LIBS=`echo $LIBS | sed -e s/-lbsd//`
2707 ;;
30a4f2a8 2708 *m88k*)
fa035612 2709 SQUID_CFLAGS="$SQUID_CFLAGS -D_SQUID_MOTOROLA_"
2710 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_SQUID_MOTOROLA_"
6a9f6389 2711 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1,[If gettimeofday is known to take only one argument])
7149a49f 2712 ;;
580ce039 2713 [*-*-solaris2.[0-4]])
6a9f6389 2714 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
30a4f2a8 2715 ;;
711fa75e 2716 [*-sony-newsos[56]*])
6a9f6389 2717 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
f62c73dc 2718 ;;
77f675ad 2719esac
090089c4 2720
57faa85a 2721# Remove optimization for GCC 2.95.[123]
d20b1cd0 2722# gcc -O[2] on *BSD and Linux (x86) causes pointers to magically become NULL
2723if test "$GCC" = "yes"; then
2724 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
2725 case "$GCCVER" in
57faa85a 2726 [2.95.[123]])
d20b1cd0 2727 echo "Removing -O for gcc on $host with GCC $GCCVER"
2728 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
2729 ;;
2730 esac
2731fi
2732
176d10ee 2733# Recommended by Balint Nagy Endre <bne@CareNet.hu>
2734case "$host" in
2735 *-univel-sysv4.2MP)
2736 if test `uname -v` = "2.03"; then
2737 echo "disabling mallinfo for $host"
2738 ac_cv_func_mallinfo=no
2739 fi
2740 ;;
2741esac
2742
84cecfd2 2743dnl This has to be before AC_CHECK_FUNCS
2744# Disable poll() on certain platforms. Override by setting ac_cv_func_poll
2745# when running configure.
2746if test -z "$ac_cv_func_poll"; then
2747 case "$host" in
2748 [alpha-dec-osf3.*])
2749 # John Kay (jkay@nlanr.net) 19970818
2750 echo "disabling poll for $host..."
2751 ac_cv_func_poll='no'
2752 ;;
2753 [*-hp-hpux*.*])
2754 # Duane Wessels
2755 echo "disabling poll for $host..."
2756 ac_cv_func_poll='no'
2757 ;;
2758 [*-linux-*])
f5cec332 2759 # Henrik Nordstrom (hno@squid-cache.org) 19980817
9bb83c8b 2760 # poll is problematic on Linux. We disable it
2761 # by default until Linux gets it right.
b6a2f15e 2762 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
2763 if test $rev -lt 002002; then
2764 echo "disabling poll for $host < 2.2..."
2765 ac_cv_func_poll='no'
2766 fi
84cecfd2 2767 ;;
c68e9c6b 2768 [powerpc-ibm-aix4.1.*])
2769 # Mike Laster (mlaster@metavillage.com) 19981021
2770 echo "disabling poll for $host..."
2771 ac_cv_func_poll='no'
2772 ;;
86ec11aa 2773 [*-pc-sco3.2*])
2774 # Robert Side <rside@aiinc.bc.ca>
2775 # Mon, 18 Jan 1999 17:48:00 GMT
2776 echo "disabling poll for $host..."
2777 ac_cv_func_poll='no'
2778 ;;
84cecfd2 2779 esac
2780fi
176d10ee 2781
08caf8c6 2782dnl Override statfs() detect on MinGW becasue is emulated in source code
2783case "$host_os" in
2784mingw|mingw32)
2785 ac_cv_func_statfs='yes'
2786 ;;
2787esac
2788
6716b242 2789dnl Check for library functions
2790AC_CHECK_FUNCS(\
ce3d30fb 2791 backtrace_symbols_fd \
3a144521 2792 bcopy \
2793 bswap_16 \
2794 bswap_32 \
f9576890 2795 bswap16 \
2796 bswap32 \
4ac29a5b 2797 fchmod \
6716b242 2798 getdtablesize \
8505e57b 2799 getpagesize \
230c091c 2800 getpass \
3a144521 2801 getrlimit \
30a4f2a8 2802 getrusage \
9c1d8929 2803 getspnam \
379d5751 2804 gettimeofday \
52303a3d 2805 glob \
f9576890 2806 htobe16 \
2807 htole16 \
d474c7a6 2808 kqueue\
30a4f2a8 2809 lrand48 \
6716b242 2810 mallinfo \
0f5efab0 2811 mallocblksize \
6716b242 2812 mallopt \
2ae6b9b0 2813 memcpy \
30a4f2a8 2814 memmove \
dac27377 2815 memset \
b99a6dec 2816 mkstemp \
1812b6c7 2817 mktime \
88738790 2818 mstats \
84cecfd2 2819 poll \
62ae0622 2820 prctl \
3a144521 2821 pthread_attr_setschedparam \
cd748f27 2822 pthread_attr_setscope \
2823 pthread_setschedparam \
42b51993 2824 pthread_sigmask \
c68e9c6b 2825 putenv \
b1e77ec1 2826 random \
6716b242 2827 regcomp \
2828 regexec \
2829 regfree \
30a4f2a8 2830 res_init \
af76ec93 2831 __res_init \
4915be3b 2832 rint \
a4ba1105 2833 sbrk \
3a144521 2834 select \
234967c9 2835 seteuid \
c415c128 2836 setgroups \
30a4f2a8 2837 setpgrp \
6716b242 2838 setrlimit \
30a4f2a8 2839 setsid \
2840 sigaction \
11430c03 2841 snprintf \
1ccc0d40 2842 socketpair \
30a4f2a8 2843 srand48 \
b1e77ec1 2844 srandom \
0343b99c 2845 statfs \
1cd53467 2846 strsep \
2733d426 2847 strtoll \
6716b242 2848 sysconf \
2849 syslog \
234967c9 2850 timegm \
28da5e0d 2851 vsnprintf \
6716b242 2852)
f5e5c4cf 2853dnl ... and some we provide local replacements for
2854AC_REPLACE_FUNCS(\
2855 drand48 \
cc192b50 2856 inet_ntop \
2857 inet_pton \
f5e5c4cf 2858 initgroups \
cc192b50 2859 getaddrinfo \
2860 getnameinfo \
f5e5c4cf 2861 strerror \
2862 tempnam \
2863)
6716b242 2864
d06d566f 2865# check for crypt, may require -lcrypt
2866SAVED_LIBS="$LIBS"
2867LIBS="$LIBS $CRYPTLIB"
2868AC_CHECK_FUNCS(crypt)
2869LIBS="$SAVED_LIBS"
2870
d474c7a6 2871# Check for libepoll
2872EPOLL_LIB=
2873AC_CHECK_LIB(epoll, epoll_ctl, [EPOLL_LIBS="-lepoll"])
2874AC_SUBST(EPOLL_LIBS)
2875
2876# Check for epoll_ctl, may need -lepoll
2877SAVED_LIBS="$LIBS"
2878LIBS="$LIBS $LIB_EPOLL"
2879AC_CHECK_FUNCS(epoll_ctl)
2880LIBS="$SAVED_LIBS"
2881
2882dnl Verify that epoll really works
2883if test $ac_cv_func_epoll_ctl = yes; then
2884 AC_CACHE_CHECK(if epoll works, ac_cv_epoll_works,
2885 AC_TRY_RUN([
2886#include <sys/epoll.h>
2887#include <stdlib.h>
2888#include <stdio.h>
2889int main(int argc, char **argv)
2890{
2891 int fd = epoll_create(256);
2892 if (fd < 0) {
2893 perror("epoll_create:");
2894 exit(1);
2895 }
2896 exit(0);
2897}
2898 ], [ac_cv_epoll_works=yes], [ac_cv_epoll_works=no]))
328c40de 2899fi
d474c7a6 2900
1b3db6d9 2901dnl Magic which checks whether we are forcing a type of comm loop we
2902dnl are actually going to (ab)use
2903
2904dnl Actually do the define magic now
2905dnl mostly ripped from squid-commloops, thanks to adrian and benno
2906
d474c7a6 2907if test -n "$SELECT_TYPE"; then
2908 : # Already decided above. Nothing to do here
6564c397 2909elif test -z "$disable_epoll" && test "$ac_cv_epoll_works" = "yes" ; then
a46d2c0e 2910 SELECT_TYPE="epoll"
6564c397 2911elif test -z "$disable_kqueue" && test "$ac_cv_func_kqueue" = "yes" ; then
2912 SELECT_TYPE="kqueue"
2913elif test -z "$disable_poll" && test "$ac_cv_func_poll" = "yes" ; then
6c9797b9 2914 SELECT_TYPE="poll"
6564c397 2915elif test -z "$disable_select" && test "$ac_cv_func_select" = "yes" ; then
663c0a38 2916 case "$host_os" in
2917 mingw|mingw32)
2918 SELECT_TYPE="select_win32"
663c0a38 2919 ;;
2920 *)
2921 SELECT_TYPE="select"
663c0a38 2922 ;;
2923 esac
1b3db6d9 2924else
a46d2c0e 2925 echo "Eep! Can't find poll, kqueue, epoll, or select!"
1b3db6d9 2926 echo "I'll try select and hope for the best."
2927 SELECT_TYPE="select"
6a9f6389 2928 AC_DEFINE(USE_SELECT,1)
1b3db6d9 2929fi
d474c7a6 2930
2931echo "Using ${SELECT_TYPE} for the IO loop."
2932
2933AM_CONDITIONAL([USE_POLL], [test $SELECT_TYPE = poll])
2934AM_CONDITIONAL([USE_EPOLL], [test $SELECT_TYPE = epoll])
2935AM_CONDITIONAL([USE_SELECT], [test $SELECT_TYPE = select])
2936AM_CONDITIONAL([USE_SELECT_SIMPLE], [test $SELECT_TYPE = select_simple])
2937AM_CONDITIONAL([USE_SELECT_WIN32], [test $SELECT_TYPE = select_win32])
2938AM_CONDITIONAL([USE_KQUEUE], [test $SELECT_TYPE = kqueue])
2939AM_CONDITIONAL([USE_DEVPOLL], [test $SELECT_TYPE = devpoll])
2940
2941case $SELECT_TYPE in
2942epoll)
2943 AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop])
2944 ;;
2945poll)
2946 AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop])
2947 ;;
2948kqueue)
2949 AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop])
2950 ;;
2951select_win32)
2952 AC_DEFINE(USE_SELECT_WIN32,1,[Use Winsock select() for the IO loop])
2953 ;;
2954select)
2955 AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop])
2956 ;;
2957esac
1b3db6d9 2958
2959
d06d566f 2960
60939927 2961dnl Yay! Another Linux brokenness. Its not good enough
2962dnl to know that setresuid() exists, because RedHat 5.0 declares
2963dnl setresuid() but doesn't implement it.
2964dnl
2965AC_CACHE_CHECK(if setresuid is implemented, ac_cv_func_setresuid,
5c51415d 2966 AC_TRY_RUN([
60939927 2967#include <stdlib.h>
5c51415d 2968 int main() {
2969 if(setresuid(-1,-1,-1)) {
2970 perror("setresuid:");
2971 exit(1);
60939927 2972 }
2973 exit(0);
5c51415d 2974 }
2975 ],ac_cv_func_setresuid="yes",ac_cv_func_setresuid="no")
60939927 2976)
5c51415d 2977if test "$ac_cv_func_setresuid" = "yes" ; then
6a9f6389 2978 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 2979fi
60939927 2980
cee08cbc
AJ
2981dnl Yay! This one is a MacOSX brokenness. Its not good enough
2982dnl to know that strnstr() exists, because MacOSX 10.4 have a bad
2983dnl copy that crashes with a buffer over-run!
2984dnl
2985AC_CACHE_CHECK(if strnstr is well implemented, ac_cv_func_strnstr,
2986 AC_TRY_RUN([
2987#include <stdlib.h>
2988#include <stdio.h>
2989#include <string.h>
2990 // we expect this to succeed, or crash on over-run.
2991 // if it passes otherwise we may need a better check.
2992int main(int argc, char **argv)
2993{
2994 int size = 20;
2995 char *str = malloc(size);
2996 memset(str, 'x', size);
2997 strnstr(str, "fubar", size);
2998 return 0;
2999}
3000 ],ac_cv_func_strnstr="yes",ac_cv_func_strnstr="no")
3001)
3002if test "$ac_cv_func_strnstr" = "yes" ; then
3003 AC_DEFINE(HAVE_STRNSTR,1,[Yay! We have a working strnstr!])
3004else
3005 AC_DEFINE(HAVE_STRNSTR,0,[Yay! A MacOS X brokenness. Its not good enough to know that strnstr() exists, because MacOSX 10.4 and earlier may have a buffer overrun.])
3006fi
3007
3008
1cd53467 3009AM_CONDITIONAL(NEED_OWN_STRSEP, false)
3010if test "$ac_cv_func_strsep" = "no" ; then
3011 AM_CONDITIONAL(NEED_OWN_STRSEP, true)
3012fi
3013
2733d426 3014AM_CONDITIONAL(NEED_OWN_STRTOLL, false)
3015if test "$ac_cv_func_strtoll" = "no" ; then
3016 AM_CONDITIONAL(NEED_OWN_STRTOLL, true)
3017fi
3018
eee79a2e 3019dnl
3020dnl Test for va_copy
3021dnl
3022AC_CACHE_CHECK(if va_copy is implemented, ac_cv_func_va_copy,
3023 AC_TRY_RUN([
3024 #include <stdarg.h>
3025 void f (int i, ...) {
3026 va_list args1, args2;
3027 va_start (args1, i);
3028 va_copy (args2, args1);
3029 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3030 exit (1);
3031 va_end (args1); va_end (args2);
3032 }
3033 int main() {
3034 f (0, 42);
3035 return 0;
3036 }
3037 ],ac_cv_func_va_copy="yes",ac_cv_func_va_copy="no")
3038)
3039if test "$ac_cv_func_va_copy" = "yes" ; then
a45f884d 3040 AC_DEFINE(HAVE_VA_COPY, 1, [If your system have va_copy])
eee79a2e 3041fi
3042
3043dnl
3044dnl Some systems support __va_copy
3045dnl
3046AC_CACHE_CHECK(if __va_copy is implemented, ac_cv_func___va_copy,
3047 AC_TRY_RUN([
3048 #include <stdarg.h>
3049 void f (int i, ...) {
3050 va_list args1, args2;
3051 va_start (args1, i);
3052 __va_copy (args2, args1);
3053 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3054 exit (1);
3055 va_end (args1); va_end (args2);
3056 }
3057 int main() {
3058 f (0, 42);
3059 return 0;
3060 }
3061 ],ac_cv_func___va_copy="yes",ac_cv_func___va_copy="no")
3062)
3063if test "$ac_cv_func___va_copy" = "yes" ; then
a45f884d 3064 AC_DEFINE(HAVE___VA_COPY, 1, [Some systems have __va_copy instead of va_copy])
eee79a2e 3065fi
c3d0c8b5 3066
5cafc1d6 3067dnl IP-Filter support requires ipf header files. These aren't
3068dnl installed by default, so we need to check for them
3069if test "$IPF_TRANSPARENT" ; then
3070 AC_MSG_CHECKING(if IP-Filter header files are installed)
42b51993 3071 # hold on to your hats...
3072 if test "$ac_cv_header_ip_compat_h" = "yes" ||
3073 test "$ac_cv_header_ip_fil_compat_h" = "yes" ||
87d21d8b 3074 test "$ac_cv_header_netinet_ip_compat_h" = "yes" ||
3075 test "$ac_cv_header_netinet_ip_fil_compat_h" = "yes" ; then
42b51993 3076 have_ipfilter_compat_header="yes"
3077 fi
3078 if test "x$have_ipfilter_compat_header" = "xyes" &&
eb824054 3079 test "$ac_cv_header_ip_fil_h" = "yes" &&
3080 test "$ac_cv_header_ip_nat_h" = "yes" ; then
3081 IPF_TRANSPARENT="yes"
3082 AC_DEFINE(IPF_TRANSPARENT, 1)
42b51993 3083 elif test "$have_ipfilter_compat_header" = "yes" &&
eb824054 3084 test "$ac_cv_header_netinet_ip_fil_h" = "yes" &&
3085 test "$ac_cv_header_netinet_ip_nat_h" = "yes" ; then
3086 IPF_TRANSPARENT="yes"
3087 AC_DEFINE(IPF_TRANSPARENT, 1)
3088 else
5cafc1d6 3089 IPF_TRANSPARENT="no"
3090 AC_DEFINE(IPF_TRANSPARENT, 0)
5cafc1d6 3091 fi
3092 AC_MSG_RESULT($IPF_TRANSPARENT)
3093fi
3094if test "$IPF_TRANSPARENT" = "no" ; then
3095 echo "WARNING: Cannot find necessary IP-Filter header files"
3096 echo " Transparent Proxy support WILL NOT be enabled"
3097 sleep 10
8f6ca20d 3098elif test "$IPF_TRANSPARENT" = "yes" ; then
3099dnl On Solaris Ipfilter includes expect that SOLARIS2 is defined with the
3100dnl Solaris minor version (8, 9, 10, ...)
3101 case "$host" in
3102 *-solaris*)
3103 solrev=`uname -r | sh -c 'IFS=. read j n x; echo $n'`
3104 CFLAGS="-DSOLARIS2=$solrev $CFLAGS"
20b3ae10 3105 CXXFLAGS="-DSOLARIS2=$solrev $CXXFLAGS"
8f6ca20d 3106 ;;
3107 *)
3108 ;;
3109 esac
5cafc1d6 3110fi
3111
2b0dd4ac 3112dnl PF support requires a header file.
3113if test "$PF_TRANSPARENT" ; then
3114 AC_MSG_CHECKING(if PF header file is installed)
3115 # hold on to your hats...
3116 if test "$ac_cv_header_net_pfvar_h" = "yes"; then
3117 PF_TRANSPARENT="yes"
3118 AC_DEFINE(PF_TRANSPARENT, 1)
3119 else
3120 PF_TRANSPARENT="no"
3121 AC_DEFINE(PF_TRANSPARENT, 0)
3122 fi
3123 AC_MSG_RESULT($PF_TRANSPARENT)
3124fi
3125if test "$PF_TRANSPARENT" = "no" ; then
3126 echo "WARNING: Cannot find necessary PF header file"
3127 echo " Transparent Proxy support WILL NOT be enabled"
3128 sleep 10
3129fi
3130
d852fbad 3131dnl Linux-Netfilter support requires Linux 2.4 kernel header files.
3132dnl Shamelessly copied from above
3133if test "$LINUX_NETFILTER" ; then
d6d62546 3134 AC_MSG_CHECKING(if Linux (Netfilter) kernel header files are installed)
d852fbad 3135 # hold on to your hats...
3136 if test "$ac_cv_header_linux_netfilter_ipv4_h" = "yes"; then
3137 LINUX_NETFILTER="yes"
3138 AC_DEFINE(LINUX_NETFILTER, 1)
3139 else
3140 LINUX_NETFILTER="no"
3141 AC_DEFINE(LINUX_NETFILTER, 0)
3142 fi
3143 AC_MSG_RESULT($LINUX_NETFILTER)
3144fi
3145if test "$LINUX_NETFILTER" = "no" ; then
d6d62546 3146 echo "WARNING: Cannot find necessary Linux kernel (Netfilter) header files"
7b0a0d1f 3147 echo " Linux Transparent and Intercepting Proxy support WILL NOT be enabled"
d852fbad 3148 sleep 10
3149fi
3150
f1e0717c 3151dnl Linux Netfilter/TPROXYv2 support requires some specific header files
fc68f6b1 3152dnl Shamelessly copied from shamelessly copied from above
f1e0717c
AJ
3153if test "$LINUX_TPROXY2" ; then
3154 AC_MSG_CHECKING(if TPROXYv2 header files are installed)
fc68f6b1 3155 # hold on to your hats...
3156 if test "$ac_cv_header_linux_netfilter_ipv4_ip_tproxy_h" = "yes" && test "$LINUX_NETFILTER" = "yes"; then
f1e0717c
AJ
3157 LINUX_TPROXY2="yes"
3158 AC_DEFINE(LINUX_TPROXY2, 1, [Enable real Transparent Proxy support for Netfilter TPROXY v2.])
fc68f6b1 3159 else
f1e0717c
AJ
3160 LINUX_TPROXY2="no"
3161 AC_DEFINE(LINUX_TPROXY2, 0, [Enable real Transparent Proxy support for Netfilter TPROXY v2.])
3162 fi
3163 AC_MSG_RESULT($LINUX_TPROXY2)
3164 if test "$LINUX_TPROXY2" = "no" && test "$LINUX_NETFILTER" = "yes"; then
3165 echo "WARNING: Cannot find TPROXY v2 headers, you need to install the"
3166 echo "tproxy package from:"
3167 echo " - lynx http://www.balabit.com/downloads/tproxy/"
7b0a0d1f 3168 echo "Or select the '--enable-linux-netfilter' option instead for Netfilter support."
f1e0717c 3169 sleep 10
fc68f6b1 3170 fi
fc68f6b1 3171fi
3172
91bc414e 3173if test -z "$USE_GNUREGEX" ; then
3174 case "$host" in
3175 *-sun-solaris2.[[0-4]])
3176 USE_GNUREGEX="yes"
3177 ;;
3178 *-next-nextstep*)
3179 USE_GNUREGEX="yes"
3180 ;;
3181 esac
3182fi
7a081912 3183AC_MSG_CHECKING(if GNUregex needs to be compiled)
91bc414e 3184if test -z "$USE_GNUREGEX"; then
55878dfd 3185if test "$ac_cv_func_regcomp" = "no" || test "$USE_GNUREGEX" = "yes" ; then
74946a0f 3186 USE_GNUREGEX="yes"
00fa2c12 3187else
0cccc031 3188 AC_TRY_COMPILE([#include <sys/types.h>
3189#include <regex.h>],[regex_t t; regcomp(&t,"",0);],
91bc414e 3190 USE_GNUREGEX="no",
3191 USE_GNUREGEX="yes")
3192fi
00fa2c12 3193fi
74946a0f 3194AC_MSG_RESULT($USE_GNUREGEX)
3195if test "$USE_GNUREGEX" = "yes"; then
26675bf4 3196 REGEXLIB="-lregex"
7a081912 3197 LIBREGEX="libregex.a"
6a9f6389 3198 AC_DEFINE(USE_GNUREGEX,1,[Define if we should use GNU regex])
7a081912 3199fi
26675bf4 3200AC_SUBST(REGEXLIB)
00fa2c12 3201AC_SUBST(LIBREGEX)
7a081912 3202
5c51415d 3203dnl Not cached since people are likely to tune this
e924600d 3204AC_MSG_CHECKING(Default FD_SETSIZE value)
3205AC_TRY_RUN([
3206#if HAVE_STDIO_H
3207#include <stdio.h>
3208#endif
3209#if HAVE_UNISTD_H
3210#include <unistd.h>
3211#endif
3212#if HAVE_SYS_TIME_H
3213#include <sys/time.h>
3214#endif
3215#if HAVE_SYS_SELECT_H
3216#include <sys/select.h>
3217#endif
3218#if HAVE_SYS_TYPES_H
3219#include <sys/types.h>
3220#endif
bfe8dedf
GS
3221#if HAVE_WINSOCK_H
3222#include <winsock.h>
3223#endif
3224#if HAVE_WINSOCK2_H
3225#include <winsock2.h>
3226#endif
e924600d 3227main() {
635e6242 3228 FILE *fp = fopen("conftestval", "w");
3229 fprintf (fp, "%d\n", FD_SETSIZE);
e924600d 3230 exit(0);
3231}
3232],
3233DEFAULT_FD_SETSIZE=`cat conftestval`,
3234DEFAULT_FD_SETSIZE=256,
3235DEFAULT_FD_SETSIZE=256)
3236AC_MSG_RESULT($DEFAULT_FD_SETSIZE)
6a9f6389 3237AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE, [Default FD_SETSIZE value])
e924600d 3238
f49be7d1 3239
5c51415d 3240dnl Not cached since people are likely to tune this
234967c9 3241AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
c76d8acc 3242dnl damn! FreeBSD's pthreads breaks dup2().
5132a9eb 3243TLDFLAGS="$LDFLAGS"
f49be7d1 3244if test -n "$squid_filedescriptors_num" ; then
3245 SQUID_MAXFD=$squid_filedescriptors_num
3246 AC_MSG_RESULT($SQUID_MAXFD (user-forced))
3247else
f49be7d1 3248 case $host in
3249 i386-unknown-freebsd*)
3250 if echo "$LDFLAGS" | grep -q pthread; then
3251 LDFLAGS=`echo $LDFLAGS | sed -e "s/-pthread//"`
3252 fi
3253 esac
3254 AC_TRY_RUN([
8cca06da 3255#include <stdio.h>
234967c9 3256#include <unistd.h>
30a4f2a8 3257#include <sys/time.h> /* needed on FreeBSD */
234967c9 3258#include <sys/param.h>
3259#include <sys/resource.h>
3260main() {
635e6242 3261 FILE *fp;
234967c9 3262 int i,j;
42b51993 3263#if defined(__CYGWIN32__) || defined (__CYGWIN__)
b05490a8 3264 /* getrlimit and sysconf returns bogous values on cygwin32.
df087e68 3265 * Number of fds is virtually unlimited in cygwin (sys/param.h)
b05490a8 3266 * __CYGWIN32__ is deprecated.
df087e68 3267 */
3268 i = NOFILE;
b05490a8 3269#else
3270#if HAVE_SETRLIMIT
234967c9 3271 struct rlimit rl;
3272#if defined(RLIMIT_NOFILE)
3273 if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
3274 perror("getrlimit: RLIMIT_NOFILE");
3275 } else {
f168f0c5
AJ
3276#if defined(__APPLE__)
3277 /* asking for more than OPEN_MAX fails on Leopard */
3278 rl.rlim_cur = (OPEN_MAX < rl.rlim_max ? OPEN_MAX : rl.rlim_max);
3279#else
234967c9 3280 rl.rlim_cur = rl.rlim_max; /* set it to the max */
f168f0c5 3281#endif
234967c9 3282 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
3283 perror("setrlimit: RLIMIT_NOFILE");
3284 }
3285 }
3286#elif defined(RLIMIT_OFILE)
3287 if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
3288 perror("getrlimit: RLIMIT_OFILE");
3289 } else {
3290 rl.rlim_cur = rl.rlim_max; /* set it to the max */
3291 if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
3292 perror("setrlimit: RLIMIT_OFILE");
3293 }
3294 }
3295#endif /* RLIMIT_NOFILE */
3296#endif /* HAVE_SETRLIMIT */
d9399075 3297 /* by starting at 2^14, we will never get higher
3298 than 2^15 for SQUID_MAXFD */
3299 i = j = 1<<14;
3300 while (j) {
3301 j >>= 1;
3302 if (dup2(0, i) < 0) {
3303 i -= j;
3304 } else {
3305 close(i);
3306 i += j;
3307 }
3308 }
3309 i++;
b05490a8 3310#endif /* IF !DEF CYGWIN */
635e6242 3311 fp = fopen("conftestval", "w");
a4d7e961 3312 fprintf (fp, "%d\n", i & ~0x3F);
234967c9 3313 exit(0);
3314}
f49be7d1 3315 ],
3316 SQUID_MAXFD=`cat conftestval`,
3317 SQUID_MAXFD=256,
3318 SQUID_MAXFD=256)
4b26fae9 3319 dnl Microsoft MSVCRT.DLL supports 2048 maximum FDs
3320 case "$host_os" in
3321 mingw|mingw32)
3322 SQUID_MAXFD="2048"
3323 ;;
3324 esac
f49be7d1 3325 AC_MSG_RESULT($SQUID_MAXFD)
3326fi
6a9f6389 3327AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD,[Maximum number of open filedescriptors])
b9cc811d 3328if test "$SQUID_MAXFD" -lt 512 ; then
80ab193b 3329 echo "WARNING: $SQUID_MAXFD may not be enough filedescriptors if your"
3330 echo " cache will be very busy. Please see the FAQ page"
2b6662ba 3331 echo " http://www.squid-cache.org/FAQ/FAQ-11.html#filedescriptors"
e692ff35 3332 echo " on how to increase your filedescriptor limit"
933cc58d 3333 sleep 10
80ab193b 3334fi
c76d8acc 3335LDFLAGS="$TLDFLAGS"
234967c9 3336
d0f9207a 3337if test `expr $SQUID_MAXFD % 64` != 0; then
a4d7e961 3338 echo "WARNING: $SQUID_MAXFD is not an multiple of 64. This may cause issues"
3339 echo " on certain platforms."
3340 sleep 10
3341fi
3342
5c51415d 3343dnl Not cached since people are likely to tune this
30a4f2a8 3344AC_MSG_CHECKING(Default UDP send buffer size)
3345AC_TRY_RUN([
8cca06da 3346#include <stdlib.h>
3347#include <stdio.h>
30a4f2a8 3348#include <sys/types.h>
bfe8dedf 3349#if HAVE_SYS_SOCKET_H
30a4f2a8 3350#include <sys/socket.h>
bfe8dedf
GS
3351#endif
3352#if HAVE_NETINET_IN_H
30a4f2a8 3353#include <netinet/in.h>
bfe8dedf
GS
3354#endif
3355#if HAVE_WINSOCK_H
3356#include <winsock.h>
3357#endif
3358#if HAVE_WINSOCK2_H
3359#include <winsock2.h>
3360#endif
30a4f2a8 3361main ()
3362{
635e6242 3363 FILE *fp;
30a4f2a8 3364 int fd,val=0,len=sizeof(int);
bfe8dedf
GS
3365#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
3366 WSADATA wsaData;
3367 WSAStartup(2, &wsaData);
3368#endif
30a4f2a8 3369 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
3370 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
bfe8dedf
GS
3371#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
3372 WSACleanup();
3373#endif
30a4f2a8 3374 if (val<=0) exit(1);
635e6242 3375 fp = fopen("conftestval", "w");
3376 fprintf (fp, "%d\n", val);
30a4f2a8 3377 exit(0);
3378}
3379],
6a9f6389 3380SQUID_DETECT_UDP_SO_SNDBUF=`cat conftestval`,
3381SQUID_DETECT_UDP_SO_SNDBUF=16384,
3382SQUID_DETECT_UDP_SO_SNDBUF=16384)
3383AC_MSG_RESULT($SQUID_DETECT_UDP_SO_SNDBUF)
3384AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_SNDBUF, $SQUID_DETECT_UDP_SO_SNDBUF,[UDP send buffer size])
30a4f2a8 3385
5c51415d 3386dnl Not cached since people are likely to tune this
30a4f2a8 3387AC_MSG_CHECKING(Default UDP receive buffer size)
3388AC_TRY_RUN([
8cca06da 3389#include <stdlib.h>
3390#include <stdio.h>
30a4f2a8 3391#include <sys/types.h>
bfe8dedf 3392#if HAVE_SYS_SOCKET_H
30a4f2a8 3393#include <sys/socket.h>
bfe8dedf
GS
3394#endif
3395#if HAVE_NETINET_IN_H
30a4f2a8 3396#include <netinet/in.h>
bfe8dedf
GS
3397#endif
3398#if HAVE_WINSOCK_H
3399#include <winsock.h>
3400#endif
3401#if HAVE_WINSOCK2_H
3402#include <winsock2.h>
3403#endif
30a4f2a8 3404main ()
3405{
635e6242 3406 FILE *fp;
30a4f2a8 3407 int fd,val=0,len=sizeof(int);
bfe8dedf
GS
3408#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
3409 WSADATA wsaData;
3410 WSAStartup(2, &wsaData);
3411#endif
30a4f2a8 3412 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
3413 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
bfe8dedf
GS
3414#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
3415 WSACleanup();
3416#endif
30a4f2a8 3417 if (val <= 0) exit(1);
635e6242 3418 fp = fopen("conftestval", "w");
3419 fprintf (fp, "%d\n", val);
30a4f2a8 3420 exit(0);
3421}
3422],
6a9f6389 3423SQUID_DETECT_UDP_SO_RCVBUF=`cat conftestval`,
3424SQUID_DETECT_UDP_SO_RCVBUF=16384,
3425SQUID_DETECT_UDP_SO_RCVBUF=16384)
3426AC_MSG_RESULT($SQUID_DETECT_UDP_SO_RCVBUF)
3427AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_RCVBUF, $SQUID_DETECT_UDP_SO_RCVBUF,[UDP receive buffer size])
30a4f2a8 3428
5c51415d 3429dnl Not cached since people are likely to tune this
30a4f2a8 3430AC_MSG_CHECKING(Default TCP send buffer size)
3431AC_TRY_RUN([
8cca06da 3432#include <stdlib.h>
3433#include <stdio.h>
30a4f2a8 3434#include <sys/types.h>
bfe8dedf 3435#if HAVE_SYS_SOCKET_H
30a4f2a8 3436#include <sys/socket.h>
bfe8dedf
GS
3437#endif
3438#if HAVE_NETINET_IN_H
30a4f2a8 3439#include <netinet/in.h>
bfe8dedf
GS
3440#endif
3441#if HAVE_WINSOCK_H
3442#include <winsock.h>
3443#endif
3444#if HAVE_WINSOCK2_H
3445#include <winsock2.h>
3446#endif
30a4f2a8 3447main ()
3448{
635e6242 3449 FILE *fp;
30a4f2a8 3450 int fd,val=0,len=sizeof(int);
bfe8dedf
GS
3451#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
3452 WSADATA wsaData;
3453 WSAStartup(2, &wsaData);
3454#endif
30a4f2a8 3455 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
3456 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
bfe8dedf
GS
3457#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
3458 WSACleanup();
3459#endif
30a4f2a8 3460 if (val <= 0) exit(1);
635e6242 3461 fp = fopen("conftestval", "w");
3462 fprintf (fp, "%d\n", val);
30a4f2a8 3463 exit(0);
3464}
3465],
3466SQUID_TCP_SO_SNDBUF=`cat conftestval`,
1c481e00 3467SQUID_TCP_SO_SNDBUF=16384,
3468SQUID_TCP_SO_SNDBUF=16384)
30a4f2a8 3469AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF)
2aa6ca58 3470if test $SQUID_TCP_SO_SNDBUF -gt 32768; then
3471 echo "Limiting send buffer size to 32K"
3472 SQUID_TCP_SO_SNDBUF=32768
3473fi
6a9f6389 3474AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF,[TCP send buffer size])
30a4f2a8 3475
5c51415d 3476dnl Not cached since people are likely to tune this
30a4f2a8 3477AC_MSG_CHECKING(Default TCP receive buffer size)
3478AC_TRY_RUN([
8cca06da 3479#include <stdlib.h>
3480#include <stdio.h>
30a4f2a8 3481#include <sys/types.h>
bfe8dedf 3482#if HAVE_SYS_SOCKET_H
30a4f2a8 3483#include <sys/socket.h>
bfe8dedf
GS
3484#endif
3485#if HAVE_NETINET_IN_H
30a4f2a8 3486#include <netinet/in.h>
bfe8dedf
GS
3487#endif
3488#if HAVE_WINSOCK_H
3489#include <winsock.h>
3490#endif
3491#if HAVE_WINSOCK2_H
3492#include <winsock2.h>
3493#endif
30a4f2a8 3494main ()
3495{
635e6242 3496 FILE *fp;
30a4f2a8 3497 int fd,val=0,len=sizeof(int);
bfe8dedf
GS
3498#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
3499 WSADATA wsaData;
3500 WSAStartup(2, &wsaData);
3501#endif
30a4f2a8 3502 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
3503 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
bfe8dedf
GS
3504#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
3505 WSACleanup();
3506#endif
30a4f2a8 3507 if (val <= 0) exit(1);
635e6242 3508 fp = fopen("conftestval", "w");
3509 fprintf (fp, "%d\n", val);
30a4f2a8 3510 exit(0);
3511}
3512],
3513SQUID_TCP_SO_RCVBUF=`cat conftestval`,
1c481e00 3514SQUID_TCP_SO_RCVBUF=16384,
3515SQUID_TCP_SO_RCVBUF=16384)
30a4f2a8 3516AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF)
2aa6ca58 3517if test $SQUID_TCP_SO_RCVBUF -gt 65535; then
3518 echo "Limiting receive buffer size to 64K"
3519 SQUID_TCP_SO_RCVBUF=65535
3520fi
6a9f6389 3521AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF,[TCP receive buffer size])
5c51415d 3522AC_CACHE_CHECK(if sys_errlist is already defined, ac_cv_needs_sys_errlist,
9bc73deb 3523 AC_TRY_COMPILE([#include <stdio.h>],[char *s = sys_errlist;],
5c51415d 3524 ac_cv_needs_sys_errlist="no",
3525 ac_cv_needs_sys_errlist="yes")
3526)
3527if test "$ac_cv_needs_sys_errlist" = "yes" ; then
6a9f6389 3528 AC_DEFINE(NEED_SYS_ERRLIST,1,[If we need to declare sys_errlist[] as external])
5c51415d 3529fi
30a4f2a8 3530
5c51415d 3531dnl Not cached since people are likely to change this
6bf65235 3532AC_MSG_CHECKING(for libresolv _dns_ttl_ hack)
3533AC_TRY_LINK(extern int _dns_ttl_;,return _dns_ttl_;,
3534[AC_MSG_RESULT(yes)
6a9f6389 3535AC_DEFINE(LIBRESOLV_DNS_TTL_HACK,1,[If libresolv.a has been hacked to export _dns_ttl_])],
6bf65235 3536AC_MSG_RESULT(no))
3537
a937d5e3 3538AC_MSG_CHECKING(if inet_ntoa() actually works)
3539AC_TRY_RUN([
3540#include <stdlib.h>
3541#include <stdio.h>
3542#include <sys/types.h>
3543#include <netinet/in.h>
3544#include <arpa/inet.h>
3545main ()
3546{
635e6242 3547 FILE *fp;
a937d5e3 3548 struct in_addr in;
3549 in.s_addr = inet_addr("1.2.3.4");
635e6242 3550 fp = fopen("conftestval", "w");
3551 fprintf (fp, "%s\n", inet_ntoa(in));
a937d5e3 3552 exit(0);
3553}
3554],
3555INET_NTOA_RESULT=`cat conftestval`,
3556INET_NTOA_RESULT="broken",
3557INET_NTOA_RESULT="broken")
3558if test "$INET_NTOA_RESULT" = "1.2.3.4" ; then
3559 AC_MSG_RESULT("yes")
3560else
3561 AC_MSG_RESULT("no")
4b26fae9 3562 case "$host_os" in
3563 mingw|mingw32)
3564 echo "Using Win32 resolver instead."
3565 ;;
f5e5c4cf 3566 *)
4b26fae9 3567 echo "Will use our own inet_ntoa()."
3568 AC_LIBOBJ(inet_ntoa)
3569# echo "WARNING: This looks bad, and probably prevents Squid from working."
3570# echo " If you're on IRIX and using GCC 2.8, you probably need"
3571# echo " to use the IRIX C compiler instead."
3572# sleep 10
3573 ;;
3574 esac
a937d5e3 3575fi
3576
b6a2f15e 3577if test "$ac_cv_header_sys_statvfs_h" = "yes" ; then
c68e9c6b 3578AC_MSG_CHECKING(for working statvfs() interface)
3579AC_TRY_COMPILE([
3580#include <stdlib.h>
3581#include <stdio.h>
3582#include <sys/types.h>
3583#include <sys/statvfs.h>
3584],
3585[
3586struct statvfs sfs;
3587sfs.f_blocks = sfs.f_bfree = sfs.f_frsize =
3588sfs.f_files = sfs.f_ffree = 0;
3589statvfs("/tmp", &sfs);
3590],
3591 ac_cv_func_statvfs=yes,
3592 ac_cv_func_statvfs=no)
3593AC_MSG_RESULT($ac_cv_func_statvfs)
6b8e7481 3594if test "$ac_cv_func_statvfs" = "yes" ; then
6a9f6389 3595 AC_DEFINE(HAVE_STATVFS,1,[If your system has statvfs(), and if it actually works!])
b6a2f15e 3596fi
6b8e7481 3597fi
c68e9c6b 3598
cc192b50 3599dnl Detect what resolver fields we have available to use...
3600AC_CACHE_CHECK(for _res_ext.nsaddr_list, ac_cv_have_res_ext_nsaddr_list,
3601AC_TRY_COMPILE([
3602#if HAVE_SYS_TYPES_H
3603#include <sys/types.h>
3604#endif
3605#if HAVE_NETINET_IN_H
3606#include <netinet/in.h>
3607#endif
3608#if HAVE_ARPA_INET_H
3609#include <arpa/inet.h>
3610#endif
3611#if HAVE_ARPA_NAMESER_H
3612#include <arpa/nameser.h>
3613#endif
3614#if HAVE_RESOLV_H
3615#include <resolv.h>
3616#endif
3617],
3618[_res_ext.nsaddr_list[[0]].s_addr;],
3619ac_cv_have_res_ext_nsaddr_list="yes",
3620ac_cv_have_res_ext_nsaddr_list="no"))
3621if test "$ac_cv_have_res_ext_nsaddr_list" = "yes" ; then
3622 AC_DEFINE(_SQUID_RES_NSADDR6_LARRAY,_res_ext.nsaddr_list,[If _res_ext structure has nsaddr_list member])
3623 AC_DEFINE(_SQUID_RES_NSADDR6_COUNT,ns6count,[Nameserver Counter for IPv6 _res_ext])
3624fi
3625
3626if test "$_SQUID_RES_NSADDR6_LIST" == ""; then
3627AC_CACHE_CHECK(for _res._u._ext.nsaddrs, ac_cv_have_res_ext_nsaddrs,
3628AC_TRY_COMPILE([
3629#if HAVE_SYS_TYPES_H
3630#include <sys/types.h>
3631#endif
3632#if HAVE_NETINET_IN_H
3633#include <netinet/in.h>
3634#endif
3635#if HAVE_ARPA_INET_H
3636#include <arpa/inet.h>
3637#endif
3638#if HAVE_ARPA_NAMESER_H
3639#include <arpa/nameser.h>
3640#endif
3641#if HAVE_RESOLV_H
3642#include <resolv.h>
3643#endif
3644],
3645[_res._u._ext.nsaddrs[[0]]->sin6_addr;],
3646ac_cv_have_res_ext_nsaddrs="yes",
3647ac_cv_have_res_ext_nsaddrs="no"))
3648if test "$ac_cv_have_res_ext_nsaddrs" = "yes" ; then
3649 AC_DEFINE(_SQUID_RES_NSADDR6_LPTR,_res._u._ext.nsaddrs,[If _res structure has _ext.nsaddrs member])
3650 AC_DEFINE(_SQUID_RES_NSADDR6_COUNT,_res._u._ext.nscount6,[Nameserver Counter for IPv6 _res])
3651fi
3652fi
3653
c68e9c6b 3654AC_CACHE_CHECK(for _res.nsaddr_list, ac_cv_have_res_nsaddr_list,
3655AC_TRY_COMPILE([
3656#if HAVE_SYS_TYPES_H
3657#include <sys/types.h>
3658#endif
3659#if HAVE_NETINET_IN_H
3660#include <netinet/in.h>
3661#endif
3662#if HAVE_ARPA_INET_H
3663#include <arpa/inet.h>
3664#endif
3665#if HAVE_ARPA_NAMESER_H
3666#include <arpa/nameser.h>
3667#endif
3668#if HAVE_RESOLV_H
3669#include <resolv.h>
3670#endif
3671],
3672[_res.nsaddr_list[[0]];],
3673ac_cv_have_res_nsaddr_list="yes",
3674ac_cv_have_res_nsaddr_list="no"))
3675if test $ac_cv_have_res_nsaddr_list = "yes" ; then
cc192b50 3676 AC_DEFINE(_SQUID_RES_NSADDR_LIST,_res.nsaddr_list,[If _res structure has nsaddr_list member])
3677 AC_DEFINE(_SQUID_RES_NSADDR_COUNT,_res.nscount,[Nameserver counter for IPv4 _res])
c68e9c6b 3678fi
3679
cc192b50 3680if test "$_SQUID_RES_NSADDR_LIST" == ""; then
c68e9c6b 3681AC_CACHE_CHECK(for _res.ns_list, ac_cv_have_res_ns_list,
3682AC_TRY_COMPILE([
3683#if HAVE_SYS_TYPES_H
3684#include <sys/types.h>
3685#endif
3686#if HAVE_NETINET_IN_H
3687#include <netinet/in.h>
3688#endif
3689#if HAVE_ARPA_INET_H
3690#include <arpa/inet.h>
3691#endif
3692#if HAVE_ARPA_NAMESER_H
3693#include <arpa/nameser.h>
3694#endif
3695#if HAVE_RESOLV_H
3696#include <resolv.h>
3697#endif
3698],
3699[_res.ns_list[[0]].addr;],
3700ac_cv_have_res_ns_list="yes",
3701ac_cv_have_res_ns_list="no"))
3702if test $ac_cv_have_res_ns_list = "yes" ; then
cc192b50 3703 AC_DEFINE(_SQUID_RES_NSADDR_LIST,_res.ns_list,[If _res structure has ns_list member])
3704 AC_DEFINE(_SQUID_RES_NSADDR_COUNT,_res.nscount,[Nameserver counter for IPv4 _res])
c68e9c6b 3705fi
3706fi
3707
090089c4 3708dnl Need the debugging version of malloc if available
3709XTRA_OBJS=''
6509a1a0 3710if test "$ac_cv_lib_malloc_main" = "yes" ; then
090089c4 3711 if test -r /usr/lib/debug/malloc.o ; then
3712 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
3713 fi
3714 if test -r /usr/lib/debug/mallocmap.o ; then
3715 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
3716 fi
3717fi
2bbd722b 3718
090089c4 3719AC_SUBST(XTRA_OBJS)
3720
38fea766 3721if test -z "$XTRA_LIBS"; then
3722 XTRA_LIBS="$LIBS"
0f5a16f8 3723 dnl minor cleanup
3724 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
38fea766 3725 LIBS=''
3726fi
090089c4 3727AC_SUBST(XTRA_LIBS)
3728
090089c4 3729dnl Clean up after OSF/1 core dump bug
3730rm -f core
3731
6a9f6389 3732AC_CONFIG_FILES([\
a2794549 3733 Makefile \
3734 lib/Makefile \
a2794549 3735 scripts/Makefile \
3736 scripts/RunCache \
3737 scripts/RunAccel \
3738 src/Makefile \
3739 src/fs/Makefile \
3740 src/repl/Makefile \
3741 src/auth/Makefile \
5fa840c3
AR
3742 src/adaptation/Makefile \
3743 src/ICAP/Makefile \
3e7b6055 3744 src/eCAP/Makefile \
a2794549 3745 contrib/Makefile \
3746 snmplib/Makefile \
3747 icons/Makefile \
3748 errors/Makefile \
1077c1b8 3749 test-suite/Makefile \
99db07b3 3750 doc/Makefile \
0c510f3c 3751 helpers/Makefile \
3752 helpers/basic_auth/Makefile \
3753 helpers/basic_auth/LDAP/Makefile \
3754 helpers/basic_auth/MSNT/Makefile \
3755 helpers/basic_auth/NCSA/Makefile \
3756 helpers/basic_auth/PAM/Makefile \
3757 helpers/basic_auth/SMB/Makefile \
6e785d85 3758 helpers/basic_auth/mswin_sspi/Makefile \
0c510f3c 3759 helpers/basic_auth/YP/Makefile \
3760 helpers/basic_auth/getpwnam/Makefile \
3761 helpers/basic_auth/multi-domain-NTLM/Makefile \
3762 helpers/basic_auth/SASL/Makefile \
bcf74be7 3763 helpers/basic_auth/POP3/Makefile \
002d9b03 3764 helpers/basic_auth/DB/Makefile \
d80aac12 3765 helpers/basic_auth/squid_radius_auth/Makefile \
0c510f3c 3766 helpers/digest_auth/Makefile \
3767 helpers/digest_auth/password/Makefile \
55013f9c 3768 helpers/digest_auth/ldap/Makefile \
89f77e43 3769 helpers/digest_auth/eDirectory/Makefile \
0c510f3c 3770 helpers/ntlm_auth/Makefile \
3771 helpers/ntlm_auth/fakeauth/Makefile \
3772 helpers/ntlm_auth/no_check/Makefile \
3773 helpers/ntlm_auth/SMB/Makefile \
3774 helpers/ntlm_auth/SMB/smbval/Makefile \
6e785d85 3775 helpers/ntlm_auth/mswin_sspi/Makefile \
3776 helpers/negotiate_auth/Makefile \
3777 helpers/negotiate_auth/mswin_sspi/Makefile \
3e5d7cdf 3778 helpers/negotiate_auth/squid_kerb_auth/Makefile \
c6588c68 3779 helpers/external_acl/Makefile \
3780 helpers/external_acl/ip_user/Makefile \
3781 helpers/external_acl/ldap_group/Makefile \
74ab8d10 3782 helpers/external_acl/session/Makefile \
c6588c68 3783 helpers/external_acl/unix_group/Makefile \
736a9a4d 3784 helpers/external_acl/wbinfo_group/Makefile \
9e6e0372 3785 helpers/external_acl/mswin_ad_group/Makefile \
94ab55b0 3786 helpers/external_acl/mswin_lm_group/Makefile \
3787 tools/Makefile
53cbe3e4 3788])
43ae1d95 3789
377792e4 3790AC_CONFIG_SUBDIRS(lib/libTrie)
3791
3e7b6055
AR
3792# must configure libltdl subdir unconditionally for "make distcheck" to work
3793AC_CONFIG_SUBDIRS(lib/libLtdl)
3794
3795
6a9f6389 3796AC_OUTPUT