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