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