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