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