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