]> git.ipfire.org Git - thirdparty/squid.git/blame - configure.ac
Polished to address Squid Project review comments.
[thirdparty/squid.git] / configure.ac
CommitLineData
090089c4 1dnl
262a0e14 2dnl $Id$
090089c4 3dnl
090089c4 4dnl
5dnl
ed1ccdba 6AC_INIT([Squid Web Proxy],[3.2-ecap-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
39145d19 712 # Automake on MinGW needs explicit exe extension
507ca601
FC
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
80ab04bb
AR
904dnl Necessary if the first PKG_CHECK_MODULES call is conditional
905PKG_PROG_PKG_CONFIG
906
3e7b6055 907dnl Perform configuration consistency checks for eCAP
fcabe077 908if test "x$squid_opt_use_ecap" = "xyes";
3e7b6055 909then
5fa840c3 910 dnl eCAP support requires loadable modules, which are enabled by default
73862432 911 if test "x$enable_loadable_modules" != "xyes"
3e7b6055 912 then
945980c0 913 AC_MSG_ERROR([eCAP support requires loadable modules. Please do not use --disable-loadable-modules with --enable-ecap.]);
3e7b6055 914 fi
4cfba571 915
6666da11
AR
916 dnl eCAP support requires libecap.
917 dnl This Squid supports libecap v0.2.x.
918 dnl Use EXT prefix so that make and libtool messages distinguish between
919 dnl external libecap (that we check for here) and our own convenience lib.
80ab04bb 920 PKG_CHECK_MODULES(EXTLIBECAP, [libecap > 0.2 libecap < 0.3])
3e7b6055
AR
921fi
922
fcabe077
FC
923AM_CONDITIONAL(USE_ECAP, test "x$squid_opt_use_ecap" = "xyes")
924if test "x$squid_opt_use_ecap" = "xyes";
3e7b6055
AR
925then
926 AC_DEFINE(USE_ECAP,1,[Enable eCAP support])
7b4422de 927 ECAP_LIBS="ecap/libxecap.la"
5069fb38 928 squid_opt_use_adaptation=yes
3e7b6055 929else
5fa840c3 930 AC_DEFINE(USE_ECAP,0,[Disable eCAP support])
3e7b6055
AR
931 ECAP_LIBS=""
932fi
b61a58df 933dnl convenience library
3e7b6055
AR
934AC_SUBST(ECAP_LIBS)
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])
f738d783 996AM_CONDITIONAL(ENABLE_SNMP, [test "x$enable_snmp" = "xyes"])
fcabe077 997if test "x$enable_snmp" = "xyes"; then
d6e3ad20 998 SNMPLIB='../snmplib/libsnmplib.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 1026 AS_HELP_STRING([--disable-eui],
c8da66ba 1027 [Disable use of ARP / MAC/ EUI (ether address)]), [
1a6b111a
FC
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])
39145d19
AJ
1192if test "x$enableval" = "xyes"; then
1193 if test "x$squid_host_os" = "xmingw"; then
1194 squid_opt_io_loop_engine="select_win32"
1195 else
1196 squid_opt_io_loop_engine="select"
1197 fi
1198fi
9676633b
FC
1199])
1200AC_MSG_NOTICE([enabling select syscall for net I/O: ${enable_select:=auto}])
cd748f27 1201
9bb83c8b 1202AC_ARG_ENABLE(poll,
62979ab1 1203 AS_HELP_STRING([--disable-poll],[Disable poll(2) support.]),
1b3db6d9 1204[
9676633b 1205SQUID_YESNO($enableval,[--disable-poll takes no extra argument])
fcabe077 1206test "x$enableval" = "xyes" && squid_opt_io_loop_engine="poll"
9bb83c8b 1207])
9676633b 1208AC_MSG_NOTICE([enabling poll syscall for net I/O: ${enable_poll:=auto}])
9bb83c8b 1209
9676633b 1210# kqueue support is still experiemntal and unstable. Not enabled by default.
1b3db6d9 1211AC_ARG_ENABLE(kqueue,
9676633b
FC
1212 AS_HELP_STRING([--enable-kqueue],
1213 [Enable kqueue(2) support (experimental).]), [
1214SQUID_YESNO($enableval,[--enable-kqueue takes no extra argument])
1b3db6d9 1215])
fcabe077 1216if test "x${enable_kqueue:=no}" = "xyes" ; then
9676633b
FC
1217 AC_CHECK_HEADERS([sys/event.h],[],
1218 [ AC_MSG_ERROR([kqueue support requires sys/event.h header file.]) ])
1219 squid_opt_io_loop_engine="kqueue"
1220fi
1221AC_MSG_NOTICE([enabling kqueue for net I/O: $enable_kqueue])
1b3db6d9 1222
a46d2c0e 1223dnl Enable epoll()
a46d2c0e 1224AC_ARG_ENABLE(epoll,
62979ab1 1225 AS_HELP_STRING([--disable-epoll],[Disable Linux epoll(2) support.]),
a46d2c0e 1226[
9676633b 1227SQUID_YESNO($enableval,[--disable-epoll takes no extra argument])
fcabe077 1228test "x$enableval" = "xyes" && squid_opt_io_loop_engine="epoll"
a46d2c0e 1229])
9676633b 1230AC_MSG_NOTICE([enabling epoll syscall for net I/O: ${enable_epoll:=auto}])
2ca8b332 1231
9676633b
FC
1232# auto-detect and verify epoll header and library present and working
1233# logic mapping and loop method selection are performed later
fcabe077 1234if test "x$enable_epoll" != "xno" ; then
2ca8b332 1235
9676633b
FC
1236 # check if libs are needed to support epoll
1237 # note: this code block seems quite generic. Could it be extracted
1238 # into a squid specific configure function?
af1e01a8 1239 SQUID_STATE_SAVE(squid_epoll_state)
9676633b 1240 AC_SEARCH_LIBS(epoll_ctl,[epoll])
fcabe077 1241 if test "x$ac_cv_search_epoll_ctl" = "xno" ; then
9676633b 1242 enable_epoll=no #disable. Needed code not found
fcabe077 1243 elif test "x$ac_cv_search_epoll_ctl" = "xnone required" ; then
9676633b
FC
1244 EPOLL_LIBS=""
1245 else
1246 EPOLL_LIBS=$ac_cv_search_epoll_ctl
1247 fi
1248 AC_SUBST(EPOLL_LIBS)
1249 SQUID_STATE_ROLLBACK(squid_epoll_state) #de-pollute LIBS
a46d2c0e 1250
9676633b 1251 # epoll requires sys/epoll.h
98d13964 1252 AC_CHECK_HEADERS([sys/epoll.h])
ad32c661
AJ
1253
1254 dnl Verify that epoll really works
dcac6885 1255 if test "x$ac_cv_search_epoll_ctl" != 'xno' ; then
af1e01a8 1256 SQUID_CHECK_EPOLL
ad32c661 1257 fi
2ca8b332 1258
fcabe077 1259 if test "x$enable_epoll" = "xyes" -a "x$squid_cv_epoll_works" = "xno" ; then
2ca8b332
AJ
1260 AC_MSG_ERROR([Epoll does not work. Force-enabling it is not going to help.])
1261 fi
ad32c661 1262fi
a46d2c0e 1263
a1ad2f9b
AJ
1264dnl Enable /dev/poll
1265AC_ARG_ENABLE(devpoll,
1266 AS_HELP_STRING([--disable-devpoll],[Disable Solaris /dev/poll support.]),
1267[
1268SQUID_YESNO($enableval,[--disable-devpoll takes no extra argument])
1269test "x$enableval" = "xyes" && squid_opt_io_loop_engine="devpoll"
1270])
1271AC_MSG_NOTICE([enabling /dev/poll for net I/O: ${enable_devpoll:=auto}])
1272
1273## auto-detect and verify devpoll header and library present and working
1274if test "x$enable_devpoll" != "xno"; then
1275
1276 # /dev/poll requires ioctl() and write()
1277 AC_CHECK_FUNCS(ioctl)
1278 AC_CHECK_FUNCS(write)
1279
1280 # /dev/poll requires sys/devpoll.h
1281 AC_CHECK_HEADERS([sys/devpoll.h],,[
1282 if test "x$enable_devpoll" = "xyes"; then
1283 AC_MSG_ERROR([--enable-devpoll specified but /dev/poll headers not found])
1284 fi
1285 enable_devpoll=no])
1286
1287 # Verify that /dev/poll really works
1288 if test "x$enable_devpoll" != 'xno' ; then
1289 SQUID_CHECK_DEVPOLL
1290 fi
1291
1292 if test "x$enable_devpoll" = "xyes" -a "x$squid_cv_devpoll_works" = "xno" ; then
1293 AC_MSG_ERROR([/dev/poll does not work. Force-enabling it is not going to help.])
1294 fi
1295fi
1296
9676633b 1297
72fd085a 1298AC_ARG_ENABLE(http-violations,
af1e01a8
FC
1299 AS_HELP_STRING([--disable-http-violations],
1300 [This allows you to remove code which is known to
47d80734 1301 violate the HTTP protocol specification.]), [
9676633b
FC
1302 SQUID_YESNO([$enableval],
1303 [unrecognized argument to --disable-http-violations: $enableval])
72fd085a 1304])
626096be 1305SQUID_DEFINE_BOOL(USE_HTTP_VIOLATIONS, ${enable_http_violations:=yes},
47d80734 1306 [Define to enable code which volates the HTTP standard specification])
9676633b 1307AC_MSG_NOTICE([HTTP violations support enabled: $enable_http_violations])
72fd085a 1308
47d80734 1309# IPFW Transparent Proxy
68075fad 1310AC_ARG_ENABLE(ipfw-transparent,
1d26e252
FC
1311 AS_HELP_STRING([--enable-ipfw-transparent],
1312 [Enable Transparent Proxy support for systems
47d80734 1313 using FreeBSD IPFW-style firewalling.]), [
1d26e252
FC
1314 SQUID_YESNO([$enableval],
1315 [unrecognized argument to --enable-ipfw-transparent: $enableval])
68075fad 1316])
0067eb06 1317SQUID_DEFINE_BOOL(IPFW_TRANSPARENT,${enable_ipfw_transparent:=no},
2277004e 1318 [Enable support for Transparent Proxy on systems using FreeBSD IPFW-style firewalling.])
1d26e252 1319AC_MSG_NOTICE([FreeBSD IPFW-based transparent proxying enabled: $enable_ipfw_transparent])
68075fad 1320
47d80734 1321# IP-Filter Transparent Proxy
5cafc1d6 1322AC_ARG_ENABLE(ipf-transparent,
2277004e 1323 AS_HELP_STRING([--enable-ipf-transparent],
1d26e252
FC
1324 [Enable Transparent Proxy support using IPFilter-style firewalling]), [
1325 SQUID_YESNO([$enableval],
1326 [unrecognized argument to --enable-ipf-transparent: $enableval])
5cafc1d6 1327])
be0c7ff0 1328#will be AC_DEFINEd later, after checking for appropriate infrastructure
4bd144d2
FC
1329#IPF currently broken. Default-disabled for now.
1330AC_MSG_NOTICE([IPF-based transparent proxying requested: ${enable_ipf_transparent:=no}])
5cafc1d6 1331
2b0dd4ac 1332dnl Enable PF Transparent Proxy
1333AC_ARG_ENABLE(pf-transparent,
2277004e 1334 AS_HELP_STRING([--enable-pf-transparent],
47d80734 1335 [Enable Transparent Proxy support for systems using PF network address redirection.]), [
1d26e252
FC
1336 SQUID_YESNO([$enableval],
1337 [unrecognized argument to --enable-pf-transparent: $enableval])
2b0dd4ac 1338])
be0c7ff0 1339#will be AC_DEFINEd later, after checking for appropriate infrastructure
38ff0a40 1340AC_MSG_NOTICE([PF-based transparent proxying requested: ${enable_pf_transparent:=auto}])
2b0dd4ac 1341
4bd144d2 1342# Linux Netfilter Transparent Proxy
d852fbad 1343AC_ARG_ENABLE(linux-netfilter,
20ad76ab 1344 AS_HELP_STRING([--enable-linux-netfilter],
96f08e2d 1345 [Enable Transparent Proxy support for Linux (Netfilter)]), [
4bd144d2
FC
1346 SQUID_YESNO([$enableval],
1347 [unrecognized argument to --enable-linux-netfilter: $enableval])
d852fbad 1348])
4bd144d2 1349AC_MSG_NOTICE([Linux Netfilter support requested: ${enable_linux_netfilter:=auto}])
be0c7ff0 1350#will be AC_DEFINEd later, after checking for appropriate infrastructure
d852fbad 1351
425de4c8
AJ
1352
1353dnl Look for libnetfilter_conntrack options (needed for QOS netfilter marking)
1354AC_ARG_WITH(netfilter-conntrack,
1355 AS_HELP_STRING([--without-netfilter-conntrack],
1356 [Do not use Netfilter conntrack libraries for packet marking.
1357 A path to alternative library location may be specified by
1358 using --with-netfilter-conntrack=PATH. Default: auto-detect.]), [
f4f6c2e0
AJ
1359case "$with_netfilter_conntrack" in
1360 yes|no)
1361 : # Nothing special to do here
1362 ;;
1363 *)
1364 if test ! -d "$withval" ; then
1365 AC_MSG_ERROR([--without-netfilter-conntrack path does not point to a directory])
1366 fi
1367 squid_opt_netfilterconntrackpath=$withval
1368 LDFLAGS="-L$squid_opt_netfilterconntrackpath/lib $LDFLAGS"
1369 CPPFLAGS="-I$squid_opt_netfilterconntrackpath/include $CPPFLAGS"
425de4c8 1370 with_netfilter_conntrack=yes
f4f6c2e0 1371 esac
425de4c8 1372])
f4f6c2e0
AJ
1373AC_MSG_NOTICE([Linux Netfilter Conntrack support requested: ${with_netfilter_conntrack:=auto}])
1374if test "x$with_netfilter_conntrack" != "xno"; then
1375 AC_SEARCH_LIBS([nfct_query], [netfilter_conntrack],,[
1376 if test x"$with_netfilter_conntrack" = "xyes"; then
1377 AC_MSG_ERROR([--with-netfilter-conntrack specified but libnetfilter-conntrack library not found])
425de4c8 1378 fi
f4f6c2e0 1379 with_netfilter_conntrack=no])
425de4c8 1380 AC_CHECK_HEADERS([libnetfilter_conntrack/libnetfilter_conntrack.h \
f4f6c2e0
AJ
1381 libnetfilter_conntrack/libnetfilter_conntrack_tcp.h],,[
1382 if test x"$with_netfilter_conntrack" = "xyes"; then
1383 AC_MSG_ERROR([--with-netfilter-conntrack specified but libnetfilter-conntrack headers not found])
1384 fi
1385 with_netfilter_conntrack=no])
88a2a8c6
AJ
1386 # If nothing is broken; enable the libraries usage.
1387 if test "x$with_netfilter_conntrack" != "xno"; then
1388 with_netfilter_conntrack=yes
1389 fi
425de4c8 1390fi
f4f6c2e0 1391AC_MSG_NOTICE([Linux Netfilter Conntrack support enabled: ${with_netfilter_conntrack} ${squid_opt_netfilterconntrackpath}])
425de4c8
AJ
1392
1393
bb7b5fd0 1394dnl Enable Large file support
2df6213e 1395buildmodel=""
2277004e 1396squid_opt_enable_large_files=no
2df6213e 1397
1398AC_ARG_WITH(large-files,
507ca601
FC
1399 AS_HELP_STRING([--with-large-files],[Enable support for large files (logs etc).]), [
1400 if test "x$withval" = "xyes"; then
1401 squid_opt_enable_large_files=yes
bb7b5fd0 1402 fi
1403])
1404
2df6213e 1405dnl UNIX Build environment
be0c7ff0 1406dnl AS_HELP_STRING is not suited here because it cannot to specify newlines
2df6213e 1407AC_ARG_WITH(build-environment,
507ca601
FC
1408 AS_HELP_STRING([--with-build-environment=model],
1409 [The build environment to use. Normally one of
1410 POSIX_V6_ILP32_OFF32 (32 bits),
1411 POSIX_V6_ILP32_OFFBIG (32 bits with large file support),
1412 POSIX_V6_LP64_OFF64 (64 bits),
1413 POSIX_V6_LPBIG_OFFBIG (large pointers and files),
1414 XBS5_ILP32_OFF32 i(legacy, 32 bits),
1415 XBS5_ILP32_OFFBIG (legacy, 32 bits with large file support),
1416 XBS5_LP64_OFF64 (legacy, 64 bits),
1417 XBS5_LPBIG_OFFBIG (legacy, large pointers and files)
1418 or default (The default for your OS)]), [
1419case "$withval" in
2df6213e 1420 yes|no)
507ca601
FC
1421 AC_MSG_FAILURE([--with-build-environment expects a build environment string as used by getconf])
1422 ;;
2df6213e 1423 *)
507ca601
FC
1424 buildmodel="$withval"
1425 ;;
1426esac
2df6213e 1427])
1428
fcabe077 1429if test "x$squid_opt_enable_large_files" = "xyes" -a "x$buildmodel" = "x"; then
2277004e
FC
1430 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
1431 if test "`getconf _$model 2>/dev/null || true`" = 1 || test "`getconf $model 2>/dev/null || true`" ; then
1432 buildmodel=$model
1433 break
1434 fi
1435 done
fcabe077 1436 if test "x$buildmodel" = "x"; then
2277004e
FC
1437 AC_MSG_WARN([No suitable build environment found for large files. Trying to use _FILE_OFFSET_BITS=64])
1438 fi
9b8002de 1439fi
0c0d381b 1440if test "x$buildmodel" = "xdefault" -o "x$buildmodel" = "x"; then
507ca601
FC
1441 if test "x$squid_opt_enable_large_files" = "xyes" ; then
1442 AC_MSG_NOTICE([Enabling -D_FILE_OFFSET_BITS=64])
1443 CFLAGS="-D_FILE_OFFSET_BITS=64 $CFLAGS"
1444 CXXFLAGS="-D_FILE_OFFSET_BITS=64 $CXXFLAGS"
1445 fi
1446else
1447 AC_MSG_NOTICE([Using $buildmodel build environment])
1448 if test "`getconf _$buildmodel 2>/dev/null || true`" = 1 || test "`getconf $buildmodel 2>/dev/null || true`" ; then
1449 : # All fine
1450 else
1451 AC_MSG_ERROR(Build environment $buildmodel not known to getconf.)
1452 fi
1453 CFLAGS="`getconf ${buildmodel}_CFLAGS` $CFLAGS"
1454 CXXFLAGS="`getconf ${buildmodel}_CFLAGS` $CXXFLAGS"
1455 LIBS="`getconf ${buildmodel}_LIBS` $LIBS"
1456 LDFLAGS="`getconf ${buildmodel}_LDFLAGS` $LDFLAGS"
941c31f3 1457 if test "x$squid_host_os" = "xsolaris" ; then
2277004e
FC
1458
1459# On Solaris getconf returns for CFLAGS -xarch=generic64, -Xa and -Usun options, and
1460# for LDFLAGS -xarch=generic64, but:
1461# "-Xa" is supported only by Sun cc, so we need to remove it when using gcc
1462# For gcc "-xarch=generic64" must be replaced with "-m64"
1463# The 'sun' define is needed by ipfilter includes, so we must remove "-Usun"
fcabe077 1464 if test "x$GCC" = "xyes"; then
2277004e
FC
1465 AC_MSG_NOTICE([Removing -Xa for gcc/g++ on $host])
1466 CFLAGS="`echo $CFLAGS | sed -e 's/-Xa//'`"
1467 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Xa//'`"
1468 AC_MSG_NOTICE([Replacing -xarch=generic64 with -m64 for gcc/g++ on $host])
1469 CFLAGS="`echo $CFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
1470 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
1471 LDFLAGS="`echo $LDFLAGS | sed -e 's/-xarch=generic64//'`"
1472 fi
1473 AC_MSG_NOTICE([Removing -Usun on $host])
1474 CFLAGS="`echo $CFLAGS | sed -e 's/-Usun//'`"
1475 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Usun//'`"
1476 fi
507ca601 1477fi
2df6213e 1478
5d620373 1479dnl Enable Leak Finding Functions
1480AC_ARG_ENABLE(leakfinder,
47d80734
FC
1481 AS_HELP_STRING([--enable-leakfinder],
1482 [Enable Leak Finding code. Enabling this alone does nothing;
1483 you also have to modify the source code to use the leak
1484 finding functions. Probably Useful for hackers only.]), [
89f640aa
FC
1485 SQUID_YESNO([$enableval],
1486 [unrecognized argument to --enable-leakfinder: $enableval])
5d620373 1487])
89f640aa
FC
1488AC_MSG_NOTICE([Leak Finder enabled: ${enable_leakfinder:=no}])
1489SQUID_DEFINE_BOOL(USE_LEAKFINDER,$enable_leakfinder,
47d80734 1490 [Enable code for assisting in finding memory leaks. Not for the faint of heart])
fcabe077 1491AM_CONDITIONAL(MAKE_LEAKFINDER, [test "x$enable_leakfinder" = "xyes"])
47d80734 1492
5d620373 1493
3d674977 1494AC_ARG_ENABLE(follow-x-forwarded-for,
6ec005b5
FC
1495 AS_HELP_STRING([--enable-follow-x-forwarded-for],
1496 [Enable support for following the X-Forwarded-For
19b4777c
FC
1497 HTTP header to try to find the IP address of the
1498 original or indirect client when a request has
8075a4da 1499 been forwarded through other proxies.]), [
6ec005b5
FC
1500 SQUID_YESNO([$enableval],
1501 [unrecognized argument to --enable-follow-x-forwarded-for: $enableval])
8075a4da 1502])
6ec005b5 1503AC_MSG_NOTICE([Support for X-Forwarded-For enabled: ${enable_follow_x_forwarded_for:=yes}])
3a5af257 1504SQUID_DEFINE_BOOL(FOLLOW_X_FORWARDED_FOR,$enable_follow_x_forwarded_for,
47d80734 1505 [Enable following X-Forwarded-For headers])
3d674977 1506
3898f57f 1507AC_ARG_ENABLE(ident-lookups,
8075a4da 1508 AS_HELP_STRING([--disable-ident-lookups],
47d80734
FC
1509 [Remove code that supports performing Ident (RFC 931) lookups.]), [
1510 SQUID_YESNO([$enableval],[unrecognized argument to --disable-ident-lookups: $enableval])
8075a4da 1511])
6c5dc16a
FC
1512AC_MSG_NOTICE([Support for Ident lookups enabled: ${enable_ident_lookups:=yes}])
1513SQUID_DEFINE_BOOL(USE_IDENT,$enable_ident_lookups,[Support for Ident (RFC 931) lookups])
3898f57f 1514
8efb08bc 1515squid_opt_use_dnsserver="no"
eb824054 1516AC_ARG_ENABLE(internal-dns,
8efb08bc
FC
1517 AS_HELP_STRING([--disable-internal-dns],
1518 [Prevents Squid from directly sending and receiving DNS messages,
1519 and instead enables the old external 'dnsserver' processes.]), [
fcabe077 1520 if test "x$enableval" = "xno" ; then
eed82608 1521 AC_MSG_WARN([Disabling Internal DNS queries])
8efb08bc 1522 squid_opt_use_dnsserver="yes"
eb824054 1523 fi
1524])
fcabe077
FC
1525SQUID_DEFINE_BOOL(USE_DNSSERVERS,$squid_opt_use_dnsserver,
1526 [Use dnsserver processes instead of the internal DNS protocol support])
1527AM_CONDITIONAL([USE_DNSSERVER],[test "x$squid_opt_use_dnsserver" = "xyes" ])
8efb08bc 1528
eb824054 1529
95d2589c
CT
1530AM_CONDITIONAL(USE_SSL_CRTD, false)
1531AC_ARG_ENABLE(ssl-crtd,
1532 AC_HELP_STRING([--enable-ssl-crtd],
1533 [Prevent Squid from directly generation of SSL private key and
1534 certificate request and instead enables the ssl_crtd processes.]), [
1535 SQUID_YESNO([$enableval],
1536 [unrecogized argument to --enable-ssl-crtd: $enableval])
1537])
1538
1539if test "x$enable_ssl_crtd" = "xyes" -a "x$enable_ssl" = "xno" ; then
1540 AC_MSG_ERROR([You need to enable ssl gatewaying support to use ssl_crtd feature. Try to use --enable-ssl. ])
1541fi
1542SQUID_DEFINE_BOOL(USE_SSL_CRTD, ${enable_ssl_crtd:=no},[Use ssl_crtd daemon])
1543AM_CONDITIONAL(USE_SSL_CRTD, [test "x$enable_ssl_crtd" = "xyes"])
1544
9d798391 1545dnl Select Default hosts file location
1546AC_ARG_ENABLE(default-hostsfile,
8ea232f5
FC
1547 AS_HELP_STRING([--enable-default-hostsfile=path],
1548 [Select default location for hosts file.
75eaac6c
FC
1549 See hosts_file directive in squid.conf for details]), [
1550if test "x$enableval" != "xnone" -a "x$enableval" != "xno" ; then
1551 if test \! -f "$enableval"; then
1552 AC_MSG_WARN([Unable to find file $enableval. I hope you know what you are doing.])
20ad76ab 1553 fi
75eaac6c
FC
1554 squid_opt_default_hosts=$enableval
1555else
1556 squid_opt_default_hosts="none"
1557fi
1558])
1559AC_MSG_NOTICE([Default hosts file set to: ${squid_opt_default_hosts:=/etc/hosts}])
1560DEFAULT_HOSTS=$squid_opt_default_hosts
1561AC_SUBST(DEFAULT_HOSTS)
9d798391 1562
47d80734 1563# Select auth schemes modules to build
94439e4e 1564AC_ARG_ENABLE(auth,
26ffc057
FC
1565 AS_HELP_STRING([--enable-auth],
1566 [Build global support for authentication. The list of schemes
1567 and helpers to be enabled is defined elsewhere]), [
1568SQUID_YESNO([$enableval],
1569 [unrecognized argument to --enable-auth: $enableval])
94439e4e 1570])
26ffc057 1571AC_MSG_NOTICE([Authentication support enabled: ${enable_auth:=yes}])
2f1431ea
AJ
1572SQUID_DEFINE_BOOL(USE_AUTH,$enable_auth,[Enable support for authentication])
1573AM_CONDITIONAL(ENABLE_AUTH, test "x$enable_auth" != "xno")
26ffc057
FC
1574AUTH_MODULES=""
1575
1576AC_ARG_ENABLE(auth-basic,
1577 AS_HELP_STRING([--enable-auth-basic="list of helpers"],
1578 [Enable the basic authentication scheme, and build the specified helpers.
1579 Not providing an explicit list of helpers will attempt build of
1580 all possible helpers. Default is to do so.
1581 To disable the basic authentication scheme, use --disable-auth-basic.
d9655720 1582 To enable but build no helpers, specify "none".
26ffc057
FC
1583 To see available helpers, see the helpers/basic_auth directory. ]),[
1584#nothing to do really
1585])
1586#not specified. Inherit global
1587if test "x$enable_auth_basic" = "x"; then
1588 enable_auth_basic=$enable_auth
1c690e30 1589fi
26ffc057 1590#conflicts with global
fcabe077 1591if test "x$enable_auth_basic" != "xno" -a "x$enable_auth" = "xno" ; then
26ffc057 1592 AC_MSG_ERROR([Basic auth requested but auth disabled])
9ff0f5b7 1593fi
26ffc057 1594#define list of modules to build
fcabe077 1595if test "x$enable_auth_basic" = "xyes" ; then
26ffc057 1596 SQUID_LOOK_FOR_MODULES([$srcdir/helpers/basic_auth],[enable_auth_basic])
94439e4e 1597fi
26ffc057
FC
1598#handle the "none" special case
1599if test "x$enable_auth_basic" = "xnone" ; then
1600 enable_auth_basic=""
9ff0f5b7 1601fi
26ffc057
FC
1602BASIC_AUTH_HELPERS=""
1603#enable_auth_basic contains either "no" or the list of modules to be built
1604enable_auth_basic="`echo $enable_auth_basic| sed -e 's/,/ /g;s/ */ /g'`"
fcabe077 1605if test "x$enable_auth_basic" != "xno" ; then
26ffc057
FC
1606 AUTH_MODULES="$AUTH_MODULES basic"
1607 AC_DEFINE([HAVE_AUTH_MODULE_BASIC],1,[Basic auth module is built])
1608 for helper in $enable_auth_basic
1609 do
1610 dir="$srcdir/helpers/basic_auth/$helper"
fcabe077 1611 if test -f "$dir/config.test" && sh "$dir/config.test" "$@"; then
26ffc057
FC
1612 BASIC_AUTH_HELPERS="$BASIC_AUTH_HELPERS $helper"
1613 # special case
fcabe077 1614 if test "x$helper" = "xSASL" ; then
26ffc057
FC
1615 squid_require_sasl=yes
1616 fi
fcabe077 1617 elif test -d "$srcdir/helpers/basic_auth/$helper" ; then
26ffc057 1618 AC_MSG_NOTICE([Basic auth helper $helper ... found but cannot be built])
0bbcab1c 1619 fi
26ffc057
FC
1620 done
1621fi
1622AC_MSG_NOTICE([Basic auth helpers to be built: $BASIC_AUTH_HELPERS])
fcabe077 1623AM_CONDITIONAL(ENABLE_AUTH_BASIC, test "x$enable_auth_basic" != "xno")
fc83a946 1624AC_SUBST(BASIC_AUTH_HELPERS)
94439e4e 1625
26ffc057
FC
1626AC_ARG_ENABLE(auth-ntlm,
1627 AS_HELP_STRING([--enable-auth-ntlm="list of helpers"],
1628 [Enable the NTLM authentication scheme, and build the specified helpers.
1629 Not providing an explicit list of helpers will attempt build of
1630 all possible helpers. Default is to do so.
1631 To disable the NTLM authentication scheme, use --disable-auth-ntlm.
1632 To enable but build no helpers, specify "none".
1633 To see available helpers, see the helpers/ntlm_auth directory. ]),[
380f0a87 1634])
26ffc057
FC
1635if test "x$enable_auth_ntlm" = "x"; then
1636 enable_auth_ntlm=$enable_auth
7f18d2bd 1637fi
26ffc057
FC
1638#conflicts with global
1639if test "x$enable_auth_ntlm" != "xno" -a "x$enable_auth" = "xno" ; then
1640 AC_MSG_ERROR([NTLM auth requested but auth disabled])
1641fi
1642#define list of modules to build
1643if test "x$enable_auth_ntlm" = "xyes" ; then
1644 SQUID_LOOK_FOR_MODULES([$srcdir/helpers/ntlm_auth],[enable_auth_ntlm])
1645fi
1646#handle the "none" special case
1647if test "x$enable_auth_ntlm" = "xnone" ; then
1648 enable_auth_ntlm=""
1649fi
1650NTLM_AUTH_HELPERS=""
1651enable_auth_ntlm="`echo $enable_auth_ntlm| sed -e 's/,/ /g;s/ */ /g'`"
fcabe077 1652if test "x$enable_auth_ntlm" != "xno" ; then
26ffc057
FC
1653 AUTH_MODULES="$AUTH_MODULES ntlm"
1654 AC_DEFINE([HAVE_AUTH_MODULE_NTLM],1,[NTLM auth module is built])
1655 for helper in $enable_auth_ntlm ; do
1656 dir="$srcdir/helpers/ntlm_auth/$helper"
fcabe077 1657 if test -f "$dir/config.test" && sh "$dir/config.test" "$@"; then
26ffc057 1658 NTLM_AUTH_HELPERS="$NTLM_AUTH_HELPERS $helper"
fcabe077 1659 elif test -d "$srcdir/helpers/ntlm_auth/$helper" ; then
26ffc057
FC
1660 AC_MSG_NOTICE([NTLM auth helper $helper ... found but cannot be built])
1661 fi
1662 done
380f0a87 1663fi
9ff0f5b7 1664AC_MSG_NOTICE([NTLM auth helpers built: $NTLM_AUTH_HELPERS])
fcabe077 1665AM_CONDITIONAL(ENABLE_AUTH_NTLM, test "x$enable_auth_ntlm" != "xno")
94439e4e 1666AC_SUBST(NTLM_AUTH_HELPERS)
1667
26ffc057
FC
1668AC_ARG_ENABLE(auth-negotiate,
1669 AS_HELP_STRING([--enable-auth-negotiate="list of helpers"],
1670 [Enable the Negotiate authentication scheme, and build the specified
1671 helpers.
1672 Not providing an explicit list of helpers will attempt build of
1673 all possible helpers. Default is to do so.
1674 To disable the Negotiate authentication scheme,
1675 use --disable-auth-negotiate.
1676 To enable but build no helpers, specify "none".
1677 To see available helpers, see the helpers/negotiate_auth directory. ]),[
1678#nothing to do, really
6e785d85 1679])
26ffc057
FC
1680if test "x$enable_auth_negotiate" = "x"; then
1681 enable_auth_negotiate=$enable_auth
7f18d2bd 1682fi
26ffc057
FC
1683#conflicts with global
1684if test "x$enable_auth_negotiate" != "xno" -a "x$enable_auth" = "xno" ; then
1685 AC_MSG_ERROR([Negotiate auth requested but auth disabled])
1686fi
1687#define list of modules to build
1688if test "x$enable_auth_negotiate" = "xyes" ; then
1689 SQUID_LOOK_FOR_MODULES([$srcdir/helpers/negotiate_auth],[enable_auth_negotiate])
1690fi
1691#handle the "none" special case
1692if test "x$enable_auth_negotiate" = "xnone" ; then
1693 enable_auth_negotiate=""
1694fi
1695NEGOTIATE_AUTH_HELPERS=""
1696enable_auth_negotiate="`echo $enable_auth_negotiate| sed -e 's/,/ /g;s/ */ /g'`"
fcabe077 1697if test "x$enable_auth_negotiate" != "xno" ; then
26ffc057
FC
1698 AUTH_MODULES="$AUTH_MODULES negotiate"
1699 AC_DEFINE([HAVE_AUTH_MODULE_NEGOTIATE],1,[Negotiate auth module is built])
1700 for helper in $enable_auth_negotiate ; do
1701 dir="$srcdir/helpers/negotiate_auth/$helper"
fcabe077 1702 if test -f "$dir/config.test" && sh "$dir/config.test" "$@"; then
26ffc057 1703 NEGOTIATE_AUTH_HELPERS="$NEGOTIATE_AUTH_HELPERS $helper"
fcabe077 1704 elif test -d "$srcdir/helpers/negotiate_auth/$helper" ; then
26ffc057
FC
1705 AC_MSG_NOTICE([Negotiate auth helper $helper ... found but cannot be built])
1706 fi
1707 done
6e785d85 1708fi
59b38d95 1709AC_MSG_NOTICE([Negotiate auth helpers built: $NEGOTIATE_AUTH_HELPERS])
fcabe077 1710AM_CONDITIONAL(ENABLE_AUTH_NEGOTIATE, test "x$enable_auth_negotiate" != "xno")
6e785d85 1711AC_SUBST(NEGOTIATE_AUTH_HELPERS)
1712
26ffc057
FC
1713AC_ARG_ENABLE(auth-digest,
1714 AS_HELP_STRING([--enable-auth-digest="list of helpers"],
1715 [Enable the Digest authentication scheme, and build the specified helpers.
1716 Not providing an explicit list of helpers will attempt build of
1717 all possible helpers. Default is to do so.
1718 To disable the Digest authentication scheme, use --disable-auth-digest.
1719 To enable but build no helpers, specify "none".
1720 To see available helpers, see the helpers/digest_auth directory. ]),[
1721#nothing to do, really
2d70df72 1722])
26ffc057
FC
1723if test "x$enable_auth_digest" = "x"; then
1724 enable_auth_digest=$enable_auth
7f18d2bd 1725fi
26ffc057
FC
1726#conflicts with global
1727if test "x$enable_auth_digest" != "xno" -a "x$enable_auth" = "xno" ; then
1728 AC_MSG_ERROR([Digest auth requested but auth disabled])
1729fi
1730#define list of modules to build
1731if test "x$enable_auth_digest" = "xyes" ; then
1732 SQUID_LOOK_FOR_MODULES([$srcdir/helpers/digest_auth],[enable_auth_digest])
1733fi
1734#handle the "none" special case
1735if test "x$enable_auth_digest" = "xnone" ; then
1736 enable_auth_digest=""
1737fi
1738DIGEST_AUTH_HELPERS=""
1739enable_auth_digest="`echo $enable_auth_digest| sed -e 's/,/ /g;s/ */ /g'`"
fcabe077 1740if test "x$enable_auth_digest" != "xno" ; then
26ffc057
FC
1741 AUTH_MODULES="$AUTH_MODULES digest"
1742 AC_DEFINE([HAVE_AUTH_MODULE_DIGEST],1,[Digest auth module is built])
1743 for helper in $enable_auth_digest ; do
1744 dir="$srcdir/helpers/digest_auth/$helper"
fcabe077 1745 if test -f "$dir/config.test" && sh "$dir/config.test" "$@"; then
26ffc057 1746 DIGEST_AUTH_HELPERS="$DIGEST_AUTH_HELPERS $helper"
fcabe077 1747 elif test -d "$srcdir/helpers/digest_auth/$helper" ; then
26ffc057
FC
1748 AC_MSG_NOTICE([Digest auth helper $helper ... found but cannot be built])
1749 fi
1750 done
2d70df72 1751fi
ea9b7bb6 1752AC_MSG_NOTICE([Digest auth helpers built: $DIGEST_AUTH_HELPERS])
fcabe077 1753AM_CONDITIONAL(ENABLE_AUTH_DIGEST, test "x$enable_auth_digest" != "xno")
2d70df72 1754AC_SUBST(DIGEST_AUTH_HELPERS)
380f0a87 1755
26ffc057
FC
1756dnl Authentication libraries to build
1757dnl This list will not be needed when each auth library has its own Makefile
be0c7ff0 1758dnl this is to be placed AFTER each auth module's handler
26ffc057
FC
1759AUTH_LIBS_TO_BUILD=
1760for module in $AUTH_MODULES; do
1761 AUTH_LIBS_TO_BUILD="$AUTH_LIBS_TO_BUILD lib${module}.la"
1762done
1763AC_SUBST(AUTH_MODULES)
1764AC_SUBST(AUTH_LIBS_TO_BUILD)
1765
82b7abe3 1766dnl Select logging daemon helpers to build
a62e8408 1767squid_opt_logdaemon_helpers="auto"
82b7abe3 1768AC_ARG_ENABLE(log-daemon-helpers,
26ffc057 1769 AS_HELP_STRING([--enable-log-daemon-helpers="list of helpers"],
a62e8408
FC
1770 [This option selects which logging daemon helpers to
1771 build and install as part of the normal build process
1772 For a list of available helpers see the helpers/log_daemon
1773 directory.]),[
1774case "$enableval" in
1775 yes) : ;;
1776 no) squid_opt_logdaemon_helpers="" ;;
1777 *) squid_opt_logdaemon_helpers="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`" ;;
82b7abe3
AJ
1778 esac
1779])
fcabe077 1780if test "x$squid_opt_logdaemon_helpers" = "xauto" ; then
a62e8408
FC
1781 squid_opt_logdaemon_helpers=""
1782 SQUID_LOOK_FOR_MODULES([$srcdir/helpers/log_daemon],[squid_opt_logdaemon_helpers])
82b7abe3 1783fi
a62e8408
FC
1784for helper in $squid_opt_logdaemon_helpers ; do
1785 dir="$srcdir/helpers/log_daemon/$helper"
fcabe077 1786 if test -f "$dir/config.test" && sh "$dir/config.test" "$@"; then
a62e8408 1787 LOG_DAEMON_HELPERS="$LOG_DAEMON_HELPERS $helper"
fcabe077 1788 elif test -d "$srcdir/helpers/log_daemon/$helper" ; then
26ffc057 1789 AC_MSG_NOTICE([Log daemon helper $helper ... found but cannot be built])
a62e8408
FC
1790 fi
1791done
1792AC_MSG_NOTICE([Log daemon helpers built: $LOG_DAEMON_HELPERS])
82b7abe3
AJ
1793AC_SUBST(LOG_DAEMON_HELPERS)
1794
3d62cc61
FC
1795dnl
1796dnl Check Kerberos/GSSAPI/SPNEGO
1797dnl
c8093f05
FC
1798SQUID_STATE_SAVE([krbsave])
1799
9ca29d23 1800AC_ARG_WITH(krb5-config,
507ca601
FC
1801 AS_HELP_STRING([--with-krb5-config=PATH],
1802 [specify path to krb5-config (default=detect)]), [
1803case "$withval" in
1804 yes) unset krb5confpath ;;
1805 no) krb5confpath=no ;;
1806 *) krb5confpath=$withval ;;
1807esac
9ca29d23 1808])
fcabe077
FC
1809if test x"$krb5confpath" != "xno"; then
1810 if test "x$krb5confpath" != "x"; then
9ca29d23
AJ
1811 if ! test -x "$krb5confpath"; then
1812 AC_MSG_WARN([krb5-config '$krb5confpath' not executable, ignoring])
1813 AC_CHECK_PROG(ac_krb5_config, krb5-config, yes, no)
1814 krb5confpath=krb5-config
1815 fi
1816 krb5_config_path=`dirname $krb5confpath`
1817 AC_CHECK_PROG(ac_krb5_config, krb5-config, yes, no, $krb5_config_path)
1818 else
1819 AC_CHECK_PROG(ac_krb5_config,krb5-config,yes,no)
1820 krb5confpath=krb5-config
1821 fi
1822fi
fcabe077 1823if test "x$ac_krb5_config" = "xyes" ; then
3932c674
AJ
1824 # Kerberos helpers use res_search() from libresolv or libc
1825 AC_SEARCH_LIBS([__res_search],[resolv])
1826
fcabe077
FC
1827 ac_heimdal="`$krb5confpath --version 2>/dev/null | grep -i heimdal`"
1828 ac_solaris="`$krb5confpath --version 2>/dev/null | grep -i solaris`"
1829 if test "x$ac_heimdal" != "x" ; then
1830 AC_DEFINE(HAVE_HEIMDAL_KERBEROS,1,[Define to 1 if you have Heimdal Kerberos])
1831 else
1832 AC_DEFINE(HAVE_MIT_KERBEROS,1,[Define to 1 if you have MIT Kerberos])
1833 fi
1834 if test "x$ac_solaris" != "x" ; then
1835 KRB5INCS="`$krb5confpath --cflags krb5 2>/dev/null`"
1836 KRB5LIBS="`$krb5confpath --libs krb5 2>/dev/null`"
1837 KRB5INCS="-I/usr/include/gssapi $KRB5INCS"
1838 KRB5LIBS="-L/usr/lib -R/usr/lib -lgss -lresolv -lsocket -lnsl $KRB5LIBS"
1839 else
1840 KRB5INCS="`$krb5confpath --cflags krb5 2>/dev/null`"
1841 KRB5LIBS="`$krb5confpath --libs krb5 2>/dev/null`"
1842 KRB5INCS="`$krb5confpath --cflags gssapi 2>/dev/null` $KRB5INCS"
1843 KRB5LIBS="`$krb5confpath --libs gssapi 2>/dev/null` $KRB5LIBS"
1844 fi
1845 CPPFLAGS="$CPPFLAGS $KRB5INCS"
1846 LIBS="$LIBS $KRB5LIBS"
1847 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h)
1848 if test "x$ac_heimdal" == "x" ; then
1849 AC_CHECK_HEADERS(gssapi/gssapi_generic.h)
1850 AC_CHECK_HEADERS(profile.h)
1851 fi
9ca29d23 1852
fcabe077
FC
1853 SQUID_CHECK_KRB5_SOLARIS_BROKEN_KRB5_H
1854 if test "x$squid_cv_broken_krb5_h" = "xyes"; then
ffe4ffd8 1855 AC_DEFINE(HAVE_BROKEN_SOLARIS_KRB5_H, 1, [Define to 1 if Solaris krb5.h is broken for C++])
a05af879
FC
1856 AC_MSG_WARN([You have a broken Solaris <krb5.h> system include.])
1857 AC_MSG_WARN([Please see http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6837512])
1858 AC_MSG_WARN([If you need Kerberos support you'll have to patch])
1859 AC_MSG_WARN([your system. See contrib/solaris/solaris-krb5-include.patch])
fcabe077 1860 fi
ffe4ffd8
AJ
1861 SQUID_CHECK_KRB5_HEIMDAL_BROKEN_KRB5_H
1862 if test "x$squid_cv_broken_heimdal_krb5_h" = "xyes"; then
1863 AC_DEFINE(HAVE_BROKEN_HEIMDAL_KRB5_H, 1, [Define to 1 if Heimdal krb5.h is broken for C++])
1864 fi
a05af879 1865 AC_CHECK_HEADERS(krb5.h com_err.h et/com_err.h)
3d62cc61 1866
fcabe077
FC
1867 ac_com_error_message=no
1868 if test "x$ac_cv_header_com_err_h" == "xyes" ; then
1869 AC_EGREP_HEADER(error_message,com_err.h,ac_com_error_message=yes)
1870 elif test "x$ac_cv_header_et_com_err_h" == "xyes" ; then
1871 AC_EGREP_HEADER(error_message,et/com_err.h,ac_com_error_message=yes)
1872 fi
c8093f05 1873
fcabe077
FC
1874 SQUID_CHECK_MAX_SKEW_IN_KRB5_CONTEXT
1875 if test "x$squid_cv_max_skew_context" = "xyes"; then
1876 AC_DEFINE(HAVE_MAX_SKEW_IN_KRB5_CONTEXT, 1, [Define to 1 if max_skew in struct krb5_context])
1877 fi
3d62cc61 1878
fcabe077
FC
1879 if test `echo $KRB5LIBS | grep -c com_err` -ne 0 -a "x$ac_com_error_message" == "xyes" ; then
1880 AC_CHECK_LIB(com_err,error_message,
1881 AC_DEFINE(HAVE_ERROR_MESSAGE,1,
1882 [Define to 1 if you have error_message]),)
1883 elif test "x$ac_com_error_message" == "xyes" ; then
1884 AC_CHECK_LIB(krb5,error_message,
1885 AC_DEFINE(HAVE_ERROR_MESSAGE,1,
1886 [Define to 1 if you have error_message]),)
1887 fi
1888 AC_CHECK_LIB(krb5,krb5_get_err_text,
1889 AC_DEFINE(HAVE_KRB5_GET_ERR_TEXT,1,
1890 [Define to 1 if you have krb5_get_err_text]),)
1891 AC_CHECK_LIB(krb5,krb5_get_error_message,
1892 AC_DEFINE(HAVE_KRB5_GET_ERROR_MESSAGE,1,
1893 [Define to 1 if you have krb5_get_error_message]),)
b1218840 1894 AC_CHECK_DECLS(krb5_kt_free_entry,,,[#include <krb5.h>])
fcabe077
FC
1895 AC_CHECK_LIB(krb5,krb5_kt_free_entry,
1896 AC_DEFINE(HAVE_KRB5_KT_FREE_ENTRY,1,
1897 [Define to 1 if you have krb5_kt_free_entry]),)
1898 AC_CHECK_LIB(krb5,krb5_get_init_creds_keytab,
1899 AC_DEFINE(HAVE_GET_INIT_CREDS_KEYTAB,1,
1900 [Define to 1 if you have krb5_get_init_creds_keytab]),)
1901 AC_CHECK_LIB(krb5,krb5_get_max_time_skew,
1902 AC_DEFINE(HAVE_KRB5_GET_MAX_TIME_SKEW,1,
1903 [Define to 1 if you have krb5_get_max_time_skew]),)
1904 AC_CHECK_LIB(krb5,krb5_get_profile,
1905 AC_DEFINE(HAVE_KRB5_GET_PROFILE,1,
1906 [Define to 1 if you have krb5_get_profile]),)
1907 AC_CHECK_LIB(krb5,profile_get_integer,
1908 AC_DEFINE(HAVE_PROFILE_GET_INTEGER,1,
1909 [Define to 1 if you have profile_get_integer]),)
1910 AC_CHECK_LIB(krb5,profile_release,
1911 AC_DEFINE(HAVE_PROFILE_RELEASE,1,
1912 [Define to 1 if you have profile_release]),)
1913
1914 SQUID_CHECK_KRB5_CONTEXT_MEMORY_CACHE
1915 SQUID_DEFINE_BOOL(HAVE_KRB5_MEMORY_CACHE,$squid_cv_memory_cache,
1916 [Define if kerberos has MEMORY: cache support])
1917
1918 SQUID_CHECK_WORKING_GSSAPI
1919 SQUID_DEFINE_BOOL(HAVE_GSSAPI,$squid_cv_working_gssapi,[GSSAPI support])
1920
1921 SQUID_CHECK_SPNEGO_SUPPORT
1922 SQUID_DEFINE_BOOL(HAVE_SPNEGO,$squid_cv_have_spnego,[SPNEGO support])
1923
1924 SQUID_CHECK_WORKING_KRB5
1925 SQUID_DEFINE_BOOL(HAVE_KRB5,$squid_cv_working_krb5,[KRB5 support])
1926
1927 AC_SUBST(KRB5INCS)
1928 AC_SUBST(KRB5LIBS)
9ca29d23 1929fi
1a5ffec6 1930SQUID_STATE_ROLLBACK([krbsave])
3d62cc61 1931AM_CONDITIONAL(HAVE_SPNEGO, test x"$squid_cv_have_spnego" = x"yes" )
9ca29d23 1932
6437ac71 1933dnl Enable "NTLM fail open"
1934AC_ARG_ENABLE(ntlm-fail-open,
1a5ffec6 1935 AS_HELP_STRING([--enable-ntlm-fail-open],
fcabe077
FC
1936 [Enable NTLM fail open, where a helper that fails one of the
1937 Authentication steps can allow squid to still authenticate
1938 the user. This has security implications, and is deprecated]),
d9655720 1939[
fcabe077 1940 SQUID_YESNO([$enableval],[--enable-ntlm-fail-open takes no argument])
6437ac71 1941])
0067eb06 1942SQUID_DEFINE_BOOL(NTLM_FAIL_OPEN,${enable_ntlm_fail_open:=no},
d9655720
FC
1943 [Define if NTLM is allowed to fail gracefully when a helper has problems.])
1944AC_MSG_NOTICE([ntlm-fail-open enabled: $enable_ntlm_fail_open])
6437ac71 1945
c6588c68 1946AC_ARG_ENABLE(external-acl-helpers,
f2d9a578 1947 AS_HELP_STRING([--enable-external-acl-helpers="list of helpers"],
8ea232f5 1948 [Enable external_acl helpers support and thelpers themselves.
d9655720 1949 Default is to build all buildable helpers and enable support.
8ea232f5 1950 To disable support, use --disable-external-acl-helpers.
d9655720 1951 To build no helpers, specify "none".
8ea232f5
FC
1952 To see available helpers, see the helpers/external_acl
1953 directory]), [
d9655720 1954#nothing to do, really
c6588c68 1955])
d9655720 1956if test "x${enable_external_acl_helpers:=yes}" = "xyes" ;then
507ca601
FC
1957 SQUID_LOOK_FOR_MODULES([$srcdir/helpers/external_acl],
1958 [enable_external_acl_helpers])
7f18d2bd 1959fi
d9655720 1960if test "x$enable_external_acl_helpers" = "xnone" ; then
507ca601 1961 enable_external_acl_helpers=""
d9655720
FC
1962fi
1963EXTERNAL_ACL_HELPERS=""
1964enable_external_acl_helpers="`echo $enable_external_acl_helpers| sed -e 's/,/ /g;s/ */ /g'`"
1965if test "x$enable_external_acl_helpers" != "xno" ; then
1966 for helper in $enable_external_acl_helpers ; do
1967 dir="$srcdir/helpers/external_acl/$helper"
507ca601
FC
1968 if test -f "$dir/config.test" && sh "$dir/config.test" "$@"; then
1969 EXTERNAL_ACL_HELPERS="$EXTERNAL_ACL_HELPERS $helper"
b1218840
AJ
1970 # special case
1971 if test "x$helper" = "xkerberos_ldap_group" ; then
1972 squid_require_sasl=yes
1973 fi
507ca601
FC
1974 else
1975 AC_MSG_NOTICE([external acl helper $helper ... found but cannot be built])
1976 fi
1977 done
c6588c68 1978fi
f2d9a578 1979AC_MSG_NOTICE([External acl helpers built: $EXTERNAL_ACL_HELPERS])
c6588c68 1980AC_SUBST(EXTERNAL_ACL_HELPERS)
1981
d9655720
FC
1982
1983
fdbb3b19 1984dnl Select url_rewrite helpers to build
fdbb3b19 1985AC_ARG_ENABLE(url-rewrite-helpers,
081863f3 1986 AS_HELP_STRING([--enable-url-rewrite-helpers="list of helpers"],
fdbb3b19
AJ
1987 [This option selects which url_rewrite helpers to
1988 build and install as part of the normal build
8ea232f5
FC
1989 process. The default is to attempt the build of all possible
1990 helpers. Use --disable-url-rewrite-helpers to build none.
1991 For a list of available helpers see the
1992 helpers/url_rewrite directory.]),[
fdbb3b19 1993])
8ea232f5
FC
1994if test "x${enable_url_rewrite_helpers:=yes}" = "xyes" ; then
1995 SQUID_LOOK_FOR_MODULES([$srcdir/helpers/url_rewrite],
1996 [enable_url_rewrite_helpers])
1997fi
1998enable_url_rewrite_helpers="`echo $enable_url_rewrite_helpers| sed -e 's/,/ /g;s/ */ /g'`"
1999AC_MSG_NOTICE([URL rewrite helper candidates: $enable_url_rewrite_helpers])
2000URL_REWRITE_HELPERS=""
2001if test "x$enable_url_rewrite_helpers" != "xno" ; then
2002 for helper in $enable_url_rewrite_helpers; do
2003 dir="$srcdir/helpers/url_rewrite/$helper"
fcabe077 2004 if test -f "$dir/config.test" && sh "$dir/config.test" "$@"; then
8ea232f5 2005 URL_REWRITE_HELPERS="$URL_REWRITE_HELPERS $helper"
fcabe077 2006 elif test -d "$srcdir/helpers/ntlm_auth/$helper" ; then
8ea232f5
FC
2007 AC_MSG_NOTICE([URL rewrite helper $helper ... found but cannot be built])
2008 else
2009 AC_MSG_NOTICE([URL rewrite helper $helper ... not found])
2010 fi
2011 done
fdbb3b19 2012fi
8ea232f5 2013AC_MSG_NOTICE([URL rewrite helpers built: $URL_REWRITE_HELPERS])
fdbb3b19
AJ
2014AC_SUBST(URL_REWRITE_HELPERS)
2015
2016
3a125142 2017AC_ARG_WITH(valgrind-debug,
0f705e3b
FC
2018 AS_HELP_STRING([--with-valgrind-debug],
2019 [Include debug instrumentation for use with valgrind]),
4e26f472
FC
2020[
2021 SQUID_YESNO([$withval],
2022 [unrecognized argument to --with-valgrind-debug: $withval])
fcabe077 2023 if test "x$withval" != "xno" ; then
4e26f472
FC
2024 AC_CHECK_HEADERS(valgrind/memcheck.h,[],[
2025 AC_MSG_ERROR([Valgrind support requested, needed headers not found.])
2026 ])
b4bab919 2027 fi
2028])
4e26f472
FC
2029SQUID_DEFINE_BOOL(WITH_VALGRIND,${with_valgrind_debug:=no},
2030 [Valgrind memory debugger support])
2031AC_MSG_NOTICE([Valgrind debug support enabled: $with_valgrind_debug])
b4bab919 2032
d96ceb8e 2033dnl Disable "memPools" code
8730e87a
HN
2034#AC_ARG_ENABLE(chunkedmempools,
2035# AS_HELP_STRING([--enable-chunkedmempools],
2036# [Enable experimental chunked memPools. Note that this option
507ca601 2037# simply sets the default behaviour. Specific classes can override this
8730e87a
HN
2038# at runtime, and only lib/MemPool.c needs to be altered
2039# to change the squid-wide default for all classes.]), [
2040#SQUID_YESNO([$enableval],
2041# [--enable-chunkedmempools option takes no arguments])
2042#])
4d7cefbb
HN
2043SQUID_DEFINE_BOOL(USE_CHUNKEDMEMPOOLS,${enable_chunkedmempools:=no},
2044 [Enable chunked Memory Pools support (experimental)])
8730e87a 2045#AC_MSG_NOTICE([Chunked MemPools enabled: $enable_chunkedmempools])
d96ceb8e 2046
0e657244 2047dnl Enable WIN32 Service compile mode
2048AC_ARG_ENABLE(win32-service,
054a4caa 2049 AS_HELP_STRING([--enable-win32-service],
0f705e3b 2050 [Compile Squid as a WIN32 Service.
b284c470
FC
2051 Works only on MS-Windows platforms]), [
2052SQUID_YESNO([$enableval],
2053 [unrecognized argument to --enable-win32-service: $enableval])
0e657244 2054])
b284c470
FC
2055SQUID_DEFINE_BOOL(USE_WIN32_SERVICE,${enable_win32_service:=no},
2056 [Enable code supporting MS Windows service mode])
2057AC_MSG_NOTICE([MS Windows service mode enabled: $enable_win32_service])
0e657244 2058
b1485ff8 2059
0f705e3b 2060# Check for Cyrus SASL
fcabe077 2061if test "x$squid_require_sasl" = "xyes"; then
28d80d0a
FC
2062 AC_CHECK_HEADERS(sasl/sasl.h sasl.h)
2063 AC_CHECK_LIB(sasl2,sasl_errstring,[LIBSASL="-lsasl2"],[
2064 AC_CHECK_LIB(sasl,sasl_errstring,[LIBSASL="-lsasl"], [
2065 AC_MSG_ERROR(Neither SASL nor SASL2 found)
2066 ])
2067 ])
39145d19 2068 case "$squid_host_os" in
b1218840
AJ
2069 Darwin)
2070 if test "$ac_cv_lib_sasl2_sasl_errstring" = "yes" ; then
2071 AC_DEFINE(HAVE_SASL_DARWIN,1,[Define to 1 if Mac Darwin without sasl.h])
2072 echo "checking for MAC Darwin without sasl.h ... yes"
2073 else
2074 echo "checking for MAC Darwin without sasl.h ... no"
2075 fi
2076 ;;
2077 esac
28d80d0a 2078 AC_SUBST(LIBSASL)
2adff954 2079fi
2080
29f22442 2081# Disable "unlinkd" code
fe0810ac 2082AC_ARG_ENABLE(unlinkd,
0a081cb0 2083 AS_HELP_STRING([--disable-unlinkd],[Do not use unlinkd]), [
0f705e3b
FC
2084SQUID_YESNO([$enableval],
2085 [unrecognized argument to --disable-unlinkd: $enableval])
fe0810ac 2086])
0f658b5b 2087SQUID_DEFINE_BOOL(USE_UNLINKD,${enable_unlinkd:=yes},
0f705e3b 2088 [Enable useage of unlinkd])
fcabe077 2089AM_CONDITIONAL(ENABLE_UNLINKD,test "x$enable_unlinkd" = "xyes")
fbc04c0a 2090AC_MSG_NOTICE([unlinkd enabled: $enable_unlinkd])
fe0810ac 2091
0f705e3b 2092# Enable backtraces on fatal errors
ce3d30fb 2093AC_ARG_ENABLE(stacktraces,
0f705e3b
FC
2094 AS_HELP_STRING([--enable-stacktraces],
2095 [Enable automatic call backtrace on fatal errors]), [
2096SQUID_YESNO([$enableval],
2097 [unrecognized argument to --enable-stacktraces: $enableval])
ce3d30fb 2098])
0f658b5b 2099SQUID_DEFINE_BOOL(PRINT_STACK_TRACE,${enable_stacktraces:=no},
0f705e3b 2100 [Print stack traces on fatal errors])
78614cd4 2101AC_MSG_NOTICE([Automatically print stack trace on fatal errors: $enable_stacktraces])
0a081cb0 2102
ce3d30fb 2103
904676a2 2104# CPU Profiling options handling
88bfe092 2105AC_ARG_ENABLE(cpu-profiling,
0f705e3b
FC
2106 AS_HELP_STRING([--enable-cpu-profiling],
2107 [Enable instrumentation to try and understand how CPU power
2108 is spent by squid, by enabling specific probes in selected
2109 functions.
2110 New probes can only be added by modifying the source code.
2111 It is meant to help developers in optimizing performance
2112 of Squid internal functions.
87fa90fb 2113 If you are not developer you should not enable this,
0f705e3b
FC
2114 as it slows squid down somewhat.
2115 See lib/Profiler.c for more details.]), [
2116SQUID_YESNO([$enableval],
2117 [unrecognized argument to --enable-cpu-profiling: $enableval])
88bfe092 2118])
13e41ca5
AJ
2119# Default OFF. This is a debug feature. Only check and enable if forced ON.
2120if test "x$enable_cpu_profiling" = "xyes"; then
5e44eea8 2121 SQUID_CHECK_FUNCTIONAL_CPU_PROFILER
13e41ca5 2122 if test "x$squid_cv_cpu_profiler_works" = "xno"; then
5e44eea8 2123 AC_MSG_ERROR([CPU profiling will not be functional in this build.])
5e44eea8 2124 fi
5e44eea8 2125fi
0f658b5b 2126SQUID_DEFINE_BOOL(USE_XPROF_STATS,${enable_cpu_profiling:=no},
0f705e3b
FC
2127 [Define to enable CPU profiling within Squid])
2128AM_CONDITIONAL(ENABLE_XPROF_STATS,
fcabe077 2129 test "x$enable_cpu_profiling" = "xyes")
78614cd4 2130AC_MSG_NOTICE([CPU profiling enabled: $enable_cpu_profiling])
88bfe092 2131
904676a2 2132# Enable X-Accelerator-Vary for Vary support within an accelerator setup
2092c67d 2133AC_ARG_ENABLE(x-accelerator-vary,
904676a2
FC
2134 AS_HELP_STRING([--enable-x-accelerator-vary],
2135 [Enable support for the X-Accelerator-Vary
e702812e
FC
2136 HTTP header. Can be used to indicate
2137 variance within an accelerator setup.
2138 Typically used together with other code
904676a2
FC
2139 that adds custom HTTP headers to the requests.]), [
2140SQUID_YESNO([$enableval],
2141 [unrecognized argument to --enable-x-accelerator-vary: $enableval])
f66a9ef4 2142])
0f658b5b 2143SQUID_DEFINE_BOOL(X_ACCELERATOR_VARY,${enable_x_accelerator_vary:=no},
904676a2 2144 [Enable support for the X-Accelerator-Vary HTTP header])
78614cd4 2145AC_MSG_NOTICE([X-Accelerator-Vary support enabled: $enable_x_accelerator_vary])
f66a9ef4 2146
87fa90fb 2147
7172612f 2148AC_ARG_ENABLE(zph-qos,
87fa90fb
FC
2149 AS_HELP_STRING([--enable-zph-qos],[Enable ZPH QOS support]), [
2150SQUID_YESNO([$enableval],
2151 [unrecognized argument to --enable-zph-qos: $enableval])
7172612f 2152])
425de4c8 2153SQUID_DEFINE_BOOL(USE_QOS_TOS,${enable_zph_qos:=yes},
87fa90fb
FC
2154 [Enable Zero Penalty Hit QOS. When set, Squid will alter the
2155 TOS field of HIT responses to help policing network traffic])
2156AC_MSG_NOTICE([ZPH QOS enabled: $enable_zph_qos])
425de4c8
AJ
2157if test x"$enable_zph_qos" = "xyes" ; then
2158 AC_MSG_NOTICE([QOS netfilter mark preservation enabled: $with_netfilter_conntrack])
2159 SQUID_DEFINE_BOOL(USE_LIBNETFILTERCONNTRACK,${with_netfilter_conntrack:=no},
2160 [Enable support for QOS netfilter mark preservation])
2161fi
7172612f 2162
8b5e106b 2163if $CPPUNITCONFIG --help >/dev/null; then
78cae3b4
FC
2164 squid_cv_cppunit_version="`$CPPUNITCONFIG --version`"
2165 AC_MSG_NOTICE([using system installed cppunit version $squid_cv_cppunit_version])
2166 unset squid_cv_cppunit_version
8b5e106b 2167 SQUID_CPPUNIT_LIBS="`$CPPUNITCONFIG --libs`"
2168 SQUID_CPPUNIT_LA=''
2169 SQUID_CPPUNIT_INC="`$CPPUNITCONFIG --cflags`"
2170else
eed82608 2171 AC_MSG_WARN([cppunit does not appear to be installed. squid does not require this, but code testing with 'make check' will fail.])
63d03edb 2172 SQUID_CPPUNIT_LA=''
2173 SQUID_CPPUNIT_LIBS=''
2174 SQUID_CPPUNIT_INC=''
f5691f9c 2175fi
8b5e106b 2176
f5691f9c 2177AC_ARG_WITH(cppunit-basedir,
1b9fe876 2178 AS_HELP_STRING([--with-cppunit-basedir=PATH],
3680cc44
FC
2179 [Path where the cppunit headers are libraries can be found ]), [
2180if test -f "$withval/include/cppunit/TestCase.h"; then
2181 AC_MSG_NOTICE([Using cppunit includes from $withval])
2182 SQUID_CPPUNIT_INC="-I${withval}/include"
2183else
2184 AC_MSG_ERROR(Cannot find cppunit at $withval)
2185fi
2186if test -f "$withval/lib/libcppunit.la"; then
2187 AC_MSG_NOTICE([Using cppunit lib from $withval])
2188 SQUID_CPPUNIT_LA="${withval}/lib/libcppunit.la"
2189 SQUID_CPPUNIT_LIBS='$(SQUID_CPPUNIT_LA)'
2190else
2191 AC_MSG_ERROR(Cannot find cppunit at $withval)
2192fi
f5691f9c 2193])
8b5e106b 2194AC_SUBST(SQUID_CPPUNIT_LIBS)
f5691f9c 2195AC_SUBST(SQUID_CPPUNIT_LA)
2196AC_SUBST(SQUID_CPPUNIT_INC)
f5691f9c 2197
fd9aaa3e 2198# Force some compilers to use ANSI features
2199#
2200case "$host" in
3680cc44
FC
2201 *-hp-hpux*)
2202 if test "x$ac_cv_prog_CC" = "xcc" ; then
2203 AC_MSG_NOTICE([adding '-Ae' to cc args for $host])
2204 CC="cc -Ae";
2205 ac_cv_prog_CC="$CC"
2206 fi
2207 ;;
fd9aaa3e 2208esac
2209
dd56802c 2210
a2794549 2211dnl automake handles this AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
4e9d8e26 2212
6ad85e8a 2213case "$host" in
3680cc44
FC
2214 *hpux*)
2215 AC_MSG_NOTICE([Disabling ranlib for HP-UX...])
2216 RANLIB=":"
2217 ;;
6ad85e8a 2218esac
2219
090089c4 2220dnl Check for headers
2221AC_HEADER_DIRENT
2222AC_HEADER_STDC
db40ae20 2223
2224AC_CHECK_HEADERS( \
b167f1b8 2225 algorithm \
3680cc44
FC
2226 arpa/inet.h \
2227 arpa/nameser.h \
2228 assert.h \
2229 bstring.h \
2230 cassert \
2231 crypt.h \
25f98340 2232 cstdlib \
3680cc44 2233 cstring \
95d2589c 2234 list \
3680cc44
FC
2235 ctype.h \
2236 errno.h \
2237 execinfo.h \
2238 fcntl.h \
2239 fnmatch.h \
2240 getopt.h \
2241 glob.h \
2242 gnumalloc.h \
2243 grp.h \
2244 iosfwd \
2245 iomanip \
2246 iostream \
95d2589c 2247 fstream \
43d1bbe4 2248 climits \
3680cc44
FC
2249 ip_compat.h \
2250 ip_fil_compat.h \
2251 ip_fil.h \
2252 ip_nat.h \
2253 ipl.h \
2254 lber.h \
2255 ldap.h \
2256 libc.h \
425de4c8 2257 limits \
3680cc44
FC
2258 limits.h \
2259 linux/posix_types.h \
2260 linux/types.h \
2261 machine/byte_swap.h \
2262 malloc.h \
2263 map \
2264 math.h \
2265 memory.h \
95d2589c 2266 memory \
3680cc44
FC
2267 mount.h \
2268 netdb.h \
2269 netinet/in.h \
2270 netinet/in_systm.h \
2271 netinet/ip_fil_compat.h \
2272 openssl/err.h \
2273 openssl/md5.h \
2274 openssl/ssl.h \
2275 openssl/x509v3.h \
2276 netinet/tcp.h \
2277 openssl/engine.h \
95d2589c 2278 openssl/txt_db.h \
3680cc44
FC
2279 ostream \
2280 paths.h \
2281 poll.h \
2282 pwd.h \
2283 shadow.h \
2284 regex.h \
2285 sched.h \
2286 security/pam_appl.h \
2ccf2eb2 2287 siginfo.h \
3680cc44
FC
2288 signal.h \
2289 sstream \
2290 stdarg.h \
425de4c8 2291 stdbool.h \
3680cc44
FC
2292 stddef.h \
2293 stdexcept \
2294 stdio.h \
2295 stdlib.h \
2296 string \
2297 string.h \
2298 strings.h \
2299 sys/bitypes.h \
2300 sys/bswap.h \
2301 sys/endian.h \
2302 sys/file.h \
2303 sys/ioctl.h \
2304 sys/param.h \
2305 sys/prctl.h \
2306 sys/md5.h \
2307 sys/msg.h \
2308 sys/resource.h \
2ccf2eb2 2309 sys/select.h \
3680cc44
FC
2310 sys/socket.h \
2311 sys/stat.h \
2312 sys/statvfs.h \
2313 syscall.h \
2314 sys/syscall.h \
2315 sys/time.h \
2316 sys/types.h \
2317 sys/uio.h \
2318 sys/un.h \
2319 sys/vfs.h \
2320 sys/wait.h \
2321 syslog.h \
2322 time.h \
2323 unistd.h \
2324 utime.h \
2325 varargs.h \
2326 byteswap.h \
2327 glib.h \
2328 stdint.h \
2329 inttypes.h \
3680cc44 2330 db.h \
cdb86165
FC
2331 db_185.h \
2332 wchar.h
db40ae20 2333)
3c586e38
FC
2334
2335CHECK_STRUCT_PAM_CONV
2336
fc68f6b1 2337AC_CHECK_HEADERS(
0c0d381b 2338 linux/netfilter_ipv4.h
fc68f6b1 2339,,,
dcd1dc78 2340SQUID_DEFAULT_INCLUDES
2341#if HAVE_LIMITS_H
2342#include <limits.h>
2343#endif
a74968c2
AJ
2344/* Netfilter ip(6)tables v1.4.0 has broken headers */
2345#if HAVE_NETINET_IN_H
2346#include <netinet/in.h>
2347#endif
dcd1dc78 2348)
2349
cdb352bb 2350dnl *BSD dont include the dependencies for all their net/ and netinet/ files
c92b4732 2351dnl We must include a few basic type headers for them to work.
d1e5191e 2352AC_CHECK_HEADERS( \
0c0d381b
FC
2353 net/if.h \
2354 netinet/if_ether.h\
2355 netinet/icmp6.h \
2356 netinet/in.h \
2357 netinet/ip.h \
2358 netinet/ip6.h \
2359 netinet/ip_compat.h\
2360 netinet/ip_fil_compat.h\
2361 netinet/ip_fil.h\
2362 netinet/ip_icmp.h \
2363 netinet/ipl.h \
2364 netinet/ip_nat.h\
2365 net/pf/pfvar.h \
2366 net/pfvar.h \
2367 sys/mount.h\
2368 resolv.h \
d1e5191e
AJ
2369,,,
2370SQUID_BSDNET_INCLUDES)
5a3237b0 2371
aee0606f 2372AC_C_CONST
d57288d2 2373AC_C_BIGENDIAN
aee0606f 2374
6a9f6389 2375AC_STRUCT_TM
2376AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
2377#if TM_IN_SYS_TIME
2378#if HAVE_SYS_TIME_H
2379#include <sys/time.h>
2380#endif
2381#elif HAVE_TIME_H
2382#include <time.h>
2383#endif
5c51415d 2384])
46c883ed 2385
ef7ece58 2386SQUID_HAVE_STRUCT_MALLINFO
090089c4 2387
08caf8c6 2388dnl Override rusage() detect on MinGW because is emulated in source code
78a60bca
AJ
2389case "$squid_host_os" in
2390 mingw)
08caf8c6 2391 AC_DEFINE(HAVE_STRUCT_RUSAGE)
2392 ac_cv_func_getrusage='yes'
eed82608 2393 AC_MSG_NOTICE([Using own rusage on Windows.])
08caf8c6 2394 ;;
2395 *)
2396 AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
8ff51bba 2397#if HAVE_SYS_TIME_H
2398#include <sys/time.h>
2399#endif
b54a6789 2400#if HAVE_SYS_RESOURCE_H
2401#include <sys/resource.h>
6a9f6389 2402#endif])
08caf8c6 2403 ;;
2404esac
b54a6789 2405
6a9f6389 2406AC_CHECK_MEMBERS([struct iphdr.ip_hl],,,[
2407#if HAVE_SYS_TYPES_H
2408#include <sys/types.h>
2409#endif
a025a745 2410#include <netinet/in.h>
2411#include <netinet/in_systm.h>
6ad85e8a 2412#include <netinet/ip.h>
b05490a8 2413#if defined (__linux__) || defined (__CYGWIN__)
6ad85e8a 2414#define ip_hl ihl
2415#endif
2416#ifndef __linux__
b05490a8 2417#ifndef __CYGWIN__
6ad85e8a 2418#define iphdr ip
b05490a8 2419#endif
6a9f6389 2420#endif])
a025a745 2421
090089c4 2422dnl Check for typedefs
77d6bd88 2423AC_CHECK_SIZEOF(void *)
090089c4 2424
41aa7d00
FC
2425# check for a bunch of types
2426AC_TYPE_INT8_T
2427AC_TYPE_UINT8_T
2428AC_TYPE_INT16_T
2429AC_TYPE_UINT16_T
2430AC_TYPE_INT32_T
2431AC_TYPE_UINT32_T
2432AC_TYPE_INT64_T
2433AC_TYPE_UINT64_T
2434AC_TYPE_PID_T
2435AC_TYPE_SIZE_T
2436AC_TYPE_SSIZE_T
2437AC_TYPE_OFF_T
2438AC_TYPE_UID_T
59a09b98 2439AC_CHECK_TYPE([bool])
41aa7d00
FC
2440#need the defines for PRId64
2441AC_CHECK_SIZEOF(int64_t)
2442AC_CHECK_SIZEOF(long)
50f9c873
AR
2443#need the define for overflow checks
2444AC_CHECK_SIZEOF(off_t)
6a9f6389 2445
588e71df 2446dnl On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
2447dnl that is incompatible with the updated Solaris header files.
2448dnl For this reason, we must check if pad128_t and upad128_t are defined.
2449AC_CHECK_TYPE(pad128_t,
2450 AC_DEFINE(HAVE_PAD128_T,1,[pad128_t is defined in system headers]),
2451 ,SQUID_DEFAULT_INCLUDES)
2452
2453AC_CHECK_TYPE(upad128_t,
2454 AC_DEFINE(HAVE_UPAD128_T,1,[upad128_t is defined in system headers]),
2455 ,SQUID_DEFAULT_INCLUDES)
2456
6a9f6389 2457AC_CHECK_TYPE(mode_t, AC_DEFINE(HAVE_MODE_T,1,[mode_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2458AC_CHECK_TYPE(fd_mask, AC_DEFINE(HAVE_FD_MASK,1,[fd_mask is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
adcceb47 2459
6a9f6389 2460AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the system headers]),,[
2461#include <sys/types.h>
6637e3a5 2462#include <sys/socket.h>
2463#if STDC_HEADERS
2464#include <stdlib.h>
2465#include <stddef.h>
6a9f6389 2466#endif])
6637e3a5 2467
cdb352bb
FC
2468AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,
2469 [mtyp_t is defined by the system headers]),,[#include <sys/types.h>
2470#include <sys/ipc.h>
2471#include <sys/msg.h>])
2472
2473dnl Check for special functions
2474AC_FUNC_ALLOCA
2475
2476
b50f1b2b 2477dnl Check for libcap header (assume its not broken unless
45c41a07
FC
2478AC_ARG_WITH(libcap, AS_HELP_STRING([--without-libcap],
2479 [disable usage of Linux capabilities library to control privileges]), [
2480SQUID_YESNO([$withval],[unrecognized argument to --without-libcap: $withval])
2481],[with_libcap=auto])
2482
2483if test "x$with_libcap" != "xno"; then
b64b6030 2484 # cap_clear_flag is the most recent libcap function we require
45c41a07 2485 AC_CHECK_HEADERS(sys/capability.h)
b64b6030 2486 AC_CHECK_LIB(cap, cap_clear_flag)
45c41a07
FC
2487 SQUID_CHECK_FUNCTIONAL_LIBCAP2
2488
2489 # if it can't be supported..
35e2b2e5 2490 if test "x$ac_cv_header_sys_capability_h" = "xno" -o \
46f50de9 2491 "x$ac_cv_lib_cap_cap_clear_flag" = "xno"; then
45c41a07 2492 # and it was forced on: error
46f50de9 2493 if test "x$with_libcap" = "xyes" ; then
ff8d255b 2494 AC_MSG_ERROR([libcap forced enabled but not available or not usable, requires libcap-2.09 or later])
3fbda12c
FC
2495 else
2496 # with_libcap is "auto"; it can't be supported. Disable.
2497 with_libcap=no
b64b6030 2498 fi
45c41a07
FC
2499 else
2500 # header and lib are ok, we support
2501 with_libcap=yes
b64b6030 2502 fi
69367152 2503
b50f1b2b 2504fi
5b43d209 2505
45c41a07
FC
2506SQUID_DEFINE_BOOL(USE_LIBCAP,$with_libcap,
2507 [use libcap to set capabilities required for TPROXY])
2508AC_MSG_NOTICE([libcap support enabled: $with_libcap])
2509SQUID_DEFINE_BOOL(LIBCAP_BROKEN,${squid_cv_sys_capability_works:=no},
2510 [libcap2 headers are broken and clashing with glibc])
2511AC_MSG_NOTICE([libcap2 headers are ok: $squid_cv_sys_capability_works])
2512
b64b6030 2513
090089c4 2514dnl Check for needed libraries
54c95954
FC
2515AC_SEARCH_LIBS([gethostbyname],[nsl resolv bind])
2516AC_SEARCH_LIBS([res_init],[resolv])
2517AC_SEARCH_LIBS([bind],[socket])
2518AC_SEARCH_LIBS([opcom_stack_trace],[opcom_stack])
2519AC_SEARCH_LIBS([strlcpy], [bsd])
85cd85f3 2520AC_SEARCH_LIBS([yp_match], [nsl nss_nis nss_nisplus])
bfe8dedf 2521dnl Check for Winsock only on MinGW, on Cygwin we must use emulated BSD socket API
0c0d381b
FC
2522if test "x$squid_host_os" = "xmingw" ; then
2523 SQUID_CHECK_WINSOCK_LIB
2524fi
94d48591 2525
46f50de9
FC
2526# check that we have unix sockets
2527SQUID_CHECK_UNIX_SOCKET
2528SQUID_DEFINE_BOOL(HAVE_UNIXSOCKET,$squid_cv_unixsocket,[System supports unix sockets])
2529
2530AC_CHECK_LIB(gnumalloc, malloc)
2531if test "x$ac_cv_lib_gnumalloc_malloc" = "xyes"; then
ef7ece58 2532 AC_MSG_NOTICE([Disabling extended malloc functions when using bundled gnumalloc])
46f50de9
FC
2533 ac_cv_func_mallinfo=no
2534 ac_cv_func_mallocblksize=no
2535 ac_cv_func_mallopt=no
2536else
2537 case "$squid_host_os" in
2538 solaris)
2539 AC_MSG_NOTICE([skipping libmalloc check for $host])
2540 ;;
2541 freebsd)
2542 AC_MSG_NOTICE([skipping libmalloc check for $host])
2543 ;;
2544 *)
2545 #used later. FIXME
2546 AC_CHECK_LIB(malloc, main)
2547 ;;
cdb352bb
FC
2548 esac
2549fi
94d48591 2550
78a60bca
AJ
2551case "$squid_host_os" in
2552 mingw)
2553 AC_MSG_NOTICE([Use MSVCRT for math functions.])
2554 ;;
2555 *)
2556 dnl rint() and log() are only used in old C code for now.
2557 AC_LANG_PUSH([C])
2558 AC_SEARCH_LIBS([rint],[m])
2559 AC_SEARCH_LIBS([log],[m])
2560 AC_LANG_POP([C])
2561 ;;
08caf8c6 2562esac
090089c4 2563
001ad4cc 2564
f467f578
FC
2565dnl --with-maxfd present for compatibility with Squid-2.
2566dnl undocumented in ./configure --help to encourage using the Squid-3 directive
2567AC_ARG_WITH(maxfd,,
2568[
2569 case ${withval} in
2570 [[0-9]]*)
2571 squid_filedescriptors_num=$withval
2572 ;;
2573 *)
2574 AC_MSG_ERROR(--with-maxfd expects a numeric argument)
2575 ;;
2576 esac
055421ee 2577])
001ad4cc 2578
f467f578
FC
2579AC_ARG_WITH(filedescriptors,
2580 AS_HELP_STRING([--with-filedescriptors=NUMBER],
2581 [Force squid to support NUMBER filedescriptors]),
2582[
2583 case ${withval} in
2584 [[0-9]]*)
2585 squid_filedescriptors_num=$withval
2586 ;;
2587 *)
2588 AC_MSG_ERROR(--with-filedescriptors expects a numeric argument)
2589 ;;
2590 esac
001ad4cc 2591])
f467f578
FC
2592
2593SQUID_CHECK_DEFAULT_FD_SETSIZE
2594if test "x$squid_filedescriptors_num" = "x"; then
2595 SQUID_CHECK_MAXFD
001ad4cc 2596else
f467f578 2597 AC_MSG_NOTICE([forcing use of $squid_filedescriptors_num filedescriptors (user-forced)])
001ad4cc 2598fi
f467f578
FC
2599if test "$squid_filedescriptors_num" -lt 512 ; then
2600 AC_MSG_WARN([$squid_filedescriptors_num may not be enough filedescriptors if your])
2601 AC_MSG_WARN([cache will be very busy. Please see the FAQ page])
2602 AC_MSG_WARN([http://wiki.squid-cache.org/SquidFaq/TroubleShooting])
2603 AC_MSG_WARN([on how to increase your filedescriptor limit])
2604fi
2605AC_DEFINE_UNQUOTED(SQUID_MAXFD, $squid_filedescriptors_num,[Maximum number of open filedescriptors])
001ad4cc 2606
f467f578 2607
001ad4cc
AJ
2608dnl Enable IPv6 support
2609AC_MSG_CHECKING([whether to enable IPv6])
001ad4cc 2610AC_ARG_ENABLE(ipv6,
af494bc8
FC
2611 AS_HELP_STRING([--disable-ipv6],[Disable IPv6 support. The default is to probe system capabilities on startup.]), [
2612SQUID_YESNO([$enableval],[unrecognized argument to --disable-ipv6: $enableval])
001ad4cc 2613])
af494bc8
FC
2614AC_MSG_RESULT(${use_ipng:=yes})
2615SQUID_DEFINE_BOOL(USE_IPV6,$use_ipng,[Enable support for IPv6 ])
001ad4cc 2616
af494bc8
FC
2617if test "x$use_ipng" = "xyes" ; then
2618 SQUID_CHECK_SIN6_LEN_IN_SAI
2619 SQUID_CHECK_SS_LEN_IN_SOCKADDR_STORAGE
2620 SQUID_CHECK_SIN_LEN_IN_SOCKADDR_IN
001ad4cc
AJ
2621fi
2622
001ad4cc 2623
090089c4 2624dnl Check for libcrypt
0d8565ac 2625CRYPTLIB=
8154dd82 2626dnl Some of our helpers use crypt(3) which may be in libc, or in
2627dnl libcrypt (eg FreeBSD)
c1dc012a 2628AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
3d4022fa 2629dnl Solaris10 provides MD5 natively through libmd5
c1dc012a 2630AC_CHECK_LIB(md5, MD5Init, [CRYPTLIB="$CRYPTLIB -lmd5"])
be79ade0 2631AC_SUBST(CRYPTLIB)
77f675ad 2632
0d8565ac
AJ
2633# check for crypt, may require -lcrypt
2634SAVED_LIBS="$LIBS"
2635LIBS="$LIBS $CRYPTLIB"
2636AC_CHECK_FUNCS(crypt)
2637LIBS="$SAVED_LIBS"
2638
2639
042b1f8a 2640dnl Check for libdl, used by auth_modules/PAM
fcabe077 2641if test "x$with_dl" = "xyes"; then
8154dd82 2642 AC_CHECK_LIB(dl, dlopen)
2643fi
042b1f8a 2644
86ec11aa 2645dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
2646dnl Robert Side <rside@aiinc.bc.ca>
2647dnl Mon, 18 Jan 1999 17:48:00 GMT
2648case "$host" in
2649 *-pc-sco3.2*)
2650 AC_CHECK_LIB(intl, strftime)
2651 ;;
2652esac
2653
20e869bf 2654dnl On MinGW OpenLDAP is not available, so LDAP helpers can be linked
2655dnl only with Windows LDAP libraries using -lwldap32
78a60bca
AJ
2656case "$squid_host_os" in
2657 mingw)
b1218840
AJ
2658 LDAPLIB="-lwldap32"
2659 LBERLIB=""
2660 ;;
2661 *)
2662 AC_CHECK_LIB(ldap, ldap_init, [LDAPLIB="-lldap"])
2663 dnl LDAP helpers need to know if -llber is needed or not
2664 AC_CHECK_LIB(lber, ber_init, [LBERLIB="-llber"])
2665 dnl if no ldap lib found check for mozilla version
2666 if test "x$ac_cv_lib_ldap_ldap_init" != x""yes; then
2667 oLIBS=$LIBS
2668 LIBS="$LIBPTHREADS"
2669 AC_CHECK_LIB(ldap60, ldap_init, [LDAPLIB="-lldap60"])
2670 LIBS="$LDAPLIB $LIBPTHREADS"
2671 AC_CHECK_LIB(prldap60, prldap_init, [LDAPLIB="-lprldap60 $LDAPLIB"])
2672 LIBS="$LDAPLIB $LIBPTHREADS"
2673 AC_CHECK_LIB(ssldap60, ldapssl_init, [LDAPLIB="-lssldap60 $LDAPLIB"])
2674 LIBS=$oLIBS
2675 fi
2676
2677 AC_CHECK_HEADERS(ldap.h lber.h)
2678 AC_CHECK_HEADERS(mozldap/ldap.h)
2679
2680 dnl
2681 dnl Check for LDAP_OPT_DEBUG_LEVEL
2682 dnl
2683 AC_MSG_CHECKING([for LDAP_OPT_DEBUG_LEVEL])
2684 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2685# include <ldap.h>
2686 ]],[[
2687 int i=LDAP_OPT_DEBUG_LEVEL
2688 ]])],
2689 [ AC_MSG_RESULT(yes) ],
2690 [ AC_MSG_RESULT(no) ])
2691
2692 dnl
2693 dnl Check for working ldap
2694 dnl
2695 oLIBS=$LIBS
2696 LIBS="$LDAPLIB $LBERLIB $LIBPTHREADS"
2697 AC_MSG_CHECKING([for working ldap])
2698 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2699# define LDAP_DEPRECATED 1
2700# if HAVE_LDAP_H
2701# include <ldap.h>
2702# elif HAVE_MOZLDAP_LDAP_H
2703# include <mozldap/ldap.h>
2704# endif
2705 int
2706 main(void)
2707 {
2708 char host[]="";
2709 int port;
2710
2711 ldap_init((const char *)&host, port);
2712
2713 return 0;
2714 }
2715 ]])],
2716 [ AC_DEFINE(HAVE_LDAP, 1, [LDAP support])
2717 AC_MSG_RESULT(yes) ],
aff0e8fe
AJ
2718 [ AC_MSG_RESULT(no) ],
2719 [ AC_MSG_RESULT(cross-compiler cant tell) ])
b1218840
AJ
2720 LIBS=$oLIBS
2721
2722 dnl
2723 dnl Check for ldap vendor
2724 dnl
2725 AC_MSG_CHECKING([for OpenLDAP])
2726 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2727# if HAVE_LDAP_H
2728# include <ldap.h>
2729# endif
2730# include <string.h>
2731 int
2732 main(void)
2733 {
2734 return strcmp(LDAP_VENDOR_NAME,"OpenLDAP");
2735 }
2736 ]])],
2737 [ AC_DEFINE(HAVE_OPENLDAP, 1, [OpenLDAP support])
2738 AC_MSG_RESULT(yes) ],
aff0e8fe
AJ
2739 [ AC_MSG_RESULT(no) ],
2740 [ AC_MSG_RESULT(cross-compiler cant tell) ])
b1218840
AJ
2741
2742 AC_MSG_CHECKING([for Sun LDAP SDK])
2743 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2744# if HAVE_LDAP_H
2745# include <ldap.h>
2746# endif
2747# include <string.h>
2748 int
2749 main(void)
2750 {
2751 return strcmp(LDAP_VENDOR_NAME,"Sun Microsystems Inc.");
2752 }
2753 ]])],
2754 [ AC_DEFINE(HAVE_SUN_LDAP_SDK, 1, [Sun LDAP SDK support])
2755 AC_MSG_RESULT(yes) ],
aff0e8fe
AJ
2756 [ AC_MSG_RESULT(no) ],
2757 [ AC_MSG_RESULT(cross-compiler cant tell) ])
b1218840
AJ
2758
2759 AC_MSG_CHECKING([for Mozilla LDAP SDK])
2760 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2761# if HAVE_LDAP_H
2762# include <ldap.h>
2763# elif HAVE_MOZLDAP_LDAP_H
2764# include <mozldap/ldap.h>
2765# endif
2766# include <string.h>
2767 int
2768 main(void)
2769 {
2770 return strcmp(LDAP_VENDOR_NAME,"mozilla.org");
2771 }
2772 ]])],
2773 [ AC_DEFINE(HAVE_MOZILLA_LDAP_SDK, 1, [Mozilla LDAP SDK support])
2774 AC_MSG_RESULT(yes) ],
aff0e8fe
AJ
2775 [ AC_MSG_RESULT(no)],
2776 [ AC_MSG_RESULT(cross-compiler cant tell) ])
b1218840
AJ
2777
2778 dnl
2779 dnl Check for LDAP_REBINDPROC_CALLBACK
2780 dnl
2781 AC_MSG_CHECKING([for LDAP_REBINDPROC_CALLBACK])
2782 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2783# if HAVE_LDAP_H
2784# include <ldap.h>
2785# elif HAVE_MOZLDAP_LDAP_H
2786# include <mozldap/ldap.h>
2787# endif
2788 ]],[[
2789 LDAP_REBINDPROC_CALLBACK ldap_rebind;
2790 ]])],
2791 [ AC_DEFINE(HAVE_LDAP_REBINDPROC_CALLBACK,1,[Define to 1 if you have LDAP_REBINDPROC_CALLBACK])
2792 AC_MSG_RESULT(yes) ],
2793 [ AC_MSG_RESULT(no) ])
2794
2795 dnl
2796 dnl Check for LDAP_REBIND_PROC
2797 dnl
2798 AC_MSG_CHECKING([for LDAP_REBIND_PROC])
2799 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2800# if HAVE_LDAP_H
2801# include <ldap.h>
2802# elif HAVE_MOZLDAP_LDAP_H
2803# include <mozldap/ldap.h>
2804# endif
2805 ]],[[
2806 LDAP_REBIND_PROC ldap_rebind;
2807 ]])],
2808 [ AC_DEFINE(HAVE_LDAP_REBIND_PROC,1,[Define to 1 if you have LDAP_REBIND_PROC])
2809 AC_MSG_RESULT(yes) ],
2810 [ AC_MSG_RESULT(no) ])
2811
2812 dnl
2813 dnl Check for LDAP_REBIND_FUNCTION
2814 dnl
2815 AC_MSG_CHECKING([for LDAP_REBIND_FUNCTION])
2816 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2817# define LDAP_REFERRALS
2818# if HAVE_LDAP_H
2819# include <ldap.h>
2820# elif HAVE_MOZLDAP_LDAP_H
2821# include <mozldap/ldap.h>
2822# endif
2823 ]],[[
2824 LDAP_REBIND_FUNCTION ldap_rebind;
2825 ]])],
2826 [ AC_DEFINE(HAVE_LDAP_REBIND_FUNCTION,1,[Define to 1 if you have LDAP_REBIND_FUNCTION])
2827 AC_MSG_RESULT(yes) ],
2828 [ AC_MSG_RESULT(no) ])
2829
2830 dnl
2831 dnl Check for LDAP_SCOPE_DEFAULT
2832 dnl
2833 AC_MSG_CHECKING([for LDAP_SCOPE_DEFAULT])
2834 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2835# if HAVE_LDAP_H
2836# include <ldap.h>
2837# elif HAVE_MOZLDAP_LDAP_H
2838# include <mozldap/ldap.h>
2839# endif
2840 ]],[[
2841 int i=LDAP_SCOPE_DEFAULT;
2842 ]])],
2843 [ AC_DEFINE(HAVE_LDAP_SCOPE_DEFAULT,1,[Define to 1 if you have LDAP_SCOPE_DEFAULT])
2844 AC_MSG_RESULT(yes) ],
2845 [ AC_MSG_RESULT(no) ])
2846
2847 dnl
2848 dnl Check for ldap_url_desc.lud_scheme
2849 dnl
2850 AC_CHECK_MEMBER(struct ldap_url_desc.lud_scheme,
2851 AC_DEFINE(HAVE_LDAP_URL_LUD_SCHEME,1,
2852 [Define to 1 if you have LDAPURLDesc.lud_scheme]),,[#include <ldap.h>])
2853
2854 dnl
2855 dnl Check for ldapssl_client_init
2856 dnl
2857 AC_CHECK_LIB(ldap,ldapssl_client_init,
2858 AC_DEFINE(HAVE_LDAPSSL_CLIENT_INIT,1,[Define to 1 if you have ldapssl_client_init]),)
2859
2860 dnl
2861 dnl Check for ldap_url_desc2str
2862 dnl
2863 AC_CHECK_LIB(ldap,ldap_url_desc2str,
2864 AC_DEFINE(HAVE_LDAP_URL_DESC2STR,1,[Define to 1 if you have ldap_url_desc2str]),)
2865
2866 dnl
2867 dnl Check for ldap_url_parse
2868 dnl
2869 AC_CHECK_LIB(ldap,ldap_url_parse,
2870 AC_DEFINE(HAVE_LDAP_URL_PARSE,1,[Define to 1 if you have ldap_url_parse]),)
60727a6f
AJ
2871
2872 dnl
2873 dnl Check for ldap_start_tls_s
2874 dnl
2875 AC_CHECK_LIB(ldap,ldap_start_tls_s,
2876 AC_DEFINE(HAVE_LDAP_START_TLS_S,1,[Define to 1 if you have ldap_start_tls_s]),)
b1218840 2877 ;;
20e869bf 2878esac
b1218840 2879
428744a1
AJ
2880AC_SUBST(LDAPLIB)
2881AC_SUBST(LBERLIB)
20e869bf 2882
b7a1c19e 2883dnl Check for libdb
6b5de50d 2884dnl this is not fully functional if db.h is for a differend db version
b7a1c19e 2885DBLIB=
6b5de50d
FC
2886
2887dnl check that dbopen is actually defined in the header
2888dnl FIXME: in case of failure undef db-related includes etc.
2889AC_CHECK_DECL(dbopen,,,[
06fbee01
FC
2890#if HAVE_SYS_TYPES_H
2891#include <sys/types.h>
2892#endif
2893#if HAVE_LIMITS_H
2894#include <limits.h>
2895#endif
6b5de50d
FC
2896#if HAVE_DB_185_H
2897#include <db_185.h>
2898#elif HAVE_DB_H
2899#include <db.h>
2900#endif])
2901
01b4931d 2902dnl 1.85
91983da0 2903SQUID_CHECK_DBOPEN_NEEDS_LIBDB
fcabe077 2904if test "x$ac_cv_dbopen_libdb" = "xyes"; then
32d0bbd7 2905 LIB_DB="-ldb"
2906fi
01b4931d 2907AC_SUBST(LIB_DB)
b7a1c19e 2908
77f675ad 2909dnl System-specific library modifications
2910dnl
2911case "$host" in
fcabe077
FC
2912 i386-*-solaris2.*)
2913 if test "x$GCC" = "xyes"; then
2914 AC_MSG_NOTICE([Removing -O for gcc on $host])
2915 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
2916 fi
2917 ;;
2918 *-sgi-irix*)
2919 AC_MSG_NOTICE([Removing -lsocket for IRIX...])
2920 LIBS=`echo $LIBS | sed -e s/-lsocket//`
2921 AC_MSG_NOTICE([Removing -lnsl for IRIX...])
2922 LIBS=`echo $LIBS | sed -e s/-lnsl//`
2923 ac_cv_lib_nsl_main=no
2924 AC_MSG_NOTICE([Removing -lbsd for IRIX...])
2925 LIBS=`echo $LIBS | sed -e s/-lbsd//`
2926 ;;
4ba0bd0e 2927dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
2928dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
2929dnl Please change your configure script. AIX doesn't need -lbsd.
fcabe077
FC
2930 *-ibm-aix*)
2931 AC_MSG_NOTICE([Removing -lbsd for AIX...])
2932 LIBS=`echo $LIBS | sed -e s/-lbsd//`
2933 AC_MSG_CHECKING(for aix xlc c++ comments support)
2934 AC_LANG_PUSH([C])
2935 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[//c++ cmt]])],
2936 [AIX_CPPCMT_SUPPORT=yes],[AIX_CPPCMT_SUPPORT=no])
2937 AC_MSG_RESULT($AIX_CPPCMT_SUPPORT)
2938 if test -n `echo $CC | grep cc` 2>/dev/null && \
2939 test -n `cc -qversion 2>/dev/null | grep "IBM XL C/C++ for AIX"` 2>/dev/null; then
2940 if test "$AIX_CPPCMT_SUPPORT"="no";then
2941 SQUID_CFLAGS="-qcpluscmt $SQUID_CFLAGS"
2942 fi
2943 fi
2944 AC_LANG_POP([C])
2945 ;;
2946 *m88k*)
2947 SQUID_CFLAGS="$SQUID_CFLAGS -D_SQUID_MOTOROLA_"
2948 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_SQUID_MOTOROLA_"
2949 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1,
2950 [If gettimeofday is known to take only one argument])
2951 ;;
2952 [*-*-solaris2.[0-4]])
2953 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
2954 ;;
2955 [*-sony-newsos[56]*])
2956 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
2957 ;;
2958 esac
090089c4 2959
57faa85a 2960# Remove optimization for GCC 2.95.[123]
d20b1cd0 2961# gcc -O[2] on *BSD and Linux (x86) causes pointers to magically become NULL
fcabe077 2962if test "x$GCC" = "xyes"; then
d20b1cd0 2963 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
2964 case "$GCCVER" in
57faa85a 2965 [2.95.[123]])
eed82608 2966 AC_MSG_NOTICE([Removing -O for gcc on $host with GCC $GCCVER])
d20b1cd0 2967 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
2968 ;;
2969 esac
2970fi
2971
176d10ee 2972# Recommended by Balint Nagy Endre <bne@CareNet.hu>
2973case "$host" in
fcabe077
FC
2974 *-univel-sysv4.2MP)
2975 if test `uname -v` = "2.03"; then
2976 AC_MSG_NOTICE([disabling mallinfo for $host])
2977 ac_cv_func_mallinfo=no
2978 fi
2979 ;;
176d10ee 2980esac
2981
84cecfd2 2982dnl This has to be before AC_CHECK_FUNCS
2983# Disable poll() on certain platforms. Override by setting ac_cv_func_poll
2984# when running configure.
fcabe077
FC
2985if test "x$ac_cv_func_poll" = "x" ; then
2986 case "$host" in
2987 [*-hp-hpux*.*])
2988 # Duane Wessels
2989 AC_MSG_NOTICE([disabling poll for $host...])
2990 ac_cv_func_poll='no'
2991 ;;
2992 [*-linux-*])
2993 # Henrik Nordstrom (hno@squid-cache.org) 19980817
2994 # poll is problematic on Linux. We disable it
2995 # by default until Linux gets it right.
2996 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
2997 if test $rev -lt 002002; then
2998 AC_MSG_NOTICE([disabling poll for $host < 2.2...])
2999 ac_cv_func_poll='no'
3000 fi
3001 ;;
3002 [powerpc-ibm-aix4.1.*])
3003 # Mike Laster (mlaster@metavillage.com) 19981021
3004 AC_MSG_NOTICE([disabling poll for $host...])
3005 ac_cv_func_poll='no'
3006 ;;
3007 [*-pc-sco3.2*])
3008 # Robert Side <rside@aiinc.bc.ca>
3009 # Mon, 18 Jan 1999 17:48:00 GMT
3010 AC_MSG_NOTICE([disabling poll for $host...])
3011 ac_cv_func_poll='no'
3012 ;;
3013 esac
84cecfd2 3014fi
176d10ee 3015
78a60bca
AJ
3016dnl Override statfs() detect on MinGW because it is emulated in source code
3017if test "x$squid_host_os" = "xmingw" ; then
fcabe077 3018 ac_cv_func_statfs='yes'
78a60bca 3019fi
08caf8c6 3020
6716b242 3021dnl Check for library functions
3022AC_CHECK_FUNCS(\
ce3d30fb 3023 backtrace_symbols_fd \
3a144521 3024 bcopy \
3025 bswap_16 \
3026 bswap_32 \
f9576890 3027 bswap16 \
3028 bswap32 \
4ac29a5b 3029 fchmod \
6716b242 3030 getdtablesize \
8505e57b 3031 getpagesize \
230c091c 3032 getpass \
3a144521 3033 getrlimit \
30a4f2a8 3034 getrusage \
9c1d8929 3035 getspnam \
379d5751 3036 gettimeofday \
52303a3d 3037 glob \
f9576890 3038 htobe16 \
3039 htole16 \
d474c7a6 3040 kqueue\
30a4f2a8 3041 lrand48 \
6716b242 3042 mallinfo \
0f5efab0 3043 mallocblksize \
6716b242 3044 mallopt \
2ae6b9b0 3045 memcpy \
30a4f2a8 3046 memmove \
dac27377 3047 memset \
b99a6dec 3048 mkstemp \
1812b6c7 3049 mktime \
88738790 3050 mstats \
84cecfd2 3051 poll \
62ae0622 3052 prctl \
3a144521 3053 pthread_attr_setschedparam \
cd748f27 3054 pthread_attr_setscope \
3055 pthread_setschedparam \
42b51993 3056 pthread_sigmask \
c68e9c6b 3057 putenv \
b1e77ec1 3058 random \
6716b242 3059 regcomp \
3060 regexec \
3061 regfree \
30a4f2a8 3062 res_init \
af76ec93 3063 __res_init \
4915be3b 3064 rint \
a4ba1105 3065 sbrk \
96c2bb61
AR
3066 sched_getaffinity \
3067 sched_setaffinity \
3a144521 3068 select \
234967c9 3069 seteuid \
c415c128 3070 setgroups \
30a4f2a8 3071 setpgrp \
6716b242 3072 setrlimit \
30a4f2a8 3073 setsid \
3074 sigaction \
11430c03 3075 snprintf \
1ccc0d40 3076 socketpair \
30a4f2a8 3077 srand48 \
b1e77ec1 3078 srandom \
0343b99c 3079 statfs \
6716b242 3080 sysconf \
3081 syslog \
234967c9 3082 timegm \
28da5e0d 3083 vsnprintf \
6716b242 3084)
f5e5c4cf 3085dnl ... and some we provide local replacements for
3086AC_REPLACE_FUNCS(\
3087 drand48 \
a98c2da5 3088 eui64_aton \
cc192b50 3089 inet_ntop \
3090 inet_pton \
f5e5c4cf 3091 initgroups \
cc192b50 3092 getaddrinfo \
3093 getnameinfo \
2ccf2eb2 3094 psignal \
f5e5c4cf 3095 strerror \
585cddda
AJ
3096 strsep \
3097 strtoll \
f5e5c4cf 3098 tempnam \
3099)
6716b242 3100
9676633b
FC
3101# Magic which checks whether we are forcing a type of comm loop we
3102# are actually going to (ab)use.
3103# Mostly ripped from squid-commloops, thanks to adrian and benno
1b3db6d9 3104
fcabe077 3105if test "x$squid_opt_io_loop_engine" != "x"; then
8075a4da 3106 AC_MSG_NOTICE([choosing user-specified net I/O API $squid_opt_io_loop_engine])
fcabe077 3107elif test "x$enable_epoll" != "xno" -a "x$squid_cv_epoll_works" = "xyes" ; then
8075a4da 3108 squid_opt_io_loop_engine="epoll"
fcabe077 3109elif test "x$enable_kqueue" != "xno" -a "x$ac_cv_func_kqueue" = "xyes" ; then
8075a4da 3110 squid_opt_io_loop_engine="kqueue"
a1ad2f9b
AJ
3111elif test "x$enable_devpoll" != "xno" ; then
3112 squid_opt_io_loop_engine="devpoll"
fcabe077 3113elif test "x$enable_poll" != "xno" -a "x$ac_cv_func_poll" = "xyes" ; then
8075a4da 3114 squid_opt_io_loop_engine="poll"
39145d19 3115elif test "x$enable_select" != "xno" -a "x$ac_cv_func_select" = "xyes"; then
8075a4da 3116 squid_opt_io_loop_engine="select"
39145d19
AJ
3117elif test "x$enable_select" != "xno" -a "x$squid_host_os" = "xmingw"; then
3118 squid_opt_io_loop_engine="select_win32"
1b3db6d9 3119else
a1ad2f9b 3120 AC_MSG_WARN([Eep! Cannot find epoll, kqueue, /dev/poll, poll or select!])
be0c7ff0 3121 AC_MSG_WARN([Will try select and hope for the best.])
8075a4da 3122 squid_opt_io_loop_engine="select"
1b3db6d9 3123fi
d474c7a6 3124
8075a4da 3125AC_MSG_NOTICE([Using ${squid_opt_io_loop_engine} for the IO loop.])
d474c7a6 3126
8075a4da
FC
3127AM_CONDITIONAL([USE_POLL], [test $squid_opt_io_loop_engine = poll])
3128AM_CONDITIONAL([USE_EPOLL], [test $squid_opt_io_loop_engine = epoll])
3129AM_CONDITIONAL([USE_SELECT], [test $squid_opt_io_loop_engine = select])
8075a4da
FC
3130AM_CONDITIONAL([USE_SELECT_WIN32], [test $squid_opt_io_loop_engine = select_win32])
3131AM_CONDITIONAL([USE_KQUEUE], [test $squid_opt_io_loop_engine = kqueue])
3132AM_CONDITIONAL([USE_DEVPOLL], [test $squid_opt_io_loop_engine = devpoll])
d474c7a6 3133
8075a4da 3134case $squid_opt_io_loop_engine in
0abb39dd 3135 epoll) AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop]) ;;
a1ad2f9b 3136 devpoll) AC_DEFINE(USE_DEVPOLL,1,[Use /dev/poll for the IO loop]) ;;
0abb39dd
FC
3137 poll) AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop]) ;;
3138 kqueue) AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop]) ;;
3139 select_win32) AC_DEFINE(USE_SELECT_WIN32,1,[Use Winsock select() for the IO loop]) ;;
3140 select) AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop]) ;;
d474c7a6 3141esac
1b3db6d9 3142
96c2bb61
AR
3143if test "x$ac_cv_func_sched_getaffinity" = "xyes" -a "x$ac_cv_func_sched_setaffinity" = "xyes" ; then
3144 AC_DEFINE(HAVE_CPU_AFFINITY,1,[Support setting CPU affinity for workers])
3145fi
3146
91983da0
FC
3147SQUID_CHECK_SETRESUID_WORKS
3148if test "x$squid_cv_resuid_works" = "xyes" ; then
be0c7ff0 3149 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 3150fi
60939927 3151
0abb39dd
FC
3152SQUID_CHECK_FUNC_STRNSTR
3153SQUID_CHECK_FUNC_VACOPY
3154SQUID_CHECK_FUNC___VACOPY
cee08cbc 3155
c3d0c8b5 3156
5cafc1d6 3157dnl IP-Filter support requires ipf header files. These aren't
3158dnl installed by default, so we need to check for them
fcabe077 3159if test "x$enable_ipf_transparent" != "xno" ; then
20ad76ab 3160 AC_MSG_CHECKING(for availability of IP-Filter header files)
42b51993 3161 # hold on to your hats...
fcabe077
FC
3162 if test "x$ac_cv_header_ip_compat_h" = "xyes" -o \
3163 "x$ac_cv_header_ip_fil_compat_h" = "xyes" -o \
3164 "x$ac_cv_header_netinet_ip_compat_h" = "xyes" -o \
3165 "x$ac_cv_header_netinet_ip_fil_compat_h" = "xyes" ; then
42b51993 3166 have_ipfilter_compat_header="yes"
3167 fi
fcabe077
FC
3168 if test "x$have_ipfilter_compat_header" = "xyes" -a \
3169 "x$ac_cv_header_ip_fil_h" = "xyes" -a \
3170 "x$ac_cv_header_ip_nat_h" = "xyes" ; then
1d26e252 3171 enable_ipf_transparent="yes"
fcabe077
FC
3172 elif test "x$have_ipfilter_compat_header" = "xyes" -a \
3173 "x$ac_cv_header_netinet_ip_fil_h" = "xyes" -a \
3174 "x$ac_cv_header_netinet_ip_nat_h" = "xyes" ; then
1d26e252 3175 enable_ipf_transparent="yes"
eb824054 3176 else
1d26e252 3177 enable_ipf_transparent="no"
5cafc1d6 3178 fi
3179 AC_MSG_RESULT($IPF_TRANSPARENT)
1d26e252
FC
3180fi
3181AC_MSG_NOTICE([IPF-based transparent proxying enabled: $enable_ipf_transparent])
0f658b5b 3182SQUID_DEFINE_BOOL(IPF_TRANSPARENT,$enable_ipf_transparent,
1d26e252
FC
3183 [Enable support for IPF-style transparent proxying])
3184
fcabe077 3185if test "x$enable_ipf_transparent" = "xyes" -a "x$squid_host_os" = "xsolaris" ; then
8f6ca20d 3186dnl On Solaris Ipfilter includes expect that SOLARIS2 is defined with the
3187dnl Solaris minor version (8, 9, 10, ...)
20ad76ab
FC
3188 solrev=`uname -r | sh -c 'IFS=. read j n x; echo $n'`
3189 CFLAGS="-DSOLARIS2=$solrev $CFLAGS"
3190 CXXFLAGS="-DSOLARIS2=$solrev $CXXFLAGS"
5cafc1d6 3191fi
3192
2b0dd4ac 3193dnl PF support requires a header file.
fcabe077
FC
3194if test "x$enable_pf_transparent" != "xno" ; then
3195 if test "x$ac_cv_header_net_pfvar_h" = "xyes" -o \
3196 "x$ac_cv_header_net_pf_pfvar_h" = "xyes"; then
3197 if test "x$enable_pf_transparent" = "xauto" ; then
3198 enable_pf_transparent="yes"
3199 fi
3200 else
3201 if test "x$enable_pf_transparent" = "xyes" ; then
38ff0a40 3202 AC_MSG_ERROR([PF-based transparent proxy requested but needed header not found])
fcabe077
FC
3203 fi
3204 enable_pf_transparent="no"
3205 fi
2b0dd4ac 3206fi
0f658b5b 3207SQUID_DEFINE_BOOL(PF_TRANSPARENT,$enable_pf_transparent,
38ff0a40 3208 [Enable support for PF-style transparent proxying])
2b0dd4ac 3209
fcabe077
FC
3210if test "x$enable_linux_netfilter" != "xno" ; then
3211 if test "x$ac_cv_header_linux_netfilter_ipv4_h" = "xyes"; then
3212 if test "x$enable_linux_netfilter" = "xauto" ; then
4bd144d2
FC
3213 enable_linux_netfilter=yes
3214 fi
3215 else
fcabe077 3216 if test "x$enable_linux_netfilter" = "xauto" ; then
4bd144d2 3217 enable_linux_netfilter=no
d852fbad 3218 else
4bd144d2 3219 AC_MSG_ERROR([Linux Netfilter support requested but needed headers not found])
d852fbad 3220 fi
4bd144d2 3221 fi
b50f1b2b 3222fi
0f658b5b 3223SQUID_DEFINE_BOOL(LINUX_NETFILTER,$enable_linux_netfilter,
969d4051 3224 [Enable support for Transparent Proxy on Linux via Netfilter])
20ad76ab 3225
b50f1b2b 3226dnl Netfilter TPROXY depends on libcap but the NAT parts can still work.
4bd144d2 3227AC_MSG_NOTICE([Support for Netfilter-based interception proxy requested: $enable_linux_netfilter])
fcabe077 3228if test "x$enable_linux_netfilter" = "xyes" -a "x$with_libcap" != "xyes" ; then
b50f1b2b
AJ
3229 AC_MSG_WARN([Missing needed capabilities (libcap or libcap2) for TPROXY])
3230 AC_MSG_WARN([Linux Transparent Proxy support WILL NOT be enabled])
3231 AC_MSG_WARN([Reduced support to Interception Proxy])
be0c7ff0 3232 # AC_DEFINEd later
96f08e2d
FC
3233fi
3234
0f13ff28 3235AC_CHECK_LIB(regex, regexec, [REGEXLIB="-lregex"],[REGEXLIB=''])
cc937513 3236AC_ARG_ENABLE(gnuregex,
a5eb3731
FC
3237 AS_HELP_STRING([--enable-gnuregex],
3238 [Compile GNUregex. Unless you have reason to use
cc937513
AJ
3239 this option, you should not enable it.
3240 This library file is usually only required on Windows and
3241 very old Unix boxes which do not have their own regex
0f13ff28
FC
3242 library built in.]), [
3243SQUID_YESNO([$enableval],[unrecognized argument to --enable-gnuregex: $enableval])
3244])
cdb352bb 3245# force-enable on old solaris and nextstep
fcabe077 3246if test "x${enable_gnuregex:=auto}" = "xauto" ; then
91bc414e 3247 case "$host" in
3248 *-sun-solaris2.[[0-4]])
0f13ff28 3249 enable_gnuregex="yes"
91bc414e 3250 ;;
3251 *-next-nextstep*)
0f13ff28 3252 enable_gnuregex="yes"
91bc414e 3253 ;;
3254 esac
3255fi
7a081912 3256
0f13ff28 3257# try detecting if it is needed
fcabe077 3258if test "x$enable_gnuregex" = "xauto" ; then
91983da0
FC
3259 SQUID_CHECK_REGEX_WORKS
3260 if test "x$squid_cv_regex_works" = "xyes" ; then
3261 enable_gnuregex=no
3262 else
3263 enable_gnuregex=yes
3264 fi
f49be7d1 3265fi
91983da0 3266AC_MSG_CHECKING(if GNUregex needs to be compiled)
0f13ff28 3267AC_MSG_RESULT($enable_gnuregex)
fcabe077 3268if test "x$enable_gnuregex" = "xyes"; then
0f13ff28
FC
3269 # for some reason (force-enable, test..) gnuregex was found as needed. Override any system lib
3270 REGEXLIB=""
80ab193b 3271fi
0f13ff28 3272#if no reason was found to enable gnuregex, disable it
fcabe077 3273if test "x$enable_gnuregex" = "xauto" ; then
0f13ff28 3274 enable_gnuregex=no
a4d7e961 3275fi
0f13ff28 3276SQUID_DEFINE_BOOL(USE_GNUREGEX,$enable_gnuregex,[Define if we should use GNU regex])
26675bf4 3277AC_SUBST(REGEXLIB)
a4d7e961 3278
8e0acaf5
FC
3279SQUID_DETECT_UDP_SND_BUFSIZE
3280SQUID_DETECT_UDP_RECV_BUFSIZE
3281SQUID_DETECT_TCP_SND_BUFSIZE
3282SQUID_DETECT_TCP_RECV_BUFSIZE
6bf65235 3283
5c3c56fa
FC
3284SQUID_CHECK_NEED_SYS_ERRLIST
3285SQUID_CHECK_MAXPATHLEN
cc192b50 3286
cdb352bb
FC
3287if test "x$squid_opt_use_dnsserver" = "xyes"; then
3288 SQUID_CHECK_LIBRESOLV_DNS_TTL_HACK
3289 SQUID_CHECK_RESOLVER_FIELDS
3290fi
cc192b50 3291
fcabe077 3292if test "x$ac_cv_header_sys_statvfs_h" = "xyes" ; then
bb214e97 3293 SQUID_CHECK_WORKING_STATVFS
c68e9c6b 3294fi
3295
c68e9c6b 3296
461b8219 3297dnl Squid will usually attempt to translate when packaging or building from VCS
461b8219 3298AC_ARG_ENABLE(translation,
62979ab1 3299 AS_HELP_STRING([--disable-translation],[Prevent Squid generating localized error page templates and manuals.
fb46b778
FC
3300 Which is usually tried, but may not be needed.]), [
3301SQUID_YESNO([$enableval],
3302 [unrecognized argument to --disable-translation: $enableval])
461b8219 3303])
e4b70b44 3304dnl Squid now has .po translation capability, given the right toolkit
fcabe077 3305if test "x${enable_translation:=yes}" = "xyes" ; then
461b8219
AJ
3306 AX_WITH_PROG([PO2HTML],[po2html])
3307else
3308 PO2HTML="off"
3309fi
3310AC_SUBST(PO2HTML)
ee1a8ac2 3311
43000484
AJ
3312dnl Squid now has limited locale handling ...
3313dnl on error pages
3314AC_ARG_ENABLE(auto-locale,
62979ab1 3315 AS_HELP_STRING([--disable-auto-locale],[This prevents Squid providing localized error pages based on the
21d5413e 3316 clients request headers.
fb46b778
FC
3317 When disabled Squid requires explicit language configuration.]), [
3318SQUID_YESNO([$enableval],
3319 [unrecognized argument to --disable-auto-locale: $enableval])
8db7a54b 3320])
fb46b778
FC
3321AC_MSG_NOTICE([Multi-Language support enabled: ${enable_auto_locale:=yes}])
3322SQUID_DEFINE_BOOL(USE_ERR_LOCALES,$enable_auto_locale,
3323 [Use multi-language support on error pages])
3324
43000484 3325
090089c4 3326dnl Need the debugging version of malloc if available
3327XTRA_OBJS=''
fcabe077 3328if test "x$ac_cv_lib_malloc_main" = "xyes" ; then
090089c4 3329 if test -r /usr/lib/debug/malloc.o ; then
3330 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
3331 fi
3332 if test -r /usr/lib/debug/mallocmap.o ; then
3333 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
3334 fi
3335fi
3336AC_SUBST(XTRA_OBJS)
3337
fcabe077 3338if test "x$XTRA_LIBS" = "x"; then
38fea766 3339 XTRA_LIBS="$LIBS"
0f5a16f8 3340 dnl minor cleanup
3341 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
38fea766 3342 LIBS=''
3343fi
090089c4 3344AC_SUBST(XTRA_LIBS)
3345
daed6927
FC
3346AC_SUBST(SQUID_CFLAGS)
3347AC_SUBST(SQUID_CXXFLAGS)
3348
90b412dd
AJ
3349AC_MSG_NOTICE([BUILD LIBRARIES: $LIBS])
3350AC_MSG_NOTICE([BUILD EXTRA LIBRARIES: $XTRA_LIBS])
3351AC_MSG_NOTICE([BUILD OBJECTS: $OBJS])
3352AC_MSG_NOTICE([BUILD EXTRA OBJECTS: $XTRA_OBJS])
3353AC_MSG_NOTICE([BUILD C FLAGS: $CFLAGS])
3354AC_MSG_NOTICE([BUILD EXTRA C FLAGS: $SQUID_CFLAGS])
3355AC_MSG_NOTICE([BUILD C++ FLAGS: $CXXFLAGS])
3356AC_MSG_NOTICE([BUILD EXTRA C++ FLAGS: $SQUID_CXXFLAGS])
daed6927 3357
090089c4 3358dnl Clean up after OSF/1 core dump bug
3359rm -f core
3360
6a9f6389 3361AC_CONFIG_FILES([\
a2794549 3362 Makefile \
eee95dfe 3363 compat/Makefile \
a2794549 3364 lib/Makefile \
7c16470c 3365 lib/ntlmauth/Makefile \
25f98340 3366 lib/profiler/Makefile \
7c16470c
AJ
3367 lib/rfcnb/Makefile \
3368 lib/smblib/Makefile \
a2794549 3369 scripts/Makefile \
a2794549 3370 src/Makefile \
5bd7a218 3371 src/base/Makefile \
bcf44a2c 3372 src/acl/Makefile \
a2794549 3373 src/fs/Makefile \
3374 src/repl/Makefile \
3375 src/auth/Makefile \
5fa840c3 3376 src/adaptation/Makefile \
1f3c65fc
AR
3377 src/adaptation/icap/Makefile \
3378 src/adaptation/ecap/Makefile \
04f55905 3379 src/comm/Makefile \
f99c2cfe 3380 src/esi/Makefile \
ee0927b6 3381 src/eui/Makefile \
663ff9aa 3382 src/icmp/Makefile \
4daaf3cb 3383 src/ident/Makefile \
f963428c 3384 src/ip/Makefile \
82b7abe3 3385 src/log/Makefile \
40daaeb8 3386 src/ipc/Makefile \
95d2589c 3387 src/ssl/Makefile \
8822ebee 3388 src/mgr/Makefile \
d6e3ad20 3389 src/snmp/Makefile \
a2794549 3390 contrib/Makefile \
3391 snmplib/Makefile \
3392 icons/Makefile \
3393 errors/Makefile \
1077c1b8 3394 test-suite/Makefile \
99db07b3 3395 doc/Makefile \
3faa6da8 3396 doc/manuals/Makefile \
0c510f3c 3397 helpers/Makefile \
3398 helpers/basic_auth/Makefile \
5a48ed18 3399 helpers/basic_auth/DB/Makefile \
c152a447 3400 helpers/basic_auth/fake/Makefile \
5a48ed18 3401 helpers/basic_auth/getpwnam/Makefile \
0c510f3c 3402 helpers/basic_auth/LDAP/Makefile \
3403 helpers/basic_auth/MSNT/Makefile \
5a48ed18 3404 helpers/basic_auth/MSNT-multi-domain/Makefile \
0c510f3c 3405 helpers/basic_auth/NCSA/Makefile \
5a48ed18 3406 helpers/basic_auth/NIS/Makefile \
0c510f3c 3407 helpers/basic_auth/PAM/Makefile \
bcf74be7 3408 helpers/basic_auth/POP3/Makefile \
5a48ed18
AJ
3409 helpers/basic_auth/RADIUS/Makefile \
3410 helpers/basic_auth/SASL/Makefile \
3411 helpers/basic_auth/SMB/Makefile \
3412 helpers/basic_auth/SSPI/Makefile \
0c510f3c 3413 helpers/digest_auth/Makefile \
89f77e43 3414 helpers/digest_auth/eDirectory/Makefile \
54e8823b 3415 helpers/digest_auth/file/Makefile \
56ff4687 3416 helpers/digest_auth/LDAP/Makefile \
0c510f3c 3417 helpers/ntlm_auth/Makefile \
75aa769b 3418 helpers/ntlm_auth/fake/Makefile \
3963d7b1 3419 helpers/ntlm_auth/smb_lm/Makefile \
bc25525a 3420 helpers/ntlm_auth/SSPI/Makefile \
6e785d85 3421 helpers/negotiate_auth/Makefile \
45b2de83 3422 helpers/negotiate_auth/kerberos/Makefile \
8eeb87e6 3423 helpers/negotiate_auth/SSPI/Makefile \
c6588c68 3424 helpers/external_acl/Makefile \
c152a447 3425 helpers/external_acl/AD_group/Makefile \
b283ea3f 3426 helpers/external_acl/eDirectory_userip/Makefile \
c152a447 3427 helpers/external_acl/file_userip/Makefile \
b1218840 3428 helpers/external_acl/kerberos_ldap_group/Makefile \
c152a447
AJ
3429 helpers/external_acl/LDAP_group/Makefile \
3430 helpers/external_acl/LM_group/Makefile \
74ab8d10 3431 helpers/external_acl/session/Makefile \
c6588c68 3432 helpers/external_acl/unix_group/Makefile \
736a9a4d 3433 helpers/external_acl/wbinfo_group/Makefile \
82b7abe3 3434 helpers/log_daemon/Makefile \
7ce3900c 3435 helpers/log_daemon/DB/Makefile \
82b7abe3 3436 helpers/log_daemon/file/Makefile \
fdbb3b19
AJ
3437 helpers/url_rewrite/Makefile \
3438 helpers/url_rewrite/fake/Makefile \
94ab55b0 3439 tools/Makefile
2ccf2eb2 3440 tools/purge/Makefile
53cbe3e4 3441])
43ae1d95 3442
377792e4 3443AC_CONFIG_SUBDIRS(lib/libTrie)
3444
3e7b6055 3445# must configure libltdl subdir unconditionally for "make distcheck" to work
081863f3 3446#AC_CONFIG_SUBDIRS(libltdl)
3e7b6055 3447
6a9f6389 3448AC_OUTPUT