]> git.ipfire.org Git - thirdparty/squid.git/blame - configure.in
Sanitized net I/O configuration
[thirdparty/squid.git] / configure.in
CommitLineData
e2716c57 1
090089c4 2dnl
262a0e14 3dnl $Id$
090089c4 4dnl
090089c4 5dnl
6dnl
62979ab1 7AC_INIT([Squid Web Proxy],[3.HEAD-BZR],[http://www.squid-cache.org/bugs/],[squid])
d966027f 8AC_PREREQ(2.61)
62979ab1 9AC_CONFIG_HEADERS([include/autoconf.h])
71b12d7c 10AC_CONFIG_AUX_DIR(cfgaux)
8d9ce05e 11AC_CONFIG_SRCDIR([src/main.cc])
189f1e66 12AM_INIT_AUTOMAKE([tar-ustar nostdinc])
c2720d44 13AC_REVISION($Revision$)dnl
a2794549 14AC_PREFIX_DEFAULT(/usr/local/squid)
246d7ffc 15AM_MAINTAINER_MODE
a2794549 16
fa522425 17m4_include([acinclude/squid-util.m4])
6a56798f
FC
18m4_include([acinclude/compiler-flags.m4])
19
63e02610 20PRESET_CFLAGS="$CFLAGS"
21PRESET_LDFLAGS="$LDFLAGS"
22
a2794549 23dnl Set default LDFLAGS
24if test -z "$LDFLAGS"; then
25 LDFLAGS="-g"
26fi
27
aff48cc8 28# Check for GNU cc
a2794549 29AC_PROG_CC
e6c4cdd6 30AM_PROG_CC_C_O
29b8d8d6 31AC_PROG_CXX
62979ab1 32AC_LANG([C++])
88d50a22 33AC_CANONICAL_HOST
3e7b6055 34
40503c27
FC
35AC_MSG_CHECKING([simplified host os])
36squid_host_os=`echo $host_os|sed 's/[0-9].*//'`
37squid_host_os_version=`echo $host_os|sed "s/$squid_host_os//"`
38AC_MSG_RESULT($squid_host_os (version $squid_host_os_version))
39# on windows squid_host_os is either mingw or cygwin, version is 32
40
aff48cc8
FC
41# test for programs
42AC_PROG_LIBTOOL
43AC_PROG_RANLIB
44AC_PROG_CPP
45AC_PROG_INSTALL
46AC_PROG_LN_S
47AC_PROG_EGREP
48
49AC_PATH_PROG(SH, sh, /bin/sh)
50AC_PATH_PROG(FALSE, false, /usr/bin/false)
51AC_PATH_PROG(TRUE, true, /usr/bin/true)
52AC_PATH_PROG(MV, mv, $FALSE)
53AC_PATH_PROG(MKDIR, mkdir, $FALSE)
54AC_PATH_PROG(LN, ln, cp)
55AC_PATH_PROG(CHMOD, chmod, $FALSE)
6d1c1ab1 56AC_PATH_PROG(TR, tr, $FALSE)
aff48cc8 57AC_PATH_PROG(RM, rm, $FALSE)
ffa3bad9 58AC_PATH_PROG(CPPUNITCONFIG, cppunit-config, false)
aff48cc8
FC
59dnl Libtool 2.2.6 requires: rm -f
60RM="$RM -f"
61
62AC_PATH_PROG(PERL, perl, none)
63if test "$ac_cv_path_PERL" = "none"; then
64 AC_MSG_FAILURE([Perl is required to compile Squid. Please install Perl and then re-run configure ])
65fi
07f370ee 66AC_PATH_PROG(POD2MAN, pod2man, $FALSE)
aff48cc8
FC
67
68dnl set $(AR)
69AC_PATH_PROG(AR, ar, $FALSE)
70AR_R="$AR r"
aff48cc8
FC
71AC_SUBST(AR_R)
72
f9d138eb 73
d1f95b42 74dnl Make the squid top srcdir available to sub-packages as --with-squid=PATH
fa6307ae 75ac_configure_args="$ac_configure_args --with-squid=$ac_abs_confdir"
d1f95b42 76
fa6307ae 77squid_opt_enable_werror="yes" # default
0b45d157
FC
78AC_ARG_ENABLE(strict-error-checking,
79 AS_HELP_STRING([--disable-strict-error-checking],[By default squid is compiled
80 with all possible static compiler error-checks enbled.
81 This flag disables the behavior]),
82[
83 if test "${enableval}" = "no"
84 then
fa6307ae 85 squid_opt_enable_werror="no"
0b45d157
FC
86 fi
87])
d1f95b42 88
f7baea2d 89use_loadable_modules=1
3e7b6055
AR
90AC_MSG_CHECKING(whether to use loadable modules)
91AC_ARG_ENABLE(loadable-modules,
62979ab1 92 AS_HELP_STRING([--disable-loadable-modules],[do not support loadable modules]) ,
3e7b6055
AR
93 [
94 case "${enableval}" in
95 yes) use_loadable_modules=yes ;;
96 no) use_loadable_modules=no ;;
97 *) AC_MSG_ERROR(bad value ${enableval} for --disable-loadable-modules) ;;
98 esac
99 AC_MSG_RESULT([$use_loadable_modules, explicitly])
100 ],
101 [
102 use_loadable_modules=yes;
103 AC_MSG_RESULT([$use_loadable_modules, implicitly])
104 ]
a7e513e9 105)
3e7b6055
AR
106
107AM_CONDITIONAL(USE_LOADABLE_MODULES, test $use_loadable_modules = yes)
108
109if test $use_loadable_modules = yes;
110then
111 AC_DEFINE(USE_LOADABLE_MODULES, 1, [Support Loadable Modules])
112 AC_ENABLE_SHARED
113else
114 AC_DISABLE_SHARED
115fi
116
117AC_LIBTOOL_DLOPEN
118if test $use_loadable_modules = yes;
119then
0fb3665c
AJ
120 dnl Linux LTDL v3-v7 macros assume the autoconf 2.62 variable top_build_prefix is defined
121 dnl But from autoconf 2.64 its called ac_top_build_prefix and not automatically added to the Makefile
122 top_build_prefix=${ac_top_build_prefix}
123 AC_SUBST(top_build_prefix)
124
3e7b6055
AR
125 AC_LIBLTDL_CONVENIENCE(lib/libLtdl)
126fi
f5691f9c 127AC_LTDL_DLLIB
3e7b6055
AR
128
129# Do we need these unconditionally for "make distcheck" to work?
130AC_SUBST(INCLTDL)
131AC_SUBST(LIBLTDL)
132
133if test $use_loadable_modules = yes;
134then
135 # Why is this needed? Should not libtool's AC_LIBTOOL_DLOPEN do that?
136 LIBADD_DL=${lt_cv_dlopen_libs}
137 AC_SUBST([LIBADD_DL])
138fi
139
88d50a22 140
07f370ee 141SQUID_CC_GUESS_VARIANT
fa6307ae 142SQUID_CC_GUESS_OPTIONS
f9d138eb 143
a2794549 144
00fa2c12 145REGEXLIB='' # -lregex
cc937513 146# LIBREGEX='' # libregex.a
090089c4 147
a2794549 148dnl find out the exe extension for this platform. If it's not empty, use it for CGI's as well.
149AC_EXEEXT
150AC_OBJEXT
151
152if test -z "$EXEEXT"; then
153 CGIEXT=".cgi"
154else
7aeb8001 155 # automake automatically adds .exe when installing binaries
156 CGIEXT=""
a2794549 157fi
7aeb8001 158AC_SUBST(CGIEXT)
a2794549 159
0e6d05ef 160dnl this should be expanded to a list of platform sensible support requirements.
161dnl (adding an option like --enable-cygwin-support doesn't make sense :]) - R Collins 2001
40503c27
FC
162AM_CONDITIONAL(ENABLE_WIN32SPECIFIC,[test "$squid_host_os" = "mingw" -o "$squid_host_os" = "cygwin"])
163AM_CONDITIONAL(USE_IPC_WIN32,[test "$squid_host_os" = "mingw"])
df087e68 164
40503c27 165if test $squid_host_os = "mingw"; then
4b26fae9 166 AC_PATH_PROG(WIN32_PSAPI, psapi.dll, none)
167 CFLAGS="$CFLAGS -mthreads"
168 CXXFLAGS="$CXXFLAGS -mthreads"
169 if test "$ac_cv_path_WIN32_PSAPI" = "none"; then
eed82608
AJ
170 AC_MSG_NOTICE([PSAPI.DLL is recommended to run Squid on Windows NT Platform])
171 AC_MSG_NOTICE([Please see PSAPI.DLL section on doc/win32-relnotes.html.])
4b26fae9 172 else
173 AC_DEFINE(HAVE_WIN32_PSAPI,1,[Define if you have PSAPI.DLL on Windows systems])
174 LIBS="$LIBS -lpsapi"
175 fi
790ebe36 176 MINGW_LIBS="-lmingwex"
177 AC_SUBST(MINGW_LIBS)
40503c27 178fi
4b26fae9 179
a26bdc75 180if test -z "$CACHE_HTTP_PORT"; then
181 CACHE_HTTP_PORT="3128"
182fi
183if test -z "$CACHE_ICP_PORT"; then
184 CACHE_ICP_PORT="3130"
185fi
a26bdc75 186
f4aaf39c 187dnl Substitutions
6a9f6389 188AC_DEFINE_UNQUOTED(CACHE_HTTP_PORT, $CACHE_HTTP_PORT,
189[What default TCP port to use for HTTP listening?])
58c1507a 190AC_SUBST(CACHE_HTTP_PORT)
6a9f6389 191AC_DEFINE_UNQUOTED(CACHE_ICP_PORT, $CACHE_ICP_PORT,
192[What default UDP port to use for ICP listening?])
f5e5c4cf 193AC_SUBST(CACHE_ICP_PORT)
090089c4 194
6a9f6389 195AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host",[Host type from configure])
30a4f2a8 196
6a9f6389 197AC_DEFINE_UNQUOTED(SQUID_CONFIGURE_OPTIONS, "$ac_configure_args", [configure command line used to configure Squid])
090089c4 198
5483d916 199CACHE_EFFECTIVE_USER="nobody"
200AC_ARG_WITH(default-user,
62979ab1 201 AS_HELP_STRING([--with-default-user=USER],[System user account for squid permissions. Default: nobody]),
5483d916 202 [ CACHE_EFFECTIVE_USER="$withval" ]
203)
204AC_SUBST(CACHE_EFFECTIVE_USER)
205
c8d2dc9b
AJ
206DEFAULT_LOG_DIR="$localstatedir/logs"
207AC_ARG_WITH(logdir,
62979ab1 208 AS_HELP_STRING([--with-logdir=PATH],[Default location for squid logs. default: $DEFAULT_LOG_DIR]),
c8d2dc9b
AJ
209 [ case $withval in
210 yes|no)
211 AC_MSG_ERROR( --with-logdir requires a directory PATH. --with-logdir=PATH )
212 ;;
213 *)
214 DEFAULT_LOG_DIR="$withval"
215 ;;
216 esac
217 ]
218)
219AC_SUBST(DEFAULT_LOG_DIR)
220
b1d38b05 221DEFAULT_PIDFILE="$localstatedir/run/squid.pid"
a7f6af35 222AC_ARG_WITH(pidfile,
e0eb5853
FC
223 AS_HELP_STRING([--with-pidfile=PATH],
224 [Default location for squid PID file. default: PREFIX/var/run/squid.pid]),
225[case $withval in
a7f6af35
AJ
226 yes|no)
227 AC_MSG_ERROR( --with-pidfile requires a file PATH. --with-pidfile=PATH )
228 ;;
229 *)
230 DEFAULT_PIDFILE="$withval"
231 ;;
232 esac
e0eb5853 233])
a7f6af35
AJ
234AC_SUBST(DEFAULT_PIDFILE)
235
4c43504f 236if test "$GCC" = "yes"; then
237 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
238 GCCVER2=`echo $GCCVER | awk '{print $1 * 100}'`
239 case "$host" in
240 i386-*-freebsd*)
241 if test $GCCVER2 -lt 300 ; then
eed82608 242 AC_MSG_FAILURE([GCC $GCCVER causes a coredump on $host. Try a more recent GCC version])
dd81cb63 243 sleep 5
4c43504f 244 fi
245 ;;
246 esac
247 unset GCCVER
248 unset GCCVER2
6bb3e7d4 249
4c43504f 250fi
251
30a4f2a8 252dnl Set Default CFLAGS
253if test -z "$PRESET_CFLAGS"; then
254 if test "$GCC" = "yes"; then
255 case "$host" in
97b12a5b 256 *-sun-sunos*)
30a4f2a8 257 # sunos has too many warnings for this to be useful
258 # motorola too
259 ;;
97b12a5b 260 *m88k*)
261 # Motorola cc/ld does not like -02 but is ok on -O
262 CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]/-O/'`
263 ;;
30a4f2a8 264 *)
fa6307ae 265 CFLAGS="$squid_cv_cc_option_wall $CFLAGS"
30a4f2a8 266 ;;
267 esac
81a820c6 268 else
269 case "$host" in
c415c128 270 *mips-sgi-irix6.*)
81a820c6 271 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
fa6307ae 272 CFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \
776b0191 273 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
81a820c6 274 -Wl,-woff,85,-woff,84,-woff,134 \
63e02610 275 -nostdinc -I/usr/include -D_BSD_SIGNALS $CFLAGS"
fa6307ae 276 CXXFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \
776b0191 277 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
278 -Wl,-woff,85,-woff,84,-woff,134 \
279 -nostdinc -I/usr/include -D_BSD_SIGNALS $CXXFLAGS"
81a820c6 280 ;;
e8f5fb18 281 alpha-dec-osf4.*)
553c24ae 282 # Mogul says DEC compilers take both -g and -O2
b6a2f15e 283 CFLAGS=`echo $CFLAGS | sed -e 's/-g/-g3/'`
fa6307ae 284 CFLAGS="$squid_cv_cc_option_optimize $CFLAGS"
553c24ae 285 ;;
81a820c6 286 *)
287 ;;
288 esac
30a4f2a8 289 fi
30a4f2a8 290fi
291
d2e3605e 292dnl set squid required flags
293if test "$GCC" = "yes"; then
9f68fb10 294dnl Guido Serassio (serassio@squid-cache.org) 20070811
295dnl Using the latest MinGW (gcc 3.4.5 + mingw-runtime 3.13) cannot build with
0a13cc9d 296dnl -Werror -Wmissing-prototypes -Wmissing-declarations
9f68fb10 297dnl TODO: check if the problem will be present in any other newer MinGW release.
298 case "$host_os" in
299 mingw|mingw32)
fa6307ae 300 SQUID_CFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wcomments"
9f68fb10 301 ;;
302 *)
fa6307ae 303 SQUID_CFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wcomments"
9f68fb10 304 ;;
305 esac
fa6307ae 306 SQUID_CXXFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wcomments"
d2e3605e 307else
9f68fb10 308 SQUID_CFLAGS=
309 SQUID_CXXFLAGS=
d2e3605e 310fi
07f370ee 311
fa6307ae 312if test "$squid_opt_enable_werror" = "no"
07f370ee
FC
313then
314 SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_option_werror"
315 SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cc_option_werror"
316fi
317
d2e3605e 318AC_SUBST(SQUID_CFLAGS)
319AC_SUBST(SQUID_CXXFLAGS)
320
07f370ee
FC
321SQUID_CXX_CHECK_ARG_FHUGEOBJECTS
322if test "$squid_cv_cxx_arg_fhugeobjects" = "yes"; then
6a56798f
FC
323 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -fhuge-objects"
324fi
e0eb5853
FC
325# squid_cv_cc_arg_pipe is set by SQUID_CC_GUESS_OPTIONS
326SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cc_arg_pipe"
327SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_arg_pipe"
2060fa9a 328
6c0c04db 329SquidInline="yes"
83079644 330
331AC_ARG_ENABLE(optimizations,
ffa3bad9
FC
332 AS_HELP_STRING([--disable-optimizations],
333 [Don't compile Squid with compiler optimizations enabled.
a2f6a96c
FC
334 Optimization is good for production builds, but not
335 good for debugging. During development, use
336 --disable-optimizations to reduce compilation times
337 and allow easier debugging. This option implicitly
338 also enabled --disable-inline]),
83079644 339[ if test "$enableval" = "no" ; then
eed82608 340 AC_MSG_NOTICE([Disabling compiler optimizations (-O flag)])
83079644 341 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
342 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-O[[0-9]]*//'`"
343 SquidInline="no"
344 fi
345])
346
ffa3bad9 347AH_TEMPLATE(_USE_INLINE_,[Include inline methods into header file])
6c0c04db 348AC_ARG_ENABLE(inline,
62979ab1 349 AS_HELP_STRING([--disable-inline],[Don't compile trivial methods as inline. Squid
a2f6a96c
FC
350 is coded with much of the code able to be inlined.
351 Inlining is good for production builds, but not
352 good for development. During development, use
353 --disable-inline to reduce compilation times and
354 allow incremental builds to be quick. For
355 production builds, or load tests, use
356 --enable-inline to have squid make all trivial
357 methods inlinable by the compiler.]),
6c0c04db 358[ if test "$enableval" = "no" ; then
359 SquidInline="no"
360 fi
361])
362
363if test "$SquidInline" = "yes" ; then
364 AC_DEFINE(_SQUID_INLINE_, inline, [Keyword used by squid for inlining methods])
ffa3bad9 365 AC_DEFINE(_USE_INLINE_, 1 , [Include inline methods into header file])
6c0c04db 366else
eed82608 367 AC_MSG_NOTICE([Inlining optimization disabled])
ffa3bad9 368 AC_DEFINE(_SQUID_INLINE_,[], [Keyword used by squid for inlining methods])
6c0c04db 369fi
370
0d00c98b 371AH_TEMPLATE(CBDATA_DEBUG,[Enable for cbdata debug information])
fa80a8ef 372AC_ARG_ENABLE(debug-cbdata,
62979ab1 373 AS_HELP_STRING([--enable-debug-cbdata],[Provide some debug information in cbdata]),
fa80a8ef 374[ if test "$enableval" = "yes" ; then
eed82608 375 AC_MSG_NOTICE([cbdata debugging enabled])
0d00c98b 376 AC_DEFINE(CBDATA_DEBUG,1)
fa80a8ef 377 fi
378])
379
c9267250
AJ
380dnl Nasty hack to get autoconf 2.64 on Linux to run.
381dnl all other uses of RUN_IFELSE are wrapped inside CACHE_CHECK which breaks on 2.64
382AC_RUN_IFELSE([AC_LANG_SOURCE([[ int main(int argc, char **argv) { return 0; } ]])],[],[],[])
383
0961c811 384dnl This is a developer only option.. developers know how to set defines
385dnl
386dnl AC_ARG_ENABLE(xmalloc-debug,
387dnl [ --enable-xmalloc-debug Do some simple malloc debugging],
388dnl [ if test "$enableval" = "yes" ; then
eed82608 389dnl AC_MSG_NOTICE([malloc debugging enabled])
6a9f6389 390dnl AC_DEFINE(XMALLOC_DEBUG,1,[Define to do simple malloc debugging])
0961c811 391dnl fi
392dnl ])
393
394dnl This is a developer only option.. developers know how to set defines
395dnl
396dnl AC_ARG_ENABLE(xmalloc-debug-trace,
397dnl [ --enable-xmalloc-debug-trace
398dnl Detailed trace of memory allocations],
399dnl [ if test "$enableval" = "yes" ; then
eed82608 400dnl AC_MSG_NOTICE([malloc debug trace enabled])
6a9f6389 401dnl AC_DEFINE(XMALLOC_TRACE,1,[Define to have a detailed trace of memory allocations])
402dnl AC_DEFINE(XMALLOC_DEBUG,1)
0961c811 403dnl fi
404dnl ])
e5f4e1b0 405
0d00c98b 406AH_TEMPLATE(XMALLOC_STATISTICS,[Define to have malloc statistics])
d9180414 407AC_ARG_ENABLE(xmalloc-statistics,
62979ab1 408 AS_HELP_STRING([--enable-xmalloc-statistics],[Show malloc statistics in status page]),
e5f4e1b0 409[ if test "$enableval" = "yes" ; then
eed82608 410 AC_MSG_NOTICE([malloc statistics enabled])
0d00c98b 411 AC_DEFINE(XMALLOC_STATISTICS,1)
e5f4e1b0 412 fi
413])
414
f85c88f3 415AC_ARG_WITH(aufs-threads,
62979ab1 416 AS_HELP_STRING([--with-aufs-threads=N_THREADS],[Tune the number of worker threads for the aufs object store.]),
a3310b77 417[ case $withval in
418 [[0-9]]*)
50fbcbd6 419 squid_opt_aufs_threads=$withval
a3310b77 420 ;;
421 *)
8b0d8e31 422 AC_MSG_ERROR(--with-aufs-threads expects a numeric argument)
a3310b77 423 ;;
424 esac
425])
50fbcbd6
FC
426if test "$squid_opt_aufs_threads"; then
427 AC_MSG_NOTICE([With $squid_opt_aufs_threads aufs threads])
428 AC_DEFINE_UNQUOTED(AUFS_IO_THREADS,$squid_opt_aufs_threads,
6a9f6389 429 [Defines how many threads aufs uses for I/O])
cd748f27 430fi
431
50fbcbd6 432AC_ARG_WITH(dl, AS_HELP_STRING([--with-dl],[Use dynamic linking]))
8154dd82 433if test "$with_dl" = "yes"; then
eed82608 434 AC_MSG_NOTICE([With dl])
8154dd82 435fi
f85c88f3 436
d235bc84 437AC_MSG_CHECKING([for DiskIO modules to be enabled])
50fbcbd6
FC
438squid_disk_module_candidates=""
439squid_opt_enable_diskio=auto #values: 0(no), 1(yes), "auto"(=yes+detect modules)
2513178d 440AC_ARG_ENABLE(disk-io,
50fbcbd6
FC
441 AS_HELP_STRING([--enable-disk-io="list of modules"],
442 [Build support for the list of disk I/O modules.
443 Set without a value or omitted, all available modules will be built.
444 See src/DiskIO for a list of available modules, or
445 Programmers Guide section on DiskIO
446 for details on how to build your custom disk module]),
2513178d
AJ
447[ case $enableval in
448 yes)
50fbcbd6 449 #do nothing, "auto" is ok
2513178d
AJ
450 ;;
451 no)
50fbcbd6 452 squid_opt_enable_diskio=0
2513178d
AJ
453 ;;
454 *)
50fbcbd6
FC
455 squid_opt_enable_diskio=1
456 squid_disk_module_candidates=" `echo $enableval| sed -e 's/,/ /g;s/ */ /g'` "
d235bc84 457 SQUID_CLEANUP_MODULES_LIST([squid_disk_module_candidates])
2513178d
AJ
458 ;;
459 esac
50fbcbd6
FC
460])
461
d235bc84 462# if requested to autodetect, find out what we have
50fbcbd6
FC
463if test $squid_opt_enable_diskio = "auto"; then
464 squid_opt_enable_diskio=1
50fbcbd6 465 SQUID_LOOK_FOR_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates])
50fbcbd6 466fi
d235bc84
FC
467
468AC_MSG_RESULT([${squid_disk_module_candidates_output:-none}])
dc299f29 469SQUID_CHECK_EXISTING_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates])
50fbcbd6
FC
470AC_DEFINE_UNQUOTED([USE_DISKIO],[$squid_opt_enable_diskio],
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
2513178d
AJ
492 if test "$module" = "none"; then
493 continue
494 fi
495 if ! test -d $srcdir/src/DiskIO/$module; then
496 AC_MSG_ERROR(disk-io $module does not exist)
497 fi
498 case "$module" in
499 DiskDaemon)
6312592e 500 AC_MSG_NOTICE([Enabling DiskDaemon DiskIO module])
2513178d
AJ
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 ;;
506 DiskThreads)
ffa3bad9 507 squid_opt_use_diskthreads="yes"
6312592e 508 LIBPTHREADS=
0b163dbb 509 SQUID_STATE_SAVE([diskthreads_state],[SQUID_CFLAGS SQUID_CXXFLAGS])
6312592e
AJ
510 if test "$with_pthreads" != "no"; 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
0b163dbb
FC
514 case "$squid_host_os" in
515 mingw)
6312592e
AJ
516 USE_AIOPS_WIN32=1
517 AC_MSG_NOTICE([Windows threads support automatically enabled])
518 ;;
0b163dbb 519 freebsd)
6312592e
AJ
520 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
521 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
0b163dbb
FC
522 if test "$GCC" = "yes" -a -z "$PRESET_LDFLAGS" ; then
523 LDFLAGS="$LDFLAGS -pthread"
6312592e
AJ
524 fi
525 ;;
0b163dbb 526 solaris)
6312592e
AJ
527 if test "$GCC" = "yes" ; then
528 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT -pthreads"
529 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT -pthreads"
ffa3bad9 530 AC_CHECK_LIB(pthread, pthread_create ,[LIBPTHREADS="-lpthread"],
6312592e 531 [ AC_MSG_NOTICE(pthread library required but cannot be found.)
ffa3bad9 532 squid_opt_use_diskthreads="no"
6312592e
AJ
533 ])
534 else
535 dnl test for -lpthread first. libc version is a stub apparently on Solaris.
536 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT -lpthread"
537 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT -lpthread"
40503c27
FC
538 AC_SEARCH_LIBS([pthread_create],[pthread thread],[
539 LIBPTHREADS="" #in LIBS
540 ],[
541 AC_MSG_NOTICE(pthread library required but cannot be found.)
542 squid_opt_use_diskthreads="no"
543 ])
6312592e
AJ
544 fi
545 ;;
546 *)
547 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
548 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
0b163dbb 549 AC_CHECK_LIB(pthread, pthread_create ,[LIBPTHREADS="-lpthread"],
6312592e 550 [ AC_MSG_NOTICE(pthread library required but cannot be found.)
ffa3bad9 551 squid_opt_use_diskthreads="no"
6312592e
AJ
552 ])
553 ;;
554 esac
2513178d 555 else
6312592e 556 AC_MSG_NOTICE([Native pthreads support manually disabled.])
ffa3bad9 557 squid_opt_use_diskthreads="no"
2513178d 558 fi
ffa3bad9 559 if test "$squid_opt_use_diskthreads" = "yes" ; then
6312592e 560 AC_DEFINE(USE_DISKIO_DISKTHREADS, 1, [Whether pthreads support is needed. Automatic])
2513178d 561 AC_MSG_NOTICE([Enabling DiskThreads DiskIO module])
e2716c57
HN
562 DISK_LIBS="$DISK_LIBS libDiskThreads.a"
563 DISK_OS_LIBS="$DISK_OS_LIBS $LIBPTHREADS"
2513178d
AJ
564 DISK_MODULES="$DISK_MODULES DiskThreads"
565 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/DiskThreads/DiskThreadsDiskIOModule.o"
566 else
6312592e
AJ
567 AC_DEFINE(USE_DISKIO_DISKTHREADS, 0, [Whether pthreads support is needed. Automatic])
568 AC_MSG_NOTICE([Native pthreads support disabled. DiskThreads module automaticaly disabled.])
0b163dbb 569 SQUID_STATE_ROLLBACK([diskthreads_state])
2513178d
AJ
570 fi
571 ;;
572
573 AIO)
2513178d 574 dnl Check for POSIX AIO availability
ffa3bad9 575 squid_opt_use_aio="yes"
46577dd1 576 AIOLIB=
2513178d
AJ
577 if test "$with_aio" != "no"; then
578 have_aio_header=no
579 AC_CHECK_HEADERS(aio.h,[have_aio_header=yes])
580 dnl On some systems POSIX AIO functions are in librt
581 dnl On some systems POSIX AIO functions are in libaio
46577dd1 582 AC_CHECK_LIB(rt,aio_read,[AIOLIB="-lrt"],AC_CHECK_LIB(aio,aio_read,[AIOLIB="-laio"],[]))
2513178d 583 dnl Enable AIO if the library and headers are found
46577dd1 584 if test "$AIOLIB" != "" && test "$have_aio_header" = "yes"; then
2513178d 585 AC_MSG_NOTICE([Native POSIX AIO support detected.])
ffa3bad9 586 squid_opt_use_aio="yes"
2513178d
AJ
587 else
588 dnl Windows does things differently. We provide wrappers.
589 dnl TODO: Windows really needs its own DiskIO module or its Overlaped IO
590 case "$host_os" in
591 mingw|mingw32)
ffa3bad9 592 squid_opt_use_aio="yes"
2513178d
AJ
593 AC_MSG_NOTICE([Windows being built. Maybe-enable POSIX AIO.])
594 ;;
595 *)
596 AC_MSG_NOTICE([Native POSIX AIO support not detected. AIO automatically disabled.])
ffa3bad9 597 squid_opt_use_aio="no"
2513178d
AJ
598 ;;
599 esac
600 fi
601 else
602 AC_MSG_NOTICE([POSIX AIO support manually disabled.])
ffa3bad9 603 squid_opt_use_aio="no"
2513178d
AJ
604 fi
605 dnl Use the POSIX AIO pieces if we actually need them.
ffa3bad9 606 if test "$squid_opt_use_aio" = "yes" ; then
2513178d
AJ
607 AC_DEFINE(USE_DISKIO_AIO, 1, [Whether POSIX AIO support is needed. Automatic])
608 DISK_MODULES="$DISK_MODULES AIO"
46577dd1 609 DISK_LIBS="$DISK_LIBS libAIO.a"
2513178d
AJ
610 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/AIO/AIODiskIOModule.o"
611 case "$host_os" in
612 mingw|mingw32)
613 USE_AIO_WIN32=1
614 AC_MSG_NOTICE([Replacing AIO DiskIO module with: Windows overlapped I/O support])
615 ;;
616 *)
617 AC_MSG_NOTICE([Enabling AIO DiskIO module])
e2716c57 618 DISK_OS_LIBS="$DISK_OS_LIBS $AIOLIB"
2513178d
AJ
619 ;;
620 esac
621 else
622 AC_MSG_NOTICE([AIO DiskIO Module disabled. Missing POSIX AIO support.])
623 fi
624 ;;
625
626 Blocking)
2513178d
AJ
627 AC_MSG_NOTICE([Enabling Blocking DiskIO module])
628 DISK_LIBS="$DISK_LIBS libBlocking.a"
629 DISK_MODULES="$DISK_MODULES Blocking"
630 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/Blocking/BlockingDiskIOModule.o"
631 ;;
632
633 *)
634 AC_MSG_NOTICE([Enabling $module DiskIO module])
635 DISK_LIBS="$DISK_LIBS lib${module}.a"
636 DISK_MODULES="$DISK_MODULES ${module}"
637 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/${module}/${module}DiskIOModule.o"
638 ;;
639 esac
640done
641AC_MSG_NOTICE([IO Modules built: $DISK_MODULES])
642AC_SUBST(DISK_MODULES)
643AC_SUBST(DISK_LIBS)
644AC_SUBST(DISK_PROGRAMS)
645AC_SUBST(DISK_LINKOBJS)
e2716c57 646AC_SUBST(DISK_OS_LIBS)
2513178d
AJ
647AM_CONDITIONAL([USE_AIOPS_WIN32], [test "$USE_AIOPS_WIN32" = 1])
648AM_CONDITIONAL([USE_AIO_WIN32], [test "$USE_AIO_WIN32" = 1])
649
650
651dnl Check what Storage formats are wanted.
652dnl This version will error out with a message saying why if a required DiskIO is missing.
dc299f29 653squid_opt_enable_storeio=auto
d235bc84
FC
654AC_ARG_ENABLE([storeio],
655 AS_HELP_STRING([--enable-storeio="list of modules"],
656 [Build support for the list of store I/O modules.
18cc92fb
FC
657 The default is only to build the "ufs" module.
658 See src/fs for a list of available modules, or
659 Programmers Guide section <not yet written>
660 for details on how to build your custom store module]),
cd748f27 661[ case $enableval in
662 yes)
dc299f29 663 squid_opt_enable_storeio=auto
cd748f27 664 ;;
665 no)
dc299f29 666 squid_opt_enable_storeio=no
cd748f27 667 ;;
1c690e30 668 *)
dc299f29 669 squid_opt_enable_storeio=yes
d235bc84 670 squid_storeio_module_candidates="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
80f756db
FC
671 # ufs is really always needed as it has low-level routines
672 # if it's a dupe it will be cleaned-up later
673 squid_storeio_module_candidates="$squid_storeio_module_candidates ufs"
cd748f27 674 ;;
675 esac
cd748f27 676])
dc299f29
FC
677if test "$squid_opt_enable_storeio" = "auto"; then
678 squid_opt_enable_storeio=yes
d235bc84
FC
679 AC_MSG_CHECKING([for available StoreIO modules])
680 SQUID_LOOK_FOR_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
defb3257 681 # disable coss
7eb77a5f 682 squid_storeio_module_candidates=`echo $squid_storeio_module_candidates|sed 's/coss//'`
d235bc84
FC
683 AC_MSG_RESULT([$squid_storeio_module_candidates])
684fi
685
dc299f29
FC
686SQUID_CLEANUP_MODULES_LIST([squid_storeio_module_candidates])
687SQUID_CHECK_EXISTING_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
688AC_MSG_NOTICE([Store modules built: $squid_storeio_module_candidates])
689
690for fs in $squid_storeio_module_candidates none; do
8154dd82 691 case "$fs" in
692 diskd)
80f756db
FC
693 if test "$squid_disk_module_candidates_Blocking" != "yes" -a \
694 "$squid_disk_module_candidates_DiskDaemon" != "yes" ; then
695 AC_MSG_ERROR([Storage diskd module requires DiskIO module: Blocking or DiskDaemon])
2513178d 696 fi
8154dd82 697 ;;
698 aufs)
80f756db
FC
699 if test "$squid_disk_module_candidates_Blocking" != "yes" -a \
700 "$squid_disk_module_candidates_DiskThreads" != "yes" ; then
701 AC_MSG_ERROR([Storage module aufs requires DiskIO module: Blocking or DiskThreads])
2513178d 702 fi
8154dd82 703 ;;
704 coss)
dc299f29
FC
705 AC_MSG_WARN([COSS Support is not stable yet in Squid-3. Please do not use.\a])
706 sleep 10
707 if ! test "$squid_disk_module_candidates_AIO" = "yes"; then
2513178d
AJ
708 AC_MSG_ERROR([COSS requires POSIX AIO which is not available.])
709 fi
3256ae73 710 dnl
711 dnl Automake om MinGW needs explicit exe extension
712 dnl for STORE_TESTS substition
713 dnl
082a5e7a 714 STORE_TESTS="$STORE_TESTS tests/testCoss$EXEEXT"
715 ;;
d3b3ab85 716 ufs)
082a5e7a 717 STORE_TESTS="$STORE_TESTS tests/testUfs$EXEEXT"
8154dd82 718 esac
a2794549 719done
d3b3ab85 720
6d1c1ab1 721dnl TODO: FIXME What are those for? They seem to be never be defined. Kinkie
7b5b7ba8
CT
722AH_TEMPLATE(HAVE_FS_UFS, "Define to 1 if ufs filesystem module is build")
723AH_TEMPLATE(HAVE_FS_AUFS, "Define to 1 if aufs filesystem module is build")
724AH_TEMPLATE(HAVE_FS_DISKD, "Define to 1 if diskd filesystem module is build")
725AH_TEMPLATE(HAVE_FS_COSS, "Define to 1 if coss filesystem module is build")
726
727
dc299f29 728dnl got final squid_storeio_module_candidates, build library lists
b66455ff
AR
729dnl This list will not be needed when each fs library has its own Makefile
730STORE_LIBS_TO_BUILD=
731dnl File system libraries to link executables with.
732dnl These are the same as STORE_LIBS_TO_BUILD, but with a path
733STORE_LIBS_TO_ADD=
dc299f29 734for fs in $squid_storeio_module_candidates; do
7b5b7ba8
CT
735 STORE_LIBS_TO_BUILD="$STORE_LIBS_TO_BUILD lib${fs}.la"
736 STORE_LIBS_TO_ADD="$STORE_LIBS_TO_ADD fs/lib${fs}.la"
6d1c1ab1
FC
737 SQUID_TOUPPER_VAR_CONTENTS([fs])
738 AC_DEFINE_UNQUOTED(HAVE_FS_${fs}, 1)
b66455ff
AR
739done
740
741AC_SUBST(STORE_LIBS_TO_BUILD)
742AC_SUBST(STORE_LIBS_TO_ADD)
082a5e7a 743AC_SUBST(STORE_TESTS)
a2794549 744
24a04df9
AJ
745
746dnl At lest one removal policy is always needed.
747dnl 'lru' removal policy is currently hard-coded by name for tests
748dnl so we must set it as default.
749REPL_POLICIES="lru"
d9180414 750AC_ARG_ENABLE(removal-policies,
56ffc413
FC
751 AS_HELP_STRING([--enable-removal-policies="list of policies"],
752 [Build support for the list of removal policies.
18cc92fb
FC
753 The default is only to build the "lru" module.
754 See src/repl for a list of available modules, or
755 Programmers Guide section 9.9 for details on how
756 to build your custom policy]),
6a566b9c 757[ case $enableval in
758 yes)
5069fb38 759 SQUID_LOOK_FOR_MODULES([$srcdir/src/repl],[REPL_POLICIES])
6a566b9c 760 ;;
761 no)
762 ;;
1c690e30 763 *)
764 REPL_POLICIES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
6a566b9c 765 ;;
766 esac
6a566b9c 767])
1c690e30 768if test -n "$REPL_POLICIES"; then
56ffc413 769 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/repl],[REPL_POLICIES])
5069fb38 770 AC_MSG_NOTICE([Removal policies to build: $REPL_POLICIES])
1c690e30 771 REPL_OBJS="repl/lib`echo $REPL_POLICIES|sed -e 's% %.a repl/lib%g'`.a"
772 REPL_LIBS="`echo $REPL_OBJS|sed -e 's%repl/%%g'`"
773fi
6a566b9c 774AC_SUBST(REPL_POLICIES)
6a566b9c 775AC_SUBST(REPL_OBJS)
f71946fc 776AC_SUBST(REPL_LIBS)
6a566b9c 777
d1da2d1f 778AM_CONDITIONAL(ENABLE_PINGER, false)
e5f4e1b0 779AC_ARG_ENABLE(icmp,
62979ab1 780 AS_HELP_STRING([--enable-icmp],[Enable ICMP pinging and Network Measurement]),
e5f4e1b0 781[ if test "$enableval" = "yes" ; then
eed82608 782 AC_MSG_NOTICE([ICMP enabled])
8e62bf65 783 AC_DEFINE(USE_ICMP,1,[Define to use Squid's ICMP and Network Measurement features (highly recommended!)])
d1da2d1f 784 AM_CONDITIONAL(ENABLE_PINGER, true)
e5f4e1b0 785 fi
786])
787
a2794549 788AM_CONDITIONAL(USE_DELAY_POOLS, false)
d9180414 789AC_ARG_ENABLE(delay-pools,
62979ab1 790 AS_HELP_STRING([--enable-delay-pools],[Enable delay pools to limit bandwidth usage]),
e5f4e1b0 791[ if test "$enableval" = "yes" ; then
eed82608 792 AC_MSG_NOTICE([Delay pools enabled])
6a9f6389 793 AC_DEFINE([DELAY_POOLS],1,[Traffic management via "delay pools".])
794 AM_CONDITIONAL(USE_DELAY_POOLS, true,)
e5f4e1b0 795 fi
796])
797
5fa840c3 798dnl disable generic/common adaptation support by default
5069fb38 799squid_opt_use_adaptation=no
5fa840c3 800
5069fb38 801squid_opt_use_esi=yes
7eb77a5f
FC
802AH_TEMPLATE([USE_SQUID_ESI],
803 [Define to enable the ESI processor and Surrogate header support])
43ae1d95 804AC_ARG_ENABLE(esi,
7eb77a5f 805 AS_HELP_STRING([--enable-esi],
5069fb38 806 [Enable ESI for accelerators. Benefits from expat or libxml2.
7eb77a5f 807 Enabling ESI will cause squid reverse proxies to be capable
5069fb38
FC
808 of the Edge Acceleration Specification (www.esi.org).]),
809 [squid_opt_use_esi=$enableval], [squid_opt_use_esi=no])
88bfe098
AJ
810HAVE_LIBEXPAT=0
811EXPATLIB=
812HAVE_LIBXML2=0
813XMLLIB=
5069fb38 814if test "$squid_opt_use_esi" = "yes" ; then
3473acb1 815 AC_MSG_NOTICE([Enabling ESI processor and Surrogate header support.])
7eb77a5f
FC
816 AC_DEFINE(USE_SQUID_ESI,1,
817 [Compile the ESI processor and Surrogate header support])
818else
819 AC_MSG_NOTICE([Disabling ESI processor])
820fi
88bfe098 821
7eb77a5f
FC
822# ESI support libraries: expat
823AC_ARG_WITH(expat, AS_HELP_STRING([--without-expat],[Do not use expat for ESI. Default: auto-detect]))
5069fb38 824if test "$squid_opt_use_esi" = "yes" -a "$with_expat" != "no" ; then
7eb77a5f
FC
825 AC_CHECK_LIB([expat], [main], [EXPATLIB="-lexpat"; HAVE_LIBEXPAT=1])
826 AC_CHECK_HEADERS([expat.h])
827 AC_DEFINE_UNQUOTED(HAVE_LIBEXPAT, $HAVE_LIBEXPAT, [Define to 1 if you have the expat library])
828 if test "$with_expat" = "yes" && test "$HAVE_LIBEXPAT" != "1" ; then
829 AC_MSG_ERROR([Required library expat is not able to be found.])
23df48fd 830 fi
7eb77a5f 831fi
ad32c661 832
7eb77a5f 833AC_ARG_WITH(libxml2, AS_HELP_STRING([--without-libxml2],[Do not use libxml2 for ESI. Default: auto-detect]))
5069fb38 834if test "$squid_opt_use_esi" = "yes" -a "$with_libxml2" != "no" ; then
7eb77a5f
FC
835 AC_CHECK_LIB([xml2], [main], [XMLLIB="-lxml2"; HAVE_LIBXML2=1])
836 dnl Find the main header and include path...
837 AC_CHECK_HEADERS([libxml/parser.h], [], [
838 SAVED_CPPFLAGS="$CPPFLAGS"
839 CPPFLAGS="-I/usr/include/libxml2 $CPPFLAGS"
840 unset ac_cv_header_libxml_parser_h
841 AC_CHECK_HEADERS([libxml/parser.h], [ac_cv_libxml2_include=yes], [])
842 CPPFLAGS="$SAVED_CPPFLAGS"
843 ])
844 if test "x$ac_cv_libxml2_include" = "xyes"; then
845 SQUID_CXXFLAGS="-I/usr/include/libxml2 $SQUID_CXXFLAGS"
846 CPPFLAGS="-I/usr/include/libxml2 $CPPFLAGS"
847 fi
848 dnl Now that we know where to look find the other headers...
849 AC_CHECK_HEADERS(libxml/HTMLparser.h libxml/HTMLtree.h)
850 AC_DEFINE_UNQUOTED(HAVE_LIBXML2, $HAVE_LIBXML2, [Define to 1 if you have the libxml2 library])
851 if test "$with_libxml2" = "yes" && test "$HAVE_LIBXML2" != "1" ; then
852 AC_MSG_ERROR([Required library libxml2 is not able to be found.])
853 fi
43ae1d95 854fi
7eb77a5f 855
5069fb38 856AM_CONDITIONAL(USE_ESI, test "$squid_opt_use_esi" = "yes")
88bfe098
AJ
857AM_CONDITIONAL(HAVE_LIBEXPAT, test $HAVE_LIBEXPAT = 1)
858AC_SUBST(EXPATLIB)
859AM_CONDITIONAL(HAVE_LIBXML2, test $HAVE_LIBXML2 = 1)
860AC_SUBST(XMLLIB)
43ae1d95 861
51952383 862AM_CONDITIONAL(USE_ICAP_CLIENT, false)
863AC_ARG_ENABLE(icap-client,
62979ab1 864 AS_HELP_STRING([--enable-icap-client],[Enable the ICAP client.]),
5069fb38
FC
865 squid_opt_use_icap_client=$enableval, squid_opt_use_icap_client=no)
866if test "$squid_opt_use_icap_client" = "yes" ; then
51952383 867 AC_DEFINE(ICAP_CLIENT,1,[Enable ICAP client features in Squid])
868 AM_CONDITIONAL(USE_ICAP_CLIENT, true)
1f3c65fc 869 ICAP_LIBS="icap/libicap.la"
5069fb38 870 squid_opt_use_adaptation=yes
51952383 871else
872 AC_DEFINE(ICAP_CLIENT,0,[Enable ICAP client features in Squid])
c21ad0f5 873 ICAP_LIBS=""
51952383 874fi
c21ad0f5 875AC_SUBST(ICAP_LIBS)
51952383 876
5069fb38 877squid_opt_use_ecap=1
3e7b6055
AR
878AC_MSG_CHECKING(whether to support eCAP)
879AC_ARG_ENABLE(ecap,
62979ab1 880 AS_HELP_STRING([--enable-ecap],[support loadable content adaptation modules]),
3e7b6055
AR
881 [
882 case "${enableval}" in
5069fb38
FC
883 yes) squid_opt_use_ecap=yes ;;
884 no) squid_opt_use_ecap=no ;;
3e7b6055
AR
885 *) AC_MSG_ERROR(bad value ${enableval} for --enable-ecap) ;;
886 esac
5069fb38 887 AC_MSG_RESULT([$squid_opt_use_ecap, explicitly])
3e7b6055
AR
888 ],
889 [
5069fb38
FC
890 squid_opt_use_ecap=no;
891 AC_MSG_RESULT([$squid_opt_use_ecap, implicitly])
3e7b6055
AR
892 ]
893)
894
895dnl Perform configuration consistency checks for eCAP
b61a58df 896ECAPLIB=""
5069fb38 897if test $squid_opt_use_ecap = yes;
3e7b6055 898then
5fa840c3 899 dnl eCAP support requires loadable modules, which are enabled by default
3e7b6055
AR
900 if test "$use_loadable_modules" != "yes"
901 then
945980c0 902 AC_MSG_ERROR([eCAP support requires loadable modules. Please do not use --disable-loadable-modules with --enable-ecap.]);
3e7b6055 903 fi
4cfba571
AR
904
905 dnl eCAP support requires libecap
906 AC_CHECK_LIB([ecap], [main],
b61a58df 907 [ECAPLIB="-lecap"],
591e6db0 908 [AC_MSG_FAILURE([eCAP support requires libecap library, but no usable library was found])]
4cfba571 909 )
3e7b6055
AR
910fi
911
5069fb38
FC
912AM_CONDITIONAL(USE_ECAP, test $squid_opt_use_ecap = yes)
913if test $squid_opt_use_ecap = yes;
3e7b6055
AR
914then
915 AC_DEFINE(USE_ECAP,1,[Enable eCAP support])
1f3c65fc 916 ECAP_LIBS="ecap/libecap.la $ECAP_LIBS"
5069fb38 917 squid_opt_use_adaptation=yes
3e7b6055 918else
5fa840c3 919 AC_DEFINE(USE_ECAP,0,[Disable eCAP support])
3e7b6055
AR
920 ECAP_LIBS=""
921fi
b61a58df 922dnl convenience library
3e7b6055 923AC_SUBST(ECAP_LIBS)
b61a58df
AJ
924dnl -lecap if needed
925AC_SUBST(ECAPLIB)
3e7b6055 926
3e7b6055 927
5fa840c3 928dnl enable adaptation if requested by specific adaptation mechanisms
5069fb38
FC
929AM_CONDITIONAL(USE_ADAPTATION, test $squid_opt_use_adaptation = yes)
930if test $squid_opt_use_adaptation = yes
5fa840c3
AR
931then
932 AC_DEFINE(USE_ADAPTATION,1,[common adaptation support])
933 ADAPTATION_LIBS="adaptation/libadaptation.la"
51952383 934else
5fa840c3
AR
935 AC_DEFINE(USE_ADAPTATION,0,[common adaptation support])
936 ADAPTATION_LIBS=""
51952383 937fi
5fa840c3 938AC_SUBST(ADAPTATION_LIBS)
3e7b6055
AR
939
940
0961c811 941dnl This is a developer only option. Developers know how to set defines
942dnl
943dnl AC_ARG_ENABLE(mem-gen-trace,
944dnl [ --enable-mem-gen-trace Do trace of memory stuff],
945dnl [ if test "$enableval" = "yes" ; then
eed82608 946dnl AC_MSG_NOTICE([Memory trace (to file) enabled])
6a9f6389 947dnl AC_DEFINE(MEM_GEN_TRACE,1,[Define for log file trace of mem alloc/free])
5069fb38
FC
948dnl fi
949dnl ])
950
36a97e19 951
d9180414 952AC_ARG_ENABLE(useragent-log,
62979ab1 953 AS_HELP_STRING([--enable-useragent-log],[Enable logging of User-Agent header]),
e5f4e1b0 954[ if test "$enableval" = "yes" ; then
eed82608 955 AC_MSG_NOTICE([User-Agent logging enabled])
5069fb38
FC
956 AC_DEFINE(USE_USERAGENT_LOG,1,
957 [If you want to log User-Agent request header values, define this.
958 By default, they are written to useragent.log in the Squid log
959 directory.])
e5f4e1b0 960 fi
961])
962
dfca7e1a 963AC_ARG_ENABLE(referer-log,
62979ab1 964 AS_HELP_STRING([--enable-referer-log],[Enable logging of Referer header]),
dfca7e1a 965[ if test "$enableval" = "yes" ; then
eed82608 966 AC_MSG_NOTICE([Referer logging enabled])
5069fb38
FC
967 AC_DEFINE(USE_REFERER_LOG,1,
968 [If you want to log Referer request header values, define this.
969 By default, they are written to referer.log in the Squid log directory.])
dfca7e1a 970 fi
971])
972
0b0cfcf2 973USE_WCCP=1
5069fb38 974AC_ARG_ENABLE(wccp,
62979ab1 975 AS_HELP_STRING([--disable-wccp],[Disable Web Cache Coordination Protocol]),
eb824054 976[ if test "$enableval" = "no" ; then
eed82608 977 AC_MSG_NOTICE([Web Cache Coordination Protocol disabled])
0b0cfcf2 978 USE_WCCP=0
320e9f36 979 fi
5069fb38 980])
0b0cfcf2 981if test $USE_WCCP = 1; then
982 AC_DEFINE(USE_WCCP, 1, [Define to enable WCCP])
983fi
984
985USE_WCCPv2=1
986AC_ARG_ENABLE(wccpv2,
62979ab1 987 AS_HELP_STRING([--disable-wccpv2],[Disable Web Cache Coordination V2 Protocol]),
0b0cfcf2 988[ if test "$enableval" = "no" ; then
bf53a520 989 AC_MSG_NOTICE([Web Cache Coordination V2 Protocol disabled])
0b0cfcf2 990 USE_WCCPv2=0
991 fi
992])
993if test $USE_WCCPv2 = 1; then
994 AC_DEFINE(USE_WCCPv2, 1, [Define to enable WCCP V2])
14b32873 995fi
320e9f36 996
d9180414 997AC_ARG_ENABLE(kill-parent-hack,
62979ab1 998 AS_HELP_STRING([--enable-kill-parent-hack],[Kill parent on shutdown]),
e5f4e1b0 999[ if test "$enableval" = "yes" ; then
eed82608 1000 AC_MSG_NOTICE([Kill parent on shutdown])
5069fb38
FC
1001 AC_DEFINE(KILL_PARENT_OPT,1,
1002 [A dangerous feature which causes Squid to kill its parent process
1003 (presumably the RunCache script) upon receipt of SIGTERM or SIGINT.
1004 Use with caution.])
e5f4e1b0 1005 fi
1006])
1007
87630341 1008USE_SNMP=true
e5f4e1b0 1009AC_ARG_ENABLE(snmp,
62979ab1 1010 AS_HELP_STRING([--disable-snmp],[Disable SNMP monitoring support]),
87630341 1011[ if test "$enableval" = "no" ; then
eed82608 1012 AC_MSG_NOTICE([SNMP monitoring disabled])
87630341 1013 USE_SNMP=
1014 fi
1015])
5069fb38 1016if test "$USE_SNMP" = 'true'; then
6a9f6389 1017 AC_DEFINE(SQUID_SNMP,1,[Define to enable SNMP monitoring of Squid])
63705952 1018 SNMPLIB='../snmplib/libsnmp.a'
e5f4e1b0 1019 makesnmplib=snmplib
87630341 1020fi
5069fb38 1021AM_CONDITIONAL(USE_SNMP, [test "$USE_SNMP" = "true"])
e5f4e1b0 1022AC_SUBST(SNMPLIB)
e5f4e1b0 1023AC_SUBST(makesnmplib)
1024
d9180414 1025AC_ARG_ENABLE(cachemgr-hostname,
5069fb38
FC
1026 AS_HELP_STRING([--enable-cachemgr-hostname=hostname],
1027 [Make cachemgr.cgi default to this host.
86f53af2 1028 If unspecified, uses the name of the build-host]),
e5f4e1b0 1029[ case $enableval in
1030 yes)
6a9f6389 1031 AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()],
1032 [If you are upset that the cachemgr.cgi form comes up with the hostname field blank, then define this to getfullhostname()])
eed82608 1033 AC_MSG_NOTICE([Cachemgr default hostname == host where cachemgr runs])
e5f4e1b0 1034 ;;
1035 no)
1036 : # Nothing to do..
1037 ;;
1038 *)
1039 AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
eed82608 1040 AC_MSG_NOTICE([Cachemgr default hostname set to ${enableval}])
e5f4e1b0 1041 ;;
1042 esac
1043])
1044
ee0927b6 1045AM_CONDITIONAL(USE_SQUID_EUI, false)
5069fb38 1046squid_opt_use_eui="yes"
ee0927b6 1047AC_ARG_ENABLE(eui,
a98c2da5 1048 AS_HELP_STRING([--disable-eui],[Enable use of ARP / MAC/ EUI (ether address)]),
5069fb38
FC
1049 [squid_opt_use_eui="$enableval"])
1050if test "$squid_opt_use_eui" = "yes" ; then
ee0927b6 1051 AC_MSG_NOTICE([EUI controls enabled (ether address)])
5069fb38
FC
1052 case "$squid_host_os" in
1053 linux|solaris|freebsd|openbsd|netbsd)
1054 $(TRUE)
074bf084 1055 ;;
5069fb38 1056 cygwin|mingw)
ee0927b6 1057 EUILIB="-liphlpapi"
5700029a 1058 ;;
933cc58d 1059 *)
ee0927b6 1060 AC_MSG_WARN([EUI support probably won't work on $host.])
933cc58d 1061 sleep 10
1062 ;;
1063 esac
ee0927b6
AJ
1064 AC_CHECK_HEADERS( \
1065 Iphlpapi.h \
1066 net/if.h \
1067 net/if_arp.h \
1068 net/if_dl.h \
1069 net/route.h \
1070 netinet/if_ether.h \
1071 sys/sockio.h \
1072 sys/sysctl.h \
1073 sys/ioctl.h \
1074 )
5069fb38 1075 AC_DEFINE(USE_SQUID_EUI,1,[Define this to include code which lets you use ethernet hardware addresses. This code uses API initially defined in 4.4-BSD.])
ee0927b6 1076 AM_CONDITIONAL(USE_SQUID_EUI, true)
a98c2da5
AJ
1077else
1078 AC_MSG_NOTICE([EUI controls disabled (ether address)])
1079fi
e5f4e1b0 1080
87630341 1081USE_HTCP=true
a2794549 1082AM_CONDITIONAL(ENABLE_HTCP, false)
74075210 1083AC_ARG_ENABLE(htcp,
62979ab1 1084 AS_HELP_STRING([--disable-htcp],[Disable HTCP protocol support]),
87630341 1085[ if test "$enableval" = "no" ; then
eed82608 1086 AC_MSG_NOTICE([HTCP support disabled])
b4b8b6da 1087 fi
74075210 1088])
5069fb38
FC
1089if test "$USE_HTCP" = "true"; then
1090 AC_DEFINE(USE_HTCP,1,
1091 [Define this to include code for the Hypertext Cache Protocol (HTCP)])
87630341 1092fi
5069fb38 1093AM_CONDITIONAL(ENABLE_HTCP, [test "$USE_HTCP" = "true"])
a2794549 1094
3d4022fa 1095dnl SSL is not enabled by default.
a2794549 1096AM_CONDITIONAL(ENABLE_SSL, false)
74075210 1097
3d4022fa 1098dnl Default is to use OpenSSL when available
1f7c9178 1099AC_ARG_ENABLE(ssl,
62979ab1 1100 AS_HELP_STRING([--enable-ssl],[Enable ssl gatewaying support using OpenSSL]),
1f7c9178 1101[ if test "$enableval" != "no"; then
eed82608 1102 AC_MSG_NOTICE([SSL gatewaying using OpenSSL enabled])
6a9f6389 1103 AC_DEFINE(USE_SSL,1,[Define this to include code for SSL encryption.])
a2794549 1104 AM_CONDITIONAL(ENABLE_SSL, true)
5069fb38 1105 if test "$squid_host_os" = "mingw" ; then
ee86c79b 1106 SSLLIB='-lssleay32 -leay32 -lgdi32'
5069fb38 1107 else
4b26fae9 1108 SSLLIB='-lssl -lcrypto'
5069fb38 1109 fi
1f7c9178 1110 USE_OPENSSL=1
1111 fi
1112])
1113
3d4022fa 1114dnl User may specify OpenSSL is needed from a non-standard location
1f7c9178 1115AC_ARG_WITH(openssl,
62979ab1 1116 AS_HELP_STRING([--with-openssl{=PATH}],[Compile with the OpenSSL libraries. The path to
86f53af2
FC
1117 the OpenSSL development libraries and headers
1118 installation can be specified if outside of the
1119 system standard directories]),
1f7c9178 1120[
46ce628c 1121 case "$with_openssl" in
1f7c9178 1122 yes)
1123 USE_OPENSSL=1
1124 ;;
1125 no)
1126 USE_OPENSSL=
1127 ;;
1128 *)
46ce628c 1129 SSLLIBDIR="$with_openssl/lib"
bcce53ce 1130 CPPFLAGS="-I$with_openssl/include $CPPFLAGS"
1f7c9178 1131 USE_OPENSSL=1
1132 esac
1133])
1f7c9178 1134if test -n "$USE_OPENSSL"; then
eed82608 1135 AC_MSG_NOTICE([Using OpenSSL MD5 implementation])
6a9f6389 1136 AC_DEFINE(USE_OPENSSL,1,[Define this to make use of the OpenSSL libraries for MD5 calculation rather than Squid's own MD5 implementation or if building with SSL encryption (USE_SSL)])
1f7c9178 1137 if test -z "$SSLLIB"; then
1138 SSLLIB="-lcrypto" # for MD5 routines
1139 fi
f11555e0 1140 dnl This is a workaround for RedHat 9 brain damage..
1141 if test -d /usr/kerberos/include && test -z "$SSLLIBDIR" && test -f /usr/include/openssl/kssl.h; then
eed82608 1142 AC_MSG_NOTICE([OpenSSL depends on Kerberos])
f11555e0 1143 SSLLIBDIR="/usr/kerberos/lib"
1144 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
1145 fi
1f7c9178 1146fi
1147if test -n "$SSLLIBDIR"; then
1148 SSLLIB="-L$SSLLIBDIR $SSLLIB"
1149fi
1f7c9178 1150AC_SUBST(SSLLIB)
1151
3d4022fa 1152
02749868 1153AC_ARG_ENABLE(forw-via-db,
62979ab1 1154 AS_HELP_STRING([--enable-forw-via-db],[Enable Forw/Via database]),
02749868 1155[ if test "$enableval" = "yes" ; then
eed82608 1156 AC_MSG_NOTICE([FORW-VIA enabled])
6a9f6389 1157 AC_DEFINE(FORW_VIA_DB,1,[Enable Forw/Via database])
02749868 1158 fi
1159])
1160
6cfa8966 1161AC_ARG_ENABLE(cache-digests,
62979ab1 1162 AS_HELP_STRING([--enable-cache-digests],[Use Cache Digests.
86f53af2 1163 See http://wiki.squid-cache.org/SquidFaq/CacheDigests]),
484f2ebc 1164[ if test "$enableval" = "yes" ; then
eed82608 1165 AC_MSG_NOTICE([Cache Disgests enabled])
6a9f6389 1166 AC_DEFINE(USE_CACHE_DIGESTS,1,[Use Cache Digests for locating objects in neighbor caches. This code is still semi-experimental.])
484f2ebc 1167 fi
1168])
1169
cd748f27 1170dnl Size of COSS memory buffer
1171AC_ARG_WITH(coss-membuf-size,
62979ab1 1172 AS_HELP_STRING([--with-coss-membuf-size=size],[COSS membuf size (default 1048576 bytes)]),
8b0d8e31 1173[ if test -n "$withval" -a "x$withval" != "xno" ; then
eed82608 1174 AC_MSG_NOTICE([Setting COSS membuf size to $with_coss_membuf_size bytes])
6a9f6389 1175 AC_DEFINE_UNQUOTED(COSS_MEMBUF_SZ, $with_coss_membuf_size,[Define if you want to set the COSS membuf size])
cd748f27 1176 fi
1177])
1178
1b3db6d9 1179dnl check for netio plugin stuff
6564c397 1180
9bb83c8b 1181dnl Enable poll()
bf53a520 1182squid_opt_enable_poll=auto
9bb83c8b 1183AC_ARG_ENABLE(poll,
62979ab1 1184 AS_HELP_STRING([--disable-poll],[Disable poll(2) support.]),
1b3db6d9 1185[
c68e9c6b 1186 case "$enableval" in
1187 yes)
d474c7a6 1188 SELECT_TYPE="poll"
bf53a520 1189 squid_opt_enable_poll=yes
c68e9c6b 1190 ;;
1191 no)
bf53a520 1192 squid_opt_enable_poll=no
c68e9c6b 1193 ;;
1194 esac
9bb83c8b 1195])
bf53a520 1196AC_MSG_NOTICE([enabling the use of poll() for net I/O: $squid_opt_enable_poll])
9bb83c8b 1197
1b3db6d9 1198dnl Enable select()
bf53a520 1199squid_opt_enable_select=auto
1b3db6d9 1200AC_ARG_ENABLE(select,
62979ab1 1201 AS_HELP_STRING([--disable-select],[Disable select(2) support.]),
1b3db6d9 1202[
1203 case "$enableval" in
1204 yes)
d474c7a6 1205 SELECT_TYPE="select"
bf53a520 1206 squid_opt_enable_select=yes
1b3db6d9 1207 ;;
1208 no)
bf53a520 1209 squid_opt_enable_select=no
1b3db6d9 1210 ;;
1211 esac
1212])
bf53a520 1213AC_MSG_NOTICE([enabling the use of select() for net I/O: $squid_opt_enable_select])
1b3db6d9 1214
1215dnl Enable kqueue()
6564c397 1216dnl kqueue support is still experiemntal and unstable. Not enabled by default.
bf53a520 1217squid_opt_enable_kqueue="no"
1b3db6d9 1218AC_ARG_ENABLE(kqueue,
62979ab1 1219 AS_HELP_STRING([--enable-kqueue],[Enable kqueue(2) support (experimental).]),
1b3db6d9 1220[
1221 case "$enableval" in
1222 yes)
d474c7a6 1223 SELECT_TYPE="kqueue"
11f11b5c
AJ
1224 AC_CHECK_HEADERS([sys/event.h],[],
1225 [ AC_MSG_ERROR([kqueue support requires sys/event.h header file.]) ])
bf53a520 1226 squid_opt_enable_kqueue=yes
1b3db6d9 1227 ;;
1228 no)
bf53a520 1229 squid_opt_enable_kqueue=no
1b3db6d9 1230 ;;
bf53a520 1231 esac
1b3db6d9 1232])
bf53a520 1233AC_MSG_NOTICE([enabling the use of kqueue for net I/O: $squid_opt_enable_kqueue])
1b3db6d9 1234
a46d2c0e 1235dnl Enable epoll()
bf53a520 1236squid_opt_enable_epoll="auto"
a46d2c0e 1237AC_ARG_ENABLE(epoll,
62979ab1 1238 AS_HELP_STRING([--disable-epoll],[Disable Linux epoll(2) support.]),
a46d2c0e 1239[
1240 case "$enableval" in
1241 yes)
d474c7a6 1242 SELECT_TYPE="epoll"
bf53a520 1243 squid_opt_enable_epoll="yes"
a46d2c0e 1244 ;;
1245 no)
bf53a520 1246 squid_opt_enable_epoll="no"
a46d2c0e 1247 ;;
1248esac
1249])
bf53a520
FC
1250AC_MSG_NOTICE([enabling the use of epoll for net I/O: $squid_opt_enable_epoll])
1251
1252dnl ********************** KK HERE **************
2ca8b332 1253dnl auto-detect and verify epoll header and library present and working
bf53a520 1254if test "$squid_opt_enable_epoll" != "no" ; then
2ca8b332 1255
ad32c661 1256 # Check for libepoll
bf53a520 1257 EPOLL_LIBS=""
ad32c661
AJ
1258 AC_CHECK_LIB(epoll, epoll_ctl, [EPOLL_LIBS="-lepoll"])
1259 AC_SUBST(EPOLL_LIBS)
1260
2ca8b332
AJ
1261 dnl on some systems it is provided by libc
1262 dnl not to worry, the working test below will catch them
1263 dnl and we don't want to force additional libraries
1264
1265
ad32c661
AJ
1266 # Check for epoll_ctl, may need -lepoll
1267 SAVED_LIBS="$LIBS"
2ca8b332 1268 LIBS="$LIBS $EPOLL_LIBS"
ad32c661
AJ
1269 AC_CHECK_FUNCS(epoll_ctl)
1270 LIBS="$SAVED_LIBS"
a46d2c0e 1271
2ca8b332 1272 dnl epoll requires sys/epoll.h
98d13964 1273 AC_CHECK_HEADERS([sys/epoll.h])
ad32c661
AJ
1274
1275 dnl Verify that epoll really works
1276 if test $ac_cv_func_epoll_ctl = yes; then
1277 AC_CACHE_CHECK(if epoll works, ac_cv_epoll_works,
62979ab1 1278 AC_RUN_IFELSE([AC_LANG_SOURCE([[
ad32c661
AJ
1279#include <sys/epoll.h>
1280#include <stdlib.h>
1281#include <stdio.h>
1282int main(int argc, char **argv)
1283{
1284 int fd = epoll_create(256);
1285 if (fd < 0) {
1286 perror("epoll_create:");
b3167ca7 1287 return 1;
ad32c661 1288 }
b3167ca7 1289 return 0;
ad32c661 1290}
62979ab1 1291 ]])],[ac_cv_epoll_works=yes],[ac_cv_epoll_works=no],[]))
ad32c661 1292 fi
2ca8b332
AJ
1293
1294 if test "$force_epoll" = "yes" && test "$ac_cv_epoll_works" = "no" ; then
1295 AC_MSG_ERROR([Epoll does not work. Force-enabling it is not going to help.])
1296 fi
ad32c661 1297fi
a46d2c0e 1298
72fd085a 1299dnl Disable HTTP violations
14b32873 1300http_violations=1
72fd085a 1301AC_ARG_ENABLE(http-violations,
62979ab1 1302 AS_HELP_STRING([--disable-http-violations],[This allows you to remove code which is known to
ddfc433e 1303 violate the HTTP protocol specification.]),
72fd085a 1304[ if test "$enableval" = "no" ; then
eed82608 1305 AC_MSG_NOTICE([Disabling HTTP Violations])
14b32873 1306 http_violations=0
72fd085a 1307 fi
1308])
14b32873 1309if test $http_violations = 1; then
1310 AC_DEFINE(HTTP_VIOLATIONS, 1,[By default (for now anyway) Squid includes options which allows the cache administrator to violate the HTTP protocol specification in terms of cache behaviour. Setting this to '0' will disable such code.])
1311else
1312 AC_DEFINE(HTTP_VIOLATIONS, 0)
1313fi
72fd085a 1314
68075fad 1315dnl Enable IPFW Transparent Proxy
1316AC_ARG_ENABLE(ipfw-transparent,
62979ab1 1317 AS_HELP_STRING([--enable-ipfw-transparent],[Enable Transparent Proxy support for systems
ddfc433e 1318 using FreeBSD IPFW style redirection.]),
68075fad 1319[ if test "$enableval" = "yes" ; then
eed82608 1320 AC_MSG_NOTICE([IPFW Transparent Proxy enabled])
68075fad 1321 AC_DEFINE(IPFW_TRANSPARENT,1,[Enable support for Transparent Proxy on systems using FreeBSD IPFW address redirection.])
1322 IPFW_TRANSPARENT="yes"
a74968c2
AJ
1323 else
1324 AC_DEFINE(IPFW_TRANSPARENT,0,[Enable support for Transparent Proxy on systems using FreeBSD IPFW address redirection.])
68075fad 1325 fi
1326])
1327
5cafc1d6 1328dnl Enable IP-Filter Transparent Proxy
1329AC_ARG_ENABLE(ipf-transparent,
62979ab1 1330 AS_HELP_STRING([--enable-ipf-transparent],[Enable Transparent Proxy support for systems
ddfc433e 1331 using IP-Filter network address redirection.]),
5cafc1d6 1332[ if test "$enableval" = "yes" ; then
eed82608 1333 AC_MSG_NOTICE([IP-Filter Transparent Proxy enabled])
6a9f6389 1334 AC_DEFINE(IPF_TRANSPARENT,1,[Enable support for Transparent Proxy on systems using IP-Filter address redirection. This provides "masquerading" support for non Linux system.])
5cafc1d6 1335 IPF_TRANSPARENT="yes"
a74968c2
AJ
1336 else
1337 AC_DEFINE(IPF_TRANSPARENT,0,[Enable support for Transparent Proxy on systems using IP-Filter address redirection. This provides "masquerading" support for non Linux system.])
5cafc1d6 1338 fi
1339])
1340
2b0dd4ac 1341dnl Enable PF Transparent Proxy
1342AC_ARG_ENABLE(pf-transparent,
62979ab1 1343 AS_HELP_STRING([--enable-pf-transparent],[Enable Transparent Proxy support for systems
ddfc433e 1344 using PF network address redirection.]),
2b0dd4ac 1345[ if test "$enableval" = "yes" ; then
eed82608 1346 AC_MSG_NOTICE([PF Transparent Proxy enabled])
6a9f6389 1347 AC_DEFINE(PF_TRANSPARENT,1,[Enable support for Transparent Proxy on systems using PF address redirection. This provides "masquerading" support for OpenBSD.])
2b0dd4ac 1348 PF_TRANSPARENT="yes"
a74968c2
AJ
1349 else
1350 AC_DEFINE(PF_TRANSPARENT,0,[Enable support for Transparent Proxy on systems using PF address redirection. This provides "masquerading" support for OpenBSD.])
2b0dd4ac 1351 fi
1352])
1353
d6d62546 1354dnl Enable Linux Netfilter Transparent Proxy
d852fbad 1355AC_ARG_ENABLE(linux-netfilter,
62979ab1 1356 AS_HELP_STRING([--enable-linux-netfilter],[Enable Transparent Proxy support for Linux (Netfilter)]),
d852fbad 1357[ if test "$enableval" = "yes" ; then
eed82608 1358 AC_MSG_NOTICE([Linux (Netfilter) Transparent Proxy enabled])
d6d62546 1359 AC_DEFINE(LINUX_NETFILTER,1,[Enable support for Transparent Proxy on Linux (Netfilter) systems])
d852fbad 1360 LINUX_NETFILTER="yes"
a74968c2
AJ
1361 else
1362 AC_DEFINE(LINUX_NETFILTER,0,[Enable support for Transparent Proxy on Linux (Netfilter) systems])
d852fbad 1363 fi
1364])
1365
bb7b5fd0 1366dnl Enable Large file support
2df6213e 1367buildmodel=""
1368needlargefiles=
1369
1370AC_ARG_WITH(large-files,
62979ab1 1371 AS_HELP_STRING([--with-large-files],[Enable support for large files (logs etc).]),
8b0d8e31 1372[ if test "x$withval" = "xyes"; then
2df6213e 1373 needlargefiles=1
bb7b5fd0 1374 fi
1375])
1376
2df6213e 1377dnl UNIX Build environment
62979ab1 1378dnl AS_HELP_STRING is not suited here because it doesn't allow to specify newlines
2df6213e 1379AC_ARG_WITH(build-environment,
1380[ --with-build-environment=model
1381 The build environment to use. Normally one of
1382 POSIX_V6_ILP32_OFF32 32 bits
1383 POSIX_V6_ILP32_OFFBIG 32 bits with large file support
1384 POSIX_V6_LP64_OFF64 64 bits
1385 POSIX_V6_LPBIG_OFFBIG large pointers and files
1386 XBS5_ILP32_OFF32 32 bits (legacy)
1387 XBS5_ILP32_OFFBIG 32 bits with large file support (legacy)
1388 XBS5_LP64_OFF64 64 bits (legacy)
1389 XBS5_LPBIG_OFFBIG large pointers and files (legacy)
1390 default The default for your OS],
1391[ case "$withval" in
1392 yes|no)
eed82608 1393 AC_MSG_FAILURE(["--with-build-environment expects a build environment string as used by getconf])
2df6213e 1394 ;;
1395 *)
1396 buildmodel="$withval"
1397 ;;
1398 esac
1399])
1400
1401if test $needlargefiles && test -z "$buildmodel"; then
f6fd3d67 1402 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
2df6213e 1403 if test "`getconf _$model 2>/dev/null || true`" = 1 || test "`getconf $model 2>/dev/null || true`" ; then
1404 buildmodel=$model
1405 break
1406 fi
1407 done
1408 if test -z "$buildmodel"; then
eed82608 1409 AC_MSG_WARN(["No suitable build environment found for large files. Trying to use _FILE_OFFSET_BITS=64])
2df6213e 1410 sleep 1
9b8002de
HN
1411 fi
1412fi
1413case "$buildmodel" in
1414default|"")
1415 if test "$needlargefiles"; then
eed82608 1416 AC_MSG_NOTICE([Enabling -D_FILE_OFFSET_BITS=64])
2df6213e 1417 CFLAGS="-D_FILE_OFFSET_BITS=64 $CFLAGS"
cca81db1 1418 CXXFLAGS="-D_FILE_OFFSET_BITS=64 $CXXFLAGS"
2df6213e 1419 fi
9b8002de
HN
1420 ;;
1421*)
eed82608 1422 AC_MSG_NOTICE([Using $buildmodel build environment])
2df6213e 1423 if test "`getconf _$buildmodel 2>/dev/null || true`" = 1 || test "`getconf $buildmodel 2>/dev/null || true`" ; then
1424 : # All fine
1425 else
8b0d8e31 1426 AC_MSG_ERROR(Build environment $buildmodel not known to getconf.)
2df6213e 1427 fi
1428 CFLAGS="`getconf ${buildmodel}_CFLAGS` $CFLAGS"
cca81db1 1429 CXXFLAGS="`getconf ${buildmodel}_CFLAGS` $CXXFLAGS"
2df6213e 1430 LIBS="`getconf ${buildmodel}_LIBS` $LIBS"
1431 LDFLAGS="`getconf ${buildmodel}_LDFLAGS` $LDFLAGS"
63e02610 1432 case "$host" in
2df6213e 1433dnl
a078ea4d
GS
1434dnl On Solaris getconf returns for CFLAGS -xarch=generic64, -Xa and -Usun options, and
1435dnl for LDFLAGS -xarch=generic64, but:
1436dnl "-Xa" is supported only by Sun cc, so we need to remove it when using gcc
1437dnl For gcc "-xarch=generic64" must be replaced with "-m64"
1438dnl The 'sun' define is needed by ipfilter includes, so we must remove "-Usun"
2df6213e 1439 *-solaris*)
1440 if test "$GCC" = "yes"; then
eed82608 1441 AC_MSG_NOTICE([Removing -Xa for gcc/g++ on $host])
2df6213e 1442 CFLAGS="`echo $CFLAGS | sed -e 's/-Xa//'`"
cca81db1 1443 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Xa//'`"
eed82608 1444 AC_MSG_NOTICE([Replacing -xarch=generic64 with -m64 for gcc/g++ on $host])
a078ea4d 1445 CFLAGS="`echo $CFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
bb60974e 1446 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
a078ea4d 1447 LDFLAGS="`echo $LDFLAGS | sed -e 's/-xarch=generic64//'`"
2df6213e 1448 fi
eed82608 1449 AC_MSG_NOTICE([Removing -Usun on $host])
2df6213e 1450 CFLAGS="`echo $CFLAGS | sed -e 's/-Usun//'`"
cca81db1 1451 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Usun//'`"
2df6213e 1452 ;;
eed82608 1453dnl
63e02610 1454dnl On Irix 6.x getconf returns options valid only for the SGI MipsPRO compiler,
1455dnl so we must adjust something to avoid gcc errors.
1456dnl On Irix 6.x 32/64 bit we must replace "-n32" with "-mabi=n32" in CFLAGS and
1457dnl remove "-n32" from LDFLAGS
1458dnl On Irix 6.x 64 bit we must replace "-64" with "-mabi=64" in CFLAGS and remove
1459dnl "-64" from LDFLAGS
1460 *-sgi-irix6.*)
1461 if test "$GCC" = "yes"; then
1462 CFLAGS="`echo $CFLAGS | sed -e 's/-n32/-mabi=n32/'`"
ff37fe61 1463 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-n32/-mabi=n32/'`"
63e02610 1464 LDFLAGS="`echo $LDFLAGS | sed -e 's/-n32//'`"
1465 CFLAGS="`echo $CFLAGS | sed -e 's/-64/-mabi=64/'`"
ff37fe61 1466 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-64/-mabi=64/'`"
63e02610 1467 LDFLAGS="`echo $LDFLAGS | sed -e 's/-64//'`"
1468 fi
1469 ;;
2df6213e 1470 *)
1471 ;;
1472 esac
993f04c1 1473 ;;
9b8002de 1474esac
2df6213e 1475
7b0a0d1f 1476dnl Enable Linux transparent proxy support for obsolete TPROXY
e8cca4ac 1477AC_ARG_ENABLE(linux-tproxy,
62979ab1 1478 AS_HELP_STRING([--enable-linux-tproxy],[Enable real Transparent Proxy support for Netfilter TPROXY
19b4777c 1479 (version 2).]),
fc68f6b1 1480[ if test "$enableval" = "yes" ; then
5b3fec23 1481 AC_MSG_NOTICE([Linux Netfilter/TPROXY v2 enabled])
f1e0717c
AJ
1482 AC_DEFINE(LINUX_TPROXY2, 1, [Enable real Transparent Proxy support for Netfilter TPROXY v2.])
1483 LINUX_TPROXY2="yes"
1484 if test -z "$LINUX_NETFILTER"; then
eed82608 1485 AC_MSG_NOTICE([Linux-Netfilter Transparent Proxy automatically enabled])
f1e0717c
AJ
1486 LINUX_NETFILTER="yes"
1487 fi
a74968c2
AJ
1488 else
1489 AC_DEFINE(LINUX_TPROXY2, 0, [Enable real Transparent Proxy support for Netfilter TPROXY v2.])
f1e0717c
AJ
1490 fi
1491])
fc68f6b1 1492
a2794549 1493AM_CONDITIONAL(MAKE_LEAKFINDER, false)
5d620373 1494dnl Enable Leak Finding Functions
1495AC_ARG_ENABLE(leakfinder,
62979ab1 1496 AS_HELP_STRING([--enable-leakfinder],[Enable Leak Finding code. Enabling this alone
19b4777c
FC
1497 does nothing; you also have to modify the source
1498 code to use the leak finding functions. Probably
1499 Useful for hackers only.]),
5d620373 1500[ if test "$enableval" = "yes" ; then
eed82608 1501 AC_MSG_NOTICE([Leak-Finding enabled])
6a9f6389 1502 AC_DEFINE(USE_LEAKFINDER,1,[Enable code for assisting in finding memory leaks. Hacker stuff only.])
5d620373 1503 USE_LEAKFINDER="yes"
a2794549 1504 AM_CONDITIONAL(MAKE_LEAKFINDER, true)
5d620373 1505 fi
1506])
5d620373 1507
3d674977
AJ
1508follow_xff=1
1509AC_ARG_ENABLE(follow-x-forwarded-for,
62979ab1 1510 AS_HELP_STRING([--enable-follow-x-forwarded-for],[Enable support for following the X-Forwarded-For
19b4777c
FC
1511 HTTP header to try to find the IP address of the
1512 original or indirect client when a request has
1513 been forwarded through other proxies.]),
3d674977 1514[ if test "$enableval" = "yes" ; then
eed82608 1515 AC_MSG_NOTICE([follow X-Forwarded-For enabled])
3d674977
AJ
1516 follow_xff=1
1517 fi
1518])
1519if test $follow_xff = 1; then
1520 AC_DEFINE(FOLLOW_X_FORWARDED_FOR, 1, [Enable following X-Forwarded-For headers])
1521else
1522 AC_DEFINE(FOLLOW_X_FORWARDED_FOR, 0)
1523fi
1524
14b32873 1525use_ident=1
3898f57f 1526AC_ARG_ENABLE(ident-lookups,
62979ab1 1527 AS_HELP_STRING([--disable-ident-lookups],[This allows you to remove code that performs Ident (RFC 931) lookups.]),
3898f57f 1528[ if test "$enableval" = "no" ; then
eed82608 1529 AC_MSG_NOTICE([Disabling Ident Lookups])
14b32873 1530 use_ident=0
3898f57f 1531 fi
1532])
14b32873 1533if test $use_ident = 1; then
1534 AC_DEFINE(USE_IDENT, 1,[Compile in support for Ident (RFC 931) lookups? Enabled by default.])
1535else
1536 AC_DEFINE(USE_IDENT, 0)
1537fi
3898f57f 1538
a2794549 1539AM_CONDITIONAL(USE_DNSSERVER, false)
3c573763 1540use_dnsserver=
eb824054 1541AC_ARG_ENABLE(internal-dns,
62979ab1 1542 AS_HELP_STRING([--disable-internal-dns],[Prevents Squid from directly sending and receiving DNS messages,
19b4777c 1543 and instead enables the old external 'dnsserver' processes.]),
eb824054 1544[ if test "$enableval" = "no" ; then
eed82608 1545 AC_MSG_WARN([Disabling Internal DNS queries])
3c573763 1546 use_dnsserver="yes"
eb824054 1547 fi
1548])
3c573763 1549if test "$use_dnsserver" = "yes"; then
6a9f6389 1550 AC_DEFINE(USE_DNSSERVERS,1,[Use dnsserver processes instead of the internal DNS protocol support])
a2794549 1551 AM_CONDITIONAL(USE_DNSSERVER, true)
3c573763 1552fi
eb824054 1553
9d798391 1554dnl Select Default hosts file location
1555AC_ARG_ENABLE(default-hostsfile,
62979ab1 1556 AS_HELP_STRING([--enable-default-hostsfile=path],[Select default location for hosts file.
19b4777c 1557 See hosts_file directive in squid.conf for details]),
9d798391 1558[
1559 if test "$enableval" != "none" ; then
1560 if test -f $enableval; then
1561 OPT_DEFAULT_HOSTS=$enableval
1562 else
eed82608 1563 AC_MSG_WARN([Unable to find $enableval])
9d798391 1564 sleep 5
1565 fi
1566 else
eed82608 1567 OPT_DEFAULT_HOSTS="none"
9d798391 1568 fi
eed82608 1569 AC_MSG_NOTICE([Default hosts file set to: $enableval])
9d798391 1570],[OPT_DEFAULT_HOSTS="/etc/hosts"])
1571AC_SUBST(OPT_DEFAULT_HOSTS)
1572
94439e4e 1573dnl Select auth schemes modules to build
1574AC_ARG_ENABLE(auth,
62979ab1 1575 AS_HELP_STRING([--enable-auth="list of auth scheme modules"],[Build support for the list of authentication schemes.
19b4777c
FC
1576 The default is to build support for the Basic scheme.
1577 See src/auth for a list of available modules, or
1578 Programmers Guide section authentication schemes
1579 for details on how to build your custom auth scheme
1580 module]),
94439e4e 1581[ case $enableval in
1582 yes)
1c42c4a1 1583 for dir in $srcdir/src/auth/*; do
1584 module="`basename $dir`"
1c690e30 1585 if test -d "$dir" && test "$module" != CVS; then
1c42c4a1 1586 AUTH_MODULES="$AUTH_MODULES $module"
94439e4e 1587 fi
1588 done
1589 ;;
1590 no)
1591 ;;
1c690e30 1592 *)
1593 AUTH_MODULES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1594 ;;
94439e4e 1595 esac
1596],
1597[ if test -z "$AUTH_MODULES"; then
6bf4f823 1598 AUTH_MODULES="ntlm basic digest negotiate"
94439e4e 1599 fi
1600])
1c690e30 1601if test -n "$AUTH_MODULES"; then
1602 for module in $AUTH_MODULES; do
1603 if test -d $srcdir/src/auth/$module; then
1604 :
1605 else
8b0d8e31 1606 AC_MSG_ERROR(Auth scheme $module does not exist)
1c690e30 1607 fi
7f18d2bd 1608 eval AUTH_MODULE_${module}=yes
1c690e30 1609 done
eed82608 1610 AC_MSG_NOTICE([Auth scheme modules built: $AUTH_MODULES])
d0571da6 1611else
eed82608 1612 AC_MSG_WARN([Auth scheme modules built: None])
1c690e30 1613fi
2d2b0bb7
AR
1614dnl Authentication libraries to build
1615dnl This list will not be needed when each auth library has its own Makefile
1616AUTH_LIBS_TO_BUILD=
f5691f9c 1617for module in $AUTH_MODULES; do
bcf44a2c 1618 AUTH_LIBS_TO_BUILD="$AUTH_LIBS_TO_BUILD lib${module}.la"
f5691f9c 1619done
94439e4e 1620AC_SUBST(AUTH_MODULES)
2d2b0bb7 1621AC_SUBST(AUTH_LIBS_TO_BUILD)
94439e4e 1622
7762106d
FC
1623dnl bundled auth modules, in order to have handy defines for the cppunit testsuite
1624test -n "$AUTH_MODULE_basic" && AC_DEFINE([HAVE_AUTH_MODULE_BASIC],1,[Basic auth module is built])
1625test -n "$AUTH_MODULE_digest" && AC_DEFINE([HAVE_AUTH_MODULE_DIGEST],1,[Digest auth module is built])
1626test -n "$AUTH_MODULE_ntlm" && AC_DEFINE([HAVE_AUTH_MODULE_NTLM],1,[NTLM auth module is built])
1627test -n "$AUTH_MODULE_negotiate" && AC_DEFINE([HAVE_AUTH_MODULE_NEGOTIATE],1,[Negotiate auth module is built])
1628
94439e4e 1629dnl Select basic auth scheme helpers to build
7f18d2bd 1630if test -n "$AUTH_MODULE_basic"; then
1631 BASIC_AUTH_HELPERS="all"
1632fi
94439e4e 1633AC_ARG_ENABLE(basic-auth-helpers,
62979ab1 1634 AS_HELP_STRING([--enable-basic-auth-helpers="list of helpers"],[This option selects which basic scheme proxy_auth
19b4777c
FC
1635 helpers to build and install as part of the normal
1636 build process. For a list of available
1637 helpers see the helpers/basic_auth directory.]),
94439e4e 1638[ case "$enableval" in
7f18d2bd 1639 yes)
1640 BASIC_AUTH_HELPERS="all"
1c690e30 1641 ;;
94439e4e 1642 no)
7f18d2bd 1643 BASIC_AUTH_HELPERS=""
1c690e30 1644 ;;
94439e4e 1645 *)
7f18d2bd 1646 if test -z "$AUTH_MODULE_basic"; then
eed82608 1647 AC_MSG_WARN([Basic auth helpers selected without the basic scheme enabled])
7f18d2bd 1648 sleep 15
1649 fi
1c690e30 1650 BASIC_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1651 ;;
94439e4e 1652 esac
1653])
7f18d2bd 1654if test "$BASIC_AUTH_HELPERS" = "all" ; then
1655 BASIC_AUTH_HELPERS=""
1656 for dir in $srcdir/helpers/basic_auth/*; do
1657 helper="`basename $dir`"
1658 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1659 BASIC_AUTH_HELPERS="$BASIC_AUTH_HELPERS $helper"
ce7c6bba
AJ
1660 elif test -d $srcdir/helpers/basic_auth/$helper ; then
1661 AC_MSG_NOTICE([Basic auth helper $helper ... found but cannot be built])
7f18d2bd 1662 fi
1663 done
1664fi
fc83a946 1665if test -n "$BASIC_AUTH_HELPERS"; then
20d8bfe4 1666 for helper in $BASIC_AUTH_HELPERS; do
1c690e30 1667 if test -d $srcdir/helpers/basic_auth/$helper; then
2adff954 1668 case $helper in
1669 SASL)
1670 require_sasl=yes
1671 ;;
1672 esac
20d8bfe4 1673 else
8b0d8e31 1674 AC_MSG_ERROR(Basic auth helper $helper does not exist)
20d8bfe4 1675 fi
1676 done
eed82608 1677 AC_MSG_NOTICE([Basic auth helpers built: $BASIC_AUTH_HELPERS])
94439e4e 1678fi
fc83a946 1679AC_SUBST(BASIC_AUTH_HELPERS)
94439e4e 1680
1681dnl Select ntlm auth helpers to build
7f18d2bd 1682if test -n "$AUTH_MODULE_ntlm"; then
1683 NTLM_AUTH_HELPERS="all"
1684fi
94439e4e 1685AC_ARG_ENABLE(ntlm-auth-helpers,
62979ab1 1686 AS_HELP_STRING([--enable-ntlm-auth-helpers="list of helpers"],[This option selects which proxy_auth ntlm helpers
19b4777c
FC
1687 to build and install as part of the normal build
1688 process. For a list of available helpers see
1689 the helpers/ntlm_auth directory.]),
380f0a87 1690[ case "$enableval" in
1691 yes)
7f18d2bd 1692 NTLM_AUTH_HELPERS="all"
1c690e30 1693 ;;
380f0a87 1694 no)
7f18d2bd 1695 NTLM_AUTH_HELPERS=""
1c690e30 1696 ;;
380f0a87 1697 *)
1c690e30 1698 NTLM_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1699 ;;
380f0a87 1700 esac
1701])
7f18d2bd 1702if test "$NTLM_AUTH_HELPERS" = "all" ; then
1703 NTLM_AUTH_HELPERS=""
1704 for dir in $srcdir/helpers/ntlm_auth/*; do
1705 helper="`basename $dir`"
1706 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1707 NTLM_AUTH_HELPERS="$NTLM_AUTH_HELPERS $helper"
ce7c6bba
AJ
1708 elif test -d $srcdir/helpers/ntlm_auth/$helper ; then
1709 AC_MSG_NOTICE([NTLM auth helper $helper ... found but cannot be built])
7f18d2bd 1710 fi
1711 done
1712fi
94439e4e 1713if test -n "$NTLM_AUTH_HELPERS"; then
20d8bfe4 1714 for helper in $NTLM_AUTH_HELPERS; do
1c690e30 1715 if test -d $srcdir/helpers/ntlm_auth/$helper; then
1716 :
20d8bfe4 1717 else
8b0d8e31 1718 AC_MSG_ERROR(NTLM Auth helper $helper does not exist)
20d8bfe4 1719 fi
1720 done
eed82608 1721 AC_MSG_NOTICE([NTLM auth helpers built: $NTLM_AUTH_HELPERS])
380f0a87 1722fi
94439e4e 1723AC_SUBST(NTLM_AUTH_HELPERS)
1724
6e785d85 1725dnl Select negotiate auth helpers to build
7f18d2bd 1726if test -n "$AUTH_MODULE_negotiate"; then
1727 NEGOTIATE_AUTH_HELPERS="all"
1728fi
6e785d85 1729AC_ARG_ENABLE(negotiate-auth-helpers,
62979ab1 1730 AS_HELP_STRING([--enable-negotiate-auth-helpers="list of helpers"],[This option selects which proxy_auth negotiate helpers
e702812e
FC
1731 to build and install as part of the normal build
1732 process. For a list of available helpers see
1733 the helpers/negotiate_auth directory.]),
6e785d85 1734[ case "$enableval" in
1735 yes)
7f18d2bd 1736 NEGOTIATE_AUTH_HELPERS="all"
6e785d85 1737 ;;
1738 no)
7f18d2bd 1739 NEGOTIATE_AUTH_HELPERS=""
6e785d85 1740 ;;
1741 *)
1742 NEGOTIATE_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1743 ;;
1744 esac
1745])
7f18d2bd 1746if test "$NEGOTIATE_AUTH_HELPERS" = "all" ; then
1747 NEGOTIATE_AUTH_HELPERS=""
1748 for dir in $srcdir/helpers/negotiate_auth/*; do
1749 helper="`basename $dir`"
1750 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1751 NEGOTIATE_AUTH_HELPERS="$NEGOTIATE_AUTH_HELPERS $helper"
ce7c6bba
AJ
1752 elif test -d $srcdir/helpers/negotiate_auth/$helper ; then
1753 AC_MSG_NOTICE([Negotiate auth helper $helper ... found but cannot be built])
7f18d2bd 1754 fi
1755 done
1756fi
6e785d85 1757if test -n "$NEGOTIATE_AUTH_HELPERS"; then
1758 for helper in $NEGOTIATE_AUTH_HELPERS; do
1759 if test -d $srcdir/helpers/negotiate_auth/$helper; then
1760 :
1761 else
8b0d8e31 1762 AC_MSG_ERROR(Negotiate Auth helper $helper does not exist)
6e785d85 1763 fi
1764 done
eed82608 1765 AC_MSG_NOTICE([Negotiate auth helpers built: $NEGOTIATE_AUTH_HELPERS])
6e785d85 1766fi
1767AC_SUBST(NEGOTIATE_AUTH_HELPERS)
1768
2d70df72 1769dnl Select digest auth scheme helpers to build
7f18d2bd 1770if test -n "$AUTH_MODULE_digest"; then
1771 DIGEST_AUTH_HELPERS=all
1772fi
2d70df72 1773AC_ARG_ENABLE(digest-auth-helpers,
62979ab1 1774 AS_HELP_STRING([--enable-digest-auth-helpers="list of helpers"],[This option selects which digest scheme authentication
e702812e
FC
1775 helpers to build and install as part of the normal build
1776 process. For a list of available helpers see the
1777 helpers/digest_auth directory.]),
2d70df72 1778[ case "$enableval" in
1779 yes)
7f18d2bd 1780 DIGEST_AUTH_HELPERS="all"
1c690e30 1781 ;;
2d70df72 1782 no)
7f18d2bd 1783 DIGEST_AUTH_HELPERS=""
1c690e30 1784 ;;
2d70df72 1785 *)
1c690e30 1786 DIGEST_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1787 ;;
2d70df72 1788 esac
1789])
7f18d2bd 1790if test "$DIGEST_AUTH_HELPERS" = "all" ; then
1791 DIGEST_AUTH_HELPERS=""
1792 for dir in $srcdir/helpers/digest_auth/*; do
1793 helper="`basename $dir`"
1794 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1795 DIGEST_AUTH_HELPERS="$DIGEST_AUTH_HELPERS $helper"
ce7c6bba
AJ
1796 elif test -d $srcdir/helpers/digest_auth/$helper ; then
1797 AC_MSG_NOTICE([Digest auth helper $helper ... found but cannot be built])
7f18d2bd 1798 fi
1799 done
1800fi
2d70df72 1801if test -n "$DIGEST_AUTH_HELPERS"; then
1daefc1a 1802 for helper in $DIGEST_AUTH_HELPERS; do
1803 if test -f $srcdir/helpers/digest_auth/$helper/Makefile.in; then
1804 :
1805 else
8b0d8e31 1806 AC_MSG_ERROR(digest auth helper $helper does not exist)
1daefc1a 1807 fi
1808 done
eed82608 1809 AC_MSG_NOTICE([Digest auth helpers built: $DIGEST_AUTH_HELPERS])
2d70df72 1810fi
1811AC_SUBST(DIGEST_AUTH_HELPERS)
380f0a87 1812
82b7abe3
AJ
1813dnl Select logging daemon helpers to build
1814LOG_DAEMON_HELPERS="all"
1815AC_ARG_ENABLE(log-daemon-helpers,
1816 AS_HELP_STRING([--enable-log-daemon-auth-helpers="list of helpers"],[This option selects which logging daemon
1817 helpers to build and install as part of the normal build process. For a list of available
1818 helpers see the helpers/log_daemon directory.]),
1819[ case "$enableval" in
1820 yes)
1821 LOG_DAEMON_HELPERS="all"
1822 ;;
1823 no)
1824 LOG_DAEMON_HELPERS=""
1825 ;;
1826 *)
1827 LOG_DAEMON_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1828 ;;
1829 esac
1830])
1831if test "$LOG_DAEMON_HELPERS" = "all" ; then
1832 LOG_DAEMON_HELPERS=""
1833 for dir in $srcdir/helpers/log_daemon/*; do
1834 helper="`basename $dir`"
1835 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1836 LOG_DAEMON_HELPERS="$LOG_DAEMON_HELPERS $helper"
1837 elif test -d $srcdir/helpers/log_daemon/$helper ; then
1838 AC_MSG_NOTICE([Log daemon auth helper $helper ... found but cannot be built])
1839 fi
1840 done
1841fi
1842if test -n "$LOG_DAEMON_HELPERS"; then
1843 for helper in $LOG_DAEMON_HELPERS; do
1844 if test -d $srcdir/helpers/log_daemon/$helper; then
1845 :
1846 else
1847 AC_MSG_ERROR(Log daemon helper $helper does not exist)
1848 fi
1849 done
1850 AC_MSG_NOTICE([Log daemon helpers built: $LOG_DAEMON_HELPERS])
1851fi
1852AC_SUBST(LOG_DAEMON_HELPERS)
1853
3d62cc61
FC
1854dnl
1855dnl Check Kerberos/GSSAPI/SPNEGO
1856dnl
9ca29d23
AJ
1857SAVED_CPPFLAGS=$CPPFLAGS
1858SAVED_LIBS=$LIBS
1859AC_ARG_WITH(krb5-config,
1860 [ --with-krb5-config=PATH specify path to krb5-config @<:@default=detect@:>@],
1861[ if test "$withval" = "yes"; then
1862 unset krb5confpath
1863 elif test "$withval" != "no"; then
1864 krb5confpath=$withval
1865 else
1866 krb5confpath=no
1867 fi
1868])
1869if test x"$krb5confpath" != xno; then
1870 if test x"$krb5confpath" != x; then
1871 if ! test -x "$krb5confpath"; then
1872 AC_MSG_WARN([krb5-config '$krb5confpath' not executable, ignoring])
1873 AC_CHECK_PROG(ac_krb5_config, krb5-config, yes, no)
1874 krb5confpath=krb5-config
1875 fi
1876 krb5_config_path=`dirname $krb5confpath`
1877 AC_CHECK_PROG(ac_krb5_config, krb5-config, yes, no, $krb5_config_path)
1878 else
1879 AC_CHECK_PROG(ac_krb5_config,krb5-config,yes,no)
1880 krb5confpath=krb5-config
1881 fi
1882fi
1883if test "$ac_krb5_config" = "yes" ; then
cf99ae25
AJ
1884 ac_heimdal="`$krb5confpath --version 2>/dev/null | grep -i heimdal`"
1885 ac_solaris="`$krb5confpath --version 2>/dev/null | grep -i solaris`"
9ca29d23
AJ
1886 if test "x$ac_heimdal" != "x" ; then
1887 AC_DEFINE(HAVE_HEIMDAL_KERBEROS,1,[Define to 1 if you have Heimdal Kerberos])
1888 else
1889 AC_DEFINE(HAVE_MIT_KERBEROS,1,[Define to 1 if you have MIT Kerberos])
1890 fi
1891 if test "$ac_solaris" != "" ; then
cf99ae25
AJ
1892 KRB5INCS="`$krb5confpath --cflags krb5 2>/dev/null`"
1893 KRB5LIBS="`$krb5confpath --libs krb5 2>/dev/null`"
9ca29d23
AJ
1894 KRB5INCS="-I/usr/include/gssapi $KRB5INCS"
1895 KRB5LIBS="-L/usr/lib -R/usr/lib -lgss -lresolv -lsocket -lnsl $KRB5LIBS"
1896 else
cf99ae25
AJ
1897 KRB5INCS="`$krb5confpath --cflags krb5 2>/dev/null`"
1898 KRB5LIBS="`$krb5confpath --libs krb5 2>/dev/null`"
9ca29d23
AJ
1899 KRB5INCS="`$krb5confpath --cflags gssapi 2>/dev/null` $KRB5INCS"
1900 KRB5LIBS="`$krb5confpath --libs gssapi 2>/dev/null` $KRB5LIBS"
1901 fi
1902 CPPFLAGS="$CPPFLAGS $KRB5INCS"
1903 LIBS="$LIBS $KRB5LIBS"
1904 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h)
1905 if test "x$ac_heimdal" == "x" ; then
1906 AC_CHECK_HEADERS(gssapi/gssapi_generic.h)
3d62cc61 1907 AC_CHECK_HEADERS(profile.h)
9ca29d23 1908 fi
d14e78e9 1909 AC_CHECK_HEADERS(krb5.h com_err.h et/com_err.h)
3d62cc61
FC
1910 AC_CACHE_CHECK([for broken Solaris krb5.h],squid_cv_broken_krb5_h, [
1911 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9ca29d23 1912#include <krb5.h>
3d62cc61
FC
1913int i;
1914]])], [ squid_cv_broken_krb5_h=no ],
1915 [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1916#if defined(__cplusplus)
1917#define KRB5INT_BEGIN_DECLS extern "C" {
1918#define KRB5INT_END_DECLS
1919KRB5INT_BEGIN_DECLS
1920#endif
1921#include <krb5.h>
1922int i;
1923]])], [ squid_cv_broken_krb5_h=yes ], [ squid_cv_broken_krb5_h=no ])])])
1924 if test x"$squid_cv_broken_krb5_h" = x"yes"; then
1925 AC_DEFINE(HAVE_BROKEN_SOLARIS_KRB5_H, 1, [Define to 1 if krb5.h is broken for C++])
1926 fi
9ca29d23 1927
3d62cc61
FC
1928 ac_com_error_message=no
1929 if test "x$ac_cv_header_com_err_h" == "xyes" ; then
1930 AC_EGREP_HEADER(error_message,com_err.h,ac_com_error_message=yes)
1931 elif test "x$ac_cv_header_et_com_err_h" == "xyes" ; then
1932 AC_EGREP_HEADER(error_message,et/com_err.h,ac_com_error_message=yes)
1933 fi
1934 AC_CACHE_CHECK([for max_skew in struct krb5_context],squid_cv_max_skew_context, [
1935 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1936#if HAVE_BROKEN_SOLARIS_KRB5_H
1937#if defined(__cplusplus)
1938#define KRB5INT_BEGIN_DECLS extern "C" {
1939#define KRB5INT_END_DECLS
1940KRB5INT_BEGIN_DECLS
1941#endif
1942#endif
1943#include <krb5.h>
1944krb5_context kc; kc->max_skew = 1;
1945]])],[ squid_cv_max_skew_context=yes ], [ squid_cv_max_skew_context=no ])])
1946 if test x"$squid_cv_max_skew_context" = x"yes"; then
1947 AC_DEFINE(HAVE_MAX_SKEW_IN_KRB5_CONTEXT, 1, [Define to 1 if max_skew in struct krb5_context])
1948 fi
1949
1950 if test `echo $KRB5LIBS | grep -c com_err` -ne 0 -a "x$ac_com_error_message" == "xyes" ; then
1951 AC_CHECK_LIB(com_err,error_message,
1952 AC_DEFINE(HAVE_ERROR_MESSAGE,1,[Define to 1 if you have error_message]),)
1953 elif test "x$ac_com_error_message" == "xyes" ; then
1954 AC_CHECK_LIB(krb5,error_message,
1955 AC_DEFINE(HAVE_ERROR_MESSAGE,1,[Define to 1 if you have error_message]),)
9ca29d23 1956 fi
cf99ae25
AJ
1957 AC_CHECK_LIB(krb5,krb5_get_err_text,
1958 AC_DEFINE(HAVE_KRB5_GET_ERR_TEXT,1,[Define to 1 if you have krb5_get_err_text]),)
1959 AC_CHECK_LIB(krb5,krb5_get_error_message,
1960 AC_DEFINE(HAVE_KRB5_GET_ERROR_MESSAGE,1,[Define to 1 if you have krb5_get_error_message]),)
9ca29d23
AJ
1961 AC_CHECK_LIB(krb5,krb5_kt_free_entry,
1962 AC_DEFINE(HAVE_KRB5_KT_FREE_ENTRY,1,[Define to 1 if you have krb5_kt_free_entry]),)
1963 AC_CHECK_LIB(krb5,krb5_get_init_creds_keytab,
1964 AC_DEFINE(HAVE_GET_INIT_CREDS_KEYTAB,1,[Define to 1 if you have krb5_get_init_creds_keytab]),)
1965 AC_CHECK_LIB(krb5,krb5_get_max_time_skew,
1966 AC_DEFINE(HAVE_KRB5_GET_MAX_TIME_SKEW,1,[Define to 1 if you have krb5_get_max_time_skew]),)
1967 AC_CHECK_LIB(krb5,krb5_get_profile,
1968 AC_DEFINE(HAVE_KRB5_GET_PROFILE,1,[Define to 1 if you have krb5_get_profile]),)
1969 AC_CHECK_LIB(krb5,profile_get_integer,
1970 AC_DEFINE(HAVE_PROFILE_GET_INTEGER,1,[Define to 1 if you have profile_get_integer]),)
1971 AC_CHECK_LIB(krb5,profile_release,
1972 AC_DEFINE(HAVE_PROFILE_RELEASE,1,[Define to 1 if you have profile_release]),)
3d62cc61
FC
1973 AC_CACHE_CHECK([for memory cache], squid_cv_memory_cache, [
1974 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1975#if HAVE_BROKEN_SOLARIS_KRB5_H
1976#if defined(__cplusplus)
1977#define KRB5INT_BEGIN_DECLS extern "C" {
1978#define KRB5INT_END_DECLS
1979KRB5INT_BEGIN_DECLS
1980#endif
1981#endif
9ca29d23
AJ
1982#include<krb5.h>
1983main()
1984{
1985 krb5_context context;
1986 krb5_ccache cc;
1987
1988 krb5_init_context(&context);
1989 return krb5_cc_resolve(context, "MEMORY:test_cache", &cc);
3d62cc61
FC
1990}
1991]])], [ squid_cv_memory_cache=yes ], [ squid_cv_memory_cache=no ])])
1992 if test "$squid_cv_memory_cache" = "yes" ; then
1993 AC_DEFINE(HAVE_KRB5_MEMORY_CACHE,1, [Define to 1 if you have MEMORY: cache support])
1994 fi
1995 AC_CACHE_CHECK([for working gssapi], squid_cv_working_gssapi, [
1996 AC_RUN_IFELSE([AC_LANG_SOURCE([[
9ca29d23
AJ
1997#ifdef HAVE_GSSAPI_GSSAPI_H
1998#include <gssapi/gssapi.h>
1999#elif HAVE_GSSAPI_H
2000#include <gssapi.h>
2001#endif
2002
2003#ifdef HAVE_GSSAPI_GSSAPI_EXT_H
2004#include <gssapi/gssapi_ext.h>
2005#endif
2006
2007#ifdef HAVE_GSSAPI_GSSAPI_KRB5_H
2008#include <gssapi/gssapi_krb5.h>
2009#endif
2010
2011#ifdef HAVE_GSSAPI_GSSAPI_GENERIC_H
2012#include <gssapi/gssapi_generic.h>
2013#endif
2014int
2015main(void)
2016{
2017 OM_uint32 val;
2018 gss_OID_set set;
2019
2020 gss_create_empty_oid_set(&val, &set);
2021
2022 return 0;
2023}
3d62cc61
FC
2024]])], [ squid_cv_working_gssapi=yes ], [ squid_cv_working_gssapi=no ])])
2025 if test "$squid_cv_working_gssapi" = "yes" ; then
2026 AC_DEFINE(HAVE_GSSAPI, 1, [GSSAPI support])
2027 fi
2028
2029 AC_CACHE_CHECK([for spnego support], squid_cv_have_spnego, [
2030 AC_RUN_IFELSE([AC_LANG_SOURCE([[
9ca29d23
AJ
2031#ifdef HAVE_HEIMDAL_KERBEROS
2032#ifdef HAVE_GSSAPI_GSSAPI_H
2033#include <gssapi/gssapi.h>
2034#elif defined(HAVE_GSSAPI_H)
2035#include <gssapi.h>
2036#endif
2037#else
2038#ifdef HAVE_GSSAPI_GSSAPI_H
2039#include <gssapi/gssapi.h>
2040#elif defined(HAVE_GSSAPI_H)
2041#include <gssapi.h>
2042#endif
2043#ifdef HAVE_GSSAPI_GSSAPI_KRB5_H
2044#include <gssapi/gssapi_krb5.h>
2045#endif
2046#ifdef HAVE_GSSAPI_GSSAPI_GENERIC_H
2047#include <gssapi/gssapi_generic.h>
2048#endif
2049#endif
2050#include <string.h>
2051int main(int argc, char *argv[]) {
2052 OM_uint32 major_status,minor_status;
2053 gss_OID_set gss_mech_set;
2054 int i;
2055
2056static gss_OID_desc _gss_mech_spnego = {6, (void *)"\x2b\x06\x01\x05\x05\x02"};
2057gss_OID gss_mech_spnego = &_gss_mech_spnego;
2058
2059 major_status = gss_indicate_mechs( &minor_status, &gss_mech_set);
2060
2061 for (i=0;i<gss_mech_set->count;i++) {
2062 if (!memcmp(gss_mech_set->elements[i].elements,gss_mech_spnego->elements,gss_mech_set->elements[i].length)) {
2063 return 0;
2064 }
2065 }
2066
2067 return 1;
3d62cc61
FC
2068}
2069]])], [ squid_cv_have_spnego=yes ], [ squid_cv_have_spnego=no ])])
2070
2071 if test "$squid_cv_have_spnego" = "yes" ; then
9ca29d23 2072 AC_DEFINE(HAVE_SPNEGO,1, [Define to 1 if you have SPNEGO support])
3d62cc61
FC
2073 fi
2074 AC_CACHE_CHECK([for working krb5], squid_cv_working_krb5, [
2075 AC_RUN_IFELSE([AC_LANG_SOURCE([[
9ca29d23 2076#ifdef HAVE_KRB5_H
3d62cc61
FC
2077#if HAVE_BROKEN_SOLARIS_KRB5_H
2078#if defined(__cplusplus)
2079#define KRB5INT_BEGIN_DECLS extern "C" {
2080#define KRB5INT_END_DECLS
2081KRB5INT_BEGIN_DECLS
2082#endif
2083#endif
9ca29d23
AJ
2084#include <krb5.h>
2085#endif
2086
2087int
2088main(void)
2089{
2090 krb5_context context;
2091
2092 krb5_init_context(&context);
2093
2094 return 0;
2095}
3d62cc61
FC
2096]])], [ squid_cv_working_krb5=yes ], [ squid_cv_working_krb5=no ])])
2097 if test "$squid_cv_working_krb5" = "yes" ; then
2098 AC_DEFINE(HAVE_KRB5, 1, [KRB5 support])
2099 fi
2100
9ca29d23
AJ
2101 LIBS=$SAVED_LIBS
2102 CPPFLAGS=$SAVED_CPPFLAGS
2103 AC_SUBST(KRB5INCS)
2104 AC_SUBST(KRB5LIBS)
2105fi
3d62cc61 2106AM_CONDITIONAL(HAVE_SPNEGO, test x"$squid_cv_have_spnego" = x"yes" )
9ca29d23 2107
6437ac71 2108dnl Enable "NTLM fail open"
2109AC_ARG_ENABLE(ntlm-fail-open,
62979ab1 2110 AS_HELP_STRING([--enable-ntlm-fail-open],[Enable NTLM fail open, where a helper that fails one of the
e702812e
FC
2111 Authentication steps can allow squid to still authenticate
2112 the user.]),
6437ac71 2113[ if test "$enableval" = "yes" ; then
6a9f6389 2114 AC_DEFINE(NTLM_FAIL_OPEN,1,[Define if NTLM is allowed to fail gracefully when a helper has problems. WARNING: This has security implications. DO NOT enable unless you KNOW you need it.])
6437ac71 2115 fi
2116])
2117
c6588c68 2118dnl Select external_acl helpers to build
7f18d2bd 2119EXTERNAL_ACL_HELPERS=all
c6588c68 2120AC_ARG_ENABLE(external-acl-helpers,
62979ab1 2121 AS_HELP_STRING([--enable-external-acl-helpers="list of helpers"],[This option selects which external_acl helpers to
e702812e
FC
2122 build and install as part of the normal build
2123 process. For a list of available helpers see the
2124 helpers/external_acl directory.]),
c6588c68 2125[ case "$enableval" in
2126 yes)
7f18d2bd 2127 EXTERNAL_ACL_HELPERS=all
1c690e30 2128 ;;
c6588c68 2129 no)
7f18d2bd 2130 EXTERNAL_ACL_HELPERS=""
1c690e30 2131 ;;
c6588c68 2132 *)
1c690e30 2133 EXTERNAL_ACL_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
2134 ;;
c6588c68 2135 esac
2136])
7f18d2bd 2137if test "$EXTERNAL_ACL_HELPERS" = "all" ; then
39ee7289 2138 EXTERNAL_ACL_HELPERS=""
7f18d2bd 2139 for dir in $srcdir/helpers/external_acl/*; do
2140 helper="`basename $dir`"
2141 if test -f $dir/config.test && sh $dir/config.test "$@"; then
2142 EXTERNAL_ACL_HELPERS="$EXTERNAL_ACL_HELPERS $helper"
ce7c6bba
AJ
2143 elif test -d $srcdir/helpers/external_acl/$helper ; then
2144 AC_MSG_NOTICE([External ACL helper $helper ... found but cannot be built])
7f18d2bd 2145 fi
2146 done
2147fi
c6588c68 2148if test -n "$EXTERNAL_ACL_HELPERS"; then
20d8bfe4 2149 for helper in $EXTERNAL_ACL_HELPERS; do
2150 if test -f $srcdir/helpers/external_acl/$helper/Makefile.in; then
2151 :
2152 else
8b0d8e31 2153 AC_MSG_ERROR(external acl helper $helper does not exist)
20d8bfe4 2154 fi
2155 done
eed82608 2156 AC_MSG_NOTICE([External acl helpers built: $EXTERNAL_ACL_HELPERS])
c6588c68 2157fi
2158AC_SUBST(EXTERNAL_ACL_HELPERS)
2159
fdbb3b19
AJ
2160dnl Select url_rewrite helpers to build
2161URL_REWRITE_HELPERS=all
2162AC_ARG_ENABLE(url-rewrite-helpers,
2163 AC_HELP_STRING([--enable-url-rewrite-helpers="list of helpers"],
2164 [This option selects which url_rewrite helpers to
2165 build and install as part of the normal build
2166 process. For a list of available helpers see the
2167 helpers/url_rewrite directory.]),
2168[ case "$enableval" in
2169 yes)
2170 URL_REWRITE_HELPERS=all
2171 ;;
2172 no)
2173 URL_REWRITE_HELPERS=""
2174 ;;
2175 *)
2176 URL_REWRITE_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
2177 ;;
2178 esac
2179])
2180if test "$URL_REWRITE_HELPERS" = "all" ; then
2181 URL_REWRITE_HELPERS=""
2182 for dir in $srcdir/helpers/url_rewrite/*; do
2183 helper="`basename $dir`"
2184 if test -f $dir/config.test && sh $dir/config.test "$@"; then
2185 URL_REWRITE_HELPERS="$URL_REWRITE_HELPERS $helper"
ce7c6bba
AJ
2186 elif test -d $srcdir/helpers/url_rewrite/$helper ; then
2187 AC_MSG_NOTICE([URL re-write helper $helper ... found but cannot be built])
fdbb3b19
AJ
2188 fi
2189 done
2190fi
2191if test -n "$URL_REWRITE_HELPERS"; then
2192 for helper in $URL_REWRITE_HELPERS; do
2193 if test -f $srcdir/helpers/url_rewrite/$helper/Makefile.in; then
2194 :
2195 else
2196 AC_MSG_ERROR(url_rewrite helper $helper does not exist)
2197 fi
2198 done
2199 AC_MSG_NOTICE([url_rewrite helpers built: $URL_REWRITE_HELPERS])
2200fi
2201AC_SUBST(URL_REWRITE_HELPERS)
2202
2203
3a125142 2204AC_ARG_WITH(valgrind-debug,
62979ab1 2205 AS_HELP_STRING([--with-valgrind-debug],[Include debug instrumentation for use with valgrind]),
b4bab919 2206[ case $withval in
2207 yes)
2208 valgrind=1
2209 ;;
2210 no)
2211 valgrind=
2212 ;;
2213 *)
2214 CPPFLAGS="$CPPFLAGS -I${enableval}/include"
2215 valgrind=1
2216 ;;
2217 esac
2218 if test $valgrind; then
ad32c661
AJ
2219 AC_CHECK_HEADERS(valgrind/memcheck.h,
2220 [ AC_DEFINE(WITH_VALGRIND, 1, [Valgrind memory debugger support])
eed82608
AJ
2221 AC_MSG_NOTICE([Valgrind debug support enabled]) ],
2222 [ AC_MSG_WARN([Valgrind header not found. Valgrind support disabled.]) ]
ad32c661 2223 )
b4bab919 2224 fi
2225])
2226
d96ceb8e 2227dnl Disable "memPools" code
2228AC_ARG_ENABLE(mempools,
62979ab1 2229 AS_HELP_STRING([--disable-mempools],[Disable memPools. Note that this option now simply sets the
e702812e
FC
2230 default behaviour. Specific classes can override this at runtime, and
2231 only lib/MemPool.c needs to be altered to change the squid-wide
2232 default for all classes.]),
d96ceb8e 2233[ if test "$enableval" = "no" ; then
eed82608 2234 AC_MSG_NOTICE([memPools disabled])
6a9f6389 2235 AC_DEFINE(DISABLE_POOLS, 1, [Define if you have problems with memPools and want to disable Pools])
3e0dc9a8 2236 else
2237 AC_DEFINE(DISABLE_POOLS, 0, [Define if you have problems with memPools and want to disable Pools.])
d96ceb8e 2238 fi
3e0dc9a8 2239],
2240[ AC_DEFINE(DISABLE_POOLS, 0, [Define if you have problems with memPools and want to disable Pools.])
d96ceb8e 2241])
2242
0e657244 2243dnl Enable WIN32 Service compile mode
2244AC_ARG_ENABLE(win32-service,
62979ab1 2245 AS_HELP_STRING([--enable-win32-service],[Compile Squid as a WIN32 Service.
e702812e 2246 Works only on MS-Windows platforms (NT and up).]),
0e657244 2247[ if test "$enableval" = "yes" ; then
eed82608 2248 AC_MSG_NOTICE([Enabling WIN32 run service mode])
0e657244 2249 AC_DEFINE(USE_WIN32_SERVICE,1,[Define Windows NT & Windows 2000 run service mode])
2250 fi
2251])
2252
b1485ff8 2253
2adff954 2254dnl Check for Cyrus SASL
2255if test "$require_sasl" = "yes"; then
2256 AC_CHECK_HEADERS(sasl/sasl.h sasl.h)
2257 if test "$ac_cv_header_sasl_sasl_h" = "yes"; then
eed82608 2258 AC_MSG_NOTICE([using SASL2])
2adff954 2259 LIBSASL="-lsasl2"
2260 else
2261 if test "$ac_cv_header_sasl_h" = "yes"; then
eed82608 2262 AC_MSG_NOTICE([using SASL])
2adff954 2263 LIBSASL="-lsasl"
2264 else
8b0d8e31 2265 AC_MSG_ERROR(Neither SASL nor SASL2 found)
2adff954 2266 fi
2267 fi
2268 AC_SUBST(LIBSASL)
2269fi
2270
3c573763 2271dnl Disable "unlinkd" code
fe0810ac 2272AC_ARG_ENABLE(unlinkd,
62979ab1 2273 AS_HELP_STRING([--disable-unlinkd],[Do not use unlinkd]),
fe0810ac 2274[ if test "$enableval" = "no" ; then
3c573763 2275 use_unlinkd=no
fe0810ac 2276 else
3c573763 2277 use_unlinkd=yes
fe0810ac 2278 fi
2279],[
2280 # Here we should probably use some magic depending on the selected
2281 # storage models
3c573763 2282 use_unlinkd=yes
fe0810ac 2283])
3c573763 2284if test "$use_unlinkd" = "yes"; then
eed82608 2285 AC_MSG_NOTICE([unlinkd enabled])
6a9f6389 2286 AC_DEFINE(USE_UNLINKD,1,[Define this if unlinkd is required (strongly recommended for ufs storage type)])
a2794549 2287 AM_CONDITIONAL(ENABLE_UNLINKD, true)
fe0810ac 2288else
eed82608 2289 AC_MSG_NOTICE([unlinkd disabled])
a2794549 2290 AM_CONDITIONAL(ENABLE_UNLINKD, false)
fe0810ac 2291fi
fe0810ac 2292
ce3d30fb 2293dnl Enable backtraces on fatal errors
2294AC_ARG_ENABLE(stacktraces,
62979ab1 2295 AS_HELP_STRING([--enable-stacktraces],[Enable automatic call backtrace on fatal errors]),
ce3d30fb 2296[ if test "$enableval" = "yes" ; then
eed82608 2297 AC_MSG_NOTICE([Enabling automatic stack backtraces on fatal errors])
6a9f6389 2298 AC_DEFINE(PRINT_STACK_TRACE, 1,[Print stacktraces on fatal errors])
ce3d30fb 2299 fi
2300])
2301
88bfe092 2302AM_CONDITIONAL(ENABLE_XPROF_STATS, false)
2303dnl Enable USE_XPROF_STATS
2304AC_ARG_ENABLE(cpu-profiling,
62979ab1 2305 AS_HELP_STRING([--enable-cpu-profiling],[Enable instrumentation to try and understand how CPU power
e702812e
FC
2306 is spent by squid, by enabling specific probes in selected
2307 functions. New probes can only be added by modifying the source code.
2308 It is meant to help developers in optimizing performance
2309 of Squid internal functions.
2310 If you are not developer you shouldn't enable this,
2311 as it slows squid down somewhat. See lib/Profiler.c for more details.]),
88bfe092 2312[ if test "$enableval" = "yes" ; then
eed82608 2313 AC_MSG_NOTICE([Enabling cpu-profiling])
6a9f6389 2314 AC_DEFINE(USE_XPROF_STATS, 1,[Define to enable CPU profiling within Squid])
88bfe092 2315 AM_CONDITIONAL(ENABLE_XPROF_STATS, true)
2316 fi
2317])
2318
f66a9ef4 2319dnl Enable X-Accelerator-Vary for Vary support within an accelerator setup
2092c67d 2320AC_ARG_ENABLE(x-accelerator-vary,
62979ab1 2321 AS_HELP_STRING([--enable-x-accelerator-vary],[Enable support for the X-Accelerator-Vary
e702812e
FC
2322 HTTP header. Can be used to indicate
2323 variance within an accelerator setup.
2324 Typically used together with other code
2325 that adds custom HTTP headers to the requests.]),
f66a9ef4 2326[ if test "$enableval" = "yes" ; then
eed82608 2327 AC_MSG_NOTICE([Enabling support for X-Accelerator-Vary])
6a9f6389 2328 AC_DEFINE(X_ACCELERATOR_VARY, 1, [Enable support for the X-Accelerator-Vary HTTP header])
f66a9ef4 2329 fi
2330])
2331
7172612f 2332AC_ARG_ENABLE(zph-qos,
62979ab1 2333 AS_HELP_STRING([--enable-zph-qos],[Enable ZPH QOS support]),
7172612f 2334[ if test "$enableval" = "yes" ; then
eed82608 2335 AC_MSG_NOTICE([ZPH QOS enabled])
7172612f
AJ
2336 AC_DEFINE(USE_ZPH_QOS,1,
2337 [ Define this to use Squid's ZPH (Zero Penalty Hit) QOS features.
2338 When enabled, Squid will alter TOS field of HIT responses for better QOS on intermediate routing/shaping devices.])
2339 fi
2340])
2341
a41b3435
AJ
2342dnl --with-maxfd present for compatibility with Squid-2.
2343dnl undocumented in ./configure --help to encourage using the Squid-3 directive.
2344AC_ARG_WITH(maxfd,,
2345[
2346 case ${withval} in
2347 [[0-9]]*)
2348 squid_filedescriptors_num=$withval
2349 ;;
2350 *)
2351 AC_MSG_ERROR(--with-maxfd expects a numeric argument)
2352 ;;
2353 esac
2354])
f49be7d1 2355AC_ARG_WITH(filedescriptors,
62979ab1 2356 AS_HELP_STRING([--with-filedescriptors=NUMBER],[Force squid to support NUMBER filedescriptors]),
8b0d8e31
AJ
2357[
2358 case ${withval} in
2359 [[0-9]]*)
2360 squid_filedescriptors_num=$withval
2361 ;;
2362 *)
2363 AC_MSG_ERROR(--with-filedescriptors expects a numeric argument)
2364 ;;
2365 esac
2366])
f49be7d1 2367
8b5e106b 2368if $CPPUNITCONFIG --help >/dev/null; then
eed82608 2369 AC_MSG_NOTICE([using system installed cppunit])
8b5e106b 2370 SQUID_CPPUNIT_LIBS="`$CPPUNITCONFIG --libs`"
2371 SQUID_CPPUNIT_LA=''
2372 SQUID_CPPUNIT_INC="`$CPPUNITCONFIG --cflags`"
2373else
eed82608 2374 AC_MSG_WARN([cppunit does not appear to be installed. squid does not require this, but code testing with 'make check' will fail.])
63d03edb 2375 SQUID_CPPUNIT_LA=''
2376 SQUID_CPPUNIT_LIBS=''
2377 SQUID_CPPUNIT_INC=''
f5691f9c 2378fi
8b5e106b 2379
f5691f9c 2380AC_ARG_WITH(cppunit-basedir,
62979ab1 2381 AS_HELP_STRING([--with-cppunit-basedir=PATH],[Path where the cppunit headers are libraries are found
b0e7900f 2382 for unit testing.]),
f5691f9c 2383[ if test -f $withval/include/cppunit/TestCase.h; then
eed82608 2384 AC_MSG_NOTICE([Using cppunit includes from $withval])
f5691f9c 2385 SQUID_CPPUNIT_INC="-I${withval}/include"
2386 else
8b0d8e31 2387 AC_MSG_ERROR(Cannot find cppunit at $withval)
f5691f9c 2388 fi
2389 if test -f $withval/lib/libcppunit.la; then
eed82608 2390 AC_MSG_NOTICE([Using cppunit lib from $withval])
549b1e60 2391 SQUID_CPPUNIT_LA="${withval}/lib/libcppunit.la"
8b5e106b 2392 SQUID_CPPUNIT_LIBS='$(SQUID_CPPUNIT_LA)'
f5691f9c 2393 else
8b0d8e31 2394 AC_MSG_ERROR(Cannot find cppunit at $withval)
f5691f9c 2395 fi
f5691f9c 2396])
8b5e106b 2397AC_SUBST(SQUID_CPPUNIT_LIBS)
f5691f9c 2398AC_SUBST(SQUID_CPPUNIT_LA)
2399AC_SUBST(SQUID_CPPUNIT_INC)
f5691f9c 2400
fd9aaa3e 2401# Force some compilers to use ANSI features
2402#
2403case "$host" in
2404 alpha-dec-osf*)
2405 if test "$ac_cv_prog_CC" = "cc" ; then
eed82608 2406 AC_MSG_NOTICE([adding '-std1' to cc args for $host])
fd9aaa3e 2407 CC="cc -std1";
2408 ac_cv_prog_CC="$CC"
2409 fi
2410 ;;
c68e9c6b 2411 *-hp-hpux*)
2412 if test "$ac_cv_prog_CC" = "cc" ; then
eed82608 2413 AC_MSG_NOTICE([adding '-Ae' to cc args for $host])
c68e9c6b 2414 CC="cc -Ae";
2415 ac_cv_prog_CC="$CC"
2416 fi
2417 ;;
fd9aaa3e 2418esac
2419
dd56802c 2420
a2794549 2421dnl automake handles this AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
4e9d8e26 2422
6ad85e8a 2423case "$host" in
2424 *-hp-hpux*)
eed82608 2425 AC_MSG_NOTICE([Disabling 'ranlib' for HP-UX...])
6ad85e8a 2426 RANLIB=":"
2427 ;;
2428esac
2429
090089c4 2430dnl Check for headers
2431AC_HEADER_DIRENT
2432AC_HEADER_STDC
db40ae20 2433
2434AC_CHECK_HEADERS( \
db40ae20 2435 arpa/inet.h \
30a4f2a8 2436 arpa/nameser.h \
9441aa34 2437 assert.h \
db40ae20 2438 bstring.h \
27e059d4 2439 cassert \
db40ae20 2440 crypt.h \
281422f8 2441 cstring \
30a4f2a8 2442 ctype.h \
2443 errno.h \
ce3d30fb 2444 execinfo.h \
db40ae20 2445 fcntl.h \
42ad37af 2446 fnmatch.h \
9c1d8929 2447 getopt.h \
52303a3d 2448 glob.h \
88738790 2449 gnumalloc.h \
30a4f2a8 2450 grp.h \
27e059d4
AJ
2451 iosfwd \
2452 iomanip \
2453 iostream \
5cafc1d6 2454 ip_compat.h \
42b51993 2455 ip_fil_compat.h \
5cafc1d6 2456 ip_fil.h \
2457 ip_nat.h \
dbc5782a 2458 ipl.h \
30a4f2a8 2459 libc.h \
6ad85e8a 2460 limits.h \
d2422105 2461 linux/types.h \
1cc2f840 2462 machine/byte_swap.h \
30a4f2a8 2463 malloc.h \
e0bddc45 2464 math.h \
db40ae20 2465 memory.h \
b075cbb1 2466 mount.h \
30a4f2a8 2467 netdb.h \
db40ae20 2468 netinet/in.h \
cc192b50 2469 netinet/in_systm.h \
42b51993 2470 netinet/ip_fil_compat.h \
1f7c9178 2471 openssl/err.h \
2472 openssl/md5.h \
2473 openssl/ssl.h \
cc192b50 2474 netinet/tcp.h \
a7ad6e4e 2475 openssl/engine.h \
27e059d4 2476 ostream \
4da086c4 2477 paths.h \
dcfe6390 2478 poll.h \
30a4f2a8 2479 pwd.h \
b5e4d7d4 2480 shadow.h \
30a4f2a8 2481 regex.h \
c68e9c6b 2482 sched.h \
30a4f2a8 2483 signal.h \
27e059d4 2484 sstream \
30a4f2a8 2485 stdarg.h \
2486 stddef.h \
27e059d4 2487 stdexcept \
30a4f2a8 2488 stdio.h \
db40ae20 2489 stdlib.h \
27e059d4 2490 string \
db40ae20 2491 string.h \
2492 strings.h \
0a4e8536 2493 sys/bitypes.h \
f9576890 2494 sys/bswap.h \
2495 sys/endian.h \
db40ae20 2496 sys/file.h \
5cafc1d6 2497 sys/ioctl.h \
30a4f2a8 2498 sys/param.h \
62ae0622 2499 sys/prctl.h \
3d4022fa 2500 sys/md5.h \
77e4c0c9 2501 sys/msg.h \
30a4f2a8 2502 sys/resource.h \
db40ae20 2503 sys/select.h\
30a4f2a8 2504 sys/socket.h \
2505 sys/stat.h \
b075cbb1 2506 sys/statvfs.h \
3c641669 2507 syscall.h \
30a4f2a8 2508 sys/syscall.h \
db40ae20 2509 sys/time.h \
2510 sys/types.h \
30a4f2a8 2511 sys/un.h \
b075cbb1 2512 sys/vfs.h \
30a4f2a8 2513 sys/wait.h \
db40ae20 2514 syslog.h \
30a4f2a8 2515 time.h \
2516 unistd.h \
3c641669 2517 utime.h \
30a4f2a8 2518 varargs.h \
77d6bd88 2519 byteswap.h \
2520 glib.h \
60d096f4 2521 stdint.h \
2522 inttypes.h \
3c641669 2523 grp.h \
94331f58 2524 db.h \
5b43d209 2525 db_185.h
db40ae20 2526)
2527
fc68f6b1 2528AC_CHECK_HEADERS(
2529 linux/netfilter_ipv4.h \
2530 linux/netfilter_ipv4/ip_tproxy.h \
2531,,,
dcd1dc78 2532SQUID_DEFAULT_INCLUDES
2533#if HAVE_LIMITS_H
2534#include <limits.h>
2535#endif
a74968c2
AJ
2536/* Netfilter ip(6)tables v1.4.0 has broken headers */
2537#if HAVE_NETINET_IN_H
2538#include <netinet/in.h>
2539#endif
dcd1dc78 2540)
2541
d1e5191e 2542dnl *BSD dont include the depenencies for all their net/ and netinet/ files
c92b4732 2543dnl We must include a few basic type headers for them to work.
d1e5191e
AJ
2544AC_CHECK_HEADERS( \
2545 net/if.h \
5a3237b0 2546 netinet/if_ether.h\
d1e5191e 2547 netinet/icmp6.h \
975cfef6 2548 netinet/in.h \
d1e5191e
AJ
2549 netinet/ip.h \
2550 netinet/ip6.h \
5a3237b0 2551 netinet/ip_compat.h\
975cfef6 2552 netinet/ip_fil_compat.h\
5a3237b0 2553 netinet/ip_fil.h\
d1e5191e 2554 netinet/ip_icmp.h \
dbc5782a 2555 netinet/ipl.h \
975cfef6 2556 netinet/ip_nat.h\
ec9909b0 2557 net/pf/pfvar.h \
d1e5191e 2558 net/pfvar.h \
77e4c0c9 2559 sys/mount.h\
d1e5191e
AJ
2560 resolv.h \
2561,,,
2562SQUID_BSDNET_INCLUDES)
5a3237b0 2563
aee0606f 2564AC_C_CONST
d57288d2 2565AC_C_BIGENDIAN
aee0606f 2566
6a9f6389 2567AC_STRUCT_TM
2568AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
2569#if TM_IN_SYS_TIME
2570#if HAVE_SYS_TIME_H
2571#include <sys/time.h>
2572#endif
2573#elif HAVE_TIME_H
2574#include <time.h>
2575#endif
5c51415d 2576])
46c883ed 2577
6a9f6389 2578AC_CHECK_TYPE(struct mallinfo,AC_DEFINE(HAVE_STRUCT_MALLINFO,1,[The system provides struct mallinfo]),,[
2579#if HAVE_SYS_TYPES_H
2580#include <sys/types.h>
2581#endif
eb824054 2582#if HAVE_MALLOC_H
2583#include <malloc.h>
6a9f6389 2584#endif])
eb824054 2585
6a9f6389 2586AC_CHECK_MEMBERS([struct mallinfo.mxfast],,,[
2587#if HAVE_SYS_TYPES_H
2588#include <sys/types.h>
2589#endif
2590#if HAVE_MALLOC_H
2591#include <malloc.h>
2592#endif])
090089c4 2593
08caf8c6 2594dnl Override rusage() detect on MinGW because is emulated in source code
2595case "$host_os" in
2596 mingw|mingw32)
2597 AC_DEFINE(HAVE_STRUCT_RUSAGE)
2598 ac_cv_func_getrusage='yes'
eed82608 2599 AC_MSG_NOTICE([Using own rusage on Windows.])
08caf8c6 2600 ;;
2601 *)
2602 AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
8ff51bba 2603#if HAVE_SYS_TIME_H
2604#include <sys/time.h>
2605#endif
b54a6789 2606#if HAVE_SYS_RESOURCE_H
2607#include <sys/resource.h>
6a9f6389 2608#endif])
08caf8c6 2609 ;;
2610esac
b54a6789 2611
6a9f6389 2612AC_CHECK_MEMBERS([struct iphdr.ip_hl],,,[
2613#if HAVE_SYS_TYPES_H
2614#include <sys/types.h>
2615#endif
a025a745 2616#include <netinet/in.h>
2617#include <netinet/in_systm.h>
6ad85e8a 2618#include <netinet/ip.h>
b05490a8 2619#if defined (__linux__) || defined (__CYGWIN__)
6ad85e8a 2620#define ip_hl ihl
2621#endif
2622#ifndef __linux__
b05490a8 2623#ifndef __CYGWIN__
6ad85e8a 2624#define iphdr ip
b05490a8 2625#endif
6a9f6389 2626#endif])
a025a745 2627
090089c4 2628dnl Check for typedefs
77d6bd88 2629AC_CHECK_SIZEOF(void *)
090089c4 2630
0409a509 2631dnl 8 bit integers - int8_t
2632dnl if this is defined we trust it to be 8 bits
2633AC_CHECK_TYPE(int8_t,[
2634 AC_CHECK_SIZEOF(int8_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2635 AC_DEFINE(HAVE_INT8_T,1,[int8_t is defined in system headers])
2636 ],,SQUID_DEFAULT_INCLUDES)
2637
2638dnl fallback #1
2639AC_CHECK_TYPE(char,[
2640 AC_CHECK_SIZEOF(char,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2641 AC_DEFINE(HAVE_CHAR,1,[char is defined in system headers])
2642 ],,SQUID_DEFAULT_INCLUDES)
2643
2644dnl unsigned 8 bit ints - u_int8_t
2645dnl if this is defined we trust it to be 8 bits
2646AC_CHECK_TYPE(u_int8_t,[
2647 AC_CHECK_SIZEOF(u_int8_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2648 AC_DEFINE(HAVE_U_INT8_T,1,[u_int8_t is defined in system headers])
2649 ],,SQUID_DEFAULT_INCLUDES)
2650
2651dnl fallback #1
2652dnl if this is defined we trust it to be 8 bits
2653AC_CHECK_TYPE(uint8_t,[
2654 AC_CHECK_SIZEOF(uint8_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2655 AC_DEFINE(HAVE_UINT8_T,1,[uint8_t is defined in system headers])
2656 ],,SQUID_DEFAULT_INCLUDES)
2657
2658dnl 16 bit integers - int16_t
6a9f6389 2659dnl if this is defined we trust it to be 16 bits
62266438 2660AC_CHECK_TYPE(int16_t,[
2661 AC_CHECK_SIZEOF(int16_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2662 AC_DEFINE(HAVE_INT16_T,1,[int16_t is defined in system headers])
2663 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2664
2665dnl fallback #1
2666AC_CHECK_TYPE(short,[
856e69c5 2667 AC_CHECK_SIZEOF(short,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2668 AC_DEFINE(HAVE_SHORT,1,[short is defined in system headers])
2669 ],,SQUID_DEFAULT_INCLUDES)
2670
2671dnl fallback #2
2672AC_CHECK_TYPE(int,[
856e69c5 2673 AC_CHECK_SIZEOF(int,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2674 AC_DEFINE(HAVE_INT,1,[int is defined in system headers])
2675 ],,SQUID_DEFAULT_INCLUDES)
2676
2677dnl unsigned 16 bit ints - u_int16_t
2678dnl if this is defined we trust it to be 16 bits
62266438 2679AC_CHECK_TYPE(u_int16_t,[
2680 AC_CHECK_SIZEOF(u_int16_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2681 AC_DEFINE(HAVE_U_INT16_T,1,[u_int16_t is defined in system headers])
2682 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2683
2684dnl fallback #1
2685dnl if this is defined we trust it to be 16 bits
62266438 2686AC_CHECK_TYPE(uint16_t,[
2687 AC_CHECK_SIZEOF(uint16_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2688 AC_DEFINE(HAVE_UINT16_T,1,[uint16_t is defined in system headers])
2689 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2690
2691dnl 32 bit signed int - int32_t
2692dnl if this is defined we trust it to be 32 bits
62266438 2693AC_CHECK_TYPE(int32_t,[
2694 AC_CHECK_SIZEOF(int32_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2695 AC_DEFINE(HAVE_INT32_T,1,[int32_t is defined in system headers])
2696 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2697
2698dnl fallback #1
2699AC_CHECK_TYPE(long,[
856e69c5 2700 AC_CHECK_SIZEOF(long,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2701 AC_DEFINE(HAVE_LONG,1,[long is defined in system headers])
2702 ],,SQUID_DEFAULT_INCLUDES)
2703
2704dnl 32 bit unsigned int - u_int32_t
2705dnl if this is defined we trust it to be 32 bits
62266438 2706AC_CHECK_TYPE(u_int32_t,[
2707 AC_CHECK_SIZEOF(u_int32_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2708 AC_DEFINE(HAVE_U_INT32_T,1,[u_int32_t is defined in system headers])
2709 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2710
2711dnl fallback #1
2712dnl if this is defined we trust it to be 32 bits
62266438 2713AC_CHECK_TYPE(uint32_t,[
2714 AC_CHECK_SIZEOF(uint32_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2715 AC_DEFINE(HAVE_UINT32_T,1,[uint32_t is defined in system headers])
2716 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2717
2718dnl 64 bit signed - int64_t
2719dnl if this is defind we trust it to be 64 bits
62266438 2720AC_CHECK_TYPE(int64_t,[
2721 AC_CHECK_SIZEOF(int64_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2722 AC_DEFINE(HAVE_INT64_T,1,[int64_t is defined in system headers])
2723 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2724
2725dnl fallback #1
2726dnl if this is defind we trust it to be 64 bits
62266438 2727AC_CHECK_TYPE(__int64,[
2728 AC_CHECK_SIZEOF(__int64,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2729 AC_DEFINE(HAVE___INT64,1,[__int64 is defined in system headers])
2730 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2731
2732dnl fallback #2
2733AC_CHECK_TYPE(long long,[
856e69c5 2734 AC_CHECK_SIZEOF(long long,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2735 AC_DEFINE(HAVE_LONG_LONG,1,[long long is defined in system headers])
2736 ],,SQUID_DEFAULT_INCLUDES)
2737
2738dnl 64 bit unsigned - u_int64_t
2739dnl if this is defind we trust it to be 64 bits
62266438 2740AC_CHECK_TYPE(u_int64_t,[
2741 AC_CHECK_SIZEOF(u_int64_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2742 AC_DEFINE(HAVE_U_INT64_T,1,[u_int64_t is defined in system headers])
2743 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2744
2745dnl fallback #1
2746dnl if this is defind we trust it to be 64 bits
62266438 2747AC_CHECK_TYPE(uint64_t,[
2748 AC_CHECK_SIZEOF(uint64_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2749 AC_DEFINE(HAVE_UINT64_T,1,[uint64_t is defined in system headers])
2750 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2751
588e71df 2752dnl On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
2753dnl that is incompatible with the updated Solaris header files.
2754dnl For this reason, we must check if pad128_t and upad128_t are defined.
2755AC_CHECK_TYPE(pad128_t,
2756 AC_DEFINE(HAVE_PAD128_T,1,[pad128_t is defined in system headers]),
2757 ,SQUID_DEFAULT_INCLUDES)
2758
2759AC_CHECK_TYPE(upad128_t,
2760 AC_DEFINE(HAVE_UPAD128_T,1,[upad128_t is defined in system headers]),
2761 ,SQUID_DEFAULT_INCLUDES)
2762
6a9f6389 2763AC_CHECK_TYPE(pid_t, AC_DEFINE(HAVE_PID_T,1,[pid_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
856e69c5 2764AC_CHECK_TYPE(size_t, [AC_CHECK_SIZEOF(size_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2765 AC_DEFINE(HAVE_SIZE_T,1,[size_t is defined by the system headers])],,SQUID_DEFAULT_INCLUDES)
2766AC_CHECK_TYPE(ssize_t, AC_DEFINE(HAVE_SSIZE_T,1,[ssize_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
856e69c5 2767AC_CHECK_TYPE(off_t,[ AC_CHECK_SIZEOF(off_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2768 AC_DEFINE(HAVE_OFF_T,1,[off_t is defined by the system headers])],,SQUID_DEFAULT_INCLUDES)
2769AC_CHECK_TYPE(mode_t, AC_DEFINE(HAVE_MODE_T,1,[mode_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2770AC_CHECK_TYPE(fd_mask, AC_DEFINE(HAVE_FD_MASK,1,[fd_mask is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
adcceb47 2771
77d6bd88 2772dnl Check for special functions
2773AC_FUNC_ALLOCA
2774
6a9f6389 2775AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the system headers]),,[
2776#include <sys/types.h>
6637e3a5 2777#include <sys/socket.h>
2778#if STDC_HEADERS
2779#include <stdlib.h>
2780#include <stddef.h>
6a9f6389 2781#endif])
6637e3a5 2782
b50f1b2b 2783dnl Check for libcap header (assume its not broken unless
69367152
HN
2784use_libcap=auto
2785AC_ARG_WITH(libcap, AS_HELP_STRING([--without-libcap],[disable usage of Linux capabilities library to control privileges]),
2786[ if test "x$withval" = "xyes" ; then
b64b6030 2787 AC_MSG_RESULT(libcap forced enabled)
69367152 2788 use_libcap=yes
b50f1b2b 2789 else
1c9910eb 2790 AC_MSG_RESULT(libcap forced disabled)
69367152 2791 use_libcap=no
b50f1b2b 2792 fi
b64b6030 2793])
69367152 2794if test "x$use_libcap" != "xno"; then
b64b6030
HN
2795 # cap_clear_flag is the most recent libcap function we require
2796 AC_CHECK_LIB(cap, cap_clear_flag)
6a4d3ec8
HN
2797 if test "x$ac_cv_lib_cap_cap_clear_flag" = xyes; then
2798 use_libcap=yes
2799 else
69367152 2800 if test "x$use_libcap" = "xyes"; then
ff8d255b 2801 AC_MSG_ERROR([libcap forced enabled but not available or not usable, requires libcap-2.09 or later])
b64b6030 2802 fi
69367152 2803 use_libcap=no
b64b6030
HN
2804 fi
2805fi
69367152 2806
6a4d3ec8 2807if test "x$use_libcap" = "xyes"; then
b64b6030
HN
2808 AC_DEFINE(USE_LIBCAP, 1, [use libcap to set capabilities required for TPROXY])
2809 dnl Check for libcap headader breakage.
b50f1b2b 2810 AC_CHECK_HEADERS(sys/capability.h)
ff8d255b
HN
2811 AC_CACHE_CHECK([for operational libcap2 headers], squid_cv_sys_capability_works,
2812 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2813#include <stdlib.h>
2814#include <stddef.h>
2815#include <sys/capability.h>
2816]], [[
2817capget(NULL, NULL);
2818capset(NULL, NULL);
2819 ]])],[squid_cv_sys_capability_works=yes],[squid_cv_sys_capability_works=no])
b50f1b2b 2820 )
ff8d255b
HN
2821 if test x$squid_cv_sys_capability_works != xyes; then
2822 AC_DEFINE([LIBCAP_BROKEN],1,[if libcap2 headers are broken and clashing with glibc])
2823 fi
b50f1b2b 2824fi
5b43d209 2825
b64b6030 2826
6a9f6389 2827AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,[mtyp_t is defined by the system headers]),,[#include <sys/types.h>
aea1be68 2828#include <sys/ipc.h>
6a9f6389 2829#include <sys/msg.h>])
aea1be68 2830
090089c4 2831dnl Check for needed libraries
54c95954
FC
2832AC_SEARCH_LIBS([gethostbyname],[nsl resolv bind])
2833AC_SEARCH_LIBS([res_init],[resolv])
2834AC_SEARCH_LIBS([bind],[socket])
2835AC_SEARCH_LIBS([opcom_stack_trace],[opcom_stack])
2836AC_SEARCH_LIBS([strlcpy], [bsd])
85cd85f3 2837AC_SEARCH_LIBS([yp_match], [nsl nss_nis nss_nisplus])
bfe8dedf 2838dnl Check for Winsock only on MinGW, on Cygwin we must use emulated BSD socket API
4b26fae9 2839case "$host_os" in
2840 mingw|mingw32)
2841 AC_MSG_CHECKING(for winsock)
2842 save_LIBS="$LIBS"
2843 for curlib in ws2_32 wsock32; do
2844 LIBS="$LIBS -l$curlib"
62979ab1 2845 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <winsock.h>]], [[
1635bf30
GS
2846 socket(0,0,0);
2847 select(0,NULL,NULL,NULL,NULL);
2848 closesocket(0);
2849 gethostname(NULL,0);
62979ab1 2850 ]])],[have_winsock=yes],[have_winsock=no])
4b26fae9 2851
2852 if test $have_winsock = yes; then
2853 ac_cv_func_select='yes'
2854 if test $curlib = ws2_32; then
2855 have_winsock=winsock2
2856 fi
2857 break
2858 fi
2859 LIBS="$save_LIBS"
2860 done
2861 AC_MSG_RESULT($have_winsock)
bfe8dedf
GS
2862 if test $have_winsock = winsock2; then
2863 AC_CHECK_HEADERS(winsock2.h)
2864 else
2865 AC_CHECK_HEADERS(winsock.h)
2866 fi
4b26fae9 2867 ;;
2868esac
94d48591 2869
3c641669 2870dnl Ripped from the Samba sources
2871AC_CACHE_CHECK([for unix domain sockets],squid_cv_unixsocket, [
62979ab1 2872 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3c641669 2873#include <sys/types.h>
2874#include <stdlib.h>
2875#include <stddef.h>
2876#include <sys/socket.h>
62979ab1 2877#include <sys/un.h>]], [[
3c641669 2878 struct sockaddr_un sunaddr;
2879 sunaddr.sun_family = AF_UNIX;
62979ab1 2880]])],[squid_cv_unixsocket=yes],[squid_cv_unixsocket=no])])
3c641669 2881if test x"$squid_cv_unixsocket" = x"yes"; then
6a9f6389 2882 AC_DEFINE(HAVE_UNIXSOCKET,1,[Do we have unix sockets? (required for the winbind ntlm helper])
3c641669 2883fi
2884dnl end rip
2885
94d48591 2886 AC_CHECK_LIB(gnumalloc, main)
2887 if test "$ac_cv_lib_gnumalloc_main" = "yes"; then
eed82608 2888 AC_MSG_NOTICE([Disabling extended malloc functions when using gnumalloc])
94d48591 2889 ac_cv_func_mallinfo=no
2890 ac_cv_func_mallocblksize=no
2891 ac_cv_func_mallopt=no
2892 else
2893 case "$host" in
2894 *-sun-solaris*)
eed82608 2895 AC_MSG_NOTICE([skipping libmalloc check for $host])
94d48591 2896 ;;
2897 i386-*-freebsd*)
eed82608 2898 AC_MSG_NOTICE([skipping libmalloc check for $host])
94d48591 2899 ;;
2900 *)
2901
2902 AC_CHECK_LIB(malloc, main)
2903 ;;
2904 esac
2905 fi
94d48591 2906
be79ade0 2907AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"])
08caf8c6 2908case "$host_os" in
2909mingw|mingw32)
eed82608 2910 AC_MSG_NOTICE([Use MSVCRT for math functions.])
08caf8c6 2911 ;;
2912 *)
2913 AC_CHECK_LIB(m, main)
2914 ;;
2915esac
090089c4 2916
001ad4cc
AJ
2917dnl Enable IPv6 support
2918AC_MSG_CHECKING([whether to enable IPv6])
2919use_ipng=yes
2920AC_ARG_ENABLE(ipv6,
62979ab1 2921 AS_HELP_STRING([--disable-ipv6],[Disable IPv6 support]),
001ad4cc
AJ
2922[ if test "x$enableval" = "xyes" ; then
2923 AC_MSG_RESULT(yes)
2924 else
2925 AC_MSG_RESULT(no)
2926 use_ipng=no
2927 fi
2928],[AC_MSG_RESULT(yes)])
2929
2930if test "$use_ipng" = "yes"; then
2931 SAVED_LIBS="$LIBS"
2932 dnl Solaris 10/11 requires -lsocket
2933 case "$host" in
2934 *-solaris*)
2935 LIBS="$LIBS -lsocket"
2936 ;;
2937 *)
2938 ;;
2939 esac
2940 AC_CACHE_CHECK([if PF_INET6 is available], $use_ipng,
62979ab1 2941 AC_RUN_IFELSE([AC_LANG_SOURCE([[ /* PF_INET6 available check */
001ad4cc
AJ
2942# include <sys/types.h>
2943# include <sys/socket.h>
b3167ca7 2944 int main(int argc, char **argv) {
001ad4cc
AJ
2945 if (socket(PF_INET6, SOCK_STREAM, 0) < 0)
2946 return 1;
2947 else
2948 return 0;
2949 }
62979ab1 2950 ]])],[ AC_MSG_RESULT(yes)
001ad4cc 2951 use_ipng=yes
62979ab1
AJ
2952 SAVED_LIBS="$LIBS" ],[ AC_MSG_RESULT(no)
2953 use_ipng=no ],[])
001ad4cc
AJ
2954 )
2955 LIBS="$SAVED_LIBS"
2956fi
2957
2958if test "$use_ipng" = "yes"; then
2959 AC_DEFINE(USE_IPV6,1,[Enable support for IPv6 ])
18a8e998 2960 SET_IPV6_SETTINGS=""
001ad4cc
AJ
2961 use_v4mapped=yes
2962
44770d71 2963dnl Check for forced split-stack mode
001ad4cc
AJ
2964 AC_MSG_CHECKING([for IPv6 split-stack requirement])
2965 AC_ARG_WITH(ipv6-split-stack,
62979ab1 2966 AS_HELP_STRING([--with-ipv6-split-stack],[Force-Enable experimental split-stack support for Windows XP and *BSD. Requires IPv6.]),
001ad4cc
AJ
2967 [ use_v4mapped="no"
2968 AC_MSG_RESULT(yes)],
2969 [ AC_MSG_RESULT(no) ])
2970
44770d71
AJ
2971dnl Check for IPv6 v4-mapping availability
2972dnl Useful for other OS with hybrid-stack defaults turned OFF
001ad4cc
AJ
2973dnl But only usable if it actually works...
2974 if test "$use_v4mapped" = "yes" ; then
2975 AC_MSG_CHECKING([for IPv6 v4-mapping ability])
62979ab1 2976 AC_RUN_IFELSE([AC_LANG_SOURCE([[ /* IPPROTO_V4MAPPED is usable check */
001ad4cc
AJ
2977# include <sys/types.h>
2978# include <sys/socket.h>
2979# include <netinet/in.h>
2980#if HAVE_NETINET_IN6_H
2981# include <netinet/in6.h>
2982#endif
b3167ca7 2983 int main(int argc, char **argv) {
001ad4cc
AJ
2984 int s = socket(PF_INET6, SOCK_STREAM, 0);
2985 int tos = 0;
2986 if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, (char *) &tos, sizeof(int)) < 0)
2987 return 1;
2988 else
2989 return 0;
2990 }
62979ab1 2991 ]])],[ AC_MSG_RESULT(yes)
001ad4cc
AJ
2992 use_v4mapped=yes
2993 AC_DEFINE(IPV6_SPECIAL_V4MAPPED, 1, [Enable v4-mapping through v6 sockets])
62979ab1 2994 ],[ AC_MSG_RESULT(no)
001ad4cc
AJ
2995 AC_DEFINE(IPV6_SPECIAL_V4MAPPED, 0, [Enable v4-mapping through v6 sockets])
2996 use_v4mapped=no
62979ab1 2997 ],[])
001ad4cc
AJ
2998 fi
2999
3000dnl if we can't defer v4-mapping to the OS we are forced to split-stack the FD table.
3001 AC_MSG_CHECKING([for IPv6 stack type/mode])
3002 if test "$use_v4mapped" = "yes"; then
3003 AC_DEFINE(IPV6_SPECIAL_V4MAPPED, 1, [Enable v4-mapping through v6 sockets. Requires IPv6 hybrid-stack.])
3004 AC_DEFINE(IPV6_SPECIAL_SPLITSTACK, 0, [Enable support for IPv6 on split-stack implementations])
3005 AC_MSG_RESULT(mapping hybrid)
3006 else
3007 AC_DEFINE(IPV6_SPECIAL_V4MAPPED, 0, [Enable v4-mapping through v6 sockets. Requires IPv6 hybrid-stack.])
3008 AC_DEFINE(IPV6_SPECIAL_SPLITSTACK, 1, [Enable support for IPv6 on split-stack implementations])
3009 AC_MSG_RESULT(split-stack or BSD non-mapping dual-stack)
3010 fi
3011
3012dnl Check whether this OS defines sin6_len as a member of sockaddr_in6 as a backup to ss_len
3013AC_CACHE_CHECK([for sin6_len field in struct sockaddr_in6],
3014 ac_cv_have_sin6_len_in_struct_sai, [
62979ab1 3015 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
001ad4cc
AJ
3016#include <sys/types.h>
3017#include <sys/socket.h>
3018#include <netinet/in.h>
62979ab1
AJ
3019 ]], [[ struct sockaddr_in6 s; s.sin6_len = 1; ]])],[ ac_cv_have_sin6_len_in_struct_sai="yes" ],[ ac_cv_have_sin6_len_in_struct_sai="no"
3020 ])
001ad4cc
AJ
3021 ])
3022 if test "x$ac_cv_have_sin6_len_in_struct_sai" = "xyes" ; then
3023 AC_DEFINE(HAVE_SIN6_LEN_IN_SAI, 1, [Does struct sockaddr_in6 have sin6_len? 1: Yes, 0: No])
3024 else
3025 AC_DEFINE(HAVE_SIN6_LEN_IN_SAI, 0, [Does struct sockaddr_in6 have sin6_len? 1: Yes, 0: No])
3026 fi
3027
3028else
3029 # NP: semi-silent failure as IPv4-only mode is perfectly usable on this system.
3030 AC_MSG_WARN([IPv6 is not available on this system.])
3031 AC_DEFINE(USE_IPV6,0,[Enable support for IPv6])
3032 AC_DEFINE(IPV6_SPECIAL_SPLITSTACK,0,[Enable support for IPv6 on split-stack implementations])
3033 AC_DEFINE(IPV6_SPECIAL_V4MAPPED,0,[Enable v4-mapping through v6 sockets])
18a8e998 3034 SET_IPV6_SETTINGS="\#IPv6 Not Available: "
001ad4cc 3035fi
18a8e998 3036AC_SUBST(SET_IPV6_SETTINGS)
001ad4cc
AJ
3037
3038dnl Check whether this OS defines ss_len as a member of sockaddr_storage
3039AC_CACHE_CHECK([for ss_len field in struct sockaddr_storage],
3040 ac_cv_have_ss_len_in_struct_ss, [
62979ab1 3041 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
001ad4cc
AJ
3042#include <sys/types.h>
3043#include <sys/socket.h>
3044#include <netinet/in.h>
62979ab1
AJ
3045 ]], [[ struct sockaddr_storage s; s.ss_len = 1; ]])],[ ac_cv_have_ss_len_in_struct_ss="yes" ],[ ac_cv_have_ss_len_in_struct_ss="no"
3046 ])
001ad4cc
AJ
3047])
3048if test "x$ac_cv_have_ss_len_in_struct_ss" = "xyes" ; then
3049 AC_DEFINE(HAVE_SS_LEN_IN_SS, 1, [Does struct sockaddr_storage have ss_len? 1: Yes, 0: No])
3050else
3051 AC_DEFINE(HAVE_SS_LEN_IN_SS, 0, [Does struct sockaddr_storage have ss_len? 1: Yes, 0: No])
3052fi
3053
3054dnl Check whether this OS defines sin_len as a member of sockaddr_in as a backup to ss_len
3055AC_CACHE_CHECK([for sin_len field in struct sockaddr_in],
3056 ac_cv_have_sin_len_in_struct_sai, [
62979ab1 3057 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
001ad4cc
AJ
3058#include <sys/types.h>
3059#include <sys/socket.h>
3060#include <netinet/in.h>
62979ab1
AJ
3061 ]], [[ struct sockaddr_in s; s.sin_len = 1; ]])],[ ac_cv_have_sin_len_in_struct_sai="yes" ],[ ac_cv_have_sin_len_in_struct_sai="no"
3062 ])
001ad4cc
AJ
3063])
3064if test "x$ac_cv_have_sin_len_in_struct_sai" = "xyes" ; then
3065 AC_DEFINE(HAVE_SIN_LEN_IN_SAI, 1, [Does struct sockaddr_in have sin_len? 1: Yes, 0: No])
3066else
3067 AC_DEFINE(HAVE_SIN_LEN_IN_SAI, 0, [Does struct sockaddr_in have sin_len? 1: Yes, 0: No])
3068fi
3069
090089c4 3070dnl Check for libcrypt
0d8565ac 3071CRYPTLIB=
8154dd82 3072dnl Some of our helpers use crypt(3) which may be in libc, or in
3073dnl libcrypt (eg FreeBSD)
c1dc012a 3074AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
3d4022fa 3075dnl Solaris10 provides MD5 natively through libmd5
c1dc012a 3076AC_CHECK_LIB(md5, MD5Init, [CRYPTLIB="$CRYPTLIB -lmd5"])
be79ade0 3077AC_SUBST(CRYPTLIB)
77f675ad 3078
0d8565ac
AJ
3079# check for crypt, may require -lcrypt
3080SAVED_LIBS="$LIBS"
3081LIBS="$LIBS $CRYPTLIB"
3082AC_CHECK_FUNCS(crypt)
3083LIBS="$SAVED_LIBS"
3084
3085
042b1f8a 3086dnl Check for libdl, used by auth_modules/PAM
8154dd82 3087if test "$with_dl" = "yes"; then
3088 AC_CHECK_LIB(dl, dlopen)
3089fi
042b1f8a 3090
86ec11aa 3091dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
3092dnl Robert Side <rside@aiinc.bc.ca>
3093dnl Mon, 18 Jan 1999 17:48:00 GMT
3094case "$host" in
3095 *-pc-sco3.2*)
3096 AC_CHECK_LIB(intl, strftime)
3097 ;;
3098esac
3099
20e869bf 3100dnl On MinGW OpenLDAP is not available, so LDAP helpers can be linked
3101dnl only with Windows LDAP libraries using -lwldap32
3102case "$host_os" in
3103mingw|mingw32)
428744a1
AJ
3104 LDAPLIB="-lwldap32"
3105 LBERLIB=""
3106 ;;
20e869bf 3107*)
428744a1
AJ
3108 LDAPLIB="-lldap"
3109 dnl LDAP helpers need to know if -llber is needed or not
3110 AC_CHECK_LIB(lber, main, [LBERLIB="-llber"])
3111 ;;
20e869bf 3112esac
428744a1
AJ
3113AC_SUBST(LDAPLIB)
3114AC_SUBST(LBERLIB)
20e869bf 3115
b7a1c19e 3116dnl Check for libdb
3117DBLIB=
01b4931d 3118dnl 1.85
a258dfca 3119AC_CACHE_CHECK(if dbopen needs -ldb,ac_cv_dbopen_libdb, [
32d0bbd7 3120SAVED_LIBS="$LIBS"; LIBS="$LIBS -ldb"
62979ab1 3121 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
a258dfca 3122#if HAVE_SYS_TYPES_H
3123#include <sys/types.h>
3124#endif
3125#if HAVE_LIMITS_H
3126#include <limits.h>
3127#endif
3128#if HAVE_DB_185_H
3129#include <db_185.h>
3130#elif HAVE_DB_H
3131#include <db.h>
62979ab1 3132#endif]], [[dbopen("", 0, 0, DB_HASH, (void *)0L)]])],[ac_cv_dbopen_libdb="yes"],[ac_cv_dbopen_libdb="no"])
32d0bbd7 3133LIBS="$SAVED_LIBS"
a258dfca 3134])
2b2161bb 3135if test $ac_cv_dbopen_libdb = yes; then
32d0bbd7 3136 LIB_DB="-ldb"
3137fi
01b4931d 3138AC_SUBST(LIB_DB)
b7a1c19e 3139
77f675ad 3140dnl System-specific library modifications
3141dnl
3142case "$host" in
88738790 3143 i386-*-solaris2.*)
7149a49f 3144 if test "$GCC" = "yes"; then
eed82608 3145 AC_MSG_NOTICE([Removing -O for gcc on $host])
80e92d6d 3146 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
7149a49f 3147 fi
3148 ;;
77f675ad 3149 *-sgi-irix*)
eed82608 3150 AC_MSG_NOTICE([Removing -lsocket for IRIX...])
6716b242 3151 LIBS=`echo $LIBS | sed -e s/-lsocket//`
eed82608 3152 AC_MSG_NOTICE([Removing -lnsl for IRIX...])
6716b242 3153 LIBS=`echo $LIBS | sed -e s/-lnsl//`
c415c128 3154 ac_cv_lib_nsl_main=no
eed82608 3155 AC_MSG_NOTICE([Removing -lbsd for IRIX...])
b44c0fb4 3156 LIBS=`echo $LIBS | sed -e s/-lbsd//`
77f675ad 3157 ;;
4ba0bd0e 3158dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
3159dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
3160dnl Please change your configure script. AIX doesn't need -lbsd.
3161 *-ibm-aix*)
eed82608 3162 AC_MSG_NOTICE([Removing -lbsd for AIX...])
4ba0bd0e 3163 LIBS=`echo $LIBS | sed -e s/-lbsd//`
3164 ;;
30a4f2a8 3165 *m88k*)
fa035612 3166 SQUID_CFLAGS="$SQUID_CFLAGS -D_SQUID_MOTOROLA_"
3167 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_SQUID_MOTOROLA_"
6a9f6389 3168 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1,[If gettimeofday is known to take only one argument])
7149a49f 3169 ;;
580ce039 3170 [*-*-solaris2.[0-4]])
6a9f6389 3171 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
30a4f2a8 3172 ;;
711fa75e 3173 [*-sony-newsos[56]*])
6a9f6389 3174 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
f62c73dc 3175 ;;
77f675ad 3176esac
090089c4 3177
57faa85a 3178# Remove optimization for GCC 2.95.[123]
d20b1cd0 3179# gcc -O[2] on *BSD and Linux (x86) causes pointers to magically become NULL
3180if test "$GCC" = "yes"; then
3181 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
3182 case "$GCCVER" in
57faa85a 3183 [2.95.[123]])
eed82608 3184 AC_MSG_NOTICE([Removing -O for gcc on $host with GCC $GCCVER])
d20b1cd0 3185 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
3186 ;;
3187 esac
3188fi
3189
176d10ee 3190# Recommended by Balint Nagy Endre <bne@CareNet.hu>
3191case "$host" in
3192 *-univel-sysv4.2MP)
3193 if test `uname -v` = "2.03"; then
eed82608 3194 AC_MSG_NOTICE([disabling mallinfo for $host])
176d10ee 3195 ac_cv_func_mallinfo=no
3196 fi
3197 ;;
3198esac
3199
84cecfd2 3200dnl This has to be before AC_CHECK_FUNCS
3201# Disable poll() on certain platforms. Override by setting ac_cv_func_poll
3202# when running configure.
3203if test -z "$ac_cv_func_poll"; then
3204 case "$host" in
3205 [alpha-dec-osf3.*])
3206 # John Kay (jkay@nlanr.net) 19970818
eed82608 3207 AC_MSG_NOTICE([disabling poll for $host...])
84cecfd2 3208 ac_cv_func_poll='no'
3209 ;;
3210 [*-hp-hpux*.*])
3211 # Duane Wessels
eed82608 3212 AC_MSG_NOTICE([disabling poll for $host...])
84cecfd2 3213 ac_cv_func_poll='no'
3214 ;;
3215 [*-linux-*])
f5cec332 3216 # Henrik Nordstrom (hno@squid-cache.org) 19980817
9bb83c8b 3217 # poll is problematic on Linux. We disable it
3218 # by default until Linux gets it right.
b6a2f15e 3219 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
3220 if test $rev -lt 002002; then
eed82608 3221 AC_MSG_NOTICE([disabling poll for $host < 2.2...])
b6a2f15e 3222 ac_cv_func_poll='no'
3223 fi
84cecfd2 3224 ;;
c68e9c6b 3225 [powerpc-ibm-aix4.1.*])
3226 # Mike Laster (mlaster@metavillage.com) 19981021
eed82608 3227 AC_MSG_NOTICE([disabling poll for $host...])
c68e9c6b 3228 ac_cv_func_poll='no'
3229 ;;
86ec11aa 3230 [*-pc-sco3.2*])
3231 # Robert Side <rside@aiinc.bc.ca>
3232 # Mon, 18 Jan 1999 17:48:00 GMT
eed82608 3233 AC_MSG_NOTICE([disabling poll for $host...])
86ec11aa 3234 ac_cv_func_poll='no'
3235 ;;
84cecfd2 3236 esac
3237fi
176d10ee 3238
08caf8c6 3239dnl Override statfs() detect on MinGW becasue is emulated in source code
3240case "$host_os" in
3241mingw|mingw32)
3242 ac_cv_func_statfs='yes'
3243 ;;
3244esac
3245
6716b242 3246dnl Check for library functions
3247AC_CHECK_FUNCS(\
ce3d30fb 3248 backtrace_symbols_fd \
3a144521 3249 bcopy \
3250 bswap_16 \
3251 bswap_32 \
f9576890 3252 bswap16 \
3253 bswap32 \
4ac29a5b 3254 fchmod \
6716b242 3255 getdtablesize \
8505e57b 3256 getpagesize \
230c091c 3257 getpass \
3a144521 3258 getrlimit \
30a4f2a8 3259 getrusage \
9c1d8929 3260 getspnam \
379d5751 3261 gettimeofday \
52303a3d 3262 glob \
f9576890 3263 htobe16 \
3264 htole16 \
d474c7a6 3265 kqueue\
30a4f2a8 3266 lrand48 \
6716b242 3267 mallinfo \
0f5efab0 3268 mallocblksize \
6716b242 3269 mallopt \
2ae6b9b0 3270 memcpy \
30a4f2a8 3271 memmove \
dac27377 3272 memset \
b99a6dec 3273 mkstemp \
1812b6c7 3274 mktime \
88738790 3275 mstats \
84cecfd2 3276 poll \
62ae0622 3277 prctl \
3a144521 3278 pthread_attr_setschedparam \
cd748f27 3279 pthread_attr_setscope \
3280 pthread_setschedparam \
42b51993 3281 pthread_sigmask \
c68e9c6b 3282 putenv \
b1e77ec1 3283 random \
6716b242 3284 regcomp \
3285 regexec \
3286 regfree \
30a4f2a8 3287 res_init \
af76ec93 3288 __res_init \
4915be3b 3289 rint \
a4ba1105 3290 sbrk \
3a144521 3291 select \
234967c9 3292 seteuid \
c415c128 3293 setgroups \
30a4f2a8 3294 setpgrp \
6716b242 3295 setrlimit \
30a4f2a8 3296 setsid \
3297 sigaction \
11430c03 3298 snprintf \
1ccc0d40 3299 socketpair \
30a4f2a8 3300 srand48 \
b1e77ec1 3301 srandom \
0343b99c 3302 statfs \
6716b242 3303 sysconf \
3304 syslog \
234967c9 3305 timegm \
28da5e0d 3306 vsnprintf \
6716b242 3307)
f5e5c4cf 3308dnl ... and some we provide local replacements for
3309AC_REPLACE_FUNCS(\
3310 drand48 \
a98c2da5 3311 eui64_aton \
cc192b50 3312 inet_ntop \
3313 inet_pton \
f5e5c4cf 3314 initgroups \
cc192b50 3315 getaddrinfo \
3316 getnameinfo \
f5e5c4cf 3317 strerror \
585cddda
AJ
3318 strsep \
3319 strtoll \
f5e5c4cf 3320 tempnam \
3321)
6716b242 3322
1b3db6d9 3323dnl Magic which checks whether we are forcing a type of comm loop we
3324dnl are actually going to (ab)use
3325
3326dnl Actually do the define magic now
3327dnl mostly ripped from squid-commloops, thanks to adrian and benno
3328
d474c7a6 3329if test -n "$SELECT_TYPE"; then
bf53a520
FC
3330 AC_MSG_NOTICE([choosing user-specified net I/O API $SELECT_TYPE])
3331elif test "$squid_opt_enable_epoll" != "no" && test "$ac_cv_epoll_works" = "yes" ; then
3332 SELECT_TYPE="epoll"
3333elif test "$squid_opt_enable_kqueue" != "no" && test "$ac_cv_func_kqueue" = "yes" ; then
3334 SELECT_TYPE="kqueue"
3335elif test "$squid_opt_enable_poll" != "no" && test "$ac_cv_func_poll" = "yes" ; then
3336 SELECT_TYPE="poll"
3337elif test "$squid_opt_enable_select" != "no" && test "$ac_cv_func_select" = "yes" ; then
3338 SELECT_TYPE="select"
3339 if test "$squid_host_os" = "mingw" ; then
3340 SELECT_TYPE="select_win32"
3341 fi
1b3db6d9 3342else
bf53a520
FC
3343 AC_MSG_WARN([Eep! Can't find poll, kqueue, epoll, or select!])
3344 AC_MSG_WARN([I'll try select and hope for the best.])
3345 SELECT_TYPE="select"
1b3db6d9 3346fi
d474c7a6 3347
eed82608 3348AC_MSG_NOTICE([Using ${SELECT_TYPE} for the IO loop.])
d474c7a6 3349
3350AM_CONDITIONAL([USE_POLL], [test $SELECT_TYPE = poll])
3351AM_CONDITIONAL([USE_EPOLL], [test $SELECT_TYPE = epoll])
3352AM_CONDITIONAL([USE_SELECT], [test $SELECT_TYPE = select])
3353AM_CONDITIONAL([USE_SELECT_SIMPLE], [test $SELECT_TYPE = select_simple])
3354AM_CONDITIONAL([USE_SELECT_WIN32], [test $SELECT_TYPE = select_win32])
3355AM_CONDITIONAL([USE_KQUEUE], [test $SELECT_TYPE = kqueue])
3356AM_CONDITIONAL([USE_DEVPOLL], [test $SELECT_TYPE = devpoll])
3357
3358case $SELECT_TYPE in
bf53a520
FC
3359epoll) AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop]) ;;
3360poll) AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop]) ;;
3361kqueue) AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop]) ;;
3362select_win32) AC_DEFINE(USE_SELECT_WIN32,1,[Use Winsock select() for the IO loop]) ;;
3363select) AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop]) ;;
d474c7a6 3364esac
1b3db6d9 3365
60939927 3366dnl Yay! Another Linux brokenness. Its not good enough
3367dnl to know that setresuid() exists, because RedHat 5.0 declares
3368dnl setresuid() but doesn't implement it.
3369dnl
3370AC_CACHE_CHECK(if setresuid is implemented, ac_cv_func_setresuid,
62979ab1 3371 AC_RUN_IFELSE([AC_LANG_SOURCE([[
60939927 3372#include <stdlib.h>
b3167ca7 3373 int main(int argc, char **argv) {
5c51415d 3374 if(setresuid(-1,-1,-1)) {
3375 perror("setresuid:");
b3167ca7 3376 return 1;
60939927 3377 }
b3167ca7 3378 return 0;
5c51415d 3379 }
62979ab1 3380 ]])],[ac_cv_func_setresuid="yes"],[ac_cv_func_setresuid="no"],[])
60939927 3381)
5c51415d 3382if test "$ac_cv_func_setresuid" = "yes" ; then
6a9f6389 3383 AC_DEFINE(HAVE_SETRESUID,1,[Yay! Another Linux brokenness. Its not good enough to know that setresuid() exists, because RedHat 5.0 declare setresuid() but doesn't implement it.])
5c51415d 3384fi
60939927 3385
cee08cbc
AJ
3386dnl Yay! This one is a MacOSX brokenness. Its not good enough
3387dnl to know that strnstr() exists, because MacOSX 10.4 have a bad
3388dnl copy that crashes with a buffer over-run!
3389dnl
3390AC_CACHE_CHECK(if strnstr is well implemented, ac_cv_func_strnstr,
62979ab1 3391 AC_RUN_IFELSE([AC_LANG_SOURCE([[
cee08cbc
AJ
3392#include <stdlib.h>
3393#include <stdio.h>
3394#include <string.h>
3395 // we expect this to succeed, or crash on over-run.
3396 // if it passes otherwise we may need a better check.
3397int main(int argc, char **argv)
3398{
3399 int size = 20;
3400 char *str = malloc(size);
3401 memset(str, 'x', size);
3402 strnstr(str, "fubar", size);
3403 return 0;
3404}
62979ab1 3405 ]])],[ac_cv_func_strnstr="yes"],[ac_cv_func_strnstr="no"],[])
cee08cbc
AJ
3406)
3407if test "$ac_cv_func_strnstr" = "yes" ; then
3408 AC_DEFINE(HAVE_STRNSTR,1,[Yay! We have a working strnstr!])
3409else
3410 AC_DEFINE(HAVE_STRNSTR,0,[Yay! A MacOS X brokenness. Its not good enough to know that strnstr() exists, because MacOSX 10.4 and earlier may have a buffer overrun.])
3411fi
3412
eee79a2e 3413dnl
3414dnl Test for va_copy
3415dnl
3416AC_CACHE_CHECK(if va_copy is implemented, ac_cv_func_va_copy,
62979ab1 3417 AC_RUN_IFELSE([AC_LANG_SOURCE([[
eee79a2e 3418 #include <stdarg.h>
cf69e4f2 3419 #include <stdlib.h>
b3167ca7 3420 int f (int i, ...) {
eee79a2e 3421 va_list args1, args2;
3422 va_start (args1, i);
3423 va_copy (args2, args1);
3424 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
b3167ca7 3425 return 1;
eee79a2e 3426 va_end (args1); va_end (args2);
eee79a2e 3427 return 0;
3428 }
b3167ca7 3429 int main(int argc, char **argv) { return f (0, 42); }
62979ab1 3430 ]])],[ac_cv_func_va_copy="yes"],[ac_cv_func_va_copy="no"],[])
eee79a2e 3431)
3432if test "$ac_cv_func_va_copy" = "yes" ; then
a45f884d 3433 AC_DEFINE(HAVE_VA_COPY, 1, [If your system have va_copy])
eee79a2e 3434fi
3435
3436dnl
3437dnl Some systems support __va_copy
3438dnl
3439AC_CACHE_CHECK(if __va_copy is implemented, ac_cv_func___va_copy,
62979ab1 3440 AC_RUN_IFELSE([AC_LANG_SOURCE([[
eee79a2e 3441 #include <stdarg.h>
cf69e4f2 3442 #include <stdlib.h>
b3167ca7 3443 int f (int i, ...) {
eee79a2e 3444 va_list args1, args2;
3445 va_start (args1, i);
3446 __va_copy (args2, args1);
3447 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
b3167ca7 3448 return 1;
eee79a2e 3449 va_end (args1); va_end (args2);
eee79a2e 3450 return 0;
3451 }
b3167ca7 3452 int main(int argc, char **argv) { return f (0, 42); }
62979ab1 3453 ]])],[ac_cv_func___va_copy="yes"],[ac_cv_func___va_copy="no"],[])
eee79a2e 3454)
3455if test "$ac_cv_func___va_copy" = "yes" ; then
a45f884d 3456 AC_DEFINE(HAVE___VA_COPY, 1, [Some systems have __va_copy instead of va_copy])
eee79a2e 3457fi
c3d0c8b5 3458
5cafc1d6 3459dnl IP-Filter support requires ipf header files. These aren't
3460dnl installed by default, so we need to check for them
3461if test "$IPF_TRANSPARENT" ; then
3462 AC_MSG_CHECKING(if IP-Filter header files are installed)
42b51993 3463 # hold on to your hats...
3464 if test "$ac_cv_header_ip_compat_h" = "yes" ||
3465 test "$ac_cv_header_ip_fil_compat_h" = "yes" ||
87d21d8b 3466 test "$ac_cv_header_netinet_ip_compat_h" = "yes" ||
3467 test "$ac_cv_header_netinet_ip_fil_compat_h" = "yes" ; then
42b51993 3468 have_ipfilter_compat_header="yes"
3469 fi
3470 if test "x$have_ipfilter_compat_header" = "xyes" &&
eb824054 3471 test "$ac_cv_header_ip_fil_h" = "yes" &&
3472 test "$ac_cv_header_ip_nat_h" = "yes" ; then
3473 IPF_TRANSPARENT="yes"
3474 AC_DEFINE(IPF_TRANSPARENT, 1)
42b51993 3475 elif test "$have_ipfilter_compat_header" = "yes" &&
eb824054 3476 test "$ac_cv_header_netinet_ip_fil_h" = "yes" &&
3477 test "$ac_cv_header_netinet_ip_nat_h" = "yes" ; then
3478 IPF_TRANSPARENT="yes"
3479 AC_DEFINE(IPF_TRANSPARENT, 1)
3480 else
5cafc1d6 3481 IPF_TRANSPARENT="no"
3482 AC_DEFINE(IPF_TRANSPARENT, 0)
5cafc1d6 3483 fi
3484 AC_MSG_RESULT($IPF_TRANSPARENT)
3485fi
3486if test "$IPF_TRANSPARENT" = "no" ; then
eed82608
AJ
3487 AC_MSG_WARN([Cannot find necessary IP-Filter header files])
3488 AC_MSG_WARN([Transparent Proxy support WILL NOT be enabled])
5cafc1d6 3489 sleep 10
8f6ca20d 3490elif test "$IPF_TRANSPARENT" = "yes" ; then
3491dnl On Solaris Ipfilter includes expect that SOLARIS2 is defined with the
3492dnl Solaris minor version (8, 9, 10, ...)
3493 case "$host" in
3494 *-solaris*)
3495 solrev=`uname -r | sh -c 'IFS=. read j n x; echo $n'`
3496 CFLAGS="-DSOLARIS2=$solrev $CFLAGS"
20b3ae10 3497 CXXFLAGS="-DSOLARIS2=$solrev $CXXFLAGS"
8f6ca20d 3498 ;;
3499 *)
3500 ;;
3501 esac
5cafc1d6 3502fi
3503
2b0dd4ac 3504dnl PF support requires a header file.
3505if test "$PF_TRANSPARENT" ; then
3506 AC_MSG_CHECKING(if PF header file is installed)
3507 # hold on to your hats...
ec9909b0 3508 if test "$ac_cv_header_net_pfvar_h" = "yes" || test "$ac_cv_header_net_pf_pfvar_h" = "yes"; then
2b0dd4ac 3509 PF_TRANSPARENT="yes"
3510 AC_DEFINE(PF_TRANSPARENT, 1)
3511 else
3512 PF_TRANSPARENT="no"
3513 AC_DEFINE(PF_TRANSPARENT, 0)
3514 fi
3515 AC_MSG_RESULT($PF_TRANSPARENT)
3516fi
3517if test "$PF_TRANSPARENT" = "no" ; then
eed82608
AJ
3518 AC_MSG_WARN([Cannot find necessary PF header file])
3519 AC_MSG_WARN([Transparent Proxy support WILL NOT be enabled])
2b0dd4ac 3520 sleep 10
3521fi
3522
d852fbad 3523dnl Linux-Netfilter support requires Linux 2.4 kernel header files.
3524dnl Shamelessly copied from above
3525if test "$LINUX_NETFILTER" ; then
d6d62546 3526 AC_MSG_CHECKING(if Linux (Netfilter) kernel header files are installed)
d852fbad 3527 # hold on to your hats...
3528 if test "$ac_cv_header_linux_netfilter_ipv4_h" = "yes"; then
3529 LINUX_NETFILTER="yes"
3530 AC_DEFINE(LINUX_NETFILTER, 1)
3531 else
3532 LINUX_NETFILTER="no"
3533 AC_DEFINE(LINUX_NETFILTER, 0)
3534 fi
3535 AC_MSG_RESULT($LINUX_NETFILTER)
b50f1b2b 3536fi
d852fbad 3537if test "$LINUX_NETFILTER" = "no" ; then
eed82608
AJ
3538 AC_MSG_WARN([Cannot find necessary Linux kernel (Netfilter) header files])
3539 AC_MSG_WARN([Linux Transparent and Intercepting Proxy support WILL NOT be enabled])
1bffb955
HN
3540 LINUX_TPROXY2="no"
3541 AC_DEFINE(LINUX_TPROXY2, 0, [Enable real Transparent Proxy support for Netfilter TPROXY v2.])
d852fbad 3542 sleep 10
3543fi
b50f1b2b 3544dnl Netfilter TPROXY depends on libcap but the NAT parts can still work.
69367152 3545if test "$LINUX_NETFILTER" = "yes" && test "$use_libcap" != "yes" ; then
b50f1b2b
AJ
3546 AC_MSG_WARN([Missing needed capabilities (libcap or libcap2) for TPROXY])
3547 AC_MSG_WARN([Linux Transparent Proxy support WILL NOT be enabled])
3548 AC_MSG_WARN([Reduced support to Interception Proxy])
1bffb955
HN
3549 LINUX_TPROXY2="no"
3550 AC_DEFINE(LINUX_TPROXY2, 0, [Enable real Transparent Proxy support for Netfilter TPROXY v2.])
b50f1b2b
AJ
3551 sleep 10
3552fi
d852fbad 3553
f1e0717c 3554dnl Linux Netfilter/TPROXYv2 support requires some specific header files
b50f1b2b
AJ
3555dnl Shamelessly copied from above
3556if test "$LINUX_TPROXY2"; then
69367152 3557 if test "$use_libcap" = "yes"; then
f1e0717c 3558 AC_MSG_CHECKING(if TPROXYv2 header files are installed)
fc68f6b1 3559 # hold on to your hats...
3560 if test "$ac_cv_header_linux_netfilter_ipv4_ip_tproxy_h" = "yes" && test "$LINUX_NETFILTER" = "yes"; then
f1e0717c
AJ
3561 LINUX_TPROXY2="yes"
3562 AC_DEFINE(LINUX_TPROXY2, 1, [Enable real Transparent Proxy support for Netfilter TPROXY v2.])
fc68f6b1 3563 else
f1e0717c
AJ
3564 LINUX_TPROXY2="no"
3565 AC_DEFINE(LINUX_TPROXY2, 0, [Enable real Transparent Proxy support for Netfilter TPROXY v2.])
3566 fi
3567 AC_MSG_RESULT($LINUX_TPROXY2)
3568 if test "$LINUX_TPROXY2" = "no" && test "$LINUX_NETFILTER" = "yes"; then
eed82608
AJ
3569 AC_MSG_WARN([Cannot find TPROXY v2 headers, you need to patch the kernel with ])
3570 AC_MSG_WARN([tproxy package from:])
3571 AC_MSG_WARN([ - lynx http://www.balabit.com/downloads/files/tproxy/])
3572 AC_MSG_WARN([Or select the '--enable-linux-netfilter' option instead for Netfilter support.])
f1e0717c 3573 sleep 10
fc68f6b1 3574 fi
b50f1b2b
AJ
3575 else
3576 AC_MSG_WARN([Missing needed capabilities (libcap or libcap2) for TPROXY v2])
3577 AC_MSG_WARN([Linux Transparent Proxy support WILL NOT be enabled])
1bffb955
HN
3578 LINUX_TPROXY2="no"
3579 AC_DEFINE(LINUX_TPROXY2, 0, [Enable real Transparent Proxy support for Netfilter TPROXY v2.])
b50f1b2b
AJ
3580 sleep 10
3581 fi
fc68f6b1 3582fi
3583
cc937513 3584AC_ARG_ENABLE(gnuregex,
62979ab1 3585 AS_HELP_STRING([--enable-gnuregex],[Compile GNUregex. Unless you have reason to use
cc937513
AJ
3586 this option, you should not enable it.
3587 This library file is usually only required on Windows and
3588 very old Unix boxes which do not have their own regex
3589 library built in.]),
3590[USE_GNUREGEX=$enableval])
91bc414e 3591if test -z "$USE_GNUREGEX" ; then
3592 case "$host" in
3593 *-sun-solaris2.[[0-4]])
3594 USE_GNUREGEX="yes"
3595 ;;
3596 *-next-nextstep*)
3597 USE_GNUREGEX="yes"
3598 ;;
3599 esac
3600fi
7a081912 3601AC_MSG_CHECKING(if GNUregex needs to be compiled)
91bc414e 3602if test -z "$USE_GNUREGEX"; then
55878dfd 3603if test "$ac_cv_func_regcomp" = "no" || test "$USE_GNUREGEX" = "yes" ; then
74946a0f 3604 USE_GNUREGEX="yes"
00fa2c12 3605else
62979ab1
AJ
3606 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
3607#include <regex.h>]], [[regex_t t; regcomp(&t,"",0);]])],[USE_GNUREGEX="no"],[USE_GNUREGEX="yes"])
91bc414e 3608fi
00fa2c12 3609fi
74946a0f 3610AC_MSG_RESULT($USE_GNUREGEX)
3611if test "$USE_GNUREGEX" = "yes"; then
cc937513
AJ
3612 # override system regex with ours. Not good. But what was asked for.
3613 REGEXLIB=""
6a9f6389 3614 AC_DEFINE(USE_GNUREGEX,1,[Define if we should use GNU regex])
7a081912 3615fi
26675bf4 3616AC_SUBST(REGEXLIB)
cc937513 3617#AC_SUBST(LIBREGEX)
7a081912 3618
5c51415d 3619dnl Not cached since people are likely to tune this
e924600d 3620AC_MSG_CHECKING(Default FD_SETSIZE value)
62979ab1 3621AC_RUN_IFELSE([AC_LANG_SOURCE([[
e924600d 3622#if HAVE_STDIO_H
3623#include <stdio.h>
3624#endif
3625#if HAVE_UNISTD_H
3626#include <unistd.h>
3627#endif
cf69e4f2
HN
3628#if HAVE_STDLIB_H
3629#include <stdlib.h>
3630#endif
e924600d 3631#if HAVE_SYS_TIME_H
3632#include <sys/time.h>
3633#endif
3634#if HAVE_SYS_SELECT_H
3635#include <sys/select.h>
3636#endif
3637#if HAVE_SYS_TYPES_H
3638#include <sys/types.h>
3639#endif
bfe8dedf
GS
3640#if HAVE_WINSOCK_H
3641#include <winsock.h>
3642#endif
3643#if HAVE_WINSOCK2_H
3644#include <winsock2.h>
3645#endif
b3167ca7 3646int main(int argc, char **argv) {
635e6242 3647 FILE *fp = fopen("conftestval", "w");
3648 fprintf (fp, "%d\n", FD_SETSIZE);
b3167ca7 3649 return 0;
e924600d 3650}
62979ab1 3651]])],[DEFAULT_FD_SETSIZE=`cat conftestval`],[DEFAULT_FD_SETSIZE=256],[DEFAULT_FD_SETSIZE=256])
e924600d 3652AC_MSG_RESULT($DEFAULT_FD_SETSIZE)
6a9f6389 3653AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE, [Default FD_SETSIZE value])
e924600d 3654
f49be7d1 3655
5c51415d 3656dnl Not cached since people are likely to tune this
234967c9 3657AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
c76d8acc 3658dnl damn! FreeBSD's pthreads breaks dup2().
5132a9eb 3659TLDFLAGS="$LDFLAGS"
f49be7d1 3660if test -n "$squid_filedescriptors_num" ; then
3661 SQUID_MAXFD=$squid_filedescriptors_num
3662 AC_MSG_RESULT($SQUID_MAXFD (user-forced))
3663else
f49be7d1 3664 case $host in
3665 i386-unknown-freebsd*)
3666 if echo "$LDFLAGS" | grep -q pthread; then
3667 LDFLAGS=`echo $LDFLAGS | sed -e "s/-pthread//"`
3668 fi
3669 esac
62979ab1 3670 AC_RUN_IFELSE([AC_LANG_SOURCE([[
8cca06da 3671#include <stdio.h>
234967c9 3672#include <unistd.h>
cf69e4f2 3673#include <stdlib.h>
30a4f2a8 3674#include <sys/time.h> /* needed on FreeBSD */
234967c9 3675#include <sys/param.h>
3676#include <sys/resource.h>
b3167ca7 3677int main(int argc, char **argv) {
635e6242 3678 FILE *fp;
234967c9 3679 int i,j;
42b51993 3680#if defined(__CYGWIN32__) || defined (__CYGWIN__)
b05490a8 3681 /* getrlimit and sysconf returns bogous values on cygwin32.
df087e68 3682 * Number of fds is virtually unlimited in cygwin (sys/param.h)
b05490a8 3683 * __CYGWIN32__ is deprecated.
df087e68 3684 */
3685 i = NOFILE;
b05490a8 3686#else
3687#if HAVE_SETRLIMIT
234967c9 3688 struct rlimit rl;
3689#if defined(RLIMIT_NOFILE)
3690 if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
3691 perror("getrlimit: RLIMIT_NOFILE");
3692 } else {
f168f0c5
AJ
3693#if defined(__APPLE__)
3694 /* asking for more than OPEN_MAX fails on Leopard */
3695 rl.rlim_cur = (OPEN_MAX < rl.rlim_max ? OPEN_MAX : rl.rlim_max);
3696#else
234967c9 3697 rl.rlim_cur = rl.rlim_max; /* set it to the max */
f168f0c5 3698#endif
234967c9 3699 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
3700 perror("setrlimit: RLIMIT_NOFILE");
3701 }
3702 }
3703#elif defined(RLIMIT_OFILE)
3704 if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
3705 perror("getrlimit: RLIMIT_OFILE");
3706 } else {
3707 rl.rlim_cur = rl.rlim_max; /* set it to the max */
3708 if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
3709 perror("setrlimit: RLIMIT_OFILE");
3710 }
3711 }
3712#endif /* RLIMIT_NOFILE */
3713#endif /* HAVE_SETRLIMIT */
d9399075 3714 /* by starting at 2^14, we will never get higher
3715 than 2^15 for SQUID_MAXFD */
3716 i = j = 1<<14;
3717 while (j) {
3718 j >>= 1;
3719 if (dup2(0, i) < 0) {
3720 i -= j;
3721 } else {
3722 close(i);
3723 i += j;
3724 }
3725 }
3726 i++;
b05490a8 3727#endif /* IF !DEF CYGWIN */
635e6242 3728 fp = fopen("conftestval", "w");
a4d7e961 3729 fprintf (fp, "%d\n", i & ~0x3F);
b3167ca7 3730 return 0;
234967c9 3731}
62979ab1 3732 ]])],[SQUID_MAXFD=`cat conftestval`],[SQUID_MAXFD=256],[SQUID_MAXFD=256])
4b26fae9 3733 dnl Microsoft MSVCRT.DLL supports 2048 maximum FDs
3734 case "$host_os" in
3735 mingw|mingw32)
3736 SQUID_MAXFD="2048"
3737 ;;
3738 esac
f49be7d1 3739 AC_MSG_RESULT($SQUID_MAXFD)
3740fi
6a9f6389 3741AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD,[Maximum number of open filedescriptors])
b9cc811d 3742if test "$SQUID_MAXFD" -lt 512 ; then
eed82608
AJ
3743 AC_MSG_WARN([$SQUID_MAXFD may not be enough filedescriptors if your])
3744 AC_MSG_WARN([cache will be very busy. Please see the FAQ page])
3745 AC_MSG_WARN([http://wiki.squid-cache.org/SquidFaq/TroubleShooting])
3746 AC_MSG_WARN([on how to increase your filedescriptor limit])
933cc58d 3747 sleep 10
80ab193b 3748fi
c76d8acc 3749LDFLAGS="$TLDFLAGS"
234967c9 3750
d0f9207a 3751if test `expr $SQUID_MAXFD % 64` != 0; then
eed82608 3752 AC_MSG_WARN([$SQUID_MAXFD is not an multiple of 64. This may cause issues on certain platforms.])
a4d7e961 3753 sleep 10
3754fi
3755
5c51415d 3756dnl Not cached since people are likely to tune this
30a4f2a8 3757AC_MSG_CHECKING(Default UDP send buffer size)
62979ab1 3758AC_RUN_IFELSE([AC_LANG_SOURCE([[
8cca06da 3759#include <stdlib.h>
3760#include <stdio.h>
30a4f2a8 3761#include <sys/types.h>
bfe8dedf 3762#if HAVE_SYS_SOCKET_H
30a4f2a8 3763#include <sys/socket.h>
bfe8dedf
GS
3764#endif
3765#if HAVE_NETINET_IN_H
30a4f2a8 3766#include <netinet/in.h>
bfe8dedf
GS
3767#endif
3768#if HAVE_WINSOCK_H
3769#include <winsock.h>
3770#endif
3771#if HAVE_WINSOCK2_H
3772#include <winsock2.h>
3773#endif
b3167ca7 3774int main(int argc, char **argv)
30a4f2a8 3775{
635e6242 3776 FILE *fp;
eab7694a 3777 int fd,val=0;
bfe8dedf 3778#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
eab7694a 3779 int len=sizeof(int);
bfe8dedf
GS
3780 WSADATA wsaData;
3781 WSAStartup(2, &wsaData);
eab7694a
GS
3782#else
3783 socklen_t len=sizeof(socklen_t);
bfe8dedf 3784#endif
b3167ca7 3785 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) return 1;
bfe8dedf 3786#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
b3167ca7 3787 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char *)&val, &len) < 0) return 1;
bfe8dedf 3788 WSACleanup();
f3f3e961 3789#else
b3167ca7 3790 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) return 1;
bfe8dedf 3791#endif
b3167ca7 3792 if (val<=0) return 1;
635e6242 3793 fp = fopen("conftestval", "w");
3794 fprintf (fp, "%d\n", val);
b3167ca7 3795 return 0;
30a4f2a8 3796}
62979ab1 3797]])],[SQUID_DETECT_UDP_SO_SNDBUF=`cat conftestval`],[SQUID_DETECT_UDP_SO_SNDBUF=16384],[SQUID_DETECT_UDP_SO_SNDBUF=16384])
6a9f6389 3798AC_MSG_RESULT($SQUID_DETECT_UDP_SO_SNDBUF)
3799AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_SNDBUF, $SQUID_DETECT_UDP_SO_SNDBUF,[UDP send buffer size])
30a4f2a8 3800
5c51415d 3801dnl Not cached since people are likely to tune this
30a4f2a8 3802AC_MSG_CHECKING(Default UDP receive buffer size)
62979ab1 3803AC_RUN_IFELSE([AC_LANG_SOURCE([[
8cca06da 3804#include <stdlib.h>
3805#include <stdio.h>
30a4f2a8 3806#include <sys/types.h>
bfe8dedf 3807#if HAVE_SYS_SOCKET_H
30a4f2a8 3808#include <sys/socket.h>
bfe8dedf
GS
3809#endif
3810#if HAVE_NETINET_IN_H
30a4f2a8 3811#include <netinet/in.h>
bfe8dedf
GS
3812#endif
3813#if HAVE_WINSOCK_H
3814#include <winsock.h>
3815#endif
3816#if HAVE_WINSOCK2_H
3817#include <winsock2.h>
3818#endif
b3167ca7 3819int main(int argc, char **argv)
30a4f2a8 3820{
635e6242 3821 FILE *fp;
eab7694a 3822 int fd,val=0;
bfe8dedf 3823#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
eab7694a 3824 int len=sizeof(int);
bfe8dedf
GS
3825 WSADATA wsaData;
3826 WSAStartup(2, &wsaData);
eab7694a
GS
3827#else
3828 socklen_t len=sizeof(socklen_t);
bfe8dedf 3829#endif
b3167ca7 3830 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) return 1;
bfe8dedf 3831#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
b3167ca7 3832 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char *)&val, &len) < 0) return 1;
bfe8dedf 3833 WSACleanup();
f3f3e961 3834#else
b3167ca7 3835 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) return 1;
bfe8dedf 3836#endif
b3167ca7 3837 if (val <= 0) return 1;
635e6242 3838 fp = fopen("conftestval", "w");
3839 fprintf (fp, "%d\n", val);
b3167ca7 3840 return 0;
30a4f2a8 3841}
62979ab1 3842]])],[SQUID_DETECT_UDP_SO_RCVBUF=`cat conftestval`],[SQUID_DETECT_UDP_SO_RCVBUF=16384],[SQUID_DETECT_UDP_SO_RCVBUF=16384])
6a9f6389 3843AC_MSG_RESULT($SQUID_DETECT_UDP_SO_RCVBUF)
3844AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_RCVBUF, $SQUID_DETECT_UDP_SO_RCVBUF,[UDP receive buffer size])
30a4f2a8 3845
5c51415d 3846dnl Not cached since people are likely to tune this
30a4f2a8 3847AC_MSG_CHECKING(Default TCP send buffer size)
62979ab1 3848AC_RUN_IFELSE([AC_LANG_SOURCE([[
8cca06da 3849#include <stdlib.h>
3850#include <stdio.h>
30a4f2a8 3851#include <sys/types.h>
bfe8dedf 3852#if HAVE_SYS_SOCKET_H
30a4f2a8 3853#include <sys/socket.h>
bfe8dedf
GS
3854#endif
3855#if HAVE_NETINET_IN_H
30a4f2a8 3856#include <netinet/in.h>
bfe8dedf
GS
3857#endif
3858#if HAVE_WINSOCK_H
3859#include <winsock.h>
3860#endif
3861#if HAVE_WINSOCK2_H
3862#include <winsock2.h>
3863#endif
b3167ca7 3864int main(int argc, char **argv)
30a4f2a8 3865{
635e6242 3866 FILE *fp;
eab7694a 3867 int fd,val=0;
bfe8dedf 3868#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
eab7694a 3869 int len=sizeof(int);
bfe8dedf
GS
3870 WSADATA wsaData;
3871 WSAStartup(2, &wsaData);
eab7694a
GS
3872#else
3873 socklen_t len=sizeof(socklen_t);
bfe8dedf 3874#endif
b3167ca7 3875 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) return 1;
bfe8dedf 3876#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
b3167ca7 3877 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char *)&val, &len) < 0) return 1;
bfe8dedf 3878 WSACleanup();
f3f3e961 3879#else
b3167ca7 3880 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) return 1;
bfe8dedf 3881#endif
b3167ca7 3882 if (val <= 0) return 1;
635e6242 3883 fp = fopen("conftestval", "w");
3884 fprintf (fp, "%d\n", val);
b3167ca7 3885 return 0;
30a4f2a8 3886}
62979ab1 3887]])],[SQUID_TCP_SO_SNDBUF=`cat conftestval`],[SQUID_TCP_SO_SNDBUF=16384],[SQUID_TCP_SO_SNDBUF=16384])
30a4f2a8 3888AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF)
2aa6ca58 3889if test $SQUID_TCP_SO_SNDBUF -gt 32768; then
eed82608 3890 AC_MSG_NOTICE([Limiting send buffer size to 32K])
2aa6ca58 3891 SQUID_TCP_SO_SNDBUF=32768
3892fi
6a9f6389 3893AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF,[TCP send buffer size])
30a4f2a8 3894
5c51415d 3895dnl Not cached since people are likely to tune this
30a4f2a8 3896AC_MSG_CHECKING(Default TCP receive buffer size)
62979ab1 3897AC_RUN_IFELSE([AC_LANG_SOURCE([[
8cca06da 3898#include <stdlib.h>
3899#include <stdio.h>
30a4f2a8 3900#include <sys/types.h>
bfe8dedf 3901#if HAVE_SYS_SOCKET_H
30a4f2a8 3902#include <sys/socket.h>
bfe8dedf
GS
3903#endif
3904#if HAVE_NETINET_IN_H
30a4f2a8 3905#include <netinet/in.h>
bfe8dedf
GS
3906#endif
3907#if HAVE_WINSOCK_H
3908#include <winsock.h>
3909#endif
3910#if HAVE_WINSOCK2_H
3911#include <winsock2.h>
3912#endif
b3167ca7 3913int main(int argc, char **argv)
30a4f2a8 3914{
635e6242 3915 FILE *fp;
eab7694a 3916 int fd,val=0;
bfe8dedf 3917#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
eab7694a 3918 int len=sizeof(int);
bfe8dedf
GS
3919 WSADATA wsaData;
3920 WSAStartup(2, &wsaData);
eab7694a
GS
3921#else
3922 socklen_t len=sizeof(socklen_t);
bfe8dedf 3923#endif
b3167ca7 3924 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) return 1;
bfe8dedf 3925#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
b3167ca7 3926 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char *)&val, &len) < 0) return 1;
bfe8dedf 3927 WSACleanup();
f3f3e961 3928#else
b3167ca7 3929 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) return 1;
bfe8dedf 3930#endif
b3167ca7 3931 if (val <= 0) return 1;
635e6242 3932 fp = fopen("conftestval", "w");
3933 fprintf (fp, "%d\n", val);
b3167ca7 3934 return 0;
30a4f2a8 3935}
62979ab1 3936]])],[SQUID_TCP_SO_RCVBUF=`cat conftestval`],[SQUID_TCP_SO_RCVBUF=16384],[SQUID_TCP_SO_RCVBUF=16384])
30a4f2a8 3937AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF)
2aa6ca58 3938if test $SQUID_TCP_SO_RCVBUF -gt 65535; then
eed82608 3939 AC_MSG_NOTICE([Limiting receive buffer size to 64K])
2aa6ca58 3940 SQUID_TCP_SO_RCVBUF=65535
3941fi
6a9f6389 3942AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF,[TCP receive buffer size])
5c51415d 3943AC_CACHE_CHECK(if sys_errlist is already defined, ac_cv_needs_sys_errlist,
62979ab1 3944 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[char *s = sys_errlist;]])],[ac_cv_needs_sys_errlist="no"],[ac_cv_needs_sys_errlist="yes"])
5c51415d 3945)
3946if test "$ac_cv_needs_sys_errlist" = "yes" ; then
6a9f6389 3947 AC_DEFINE(NEED_SYS_ERRLIST,1,[If we need to declare sys_errlist[] as external])
5c51415d 3948fi
30a4f2a8 3949
5c51415d 3950dnl Not cached since people are likely to change this
6bf65235 3951AC_MSG_CHECKING(for libresolv _dns_ttl_ hack)
62979ab1
AJ
3952AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern int _dns_ttl_;]], [[return _dns_ttl_;]])],[AC_MSG_RESULT(yes)
3953AC_DEFINE(LIBRESOLV_DNS_TTL_HACK,1,[If libresolv.a has been hacked to export _dns_ttl_])],[AC_MSG_RESULT(no)])
6bf65235 3954
b6a2f15e 3955if test "$ac_cv_header_sys_statvfs_h" = "yes" ; then
c68e9c6b 3956AC_MSG_CHECKING(for working statvfs() interface)
62979ab1 3957AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
c68e9c6b 3958#include <stdlib.h>
3959#include <stdio.h>
3960#include <sys/types.h>
3961#include <sys/statvfs.h>
62979ab1 3962]], [[
c68e9c6b 3963struct statvfs sfs;
3964sfs.f_blocks = sfs.f_bfree = sfs.f_frsize =
3965sfs.f_files = sfs.f_ffree = 0;
3966statvfs("/tmp", &sfs);
62979ab1 3967]])],[ac_cv_func_statvfs=yes],[ac_cv_func_statvfs=no])
c68e9c6b 3968AC_MSG_RESULT($ac_cv_func_statvfs)
6b8e7481 3969if test "$ac_cv_func_statvfs" = "yes" ; then
6a9f6389 3970 AC_DEFINE(HAVE_STATVFS,1,[If your system has statvfs(), and if it actually works!])
b6a2f15e 3971fi
6b8e7481 3972fi
c68e9c6b 3973
cc192b50 3974dnl Detect what resolver fields we have available to use...
3975AC_CACHE_CHECK(for _res_ext.nsaddr_list, ac_cv_have_res_ext_nsaddr_list,
62979ab1 3976AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
cc192b50 3977#if HAVE_SYS_TYPES_H
3978#include <sys/types.h>
3979#endif
3980#if HAVE_NETINET_IN_H
3981#include <netinet/in.h>
3982#endif
3983#if HAVE_ARPA_INET_H
3984#include <arpa/inet.h>
3985#endif
3986#if HAVE_ARPA_NAMESER_H
3987#include <arpa/nameser.h>
3988#endif
3989#if HAVE_RESOLV_H
3990#include <resolv.h>
3991#endif
62979ab1 3992]], [[_res_ext.nsaddr_list[[0]].s_addr;]])],[ac_cv_have_res_ext_nsaddr_list="yes"],[ac_cv_have_res_ext_nsaddr_list="no"]))
cc192b50 3993if test "$ac_cv_have_res_ext_nsaddr_list" = "yes" ; then
3994 AC_DEFINE(_SQUID_RES_NSADDR6_LARRAY,_res_ext.nsaddr_list,[If _res_ext structure has nsaddr_list member])
3995 AC_DEFINE(_SQUID_RES_NSADDR6_COUNT,ns6count,[Nameserver Counter for IPv6 _res_ext])
3996fi
3997
0873b2ab 3998if test "$_SQUID_RES_NSADDR6_LIST" = ""; then
cc192b50 3999AC_CACHE_CHECK(for _res._u._ext.nsaddrs, ac_cv_have_res_ext_nsaddrs,
62979ab1 4000AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
cc192b50 4001#if HAVE_SYS_TYPES_H
4002#include <sys/types.h>
4003#endif
4004#if HAVE_NETINET_IN_H
4005#include <netinet/in.h>
4006#endif
4007#if HAVE_ARPA_INET_H
4008#include <arpa/inet.h>
4009#endif
4010#if HAVE_ARPA_NAMESER_H
4011#include <arpa/nameser.h>
4012#endif
4013#if HAVE_RESOLV_H
4014#include <resolv.h>
4015#endif
62979ab1 4016]], [[_res._u._ext.nsaddrs[[0]]->sin6_addr;]])],[ac_cv_have_res_ext_nsaddrs="yes"],[ac_cv_have_res_ext_nsaddrs="no"]))
cc192b50 4017if test "$ac_cv_have_res_ext_nsaddrs" = "yes" ; then
4018 AC_DEFINE(_SQUID_RES_NSADDR6_LPTR,_res._u._ext.nsaddrs,[If _res structure has _ext.nsaddrs member])
4019 AC_DEFINE(_SQUID_RES_NSADDR6_COUNT,_res._u._ext.nscount6,[Nameserver Counter for IPv6 _res])
4020fi
4021fi
4022
c68e9c6b 4023AC_CACHE_CHECK(for _res.nsaddr_list, ac_cv_have_res_nsaddr_list,
62979ab1 4024AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
c68e9c6b 4025#if HAVE_SYS_TYPES_H
4026#include <sys/types.h>
4027#endif
4028#if HAVE_NETINET_IN_H
4029#include <netinet/in.h>
4030#endif
4031#if HAVE_ARPA_INET_H
4032#include <arpa/inet.h>
4033#endif
4034#if HAVE_ARPA_NAMESER_H
4035#include <arpa/nameser.h>
4036#endif
4037#if HAVE_RESOLV_H
4038#include <resolv.h>
4039#endif
62979ab1 4040]], [[_res.nsaddr_list[[0]];]])],[ac_cv_have_res_nsaddr_list="yes"],[ac_cv_have_res_nsaddr_list="no"]))
c68e9c6b 4041if test $ac_cv_have_res_nsaddr_list = "yes" ; then
cc192b50 4042 AC_DEFINE(_SQUID_RES_NSADDR_LIST,_res.nsaddr_list,[If _res structure has nsaddr_list member])
4043 AC_DEFINE(_SQUID_RES_NSADDR_COUNT,_res.nscount,[Nameserver counter for IPv4 _res])
c68e9c6b 4044fi
4045
0873b2ab 4046if test "$_SQUID_RES_NSADDR_LIST" = ""; then
c68e9c6b 4047AC_CACHE_CHECK(for _res.ns_list, ac_cv_have_res_ns_list,
62979ab1 4048AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
c68e9c6b 4049#if HAVE_SYS_TYPES_H
4050#include <sys/types.h>
4051#endif
4052#if HAVE_NETINET_IN_H
4053#include <netinet/in.h>
4054#endif
4055#if HAVE_ARPA_INET_H
4056#include <arpa/inet.h>
4057#endif
4058#if HAVE_ARPA_NAMESER_H
4059#include <arpa/nameser.h>
4060#endif
4061#if HAVE_RESOLV_H
4062#include <resolv.h>
4063#endif
62979ab1 4064]], [[_res.ns_list[[0]].addr;]])],[ac_cv_have_res_ns_list="yes"],[ac_cv_have_res_ns_list="no"]))
c68e9c6b 4065if test $ac_cv_have_res_ns_list = "yes" ; then
cc192b50 4066 AC_DEFINE(_SQUID_RES_NSADDR_LIST,_res.ns_list,[If _res structure has ns_list member])
4067 AC_DEFINE(_SQUID_RES_NSADDR_COUNT,_res.nscount,[Nameserver counter for IPv4 _res])
c68e9c6b 4068fi
4069fi
4070
461b8219 4071dnl Squid will usually attempt to translate when packaging or building from VCS
44e0a249 4072use_translation="yes"
461b8219 4073AC_ARG_ENABLE(translation,
62979ab1 4074 AS_HELP_STRING([--disable-translation],[Prevent Squid generating localized error page templates and manuals.
b3fed8c3 4075 Which is usually tried, but may not be needed.]),
461b8219
AJ
4076[ if test "$enableval" = "no" ; then
4077 use_translation=no
4078 fi
4079])
e4b70b44 4080dnl Squid now has .po translation capability, given the right toolkit
461b8219
AJ
4081if test "$use_translation" = "yes" ; then
4082 AX_WITH_PROG([PO2HTML],[po2html])
4083else
4084 PO2HTML="off"
4085fi
4086AC_SUBST(PO2HTML)
ee1a8ac2 4087
43000484
AJ
4088dnl Squid now has limited locale handling ...
4089dnl on error pages
8db7a54b 4090use_errlocale=yes
43000484 4091AC_ARG_ENABLE(auto-locale,
62979ab1 4092 AS_HELP_STRING([--disable-auto-locale],[This prevents Squid providing localized error pages based on the
21d5413e
AJ
4093 clients request headers.
4094 When disabled Squid requires explicit language configuration.]),
8db7a54b
AJ
4095[ if test "$enableval" = "no" ; then
4096 use_errlocale=no
4097 fi
4098])
4099if test "$use_errlocale" = "yes" ; then
eed82608 4100 AC_MSG_NOTICE([Enabling Multi-Language Support])
43000484 4101 AC_DEFINE(USE_ERR_LOCALES,1,[Use multi-language support on error pages])
8db7a54b 4102else
eed82608 4103 AC_MSG_WARN([Disabling Multi-Language Support])
43000484 4104 AC_DEFINE(USE_ERR_LOCALES,0,[Use multi-language support on error pages])
8db7a54b 4105fi
43000484 4106
090089c4 4107dnl Need the debugging version of malloc if available
4108XTRA_OBJS=''
6509a1a0 4109if test "$ac_cv_lib_malloc_main" = "yes" ; then
090089c4 4110 if test -r /usr/lib/debug/malloc.o ; then
4111 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
4112 fi
4113 if test -r /usr/lib/debug/mallocmap.o ; then
4114 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
4115 fi
4116fi
4117AC_SUBST(XTRA_OBJS)
4118
38fea766 4119if test -z "$XTRA_LIBS"; then
4120 XTRA_LIBS="$LIBS"
0f5a16f8 4121 dnl minor cleanup
4122 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
38fea766 4123 LIBS=''
4124fi
090089c4 4125AC_SUBST(XTRA_LIBS)
4126
090089c4 4127dnl Clean up after OSF/1 core dump bug
4128rm -f core
4129
6a9f6389 4130AC_CONFIG_FILES([\
a2794549 4131 Makefile \
eee95dfe 4132 compat/Makefile \
a2794549 4133 lib/Makefile \
a2794549 4134 scripts/Makefile \
4135 scripts/RunCache \
4136 scripts/RunAccel \
4137 src/Makefile \
5bd7a218 4138 src/base/Makefile \
bcf44a2c 4139 src/acl/Makefile \
a2794549 4140 src/fs/Makefile \
4141 src/repl/Makefile \
4142 src/auth/Makefile \
5fa840c3 4143 src/adaptation/Makefile \
1f3c65fc
AR
4144 src/adaptation/icap/Makefile \
4145 src/adaptation/ecap/Makefile \
f99c2cfe 4146 src/esi/Makefile \
ee0927b6 4147 src/eui/Makefile \
663ff9aa 4148 src/icmp/Makefile \
4daaf3cb 4149 src/ident/Makefile \
f963428c 4150 src/ip/Makefile \
82b7abe3 4151 src/log/Makefile \
a2794549 4152 contrib/Makefile \
4153 snmplib/Makefile \
4154 icons/Makefile \
4155 errors/Makefile \
1077c1b8 4156 test-suite/Makefile \
99db07b3 4157 doc/Makefile \
3faa6da8 4158 doc/manuals/Makefile \
0c510f3c 4159 helpers/Makefile \
4160 helpers/basic_auth/Makefile \
4161 helpers/basic_auth/LDAP/Makefile \
4162 helpers/basic_auth/MSNT/Makefile \
4163 helpers/basic_auth/NCSA/Makefile \
4164 helpers/basic_auth/PAM/Makefile \
4165 helpers/basic_auth/SMB/Makefile \
6e785d85 4166 helpers/basic_auth/mswin_sspi/Makefile \
0c510f3c 4167 helpers/basic_auth/YP/Makefile \
4168 helpers/basic_auth/getpwnam/Makefile \
4169 helpers/basic_auth/multi-domain-NTLM/Makefile \
4170 helpers/basic_auth/SASL/Makefile \
bcf74be7 4171 helpers/basic_auth/POP3/Makefile \
002d9b03 4172 helpers/basic_auth/DB/Makefile \
d80aac12 4173 helpers/basic_auth/squid_radius_auth/Makefile \
0c510f3c 4174 helpers/digest_auth/Makefile \
4175 helpers/digest_auth/password/Makefile \
55013f9c 4176 helpers/digest_auth/ldap/Makefile \
89f77e43 4177 helpers/digest_auth/eDirectory/Makefile \
0c510f3c 4178 helpers/ntlm_auth/Makefile \
4179 helpers/ntlm_auth/fakeauth/Makefile \
4180 helpers/ntlm_auth/no_check/Makefile \
3963d7b1
AJ
4181 helpers/ntlm_auth/smb_lm/Makefile \
4182 helpers/ntlm_auth/smb_lm/smbval/Makefile \
6e785d85 4183 helpers/ntlm_auth/mswin_sspi/Makefile \
4184 helpers/negotiate_auth/Makefile \
45b2de83 4185 helpers/negotiate_auth/kerberos/Makefile \
6e785d85 4186 helpers/negotiate_auth/mswin_sspi/Makefile \
c6588c68 4187 helpers/external_acl/Makefile \
4188 helpers/external_acl/ip_user/Makefile \
4189 helpers/external_acl/ldap_group/Makefile \
74ab8d10 4190 helpers/external_acl/session/Makefile \
c6588c68 4191 helpers/external_acl/unix_group/Makefile \
736a9a4d 4192 helpers/external_acl/wbinfo_group/Makefile \
9e6e0372 4193 helpers/external_acl/mswin_ad_group/Makefile \
94ab55b0 4194 helpers/external_acl/mswin_lm_group/Makefile \
82b7abe3
AJ
4195 helpers/log_daemon/Makefile \
4196 helpers/log_daemon/file/Makefile \
fdbb3b19
AJ
4197 helpers/url_rewrite/Makefile \
4198 helpers/url_rewrite/fake/Makefile \
94ab55b0 4199 tools/Makefile
53cbe3e4 4200])
43ae1d95 4201
377792e4 4202AC_CONFIG_SUBDIRS(lib/libTrie)
4203
3e7b6055
AR
4204# must configure libltdl subdir unconditionally for "make distcheck" to work
4205AC_CONFIG_SUBDIRS(lib/libLtdl)
4206
6a9f6389 4207AC_OUTPUT