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