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