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