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