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