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