]> git.ipfire.org Git - thirdparty/squid.git/blame - configure.in
Leaned-up some modules-detection code
[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
951dnl ****************** KK HERE *********************
36a97e19 952
d9180414 953AC_ARG_ENABLE(useragent-log,
62979ab1 954 AS_HELP_STRING([--enable-useragent-log],[Enable logging of User-Agent header]),
e5f4e1b0 955[ if test "$enableval" = "yes" ; then
eed82608 956 AC_MSG_NOTICE([User-Agent logging enabled])
5069fb38
FC
957 AC_DEFINE(USE_USERAGENT_LOG,1,
958 [If you want to log User-Agent request header values, define this.
959 By default, they are written to useragent.log in the Squid log
960 directory.])
e5f4e1b0 961 fi
962])
963
dfca7e1a 964AC_ARG_ENABLE(referer-log,
62979ab1 965 AS_HELP_STRING([--enable-referer-log],[Enable logging of Referer header]),
dfca7e1a 966[ if test "$enableval" = "yes" ; then
eed82608 967 AC_MSG_NOTICE([Referer logging enabled])
5069fb38
FC
968 AC_DEFINE(USE_REFERER_LOG,1,
969 [If you want to log Referer request header values, define this.
970 By default, they are written to referer.log in the Squid log directory.])
dfca7e1a 971 fi
972])
973
0b0cfcf2 974USE_WCCP=1
5069fb38 975AC_ARG_ENABLE(wccp,
62979ab1 976 AS_HELP_STRING([--disable-wccp],[Disable Web Cache Coordination Protocol]),
eb824054 977[ if test "$enableval" = "no" ; then
eed82608 978 AC_MSG_NOTICE([Web Cache Coordination Protocol disabled])
0b0cfcf2 979 USE_WCCP=0
320e9f36 980 fi
5069fb38 981])
0b0cfcf2 982if test $USE_WCCP = 1; then
983 AC_DEFINE(USE_WCCP, 1, [Define to enable WCCP])
984fi
985
986USE_WCCPv2=1
987AC_ARG_ENABLE(wccpv2,
62979ab1 988 AS_HELP_STRING([--disable-wccpv2],[Disable Web Cache Coordination V2 Protocol]),
0b0cfcf2 989[ if test "$enableval" = "no" ; then
5069fb38 990 AC_MSG_NOTICE(["Web Cache Coordination V2 Protocol disabled"])
0b0cfcf2 991 USE_WCCPv2=0
992 fi
993])
994if test $USE_WCCPv2 = 1; then
995 AC_DEFINE(USE_WCCPv2, 1, [Define to enable WCCP V2])
14b32873 996fi
320e9f36 997
d9180414 998AC_ARG_ENABLE(kill-parent-hack,
62979ab1 999 AS_HELP_STRING([--enable-kill-parent-hack],[Kill parent on shutdown]),
e5f4e1b0 1000[ if test "$enableval" = "yes" ; then
eed82608 1001 AC_MSG_NOTICE([Kill parent on shutdown])
5069fb38
FC
1002 AC_DEFINE(KILL_PARENT_OPT,1,
1003 [A dangerous feature which causes Squid to kill its parent process
1004 (presumably the RunCache script) upon receipt of SIGTERM or SIGINT.
1005 Use with caution.])
e5f4e1b0 1006 fi
1007])
1008
87630341 1009USE_SNMP=true
e5f4e1b0 1010AC_ARG_ENABLE(snmp,
62979ab1 1011 AS_HELP_STRING([--disable-snmp],[Disable SNMP monitoring support]),
87630341 1012[ if test "$enableval" = "no" ; then
eed82608 1013 AC_MSG_NOTICE([SNMP monitoring disabled])
87630341 1014 USE_SNMP=
1015 fi
1016])
5069fb38 1017if test "$USE_SNMP" = 'true'; then
6a9f6389 1018 AC_DEFINE(SQUID_SNMP,1,[Define to enable SNMP monitoring of Squid])
63705952 1019 SNMPLIB='../snmplib/libsnmp.a'
e5f4e1b0 1020 makesnmplib=snmplib
87630341 1021fi
5069fb38 1022AM_CONDITIONAL(USE_SNMP, [test "$USE_SNMP" = "true"])
e5f4e1b0 1023AC_SUBST(SNMPLIB)
e5f4e1b0 1024AC_SUBST(makesnmplib)
1025
d9180414 1026AC_ARG_ENABLE(cachemgr-hostname,
5069fb38
FC
1027 AS_HELP_STRING([--enable-cachemgr-hostname=hostname],
1028 [Make cachemgr.cgi default to this host.
86f53af2 1029 If unspecified, uses the name of the build-host]),
e5f4e1b0 1030[ case $enableval in
1031 yes)
6a9f6389 1032 AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()],
1033 [If you are upset that the cachemgr.cgi form comes up with the hostname field blank, then define this to getfullhostname()])
eed82608 1034 AC_MSG_NOTICE([Cachemgr default hostname == host where cachemgr runs])
e5f4e1b0 1035 ;;
1036 no)
1037 : # Nothing to do..
1038 ;;
1039 *)
1040 AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
eed82608 1041 AC_MSG_NOTICE([Cachemgr default hostname set to ${enableval}])
e5f4e1b0 1042 ;;
1043 esac
1044])
1045
ee0927b6 1046AM_CONDITIONAL(USE_SQUID_EUI, false)
5069fb38 1047squid_opt_use_eui="yes"
ee0927b6 1048AC_ARG_ENABLE(eui,
a98c2da5 1049 AS_HELP_STRING([--disable-eui],[Enable use of ARP / MAC/ EUI (ether address)]),
5069fb38
FC
1050 [squid_opt_use_eui="$enableval"])
1051if test "$squid_opt_use_eui" = "yes" ; then
ee0927b6 1052 AC_MSG_NOTICE([EUI controls enabled (ether address)])
5069fb38
FC
1053 case "$squid_host_os" in
1054 linux|solaris|freebsd|openbsd|netbsd)
1055 $(TRUE)
074bf084 1056 ;;
5069fb38 1057 cygwin|mingw)
ee0927b6 1058 EUILIB="-liphlpapi"
5700029a 1059 ;;
933cc58d 1060 *)
ee0927b6 1061 AC_MSG_WARN([EUI support probably won't work on $host.])
933cc58d 1062 sleep 10
1063 ;;
1064 esac
ee0927b6
AJ
1065 AC_CHECK_HEADERS( \
1066 Iphlpapi.h \
1067 net/if.h \
1068 net/if_arp.h \
1069 net/if_dl.h \
1070 net/route.h \
1071 netinet/if_ether.h \
1072 sys/sockio.h \
1073 sys/sysctl.h \
1074 sys/ioctl.h \
1075 )
5069fb38 1076 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 1077 AM_CONDITIONAL(USE_SQUID_EUI, true)
a98c2da5
AJ
1078else
1079 AC_MSG_NOTICE([EUI controls disabled (ether address)])
1080fi
e5f4e1b0 1081
87630341 1082USE_HTCP=true
a2794549 1083AM_CONDITIONAL(ENABLE_HTCP, false)
74075210 1084AC_ARG_ENABLE(htcp,
62979ab1 1085 AS_HELP_STRING([--disable-htcp],[Disable HTCP protocol support]),
87630341 1086[ if test "$enableval" = "no" ; then
eed82608 1087 AC_MSG_NOTICE([HTCP support disabled])
b4b8b6da 1088 fi
74075210 1089])
5069fb38
FC
1090if test "$USE_HTCP" = "true"; then
1091 AC_DEFINE(USE_HTCP,1,
1092 [Define this to include code for the Hypertext Cache Protocol (HTCP)])
87630341 1093fi
5069fb38 1094AM_CONDITIONAL(ENABLE_HTCP, [test "$USE_HTCP" = "true"])
a2794549 1095
3d4022fa 1096dnl SSL is not enabled by default.
a2794549 1097AM_CONDITIONAL(ENABLE_SSL, false)
74075210 1098
3d4022fa 1099dnl Default is to use OpenSSL when available
1f7c9178 1100AC_ARG_ENABLE(ssl,
62979ab1 1101 AS_HELP_STRING([--enable-ssl],[Enable ssl gatewaying support using OpenSSL]),
1f7c9178 1102[ if test "$enableval" != "no"; then
eed82608 1103 AC_MSG_NOTICE([SSL gatewaying using OpenSSL enabled])
6a9f6389 1104 AC_DEFINE(USE_SSL,1,[Define this to include code for SSL encryption.])
a2794549 1105 AM_CONDITIONAL(ENABLE_SSL, true)
5069fb38 1106 if test "$squid_host_os" = "mingw" ; then
ee86c79b 1107 SSLLIB='-lssleay32 -leay32 -lgdi32'
5069fb38 1108 else
4b26fae9 1109 SSLLIB='-lssl -lcrypto'
5069fb38 1110 fi
1f7c9178 1111 USE_OPENSSL=1
1112 fi
1113])
1114
3d4022fa 1115dnl User may specify OpenSSL is needed from a non-standard location
1f7c9178 1116AC_ARG_WITH(openssl,
62979ab1 1117 AS_HELP_STRING([--with-openssl{=PATH}],[Compile with the OpenSSL libraries. The path to
86f53af2
FC
1118 the OpenSSL development libraries and headers
1119 installation can be specified if outside of the
1120 system standard directories]),
1f7c9178 1121[
46ce628c 1122 case "$with_openssl" in
1f7c9178 1123 yes)
1124 USE_OPENSSL=1
1125 ;;
1126 no)
1127 USE_OPENSSL=
1128 ;;
1129 *)
46ce628c 1130 SSLLIBDIR="$with_openssl/lib"
bcce53ce 1131 CPPFLAGS="-I$with_openssl/include $CPPFLAGS"
1f7c9178 1132 USE_OPENSSL=1
1133 esac
1134])
1f7c9178 1135if test -n "$USE_OPENSSL"; then
eed82608 1136 AC_MSG_NOTICE([Using OpenSSL MD5 implementation])
6a9f6389 1137 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 1138 if test -z "$SSLLIB"; then
1139 SSLLIB="-lcrypto" # for MD5 routines
1140 fi
f11555e0 1141 dnl This is a workaround for RedHat 9 brain damage..
1142 if test -d /usr/kerberos/include && test -z "$SSLLIBDIR" && test -f /usr/include/openssl/kssl.h; then
eed82608 1143 AC_MSG_NOTICE([OpenSSL depends on Kerberos])
f11555e0 1144 SSLLIBDIR="/usr/kerberos/lib"
1145 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
1146 fi
1f7c9178 1147fi
1148if test -n "$SSLLIBDIR"; then
1149 SSLLIB="-L$SSLLIBDIR $SSLLIB"
1150fi
1f7c9178 1151AC_SUBST(SSLLIB)
1152
3d4022fa 1153
02749868 1154AC_ARG_ENABLE(forw-via-db,
62979ab1 1155 AS_HELP_STRING([--enable-forw-via-db],[Enable Forw/Via database]),
02749868 1156[ if test "$enableval" = "yes" ; then
eed82608 1157 AC_MSG_NOTICE([FORW-VIA enabled])
6a9f6389 1158 AC_DEFINE(FORW_VIA_DB,1,[Enable Forw/Via database])
02749868 1159 fi
1160])
1161
6cfa8966 1162AC_ARG_ENABLE(cache-digests,
62979ab1 1163 AS_HELP_STRING([--enable-cache-digests],[Use Cache Digests.
86f53af2 1164 See http://wiki.squid-cache.org/SquidFaq/CacheDigests]),
484f2ebc 1165[ if test "$enableval" = "yes" ; then
eed82608 1166 AC_MSG_NOTICE([Cache Disgests enabled])
6a9f6389 1167 AC_DEFINE(USE_CACHE_DIGESTS,1,[Use Cache Digests for locating objects in neighbor caches. This code is still semi-experimental.])
484f2ebc 1168 fi
1169])
1170
cd748f27 1171dnl Size of COSS memory buffer
1172AC_ARG_WITH(coss-membuf-size,
62979ab1 1173 AS_HELP_STRING([--with-coss-membuf-size=size],[COSS membuf size (default 1048576 bytes)]),
8b0d8e31 1174[ if test -n "$withval" -a "x$withval" != "xno" ; then
eed82608 1175 AC_MSG_NOTICE([Setting COSS membuf size to $with_coss_membuf_size bytes])
6a9f6389 1176 AC_DEFINE_UNQUOTED(COSS_MEMBUF_SZ, $with_coss_membuf_size,[Define if you want to set the COSS membuf size])
cd748f27 1177 fi
1178])
1179
1b3db6d9 1180dnl check for netio plugin stuff
6564c397 1181
9bb83c8b 1182dnl Enable poll()
6564c397 1183disable_poll=
9bb83c8b 1184AC_ARG_ENABLE(poll,
62979ab1 1185 AS_HELP_STRING([--disable-poll],[Disable poll(2) support.]),
1b3db6d9 1186[
c68e9c6b 1187 case "$enableval" in
1188 yes)
eed82608 1189 AC_MSG_WARN([Forcing poll() to be enabled])
d474c7a6 1190 SELECT_TYPE="poll"
c68e9c6b 1191 ;;
1192 no)
eed82608 1193 AC_MSG_WARN([Forcing poll() to be disabled])
6564c397 1194 disable_poll=true
c68e9c6b 1195 ;;
1196 esac
9bb83c8b 1197])
1198
1b3db6d9 1199dnl Enable select()
6564c397 1200disable_select=
1b3db6d9 1201AC_ARG_ENABLE(select,
62979ab1 1202 AS_HELP_STRING([--disable-select],[Disable select(2) support.]),
1b3db6d9 1203[
1204 case "$enableval" in
1205 yes)
eed82608 1206 AC_MSG_WARN([Forcing select() to be enabled])
d474c7a6 1207 SELECT_TYPE="select"
1b3db6d9 1208 ;;
1209 no)
eed82608 1210 AC_MSG_WARN([Forcing select() to be disabled])
6564c397 1211 disable_select=true
1b3db6d9 1212 ;;
1213 esac
1214])
1215
1216dnl Enable kqueue()
6564c397 1217dnl kqueue support is still experiemntal and unstable. Not enabled by default.
1218disable_kqueue=true
1b3db6d9 1219AC_ARG_ENABLE(kqueue,
62979ab1 1220 AS_HELP_STRING([--enable-kqueue],[Enable kqueue(2) support (experimental).]),
1b3db6d9 1221[
1222 case "$enableval" in
1223 yes)
eed82608 1224 AC_MSG_WARN([Forcing kqueue() to be enabled])
d474c7a6 1225 SELECT_TYPE="kqueue"
11f11b5c
AJ
1226 AC_CHECK_HEADERS([sys/event.h],[],
1227 [ AC_MSG_ERROR([kqueue support requires sys/event.h header file.]) ])
1b3db6d9 1228 ;;
1229 no)
eed82608 1230 AC_MSG_WARN([Forcing kqueue() to be disabled])
6564c397 1231 disable_kqueue=true
1b3db6d9 1232 ;;
11f11b5c
AJ
1233 *)
1234 AC_CHECK_HEADERS([sys/event.h])
1235 ;;
1b3db6d9 1236esac
1237])
1238
a46d2c0e 1239dnl Enable epoll()
6564c397 1240disable_epoll=
2ca8b332 1241force_epoll="no"
a46d2c0e 1242AC_ARG_ENABLE(epoll,
62979ab1 1243 AS_HELP_STRING([--disable-epoll],[Disable Linux epoll(2) support.]),
a46d2c0e 1244[
1245 case "$enableval" in
1246 yes)
eed82608 1247 AC_MSG_WARN([Forcing epoll() to be enabled])
d474c7a6 1248 SELECT_TYPE="epoll"
2ca8b332 1249 force_epoll="yes"
a46d2c0e 1250 ;;
1251 no)
eed82608 1252 AC_MSG_WARN([Forcing epoll() to be disabled])
6564c397 1253 disable_epoll=true
a46d2c0e 1254 ;;
1255esac
1256])
2ca8b332 1257dnl auto-detect and verify epoll header and library present and working
ad32c661 1258if test -z "$disable_epoll"; then
2ca8b332 1259
ad32c661
AJ
1260 # Check for libepoll
1261 EPOLL_LIB=
1262 AC_CHECK_LIB(epoll, epoll_ctl, [EPOLL_LIBS="-lepoll"])
1263 AC_SUBST(EPOLL_LIBS)
1264
2ca8b332
AJ
1265 dnl on some systems it is provided by libc
1266 dnl not to worry, the working test below will catch them
1267 dnl and we don't want to force additional libraries
1268
1269
ad32c661
AJ
1270 # Check for epoll_ctl, may need -lepoll
1271 SAVED_LIBS="$LIBS"
2ca8b332 1272 LIBS="$LIBS $EPOLL_LIBS"
ad32c661
AJ
1273 AC_CHECK_FUNCS(epoll_ctl)
1274 LIBS="$SAVED_LIBS"
a46d2c0e 1275
2ca8b332 1276 dnl epoll requires sys/epoll.h
98d13964 1277 AC_CHECK_HEADERS([sys/epoll.h])
ad32c661
AJ
1278
1279 dnl Verify that epoll really works
1280 if test $ac_cv_func_epoll_ctl = yes; then
1281 AC_CACHE_CHECK(if epoll works, ac_cv_epoll_works,
62979ab1 1282 AC_RUN_IFELSE([AC_LANG_SOURCE([[
ad32c661
AJ
1283#include <sys/epoll.h>
1284#include <stdlib.h>
1285#include <stdio.h>
1286int main(int argc, char **argv)
1287{
1288 int fd = epoll_create(256);
1289 if (fd < 0) {
1290 perror("epoll_create:");
b3167ca7 1291 return 1;
ad32c661 1292 }
b3167ca7 1293 return 0;
ad32c661 1294}
62979ab1 1295 ]])],[ac_cv_epoll_works=yes],[ac_cv_epoll_works=no],[]))
ad32c661 1296 fi
2ca8b332
AJ
1297
1298 if test "$force_epoll" = "yes" && test "$ac_cv_epoll_works" = "no" ; then
1299 AC_MSG_ERROR([Epoll does not work. Force-enabling it is not going to help.])
1300 fi
ad32c661 1301fi
a46d2c0e 1302
72fd085a 1303dnl Disable HTTP violations
14b32873 1304http_violations=1
72fd085a 1305AC_ARG_ENABLE(http-violations,
62979ab1 1306 AS_HELP_STRING([--disable-http-violations],[This allows you to remove code which is known to
ddfc433e 1307 violate the HTTP protocol specification.]),
72fd085a 1308[ if test "$enableval" = "no" ; then
eed82608 1309 AC_MSG_NOTICE([Disabling HTTP Violations])
14b32873 1310 http_violations=0
72fd085a 1311 fi
1312])
14b32873 1313if test $http_violations = 1; then
1314 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.])
1315else
1316 AC_DEFINE(HTTP_VIOLATIONS, 0)
1317fi
72fd085a 1318
68075fad 1319dnl Enable IPFW Transparent Proxy
1320AC_ARG_ENABLE(ipfw-transparent,
62979ab1 1321 AS_HELP_STRING([--enable-ipfw-transparent],[Enable Transparent Proxy support for systems
ddfc433e 1322 using FreeBSD IPFW style redirection.]),
68075fad 1323[ if test "$enableval" = "yes" ; then
eed82608 1324 AC_MSG_NOTICE([IPFW Transparent Proxy enabled])
68075fad 1325 AC_DEFINE(IPFW_TRANSPARENT,1,[Enable support for Transparent Proxy on systems using FreeBSD IPFW address redirection.])
1326 IPFW_TRANSPARENT="yes"
a74968c2
AJ
1327 else
1328 AC_DEFINE(IPFW_TRANSPARENT,0,[Enable support for Transparent Proxy on systems using FreeBSD IPFW address redirection.])
68075fad 1329 fi
1330])
1331
5cafc1d6 1332dnl Enable IP-Filter Transparent Proxy
1333AC_ARG_ENABLE(ipf-transparent,
62979ab1 1334 AS_HELP_STRING([--enable-ipf-transparent],[Enable Transparent Proxy support for systems
ddfc433e 1335 using IP-Filter network address redirection.]),
5cafc1d6 1336[ if test "$enableval" = "yes" ; then
eed82608 1337 AC_MSG_NOTICE([IP-Filter Transparent Proxy enabled])
6a9f6389 1338 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 1339 IPF_TRANSPARENT="yes"
a74968c2
AJ
1340 else
1341 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 1342 fi
1343])
1344
2b0dd4ac 1345dnl Enable PF Transparent Proxy
1346AC_ARG_ENABLE(pf-transparent,
62979ab1 1347 AS_HELP_STRING([--enable-pf-transparent],[Enable Transparent Proxy support for systems
ddfc433e 1348 using PF network address redirection.]),
2b0dd4ac 1349[ if test "$enableval" = "yes" ; then
eed82608 1350 AC_MSG_NOTICE([PF Transparent Proxy enabled])
6a9f6389 1351 AC_DEFINE(PF_TRANSPARENT,1,[Enable support for Transparent Proxy on systems using PF address redirection. This provides "masquerading" support for OpenBSD.])
2b0dd4ac 1352 PF_TRANSPARENT="yes"
a74968c2
AJ
1353 else
1354 AC_DEFINE(PF_TRANSPARENT,0,[Enable support for Transparent Proxy on systems using PF address redirection. This provides "masquerading" support for OpenBSD.])
2b0dd4ac 1355 fi
1356])
1357
d6d62546 1358dnl Enable Linux Netfilter Transparent Proxy
d852fbad 1359AC_ARG_ENABLE(linux-netfilter,
62979ab1 1360 AS_HELP_STRING([--enable-linux-netfilter],[Enable Transparent Proxy support for Linux (Netfilter)]),
d852fbad 1361[ if test "$enableval" = "yes" ; then
eed82608 1362 AC_MSG_NOTICE([Linux (Netfilter) Transparent Proxy enabled])
d6d62546 1363 AC_DEFINE(LINUX_NETFILTER,1,[Enable support for Transparent Proxy on Linux (Netfilter) systems])
d852fbad 1364 LINUX_NETFILTER="yes"
a74968c2
AJ
1365 else
1366 AC_DEFINE(LINUX_NETFILTER,0,[Enable support for Transparent Proxy on Linux (Netfilter) systems])
d852fbad 1367 fi
1368])
1369
bb7b5fd0 1370dnl Enable Large file support
2df6213e 1371buildmodel=""
1372needlargefiles=
1373
1374AC_ARG_WITH(large-files,
62979ab1 1375 AS_HELP_STRING([--with-large-files],[Enable support for large files (logs etc).]),
8b0d8e31 1376[ if test "x$withval" = "xyes"; then
2df6213e 1377 needlargefiles=1
bb7b5fd0 1378 fi
1379])
1380
2df6213e 1381dnl UNIX Build environment
62979ab1 1382dnl AS_HELP_STRING is not suited here because it doesn't allow to specify newlines
2df6213e 1383AC_ARG_WITH(build-environment,
1384[ --with-build-environment=model
1385 The build environment to use. Normally one of
1386 POSIX_V6_ILP32_OFF32 32 bits
1387 POSIX_V6_ILP32_OFFBIG 32 bits with large file support
1388 POSIX_V6_LP64_OFF64 64 bits
1389 POSIX_V6_LPBIG_OFFBIG large pointers and files
1390 XBS5_ILP32_OFF32 32 bits (legacy)
1391 XBS5_ILP32_OFFBIG 32 bits with large file support (legacy)
1392 XBS5_LP64_OFF64 64 bits (legacy)
1393 XBS5_LPBIG_OFFBIG large pointers and files (legacy)
1394 default The default for your OS],
1395[ case "$withval" in
1396 yes|no)
eed82608 1397 AC_MSG_FAILURE(["--with-build-environment expects a build environment string as used by getconf])
2df6213e 1398 ;;
1399 *)
1400 buildmodel="$withval"
1401 ;;
1402 esac
1403])
1404
1405if test $needlargefiles && test -z "$buildmodel"; then
f6fd3d67 1406 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 1407 if test "`getconf _$model 2>/dev/null || true`" = 1 || test "`getconf $model 2>/dev/null || true`" ; then
1408 buildmodel=$model
1409 break
1410 fi
1411 done
1412 if test -z "$buildmodel"; then
eed82608 1413 AC_MSG_WARN(["No suitable build environment found for large files. Trying to use _FILE_OFFSET_BITS=64])
2df6213e 1414 sleep 1
9b8002de
HN
1415 fi
1416fi
1417case "$buildmodel" in
1418default|"")
1419 if test "$needlargefiles"; then
eed82608 1420 AC_MSG_NOTICE([Enabling -D_FILE_OFFSET_BITS=64])
2df6213e 1421 CFLAGS="-D_FILE_OFFSET_BITS=64 $CFLAGS"
cca81db1 1422 CXXFLAGS="-D_FILE_OFFSET_BITS=64 $CXXFLAGS"
2df6213e 1423 fi
9b8002de
HN
1424 ;;
1425*)
eed82608 1426 AC_MSG_NOTICE([Using $buildmodel build environment])
2df6213e 1427 if test "`getconf _$buildmodel 2>/dev/null || true`" = 1 || test "`getconf $buildmodel 2>/dev/null || true`" ; then
1428 : # All fine
1429 else
8b0d8e31 1430 AC_MSG_ERROR(Build environment $buildmodel not known to getconf.)
2df6213e 1431 fi
1432 CFLAGS="`getconf ${buildmodel}_CFLAGS` $CFLAGS"
cca81db1 1433 CXXFLAGS="`getconf ${buildmodel}_CFLAGS` $CXXFLAGS"
2df6213e 1434 LIBS="`getconf ${buildmodel}_LIBS` $LIBS"
1435 LDFLAGS="`getconf ${buildmodel}_LDFLAGS` $LDFLAGS"
63e02610 1436 case "$host" in
2df6213e 1437dnl
a078ea4d
GS
1438dnl On Solaris getconf returns for CFLAGS -xarch=generic64, -Xa and -Usun options, and
1439dnl for LDFLAGS -xarch=generic64, but:
1440dnl "-Xa" is supported only by Sun cc, so we need to remove it when using gcc
1441dnl For gcc "-xarch=generic64" must be replaced with "-m64"
1442dnl The 'sun' define is needed by ipfilter includes, so we must remove "-Usun"
2df6213e 1443 *-solaris*)
1444 if test "$GCC" = "yes"; then
eed82608 1445 AC_MSG_NOTICE([Removing -Xa for gcc/g++ on $host])
2df6213e 1446 CFLAGS="`echo $CFLAGS | sed -e 's/-Xa//'`"
cca81db1 1447 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Xa//'`"
eed82608 1448 AC_MSG_NOTICE([Replacing -xarch=generic64 with -m64 for gcc/g++ on $host])
a078ea4d 1449 CFLAGS="`echo $CFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
bb60974e 1450 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
a078ea4d 1451 LDFLAGS="`echo $LDFLAGS | sed -e 's/-xarch=generic64//'`"
2df6213e 1452 fi
eed82608 1453 AC_MSG_NOTICE([Removing -Usun on $host])
2df6213e 1454 CFLAGS="`echo $CFLAGS | sed -e 's/-Usun//'`"
cca81db1 1455 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Usun//'`"
2df6213e 1456 ;;
eed82608 1457dnl
63e02610 1458dnl On Irix 6.x getconf returns options valid only for the SGI MipsPRO compiler,
1459dnl so we must adjust something to avoid gcc errors.
1460dnl On Irix 6.x 32/64 bit we must replace "-n32" with "-mabi=n32" in CFLAGS and
1461dnl remove "-n32" from LDFLAGS
1462dnl On Irix 6.x 64 bit we must replace "-64" with "-mabi=64" in CFLAGS and remove
1463dnl "-64" from LDFLAGS
1464 *-sgi-irix6.*)
1465 if test "$GCC" = "yes"; then
1466 CFLAGS="`echo $CFLAGS | sed -e 's/-n32/-mabi=n32/'`"
ff37fe61 1467 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-n32/-mabi=n32/'`"
63e02610 1468 LDFLAGS="`echo $LDFLAGS | sed -e 's/-n32//'`"
1469 CFLAGS="`echo $CFLAGS | sed -e 's/-64/-mabi=64/'`"
ff37fe61 1470 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-64/-mabi=64/'`"
63e02610 1471 LDFLAGS="`echo $LDFLAGS | sed -e 's/-64//'`"
1472 fi
1473 ;;
2df6213e 1474 *)
1475 ;;
1476 esac
993f04c1 1477 ;;
9b8002de 1478esac
2df6213e 1479
7b0a0d1f 1480dnl Enable Linux transparent proxy support for obsolete TPROXY
e8cca4ac 1481AC_ARG_ENABLE(linux-tproxy,
62979ab1 1482 AS_HELP_STRING([--enable-linux-tproxy],[Enable real Transparent Proxy support for Netfilter TPROXY
19b4777c 1483 (version 2).]),
fc68f6b1 1484[ if test "$enableval" = "yes" ; then
5b3fec23 1485 AC_MSG_NOTICE([Linux Netfilter/TPROXY v2 enabled])
f1e0717c
AJ
1486 AC_DEFINE(LINUX_TPROXY2, 1, [Enable real Transparent Proxy support for Netfilter TPROXY v2.])
1487 LINUX_TPROXY2="yes"
1488 if test -z "$LINUX_NETFILTER"; then
eed82608 1489 AC_MSG_NOTICE([Linux-Netfilter Transparent Proxy automatically enabled])
f1e0717c
AJ
1490 LINUX_NETFILTER="yes"
1491 fi
a74968c2
AJ
1492 else
1493 AC_DEFINE(LINUX_TPROXY2, 0, [Enable real Transparent Proxy support for Netfilter TPROXY v2.])
f1e0717c
AJ
1494 fi
1495])
fc68f6b1 1496
a2794549 1497AM_CONDITIONAL(MAKE_LEAKFINDER, false)
5d620373 1498dnl Enable Leak Finding Functions
1499AC_ARG_ENABLE(leakfinder,
62979ab1 1500 AS_HELP_STRING([--enable-leakfinder],[Enable Leak Finding code. Enabling this alone
19b4777c
FC
1501 does nothing; you also have to modify the source
1502 code to use the leak finding functions. Probably
1503 Useful for hackers only.]),
5d620373 1504[ if test "$enableval" = "yes" ; then
eed82608 1505 AC_MSG_NOTICE([Leak-Finding enabled])
6a9f6389 1506 AC_DEFINE(USE_LEAKFINDER,1,[Enable code for assisting in finding memory leaks. Hacker stuff only.])
5d620373 1507 USE_LEAKFINDER="yes"
a2794549 1508 AM_CONDITIONAL(MAKE_LEAKFINDER, true)
5d620373 1509 fi
1510])
5d620373 1511
3d674977
AJ
1512follow_xff=1
1513AC_ARG_ENABLE(follow-x-forwarded-for,
62979ab1 1514 AS_HELP_STRING([--enable-follow-x-forwarded-for],[Enable support for following the X-Forwarded-For
19b4777c
FC
1515 HTTP header to try to find the IP address of the
1516 original or indirect client when a request has
1517 been forwarded through other proxies.]),
3d674977 1518[ if test "$enableval" = "yes" ; then
eed82608 1519 AC_MSG_NOTICE([follow X-Forwarded-For enabled])
3d674977
AJ
1520 follow_xff=1
1521 fi
1522])
1523if test $follow_xff = 1; then
1524 AC_DEFINE(FOLLOW_X_FORWARDED_FOR, 1, [Enable following X-Forwarded-For headers])
1525else
1526 AC_DEFINE(FOLLOW_X_FORWARDED_FOR, 0)
1527fi
1528
14b32873 1529use_ident=1
3898f57f 1530AC_ARG_ENABLE(ident-lookups,
62979ab1 1531 AS_HELP_STRING([--disable-ident-lookups],[This allows you to remove code that performs Ident (RFC 931) lookups.]),
3898f57f 1532[ if test "$enableval" = "no" ; then
eed82608 1533 AC_MSG_NOTICE([Disabling Ident Lookups])
14b32873 1534 use_ident=0
3898f57f 1535 fi
1536])
14b32873 1537if test $use_ident = 1; then
1538 AC_DEFINE(USE_IDENT, 1,[Compile in support for Ident (RFC 931) lookups? Enabled by default.])
1539else
1540 AC_DEFINE(USE_IDENT, 0)
1541fi
3898f57f 1542
a2794549 1543AM_CONDITIONAL(USE_DNSSERVER, false)
3c573763 1544use_dnsserver=
eb824054 1545AC_ARG_ENABLE(internal-dns,
62979ab1 1546 AS_HELP_STRING([--disable-internal-dns],[Prevents Squid from directly sending and receiving DNS messages,
19b4777c 1547 and instead enables the old external 'dnsserver' processes.]),
eb824054 1548[ if test "$enableval" = "no" ; then
eed82608 1549 AC_MSG_WARN([Disabling Internal DNS queries])
3c573763 1550 use_dnsserver="yes"
eb824054 1551 fi
1552])
3c573763 1553if test "$use_dnsserver" = "yes"; then
6a9f6389 1554 AC_DEFINE(USE_DNSSERVERS,1,[Use dnsserver processes instead of the internal DNS protocol support])
a2794549 1555 AM_CONDITIONAL(USE_DNSSERVER, true)
3c573763 1556fi
eb824054 1557
9d798391 1558dnl Select Default hosts file location
1559AC_ARG_ENABLE(default-hostsfile,
62979ab1 1560 AS_HELP_STRING([--enable-default-hostsfile=path],[Select default location for hosts file.
19b4777c 1561 See hosts_file directive in squid.conf for details]),
9d798391 1562[
1563 if test "$enableval" != "none" ; then
1564 if test -f $enableval; then
1565 OPT_DEFAULT_HOSTS=$enableval
1566 else
eed82608 1567 AC_MSG_WARN([Unable to find $enableval])
9d798391 1568 sleep 5
1569 fi
1570 else
eed82608 1571 OPT_DEFAULT_HOSTS="none"
9d798391 1572 fi
eed82608 1573 AC_MSG_NOTICE([Default hosts file set to: $enableval])
9d798391 1574],[OPT_DEFAULT_HOSTS="/etc/hosts"])
1575AC_SUBST(OPT_DEFAULT_HOSTS)
1576
94439e4e 1577dnl Select auth schemes modules to build
1578AC_ARG_ENABLE(auth,
62979ab1 1579 AS_HELP_STRING([--enable-auth="list of auth scheme modules"],[Build support for the list of authentication schemes.
19b4777c
FC
1580 The default is to build support for the Basic scheme.
1581 See src/auth for a list of available modules, or
1582 Programmers Guide section authentication schemes
1583 for details on how to build your custom auth scheme
1584 module]),
94439e4e 1585[ case $enableval in
1586 yes)
1c42c4a1 1587 for dir in $srcdir/src/auth/*; do
1588 module="`basename $dir`"
1c690e30 1589 if test -d "$dir" && test "$module" != CVS; then
1c42c4a1 1590 AUTH_MODULES="$AUTH_MODULES $module"
94439e4e 1591 fi
1592 done
1593 ;;
1594 no)
1595 ;;
1c690e30 1596 *)
1597 AUTH_MODULES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1598 ;;
94439e4e 1599 esac
1600],
1601[ if test -z "$AUTH_MODULES"; then
6bf4f823 1602 AUTH_MODULES="ntlm basic digest negotiate"
94439e4e 1603 fi
1604])
1c690e30 1605if test -n "$AUTH_MODULES"; then
1606 for module in $AUTH_MODULES; do
1607 if test -d $srcdir/src/auth/$module; then
1608 :
1609 else
8b0d8e31 1610 AC_MSG_ERROR(Auth scheme $module does not exist)
1c690e30 1611 fi
7f18d2bd 1612 eval AUTH_MODULE_${module}=yes
1c690e30 1613 done
eed82608 1614 AC_MSG_NOTICE([Auth scheme modules built: $AUTH_MODULES])
d0571da6 1615else
eed82608 1616 AC_MSG_WARN([Auth scheme modules built: None])
1c690e30 1617fi
2d2b0bb7
AR
1618dnl Authentication libraries to build
1619dnl This list will not be needed when each auth library has its own Makefile
1620AUTH_LIBS_TO_BUILD=
f5691f9c 1621for module in $AUTH_MODULES; do
bcf44a2c 1622 AUTH_LIBS_TO_BUILD="$AUTH_LIBS_TO_BUILD lib${module}.la"
f5691f9c 1623done
94439e4e 1624AC_SUBST(AUTH_MODULES)
2d2b0bb7 1625AC_SUBST(AUTH_LIBS_TO_BUILD)
94439e4e 1626
7762106d
FC
1627dnl bundled auth modules, in order to have handy defines for the cppunit testsuite
1628test -n "$AUTH_MODULE_basic" && AC_DEFINE([HAVE_AUTH_MODULE_BASIC],1,[Basic auth module is built])
1629test -n "$AUTH_MODULE_digest" && AC_DEFINE([HAVE_AUTH_MODULE_DIGEST],1,[Digest auth module is built])
1630test -n "$AUTH_MODULE_ntlm" && AC_DEFINE([HAVE_AUTH_MODULE_NTLM],1,[NTLM auth module is built])
1631test -n "$AUTH_MODULE_negotiate" && AC_DEFINE([HAVE_AUTH_MODULE_NEGOTIATE],1,[Negotiate auth module is built])
1632
94439e4e 1633dnl Select basic auth scheme helpers to build
7f18d2bd 1634if test -n "$AUTH_MODULE_basic"; then
1635 BASIC_AUTH_HELPERS="all"
1636fi
94439e4e 1637AC_ARG_ENABLE(basic-auth-helpers,
62979ab1 1638 AS_HELP_STRING([--enable-basic-auth-helpers="list of helpers"],[This option selects which basic scheme proxy_auth
19b4777c
FC
1639 helpers to build and install as part of the normal
1640 build process. For a list of available
1641 helpers see the helpers/basic_auth directory.]),
94439e4e 1642[ case "$enableval" in
7f18d2bd 1643 yes)
1644 BASIC_AUTH_HELPERS="all"
1c690e30 1645 ;;
94439e4e 1646 no)
7f18d2bd 1647 BASIC_AUTH_HELPERS=""
1c690e30 1648 ;;
94439e4e 1649 *)
7f18d2bd 1650 if test -z "$AUTH_MODULE_basic"; then
eed82608 1651 AC_MSG_WARN([Basic auth helpers selected without the basic scheme enabled])
7f18d2bd 1652 sleep 15
1653 fi
1c690e30 1654 BASIC_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1655 ;;
94439e4e 1656 esac
1657])
7f18d2bd 1658if test "$BASIC_AUTH_HELPERS" = "all" ; then
1659 BASIC_AUTH_HELPERS=""
1660 for dir in $srcdir/helpers/basic_auth/*; do
1661 helper="`basename $dir`"
1662 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1663 BASIC_AUTH_HELPERS="$BASIC_AUTH_HELPERS $helper"
ce7c6bba
AJ
1664 elif test -d $srcdir/helpers/basic_auth/$helper ; then
1665 AC_MSG_NOTICE([Basic auth helper $helper ... found but cannot be built])
7f18d2bd 1666 fi
1667 done
1668fi
fc83a946 1669if test -n "$BASIC_AUTH_HELPERS"; then
20d8bfe4 1670 for helper in $BASIC_AUTH_HELPERS; do
1c690e30 1671 if test -d $srcdir/helpers/basic_auth/$helper; then
2adff954 1672 case $helper in
1673 SASL)
1674 require_sasl=yes
1675 ;;
1676 esac
20d8bfe4 1677 else
8b0d8e31 1678 AC_MSG_ERROR(Basic auth helper $helper does not exist)
20d8bfe4 1679 fi
1680 done
eed82608 1681 AC_MSG_NOTICE([Basic auth helpers built: $BASIC_AUTH_HELPERS])
94439e4e 1682fi
fc83a946 1683AC_SUBST(BASIC_AUTH_HELPERS)
94439e4e 1684
1685dnl Select ntlm auth helpers to build
7f18d2bd 1686if test -n "$AUTH_MODULE_ntlm"; then
1687 NTLM_AUTH_HELPERS="all"
1688fi
94439e4e 1689AC_ARG_ENABLE(ntlm-auth-helpers,
62979ab1 1690 AS_HELP_STRING([--enable-ntlm-auth-helpers="list of helpers"],[This option selects which proxy_auth ntlm helpers
19b4777c
FC
1691 to build and install as part of the normal build
1692 process. For a list of available helpers see
1693 the helpers/ntlm_auth directory.]),
380f0a87 1694[ case "$enableval" in
1695 yes)
7f18d2bd 1696 NTLM_AUTH_HELPERS="all"
1c690e30 1697 ;;
380f0a87 1698 no)
7f18d2bd 1699 NTLM_AUTH_HELPERS=""
1c690e30 1700 ;;
380f0a87 1701 *)
1c690e30 1702 NTLM_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1703 ;;
380f0a87 1704 esac
1705])
7f18d2bd 1706if test "$NTLM_AUTH_HELPERS" = "all" ; then
1707 NTLM_AUTH_HELPERS=""
1708 for dir in $srcdir/helpers/ntlm_auth/*; do
1709 helper="`basename $dir`"
1710 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1711 NTLM_AUTH_HELPERS="$NTLM_AUTH_HELPERS $helper"
ce7c6bba
AJ
1712 elif test -d $srcdir/helpers/ntlm_auth/$helper ; then
1713 AC_MSG_NOTICE([NTLM auth helper $helper ... found but cannot be built])
7f18d2bd 1714 fi
1715 done
1716fi
94439e4e 1717if test -n "$NTLM_AUTH_HELPERS"; then
20d8bfe4 1718 for helper in $NTLM_AUTH_HELPERS; do
1c690e30 1719 if test -d $srcdir/helpers/ntlm_auth/$helper; then
1720 :
20d8bfe4 1721 else
8b0d8e31 1722 AC_MSG_ERROR(NTLM Auth helper $helper does not exist)
20d8bfe4 1723 fi
1724 done
eed82608 1725 AC_MSG_NOTICE([NTLM auth helpers built: $NTLM_AUTH_HELPERS])
380f0a87 1726fi
94439e4e 1727AC_SUBST(NTLM_AUTH_HELPERS)
1728
6e785d85 1729dnl Select negotiate auth helpers to build
7f18d2bd 1730if test -n "$AUTH_MODULE_negotiate"; then
1731 NEGOTIATE_AUTH_HELPERS="all"
1732fi
6e785d85 1733AC_ARG_ENABLE(negotiate-auth-helpers,
62979ab1 1734 AS_HELP_STRING([--enable-negotiate-auth-helpers="list of helpers"],[This option selects which proxy_auth negotiate helpers
e702812e
FC
1735 to build and install as part of the normal build
1736 process. For a list of available helpers see
1737 the helpers/negotiate_auth directory.]),
6e785d85 1738[ case "$enableval" in
1739 yes)
7f18d2bd 1740 NEGOTIATE_AUTH_HELPERS="all"
6e785d85 1741 ;;
1742 no)
7f18d2bd 1743 NEGOTIATE_AUTH_HELPERS=""
6e785d85 1744 ;;
1745 *)
1746 NEGOTIATE_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1747 ;;
1748 esac
1749])
7f18d2bd 1750if test "$NEGOTIATE_AUTH_HELPERS" = "all" ; then
1751 NEGOTIATE_AUTH_HELPERS=""
1752 for dir in $srcdir/helpers/negotiate_auth/*; do
1753 helper="`basename $dir`"
1754 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1755 NEGOTIATE_AUTH_HELPERS="$NEGOTIATE_AUTH_HELPERS $helper"
ce7c6bba
AJ
1756 elif test -d $srcdir/helpers/negotiate_auth/$helper ; then
1757 AC_MSG_NOTICE([Negotiate auth helper $helper ... found but cannot be built])
7f18d2bd 1758 fi
1759 done
1760fi
6e785d85 1761if test -n "$NEGOTIATE_AUTH_HELPERS"; then
1762 for helper in $NEGOTIATE_AUTH_HELPERS; do
1763 if test -d $srcdir/helpers/negotiate_auth/$helper; then
1764 :
1765 else
8b0d8e31 1766 AC_MSG_ERROR(Negotiate Auth helper $helper does not exist)
6e785d85 1767 fi
1768 done
eed82608 1769 AC_MSG_NOTICE([Negotiate auth helpers built: $NEGOTIATE_AUTH_HELPERS])
6e785d85 1770fi
1771AC_SUBST(NEGOTIATE_AUTH_HELPERS)
1772
2d70df72 1773dnl Select digest auth scheme helpers to build
7f18d2bd 1774if test -n "$AUTH_MODULE_digest"; then
1775 DIGEST_AUTH_HELPERS=all
1776fi
2d70df72 1777AC_ARG_ENABLE(digest-auth-helpers,
62979ab1 1778 AS_HELP_STRING([--enable-digest-auth-helpers="list of helpers"],[This option selects which digest scheme authentication
e702812e
FC
1779 helpers to build and install as part of the normal build
1780 process. For a list of available helpers see the
1781 helpers/digest_auth directory.]),
2d70df72 1782[ case "$enableval" in
1783 yes)
7f18d2bd 1784 DIGEST_AUTH_HELPERS="all"
1c690e30 1785 ;;
2d70df72 1786 no)
7f18d2bd 1787 DIGEST_AUTH_HELPERS=""
1c690e30 1788 ;;
2d70df72 1789 *)
1c690e30 1790 DIGEST_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1791 ;;
2d70df72 1792 esac
1793])
7f18d2bd 1794if test "$DIGEST_AUTH_HELPERS" = "all" ; then
1795 DIGEST_AUTH_HELPERS=""
1796 for dir in $srcdir/helpers/digest_auth/*; do
1797 helper="`basename $dir`"
1798 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1799 DIGEST_AUTH_HELPERS="$DIGEST_AUTH_HELPERS $helper"
ce7c6bba
AJ
1800 elif test -d $srcdir/helpers/digest_auth/$helper ; then
1801 AC_MSG_NOTICE([Digest auth helper $helper ... found but cannot be built])
7f18d2bd 1802 fi
1803 done
1804fi
2d70df72 1805if test -n "$DIGEST_AUTH_HELPERS"; then
1daefc1a 1806 for helper in $DIGEST_AUTH_HELPERS; do
1807 if test -f $srcdir/helpers/digest_auth/$helper/Makefile.in; then
1808 :
1809 else
8b0d8e31 1810 AC_MSG_ERROR(digest auth helper $helper does not exist)
1daefc1a 1811 fi
1812 done
eed82608 1813 AC_MSG_NOTICE([Digest auth helpers built: $DIGEST_AUTH_HELPERS])
2d70df72 1814fi
1815AC_SUBST(DIGEST_AUTH_HELPERS)
380f0a87 1816
82b7abe3
AJ
1817dnl Select logging daemon helpers to build
1818LOG_DAEMON_HELPERS="all"
1819AC_ARG_ENABLE(log-daemon-helpers,
1820 AS_HELP_STRING([--enable-log-daemon-auth-helpers="list of helpers"],[This option selects which logging daemon
1821 helpers to build and install as part of the normal build process. For a list of available
1822 helpers see the helpers/log_daemon directory.]),
1823[ case "$enableval" in
1824 yes)
1825 LOG_DAEMON_HELPERS="all"
1826 ;;
1827 no)
1828 LOG_DAEMON_HELPERS=""
1829 ;;
1830 *)
1831 LOG_DAEMON_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1832 ;;
1833 esac
1834])
1835if test "$LOG_DAEMON_HELPERS" = "all" ; then
1836 LOG_DAEMON_HELPERS=""
1837 for dir in $srcdir/helpers/log_daemon/*; do
1838 helper="`basename $dir`"
1839 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1840 LOG_DAEMON_HELPERS="$LOG_DAEMON_HELPERS $helper"
1841 elif test -d $srcdir/helpers/log_daemon/$helper ; then
1842 AC_MSG_NOTICE([Log daemon auth helper $helper ... found but cannot be built])
1843 fi
1844 done
1845fi
1846if test -n "$LOG_DAEMON_HELPERS"; then
1847 for helper in $LOG_DAEMON_HELPERS; do
1848 if test -d $srcdir/helpers/log_daemon/$helper; then
1849 :
1850 else
1851 AC_MSG_ERROR(Log daemon helper $helper does not exist)
1852 fi
1853 done
1854 AC_MSG_NOTICE([Log daemon helpers built: $LOG_DAEMON_HELPERS])
1855fi
1856AC_SUBST(LOG_DAEMON_HELPERS)
1857
3d62cc61
FC
1858dnl
1859dnl Check Kerberos/GSSAPI/SPNEGO
1860dnl
9ca29d23
AJ
1861SAVED_CPPFLAGS=$CPPFLAGS
1862SAVED_LIBS=$LIBS
1863AC_ARG_WITH(krb5-config,
1864 [ --with-krb5-config=PATH specify path to krb5-config @<:@default=detect@:>@],
1865[ if test "$withval" = "yes"; then
1866 unset krb5confpath
1867 elif test "$withval" != "no"; then
1868 krb5confpath=$withval
1869 else
1870 krb5confpath=no
1871 fi
1872])
1873if test x"$krb5confpath" != xno; then
1874 if test x"$krb5confpath" != x; then
1875 if ! test -x "$krb5confpath"; then
1876 AC_MSG_WARN([krb5-config '$krb5confpath' not executable, ignoring])
1877 AC_CHECK_PROG(ac_krb5_config, krb5-config, yes, no)
1878 krb5confpath=krb5-config
1879 fi
1880 krb5_config_path=`dirname $krb5confpath`
1881 AC_CHECK_PROG(ac_krb5_config, krb5-config, yes, no, $krb5_config_path)
1882 else
1883 AC_CHECK_PROG(ac_krb5_config,krb5-config,yes,no)
1884 krb5confpath=krb5-config
1885 fi
1886fi
1887if test "$ac_krb5_config" = "yes" ; then
cf99ae25
AJ
1888 ac_heimdal="`$krb5confpath --version 2>/dev/null | grep -i heimdal`"
1889 ac_solaris="`$krb5confpath --version 2>/dev/null | grep -i solaris`"
9ca29d23
AJ
1890 if test "x$ac_heimdal" != "x" ; then
1891 AC_DEFINE(HAVE_HEIMDAL_KERBEROS,1,[Define to 1 if you have Heimdal Kerberos])
1892 else
1893 AC_DEFINE(HAVE_MIT_KERBEROS,1,[Define to 1 if you have MIT Kerberos])
1894 fi
1895 if test "$ac_solaris" != "" ; then
cf99ae25
AJ
1896 KRB5INCS="`$krb5confpath --cflags krb5 2>/dev/null`"
1897 KRB5LIBS="`$krb5confpath --libs krb5 2>/dev/null`"
9ca29d23
AJ
1898 KRB5INCS="-I/usr/include/gssapi $KRB5INCS"
1899 KRB5LIBS="-L/usr/lib -R/usr/lib -lgss -lresolv -lsocket -lnsl $KRB5LIBS"
1900 else
cf99ae25
AJ
1901 KRB5INCS="`$krb5confpath --cflags krb5 2>/dev/null`"
1902 KRB5LIBS="`$krb5confpath --libs krb5 2>/dev/null`"
9ca29d23
AJ
1903 KRB5INCS="`$krb5confpath --cflags gssapi 2>/dev/null` $KRB5INCS"
1904 KRB5LIBS="`$krb5confpath --libs gssapi 2>/dev/null` $KRB5LIBS"
1905 fi
1906 CPPFLAGS="$CPPFLAGS $KRB5INCS"
1907 LIBS="$LIBS $KRB5LIBS"
1908 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h)
1909 if test "x$ac_heimdal" == "x" ; then
1910 AC_CHECK_HEADERS(gssapi/gssapi_generic.h)
3d62cc61 1911 AC_CHECK_HEADERS(profile.h)
9ca29d23 1912 fi
d14e78e9 1913 AC_CHECK_HEADERS(krb5.h com_err.h et/com_err.h)
3d62cc61
FC
1914 AC_CACHE_CHECK([for broken Solaris krb5.h],squid_cv_broken_krb5_h, [
1915 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9ca29d23 1916#include <krb5.h>
3d62cc61
FC
1917int i;
1918]])], [ squid_cv_broken_krb5_h=no ],
1919 [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1920#if defined(__cplusplus)
1921#define KRB5INT_BEGIN_DECLS extern "C" {
1922#define KRB5INT_END_DECLS
1923KRB5INT_BEGIN_DECLS
1924#endif
1925#include <krb5.h>
1926int i;
1927]])], [ squid_cv_broken_krb5_h=yes ], [ squid_cv_broken_krb5_h=no ])])])
1928 if test x"$squid_cv_broken_krb5_h" = x"yes"; then
1929 AC_DEFINE(HAVE_BROKEN_SOLARIS_KRB5_H, 1, [Define to 1 if krb5.h is broken for C++])
1930 fi
9ca29d23 1931
3d62cc61
FC
1932 ac_com_error_message=no
1933 if test "x$ac_cv_header_com_err_h" == "xyes" ; then
1934 AC_EGREP_HEADER(error_message,com_err.h,ac_com_error_message=yes)
1935 elif test "x$ac_cv_header_et_com_err_h" == "xyes" ; then
1936 AC_EGREP_HEADER(error_message,et/com_err.h,ac_com_error_message=yes)
1937 fi
1938 AC_CACHE_CHECK([for max_skew in struct krb5_context],squid_cv_max_skew_context, [
1939 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1940#if HAVE_BROKEN_SOLARIS_KRB5_H
1941#if defined(__cplusplus)
1942#define KRB5INT_BEGIN_DECLS extern "C" {
1943#define KRB5INT_END_DECLS
1944KRB5INT_BEGIN_DECLS
1945#endif
1946#endif
1947#include <krb5.h>
1948krb5_context kc; kc->max_skew = 1;
1949]])],[ squid_cv_max_skew_context=yes ], [ squid_cv_max_skew_context=no ])])
1950 if test x"$squid_cv_max_skew_context" = x"yes"; then
1951 AC_DEFINE(HAVE_MAX_SKEW_IN_KRB5_CONTEXT, 1, [Define to 1 if max_skew in struct krb5_context])
1952 fi
1953
1954 if test `echo $KRB5LIBS | grep -c com_err` -ne 0 -a "x$ac_com_error_message" == "xyes" ; then
1955 AC_CHECK_LIB(com_err,error_message,
1956 AC_DEFINE(HAVE_ERROR_MESSAGE,1,[Define to 1 if you have error_message]),)
1957 elif test "x$ac_com_error_message" == "xyes" ; then
1958 AC_CHECK_LIB(krb5,error_message,
1959 AC_DEFINE(HAVE_ERROR_MESSAGE,1,[Define to 1 if you have error_message]),)
9ca29d23 1960 fi
cf99ae25
AJ
1961 AC_CHECK_LIB(krb5,krb5_get_err_text,
1962 AC_DEFINE(HAVE_KRB5_GET_ERR_TEXT,1,[Define to 1 if you have krb5_get_err_text]),)
1963 AC_CHECK_LIB(krb5,krb5_get_error_message,
1964 AC_DEFINE(HAVE_KRB5_GET_ERROR_MESSAGE,1,[Define to 1 if you have krb5_get_error_message]),)
9ca29d23
AJ
1965 AC_CHECK_LIB(krb5,krb5_kt_free_entry,
1966 AC_DEFINE(HAVE_KRB5_KT_FREE_ENTRY,1,[Define to 1 if you have krb5_kt_free_entry]),)
1967 AC_CHECK_LIB(krb5,krb5_get_init_creds_keytab,
1968 AC_DEFINE(HAVE_GET_INIT_CREDS_KEYTAB,1,[Define to 1 if you have krb5_get_init_creds_keytab]),)
1969 AC_CHECK_LIB(krb5,krb5_get_max_time_skew,
1970 AC_DEFINE(HAVE_KRB5_GET_MAX_TIME_SKEW,1,[Define to 1 if you have krb5_get_max_time_skew]),)
1971 AC_CHECK_LIB(krb5,krb5_get_profile,
1972 AC_DEFINE(HAVE_KRB5_GET_PROFILE,1,[Define to 1 if you have krb5_get_profile]),)
1973 AC_CHECK_LIB(krb5,profile_get_integer,
1974 AC_DEFINE(HAVE_PROFILE_GET_INTEGER,1,[Define to 1 if you have profile_get_integer]),)
1975 AC_CHECK_LIB(krb5,profile_release,
1976 AC_DEFINE(HAVE_PROFILE_RELEASE,1,[Define to 1 if you have profile_release]),)
3d62cc61
FC
1977 AC_CACHE_CHECK([for memory cache], squid_cv_memory_cache, [
1978 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1979#if HAVE_BROKEN_SOLARIS_KRB5_H
1980#if defined(__cplusplus)
1981#define KRB5INT_BEGIN_DECLS extern "C" {
1982#define KRB5INT_END_DECLS
1983KRB5INT_BEGIN_DECLS
1984#endif
1985#endif
9ca29d23
AJ
1986#include<krb5.h>
1987main()
1988{
1989 krb5_context context;
1990 krb5_ccache cc;
1991
1992 krb5_init_context(&context);
1993 return krb5_cc_resolve(context, "MEMORY:test_cache", &cc);
3d62cc61
FC
1994}
1995]])], [ squid_cv_memory_cache=yes ], [ squid_cv_memory_cache=no ])])
1996 if test "$squid_cv_memory_cache" = "yes" ; then
1997 AC_DEFINE(HAVE_KRB5_MEMORY_CACHE,1, [Define to 1 if you have MEMORY: cache support])
1998 fi
1999 AC_CACHE_CHECK([for working gssapi], squid_cv_working_gssapi, [
2000 AC_RUN_IFELSE([AC_LANG_SOURCE([[
9ca29d23
AJ
2001#ifdef HAVE_GSSAPI_GSSAPI_H
2002#include <gssapi/gssapi.h>
2003#elif HAVE_GSSAPI_H
2004#include <gssapi.h>
2005#endif
2006
2007#ifdef HAVE_GSSAPI_GSSAPI_EXT_H
2008#include <gssapi/gssapi_ext.h>
2009#endif
2010
2011#ifdef HAVE_GSSAPI_GSSAPI_KRB5_H
2012#include <gssapi/gssapi_krb5.h>
2013#endif
2014
2015#ifdef HAVE_GSSAPI_GSSAPI_GENERIC_H
2016#include <gssapi/gssapi_generic.h>
2017#endif
2018int
2019main(void)
2020{
2021 OM_uint32 val;
2022 gss_OID_set set;
2023
2024 gss_create_empty_oid_set(&val, &set);
2025
2026 return 0;
2027}
3d62cc61
FC
2028]])], [ squid_cv_working_gssapi=yes ], [ squid_cv_working_gssapi=no ])])
2029 if test "$squid_cv_working_gssapi" = "yes" ; then
2030 AC_DEFINE(HAVE_GSSAPI, 1, [GSSAPI support])
2031 fi
2032
2033 AC_CACHE_CHECK([for spnego support], squid_cv_have_spnego, [
2034 AC_RUN_IFELSE([AC_LANG_SOURCE([[
9ca29d23
AJ
2035#ifdef HAVE_HEIMDAL_KERBEROS
2036#ifdef HAVE_GSSAPI_GSSAPI_H
2037#include <gssapi/gssapi.h>
2038#elif defined(HAVE_GSSAPI_H)
2039#include <gssapi.h>
2040#endif
2041#else
2042#ifdef HAVE_GSSAPI_GSSAPI_H
2043#include <gssapi/gssapi.h>
2044#elif defined(HAVE_GSSAPI_H)
2045#include <gssapi.h>
2046#endif
2047#ifdef HAVE_GSSAPI_GSSAPI_KRB5_H
2048#include <gssapi/gssapi_krb5.h>
2049#endif
2050#ifdef HAVE_GSSAPI_GSSAPI_GENERIC_H
2051#include <gssapi/gssapi_generic.h>
2052#endif
2053#endif
2054#include <string.h>
2055int main(int argc, char *argv[]) {
2056 OM_uint32 major_status,minor_status;
2057 gss_OID_set gss_mech_set;
2058 int i;
2059
2060static gss_OID_desc _gss_mech_spnego = {6, (void *)"\x2b\x06\x01\x05\x05\x02"};
2061gss_OID gss_mech_spnego = &_gss_mech_spnego;
2062
2063 major_status = gss_indicate_mechs( &minor_status, &gss_mech_set);
2064
2065 for (i=0;i<gss_mech_set->count;i++) {
2066 if (!memcmp(gss_mech_set->elements[i].elements,gss_mech_spnego->elements,gss_mech_set->elements[i].length)) {
2067 return 0;
2068 }
2069 }
2070
2071 return 1;
3d62cc61
FC
2072}
2073]])], [ squid_cv_have_spnego=yes ], [ squid_cv_have_spnego=no ])])
2074
2075 if test "$squid_cv_have_spnego" = "yes" ; then
9ca29d23 2076 AC_DEFINE(HAVE_SPNEGO,1, [Define to 1 if you have SPNEGO support])
3d62cc61
FC
2077 fi
2078 AC_CACHE_CHECK([for working krb5], squid_cv_working_krb5, [
2079 AC_RUN_IFELSE([AC_LANG_SOURCE([[
9ca29d23 2080#ifdef HAVE_KRB5_H
3d62cc61
FC
2081#if HAVE_BROKEN_SOLARIS_KRB5_H
2082#if defined(__cplusplus)
2083#define KRB5INT_BEGIN_DECLS extern "C" {
2084#define KRB5INT_END_DECLS
2085KRB5INT_BEGIN_DECLS
2086#endif
2087#endif
9ca29d23
AJ
2088#include <krb5.h>
2089#endif
2090
2091int
2092main(void)
2093{
2094 krb5_context context;
2095
2096 krb5_init_context(&context);
2097
2098 return 0;
2099}
3d62cc61
FC
2100]])], [ squid_cv_working_krb5=yes ], [ squid_cv_working_krb5=no ])])
2101 if test "$squid_cv_working_krb5" = "yes" ; then
2102 AC_DEFINE(HAVE_KRB5, 1, [KRB5 support])
2103 fi
2104
9ca29d23
AJ
2105 LIBS=$SAVED_LIBS
2106 CPPFLAGS=$SAVED_CPPFLAGS
2107 AC_SUBST(KRB5INCS)
2108 AC_SUBST(KRB5LIBS)
2109fi
3d62cc61 2110AM_CONDITIONAL(HAVE_SPNEGO, test x"$squid_cv_have_spnego" = x"yes" )
9ca29d23 2111
6437ac71 2112dnl Enable "NTLM fail open"
2113AC_ARG_ENABLE(ntlm-fail-open,
62979ab1 2114 AS_HELP_STRING([--enable-ntlm-fail-open],[Enable NTLM fail open, where a helper that fails one of the
e702812e
FC
2115 Authentication steps can allow squid to still authenticate
2116 the user.]),
6437ac71 2117[ if test "$enableval" = "yes" ; then
6a9f6389 2118 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 2119 fi
2120])
2121
c6588c68 2122dnl Select external_acl helpers to build
7f18d2bd 2123EXTERNAL_ACL_HELPERS=all
c6588c68 2124AC_ARG_ENABLE(external-acl-helpers,
62979ab1 2125 AS_HELP_STRING([--enable-external-acl-helpers="list of helpers"],[This option selects which external_acl helpers to
e702812e
FC
2126 build and install as part of the normal build
2127 process. For a list of available helpers see the
2128 helpers/external_acl directory.]),
c6588c68 2129[ case "$enableval" in
2130 yes)
7f18d2bd 2131 EXTERNAL_ACL_HELPERS=all
1c690e30 2132 ;;
c6588c68 2133 no)
7f18d2bd 2134 EXTERNAL_ACL_HELPERS=""
1c690e30 2135 ;;
c6588c68 2136 *)
1c690e30 2137 EXTERNAL_ACL_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
2138 ;;
c6588c68 2139 esac
2140])
7f18d2bd 2141if test "$EXTERNAL_ACL_HELPERS" = "all" ; then
39ee7289 2142 EXTERNAL_ACL_HELPERS=""
7f18d2bd 2143 for dir in $srcdir/helpers/external_acl/*; do
2144 helper="`basename $dir`"
2145 if test -f $dir/config.test && sh $dir/config.test "$@"; then
2146 EXTERNAL_ACL_HELPERS="$EXTERNAL_ACL_HELPERS $helper"
ce7c6bba
AJ
2147 elif test -d $srcdir/helpers/external_acl/$helper ; then
2148 AC_MSG_NOTICE([External ACL helper $helper ... found but cannot be built])
7f18d2bd 2149 fi
2150 done
2151fi
c6588c68 2152if test -n "$EXTERNAL_ACL_HELPERS"; then
20d8bfe4 2153 for helper in $EXTERNAL_ACL_HELPERS; do
2154 if test -f $srcdir/helpers/external_acl/$helper/Makefile.in; then
2155 :
2156 else
8b0d8e31 2157 AC_MSG_ERROR(external acl helper $helper does not exist)
20d8bfe4 2158 fi
2159 done
eed82608 2160 AC_MSG_NOTICE([External acl helpers built: $EXTERNAL_ACL_HELPERS])
c6588c68 2161fi
2162AC_SUBST(EXTERNAL_ACL_HELPERS)
2163
fdbb3b19
AJ
2164dnl Select url_rewrite helpers to build
2165URL_REWRITE_HELPERS=all
2166AC_ARG_ENABLE(url-rewrite-helpers,
2167 AC_HELP_STRING([--enable-url-rewrite-helpers="list of helpers"],
2168 [This option selects which url_rewrite helpers to
2169 build and install as part of the normal build
2170 process. For a list of available helpers see the
2171 helpers/url_rewrite directory.]),
2172[ case "$enableval" in
2173 yes)
2174 URL_REWRITE_HELPERS=all
2175 ;;
2176 no)
2177 URL_REWRITE_HELPERS=""
2178 ;;
2179 *)
2180 URL_REWRITE_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
2181 ;;
2182 esac
2183])
2184if test "$URL_REWRITE_HELPERS" = "all" ; then
2185 URL_REWRITE_HELPERS=""
2186 for dir in $srcdir/helpers/url_rewrite/*; do
2187 helper="`basename $dir`"
2188 if test -f $dir/config.test && sh $dir/config.test "$@"; then
2189 URL_REWRITE_HELPERS="$URL_REWRITE_HELPERS $helper"
ce7c6bba
AJ
2190 elif test -d $srcdir/helpers/url_rewrite/$helper ; then
2191 AC_MSG_NOTICE([URL re-write helper $helper ... found but cannot be built])
fdbb3b19
AJ
2192 fi
2193 done
2194fi
2195if test -n "$URL_REWRITE_HELPERS"; then
2196 for helper in $URL_REWRITE_HELPERS; do
2197 if test -f $srcdir/helpers/url_rewrite/$helper/Makefile.in; then
2198 :
2199 else
2200 AC_MSG_ERROR(url_rewrite helper $helper does not exist)
2201 fi
2202 done
2203 AC_MSG_NOTICE([url_rewrite helpers built: $URL_REWRITE_HELPERS])
2204fi
2205AC_SUBST(URL_REWRITE_HELPERS)
2206
2207
3a125142 2208AC_ARG_WITH(valgrind-debug,
62979ab1 2209 AS_HELP_STRING([--with-valgrind-debug],[Include debug instrumentation for use with valgrind]),
b4bab919 2210[ case $withval in
2211 yes)
2212 valgrind=1
2213 ;;
2214 no)
2215 valgrind=
2216 ;;
2217 *)
2218 CPPFLAGS="$CPPFLAGS -I${enableval}/include"
2219 valgrind=1
2220 ;;
2221 esac
2222 if test $valgrind; then
ad32c661
AJ
2223 AC_CHECK_HEADERS(valgrind/memcheck.h,
2224 [ AC_DEFINE(WITH_VALGRIND, 1, [Valgrind memory debugger support])
eed82608
AJ
2225 AC_MSG_NOTICE([Valgrind debug support enabled]) ],
2226 [ AC_MSG_WARN([Valgrind header not found. Valgrind support disabled.]) ]
ad32c661 2227 )
b4bab919 2228 fi
2229])
2230
d96ceb8e 2231dnl Disable "memPools" code
2232AC_ARG_ENABLE(mempools,
62979ab1 2233 AS_HELP_STRING([--disable-mempools],[Disable memPools. Note that this option now simply sets the
e702812e
FC
2234 default behaviour. Specific classes can override this at runtime, and
2235 only lib/MemPool.c needs to be altered to change the squid-wide
2236 default for all classes.]),
d96ceb8e 2237[ if test "$enableval" = "no" ; then
eed82608 2238 AC_MSG_NOTICE([memPools disabled])
6a9f6389 2239 AC_DEFINE(DISABLE_POOLS, 1, [Define if you have problems with memPools and want to disable Pools])
3e0dc9a8 2240 else
2241 AC_DEFINE(DISABLE_POOLS, 0, [Define if you have problems with memPools and want to disable Pools.])
d96ceb8e 2242 fi
3e0dc9a8 2243],
2244[ AC_DEFINE(DISABLE_POOLS, 0, [Define if you have problems with memPools and want to disable Pools.])
d96ceb8e 2245])
2246
0e657244 2247dnl Enable WIN32 Service compile mode
2248AC_ARG_ENABLE(win32-service,
62979ab1 2249 AS_HELP_STRING([--enable-win32-service],[Compile Squid as a WIN32 Service.
e702812e 2250 Works only on MS-Windows platforms (NT and up).]),
0e657244 2251[ if test "$enableval" = "yes" ; then
eed82608 2252 AC_MSG_NOTICE([Enabling WIN32 run service mode])
0e657244 2253 AC_DEFINE(USE_WIN32_SERVICE,1,[Define Windows NT & Windows 2000 run service mode])
2254 fi
2255])
2256
b1485ff8 2257
2adff954 2258dnl Check for Cyrus SASL
2259if test "$require_sasl" = "yes"; then
2260 AC_CHECK_HEADERS(sasl/sasl.h sasl.h)
2261 if test "$ac_cv_header_sasl_sasl_h" = "yes"; then
eed82608 2262 AC_MSG_NOTICE([using SASL2])
2adff954 2263 LIBSASL="-lsasl2"
2264 else
2265 if test "$ac_cv_header_sasl_h" = "yes"; then
eed82608 2266 AC_MSG_NOTICE([using SASL])
2adff954 2267 LIBSASL="-lsasl"
2268 else
8b0d8e31 2269 AC_MSG_ERROR(Neither SASL nor SASL2 found)
2adff954 2270 fi
2271 fi
2272 AC_SUBST(LIBSASL)
2273fi
2274
3c573763 2275dnl Disable "unlinkd" code
fe0810ac 2276AC_ARG_ENABLE(unlinkd,
62979ab1 2277 AS_HELP_STRING([--disable-unlinkd],[Do not use unlinkd]),
fe0810ac 2278[ if test "$enableval" = "no" ; then
3c573763 2279 use_unlinkd=no
fe0810ac 2280 else
3c573763 2281 use_unlinkd=yes
fe0810ac 2282 fi
2283],[
2284 # Here we should probably use some magic depending on the selected
2285 # storage models
3c573763 2286 use_unlinkd=yes
fe0810ac 2287])
3c573763 2288if test "$use_unlinkd" = "yes"; then
eed82608 2289 AC_MSG_NOTICE([unlinkd enabled])
6a9f6389 2290 AC_DEFINE(USE_UNLINKD,1,[Define this if unlinkd is required (strongly recommended for ufs storage type)])
a2794549 2291 AM_CONDITIONAL(ENABLE_UNLINKD, true)
fe0810ac 2292else
eed82608 2293 AC_MSG_NOTICE([unlinkd disabled])
a2794549 2294 AM_CONDITIONAL(ENABLE_UNLINKD, false)
fe0810ac 2295fi
fe0810ac 2296
ce3d30fb 2297dnl Enable backtraces on fatal errors
2298AC_ARG_ENABLE(stacktraces,
62979ab1 2299 AS_HELP_STRING([--enable-stacktraces],[Enable automatic call backtrace on fatal errors]),
ce3d30fb 2300[ if test "$enableval" = "yes" ; then
eed82608 2301 AC_MSG_NOTICE([Enabling automatic stack backtraces on fatal errors])
6a9f6389 2302 AC_DEFINE(PRINT_STACK_TRACE, 1,[Print stacktraces on fatal errors])
ce3d30fb 2303 fi
2304])
2305
88bfe092 2306AM_CONDITIONAL(ENABLE_XPROF_STATS, false)
2307dnl Enable USE_XPROF_STATS
2308AC_ARG_ENABLE(cpu-profiling,
62979ab1 2309 AS_HELP_STRING([--enable-cpu-profiling],[Enable instrumentation to try and understand how CPU power
e702812e
FC
2310 is spent by squid, by enabling specific probes in selected
2311 functions. New probes can only be added by modifying the source code.
2312 It is meant to help developers in optimizing performance
2313 of Squid internal functions.
2314 If you are not developer you shouldn't enable this,
2315 as it slows squid down somewhat. See lib/Profiler.c for more details.]),
88bfe092 2316[ if test "$enableval" = "yes" ; then
eed82608 2317 AC_MSG_NOTICE([Enabling cpu-profiling])
6a9f6389 2318 AC_DEFINE(USE_XPROF_STATS, 1,[Define to enable CPU profiling within Squid])
88bfe092 2319 AM_CONDITIONAL(ENABLE_XPROF_STATS, true)
2320 fi
2321])
2322
f66a9ef4 2323dnl Enable X-Accelerator-Vary for Vary support within an accelerator setup
2092c67d 2324AC_ARG_ENABLE(x-accelerator-vary,
62979ab1 2325 AS_HELP_STRING([--enable-x-accelerator-vary],[Enable support for the X-Accelerator-Vary
e702812e
FC
2326 HTTP header. Can be used to indicate
2327 variance within an accelerator setup.
2328 Typically used together with other code
2329 that adds custom HTTP headers to the requests.]),
f66a9ef4 2330[ if test "$enableval" = "yes" ; then
eed82608 2331 AC_MSG_NOTICE([Enabling support for X-Accelerator-Vary])
6a9f6389 2332 AC_DEFINE(X_ACCELERATOR_VARY, 1, [Enable support for the X-Accelerator-Vary HTTP header])
f66a9ef4 2333 fi
2334])
2335
7172612f 2336AC_ARG_ENABLE(zph-qos,
62979ab1 2337 AS_HELP_STRING([--enable-zph-qos],[Enable ZPH QOS support]),
7172612f 2338[ if test "$enableval" = "yes" ; then
eed82608 2339 AC_MSG_NOTICE([ZPH QOS enabled])
7172612f
AJ
2340 AC_DEFINE(USE_ZPH_QOS,1,
2341 [ Define this to use Squid's ZPH (Zero Penalty Hit) QOS features.
2342 When enabled, Squid will alter TOS field of HIT responses for better QOS on intermediate routing/shaping devices.])
2343 fi
2344])
2345
a41b3435
AJ
2346dnl --with-maxfd present for compatibility with Squid-2.
2347dnl undocumented in ./configure --help to encourage using the Squid-3 directive.
2348AC_ARG_WITH(maxfd,,
2349[
2350 case ${withval} in
2351 [[0-9]]*)
2352 squid_filedescriptors_num=$withval
2353 ;;
2354 *)
2355 AC_MSG_ERROR(--with-maxfd expects a numeric argument)
2356 ;;
2357 esac
2358])
f49be7d1 2359AC_ARG_WITH(filedescriptors,
62979ab1 2360 AS_HELP_STRING([--with-filedescriptors=NUMBER],[Force squid to support NUMBER filedescriptors]),
8b0d8e31
AJ
2361[
2362 case ${withval} in
2363 [[0-9]]*)
2364 squid_filedescriptors_num=$withval
2365 ;;
2366 *)
2367 AC_MSG_ERROR(--with-filedescriptors expects a numeric argument)
2368 ;;
2369 esac
2370])
f49be7d1 2371
8b5e106b 2372if $CPPUNITCONFIG --help >/dev/null; then
eed82608 2373 AC_MSG_NOTICE([using system installed cppunit])
8b5e106b 2374 SQUID_CPPUNIT_LIBS="`$CPPUNITCONFIG --libs`"
2375 SQUID_CPPUNIT_LA=''
2376 SQUID_CPPUNIT_INC="`$CPPUNITCONFIG --cflags`"
2377else
eed82608 2378 AC_MSG_WARN([cppunit does not appear to be installed. squid does not require this, but code testing with 'make check' will fail.])
63d03edb 2379 SQUID_CPPUNIT_LA=''
2380 SQUID_CPPUNIT_LIBS=''
2381 SQUID_CPPUNIT_INC=''
f5691f9c 2382fi
8b5e106b 2383
f5691f9c 2384AC_ARG_WITH(cppunit-basedir,
62979ab1 2385 AS_HELP_STRING([--with-cppunit-basedir=PATH],[Path where the cppunit headers are libraries are found
b0e7900f 2386 for unit testing.]),
f5691f9c 2387[ if test -f $withval/include/cppunit/TestCase.h; then
eed82608 2388 AC_MSG_NOTICE([Using cppunit includes from $withval])
f5691f9c 2389 SQUID_CPPUNIT_INC="-I${withval}/include"
2390 else
8b0d8e31 2391 AC_MSG_ERROR(Cannot find cppunit at $withval)
f5691f9c 2392 fi
2393 if test -f $withval/lib/libcppunit.la; then
eed82608 2394 AC_MSG_NOTICE([Using cppunit lib from $withval])
549b1e60 2395 SQUID_CPPUNIT_LA="${withval}/lib/libcppunit.la"
8b5e106b 2396 SQUID_CPPUNIT_LIBS='$(SQUID_CPPUNIT_LA)'
f5691f9c 2397 else
8b0d8e31 2398 AC_MSG_ERROR(Cannot find cppunit at $withval)
f5691f9c 2399 fi
f5691f9c 2400])
8b5e106b 2401AC_SUBST(SQUID_CPPUNIT_LIBS)
f5691f9c 2402AC_SUBST(SQUID_CPPUNIT_LA)
2403AC_SUBST(SQUID_CPPUNIT_INC)
f5691f9c 2404
fd9aaa3e 2405# Force some compilers to use ANSI features
2406#
2407case "$host" in
2408 alpha-dec-osf*)
2409 if test "$ac_cv_prog_CC" = "cc" ; then
eed82608 2410 AC_MSG_NOTICE([adding '-std1' to cc args for $host])
fd9aaa3e 2411 CC="cc -std1";
2412 ac_cv_prog_CC="$CC"
2413 fi
2414 ;;
c68e9c6b 2415 *-hp-hpux*)
2416 if test "$ac_cv_prog_CC" = "cc" ; then
eed82608 2417 AC_MSG_NOTICE([adding '-Ae' to cc args for $host])
c68e9c6b 2418 CC="cc -Ae";
2419 ac_cv_prog_CC="$CC"
2420 fi
2421 ;;
fd9aaa3e 2422esac
2423
dd56802c 2424
a2794549 2425dnl automake handles this AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
4e9d8e26 2426
6ad85e8a 2427case "$host" in
2428 *-hp-hpux*)
eed82608 2429 AC_MSG_NOTICE([Disabling 'ranlib' for HP-UX...])
6ad85e8a 2430 RANLIB=":"
2431 ;;
2432esac
2433
090089c4 2434dnl Check for headers
2435AC_HEADER_DIRENT
2436AC_HEADER_STDC
db40ae20 2437
2438AC_CHECK_HEADERS( \
db40ae20 2439 arpa/inet.h \
30a4f2a8 2440 arpa/nameser.h \
9441aa34 2441 assert.h \
db40ae20 2442 bstring.h \
27e059d4 2443 cassert \
db40ae20 2444 crypt.h \
281422f8 2445 cstring \
30a4f2a8 2446 ctype.h \
2447 errno.h \
ce3d30fb 2448 execinfo.h \
db40ae20 2449 fcntl.h \
42ad37af 2450 fnmatch.h \
9c1d8929 2451 getopt.h \
52303a3d 2452 glob.h \
88738790 2453 gnumalloc.h \
30a4f2a8 2454 grp.h \
27e059d4
AJ
2455 iosfwd \
2456 iomanip \
2457 iostream \
5cafc1d6 2458 ip_compat.h \
42b51993 2459 ip_fil_compat.h \
5cafc1d6 2460 ip_fil.h \
2461 ip_nat.h \
dbc5782a 2462 ipl.h \
30a4f2a8 2463 libc.h \
6ad85e8a 2464 limits.h \
d2422105 2465 linux/types.h \
1cc2f840 2466 machine/byte_swap.h \
30a4f2a8 2467 malloc.h \
e0bddc45 2468 math.h \
db40ae20 2469 memory.h \
b075cbb1 2470 mount.h \
30a4f2a8 2471 netdb.h \
db40ae20 2472 netinet/in.h \
cc192b50 2473 netinet/in_systm.h \
42b51993 2474 netinet/ip_fil_compat.h \
1f7c9178 2475 openssl/err.h \
2476 openssl/md5.h \
2477 openssl/ssl.h \
cc192b50 2478 netinet/tcp.h \
a7ad6e4e 2479 openssl/engine.h \
27e059d4 2480 ostream \
4da086c4 2481 paths.h \
dcfe6390 2482 poll.h \
30a4f2a8 2483 pwd.h \
b5e4d7d4 2484 shadow.h \
30a4f2a8 2485 regex.h \
c68e9c6b 2486 sched.h \
30a4f2a8 2487 signal.h \
27e059d4 2488 sstream \
30a4f2a8 2489 stdarg.h \
2490 stddef.h \
27e059d4 2491 stdexcept \
30a4f2a8 2492 stdio.h \
db40ae20 2493 stdlib.h \
27e059d4 2494 string \
db40ae20 2495 string.h \
2496 strings.h \
0a4e8536 2497 sys/bitypes.h \
f9576890 2498 sys/bswap.h \
2499 sys/endian.h \
db40ae20 2500 sys/file.h \
5cafc1d6 2501 sys/ioctl.h \
30a4f2a8 2502 sys/param.h \
62ae0622 2503 sys/prctl.h \
3d4022fa 2504 sys/md5.h \
77e4c0c9 2505 sys/msg.h \
30a4f2a8 2506 sys/resource.h \
db40ae20 2507 sys/select.h\
30a4f2a8 2508 sys/socket.h \
2509 sys/stat.h \
b075cbb1 2510 sys/statvfs.h \
3c641669 2511 syscall.h \
30a4f2a8 2512 sys/syscall.h \
db40ae20 2513 sys/time.h \
2514 sys/types.h \
30a4f2a8 2515 sys/un.h \
b075cbb1 2516 sys/vfs.h \
30a4f2a8 2517 sys/wait.h \
db40ae20 2518 syslog.h \
30a4f2a8 2519 time.h \
2520 unistd.h \
3c641669 2521 utime.h \
30a4f2a8 2522 varargs.h \
77d6bd88 2523 byteswap.h \
2524 glib.h \
60d096f4 2525 stdint.h \
2526 inttypes.h \
3c641669 2527 grp.h \
94331f58 2528 db.h \
5b43d209 2529 db_185.h
db40ae20 2530)
2531
fc68f6b1 2532AC_CHECK_HEADERS(
2533 linux/netfilter_ipv4.h \
2534 linux/netfilter_ipv4/ip_tproxy.h \
2535,,,
dcd1dc78 2536SQUID_DEFAULT_INCLUDES
2537#if HAVE_LIMITS_H
2538#include <limits.h>
2539#endif
a74968c2
AJ
2540/* Netfilter ip(6)tables v1.4.0 has broken headers */
2541#if HAVE_NETINET_IN_H
2542#include <netinet/in.h>
2543#endif
dcd1dc78 2544)
2545
d1e5191e 2546dnl *BSD dont include the depenencies for all their net/ and netinet/ files
c92b4732 2547dnl We must include a few basic type headers for them to work.
d1e5191e
AJ
2548AC_CHECK_HEADERS( \
2549 net/if.h \
5a3237b0 2550 netinet/if_ether.h\
d1e5191e 2551 netinet/icmp6.h \
975cfef6 2552 netinet/in.h \
d1e5191e
AJ
2553 netinet/ip.h \
2554 netinet/ip6.h \
5a3237b0 2555 netinet/ip_compat.h\
975cfef6 2556 netinet/ip_fil_compat.h\
5a3237b0 2557 netinet/ip_fil.h\
d1e5191e 2558 netinet/ip_icmp.h \
dbc5782a 2559 netinet/ipl.h \
975cfef6 2560 netinet/ip_nat.h\
ec9909b0 2561 net/pf/pfvar.h \
d1e5191e 2562 net/pfvar.h \
77e4c0c9 2563 sys/mount.h\
d1e5191e
AJ
2564 resolv.h \
2565,,,
2566SQUID_BSDNET_INCLUDES)
5a3237b0 2567
aee0606f 2568AC_C_CONST
d57288d2 2569AC_C_BIGENDIAN
aee0606f 2570
6a9f6389 2571AC_STRUCT_TM
2572AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
2573#if TM_IN_SYS_TIME
2574#if HAVE_SYS_TIME_H
2575#include <sys/time.h>
2576#endif
2577#elif HAVE_TIME_H
2578#include <time.h>
2579#endif
5c51415d 2580])
46c883ed 2581
6a9f6389 2582AC_CHECK_TYPE(struct mallinfo,AC_DEFINE(HAVE_STRUCT_MALLINFO,1,[The system provides struct mallinfo]),,[
2583#if HAVE_SYS_TYPES_H
2584#include <sys/types.h>
2585#endif
eb824054 2586#if HAVE_MALLOC_H
2587#include <malloc.h>
6a9f6389 2588#endif])
eb824054 2589
6a9f6389 2590AC_CHECK_MEMBERS([struct mallinfo.mxfast],,,[
2591#if HAVE_SYS_TYPES_H
2592#include <sys/types.h>
2593#endif
2594#if HAVE_MALLOC_H
2595#include <malloc.h>
2596#endif])
090089c4 2597
08caf8c6 2598dnl Override rusage() detect on MinGW because is emulated in source code
2599case "$host_os" in
2600 mingw|mingw32)
2601 AC_DEFINE(HAVE_STRUCT_RUSAGE)
2602 ac_cv_func_getrusage='yes'
eed82608 2603 AC_MSG_NOTICE([Using own rusage on Windows.])
08caf8c6 2604 ;;
2605 *)
2606 AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
8ff51bba 2607#if HAVE_SYS_TIME_H
2608#include <sys/time.h>
2609#endif
b54a6789 2610#if HAVE_SYS_RESOURCE_H
2611#include <sys/resource.h>
6a9f6389 2612#endif])
08caf8c6 2613 ;;
2614esac
b54a6789 2615
6a9f6389 2616AC_CHECK_MEMBERS([struct iphdr.ip_hl],,,[
2617#if HAVE_SYS_TYPES_H
2618#include <sys/types.h>
2619#endif
a025a745 2620#include <netinet/in.h>
2621#include <netinet/in_systm.h>
6ad85e8a 2622#include <netinet/ip.h>
b05490a8 2623#if defined (__linux__) || defined (__CYGWIN__)
6ad85e8a 2624#define ip_hl ihl
2625#endif
2626#ifndef __linux__
b05490a8 2627#ifndef __CYGWIN__
6ad85e8a 2628#define iphdr ip
b05490a8 2629#endif
6a9f6389 2630#endif])
a025a745 2631
090089c4 2632dnl Check for typedefs
77d6bd88 2633AC_CHECK_SIZEOF(void *)
090089c4 2634
0409a509 2635dnl 8 bit integers - int8_t
2636dnl if this is defined we trust it to be 8 bits
2637AC_CHECK_TYPE(int8_t,[
2638 AC_CHECK_SIZEOF(int8_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2639 AC_DEFINE(HAVE_INT8_T,1,[int8_t is defined in system headers])
2640 ],,SQUID_DEFAULT_INCLUDES)
2641
2642dnl fallback #1
2643AC_CHECK_TYPE(char,[
2644 AC_CHECK_SIZEOF(char,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2645 AC_DEFINE(HAVE_CHAR,1,[char is defined in system headers])
2646 ],,SQUID_DEFAULT_INCLUDES)
2647
2648dnl unsigned 8 bit ints - u_int8_t
2649dnl if this is defined we trust it to be 8 bits
2650AC_CHECK_TYPE(u_int8_t,[
2651 AC_CHECK_SIZEOF(u_int8_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2652 AC_DEFINE(HAVE_U_INT8_T,1,[u_int8_t is defined in system headers])
2653 ],,SQUID_DEFAULT_INCLUDES)
2654
2655dnl fallback #1
2656dnl if this is defined we trust it to be 8 bits
2657AC_CHECK_TYPE(uint8_t,[
2658 AC_CHECK_SIZEOF(uint8_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2659 AC_DEFINE(HAVE_UINT8_T,1,[uint8_t is defined in system headers])
2660 ],,SQUID_DEFAULT_INCLUDES)
2661
2662dnl 16 bit integers - int16_t
6a9f6389 2663dnl if this is defined we trust it to be 16 bits
62266438 2664AC_CHECK_TYPE(int16_t,[
2665 AC_CHECK_SIZEOF(int16_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2666 AC_DEFINE(HAVE_INT16_T,1,[int16_t is defined in system headers])
2667 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2668
2669dnl fallback #1
2670AC_CHECK_TYPE(short,[
856e69c5 2671 AC_CHECK_SIZEOF(short,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2672 AC_DEFINE(HAVE_SHORT,1,[short is defined in system headers])
2673 ],,SQUID_DEFAULT_INCLUDES)
2674
2675dnl fallback #2
2676AC_CHECK_TYPE(int,[
856e69c5 2677 AC_CHECK_SIZEOF(int,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2678 AC_DEFINE(HAVE_INT,1,[int is defined in system headers])
2679 ],,SQUID_DEFAULT_INCLUDES)
2680
2681dnl unsigned 16 bit ints - u_int16_t
2682dnl if this is defined we trust it to be 16 bits
62266438 2683AC_CHECK_TYPE(u_int16_t,[
2684 AC_CHECK_SIZEOF(u_int16_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2685 AC_DEFINE(HAVE_U_INT16_T,1,[u_int16_t is defined in system headers])
2686 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2687
2688dnl fallback #1
2689dnl if this is defined we trust it to be 16 bits
62266438 2690AC_CHECK_TYPE(uint16_t,[
2691 AC_CHECK_SIZEOF(uint16_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2692 AC_DEFINE(HAVE_UINT16_T,1,[uint16_t is defined in system headers])
2693 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2694
2695dnl 32 bit signed int - int32_t
2696dnl if this is defined we trust it to be 32 bits
62266438 2697AC_CHECK_TYPE(int32_t,[
2698 AC_CHECK_SIZEOF(int32_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2699 AC_DEFINE(HAVE_INT32_T,1,[int32_t is defined in system headers])
2700 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2701
2702dnl fallback #1
2703AC_CHECK_TYPE(long,[
856e69c5 2704 AC_CHECK_SIZEOF(long,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2705 AC_DEFINE(HAVE_LONG,1,[long is defined in system headers])
2706 ],,SQUID_DEFAULT_INCLUDES)
2707
2708dnl 32 bit unsigned int - u_int32_t
2709dnl if this is defined we trust it to be 32 bits
62266438 2710AC_CHECK_TYPE(u_int32_t,[
2711 AC_CHECK_SIZEOF(u_int32_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2712 AC_DEFINE(HAVE_U_INT32_T,1,[u_int32_t is defined in system headers])
2713 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2714
2715dnl fallback #1
2716dnl if this is defined we trust it to be 32 bits
62266438 2717AC_CHECK_TYPE(uint32_t,[
2718 AC_CHECK_SIZEOF(uint32_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2719 AC_DEFINE(HAVE_UINT32_T,1,[uint32_t is defined in system headers])
2720 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2721
2722dnl 64 bit signed - int64_t
2723dnl if this is defind we trust it to be 64 bits
62266438 2724AC_CHECK_TYPE(int64_t,[
2725 AC_CHECK_SIZEOF(int64_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2726 AC_DEFINE(HAVE_INT64_T,1,[int64_t is defined in system headers])
2727 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2728
2729dnl fallback #1
2730dnl if this is defind we trust it to be 64 bits
62266438 2731AC_CHECK_TYPE(__int64,[
2732 AC_CHECK_SIZEOF(__int64,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2733 AC_DEFINE(HAVE___INT64,1,[__int64 is defined in system headers])
2734 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2735
2736dnl fallback #2
2737AC_CHECK_TYPE(long long,[
856e69c5 2738 AC_CHECK_SIZEOF(long long,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2739 AC_DEFINE(HAVE_LONG_LONG,1,[long long is defined in system headers])
2740 ],,SQUID_DEFAULT_INCLUDES)
2741
2742dnl 64 bit unsigned - u_int64_t
2743dnl if this is defind we trust it to be 64 bits
62266438 2744AC_CHECK_TYPE(u_int64_t,[
2745 AC_CHECK_SIZEOF(u_int64_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2746 AC_DEFINE(HAVE_U_INT64_T,1,[u_int64_t is defined in system headers])
2747 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2748
2749dnl fallback #1
2750dnl if this is defind we trust it to be 64 bits
62266438 2751AC_CHECK_TYPE(uint64_t,[
2752 AC_CHECK_SIZEOF(uint64_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2753 AC_DEFINE(HAVE_UINT64_T,1,[uint64_t is defined in system headers])
2754 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2755
588e71df 2756dnl On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
2757dnl that is incompatible with the updated Solaris header files.
2758dnl For this reason, we must check if pad128_t and upad128_t are defined.
2759AC_CHECK_TYPE(pad128_t,
2760 AC_DEFINE(HAVE_PAD128_T,1,[pad128_t is defined in system headers]),
2761 ,SQUID_DEFAULT_INCLUDES)
2762
2763AC_CHECK_TYPE(upad128_t,
2764 AC_DEFINE(HAVE_UPAD128_T,1,[upad128_t is defined in system headers]),
2765 ,SQUID_DEFAULT_INCLUDES)
2766
6a9f6389 2767AC_CHECK_TYPE(pid_t, AC_DEFINE(HAVE_PID_T,1,[pid_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
856e69c5 2768AC_CHECK_TYPE(size_t, [AC_CHECK_SIZEOF(size_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2769 AC_DEFINE(HAVE_SIZE_T,1,[size_t is defined by the system headers])],,SQUID_DEFAULT_INCLUDES)
2770AC_CHECK_TYPE(ssize_t, AC_DEFINE(HAVE_SSIZE_T,1,[ssize_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
856e69c5 2771AC_CHECK_TYPE(off_t,[ AC_CHECK_SIZEOF(off_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2772 AC_DEFINE(HAVE_OFF_T,1,[off_t is defined by the system headers])],,SQUID_DEFAULT_INCLUDES)
2773AC_CHECK_TYPE(mode_t, AC_DEFINE(HAVE_MODE_T,1,[mode_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2774AC_CHECK_TYPE(fd_mask, AC_DEFINE(HAVE_FD_MASK,1,[fd_mask is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
adcceb47 2775
77d6bd88 2776dnl Check for special functions
2777AC_FUNC_ALLOCA
2778
6a9f6389 2779AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the system headers]),,[
2780#include <sys/types.h>
6637e3a5 2781#include <sys/socket.h>
2782#if STDC_HEADERS
2783#include <stdlib.h>
2784#include <stddef.h>
6a9f6389 2785#endif])
6637e3a5 2786
b50f1b2b 2787dnl Check for libcap header (assume its not broken unless
69367152
HN
2788use_libcap=auto
2789AC_ARG_WITH(libcap, AS_HELP_STRING([--without-libcap],[disable usage of Linux capabilities library to control privileges]),
2790[ if test "x$withval" = "xyes" ; then
b64b6030 2791 AC_MSG_RESULT(libcap forced enabled)
69367152 2792 use_libcap=yes
b50f1b2b 2793 else
1c9910eb 2794 AC_MSG_RESULT(libcap forced disabled)
69367152 2795 use_libcap=no
b50f1b2b 2796 fi
b64b6030 2797])
69367152 2798if test "x$use_libcap" != "xno"; then
b64b6030
HN
2799 # cap_clear_flag is the most recent libcap function we require
2800 AC_CHECK_LIB(cap, cap_clear_flag)
6a4d3ec8
HN
2801 if test "x$ac_cv_lib_cap_cap_clear_flag" = xyes; then
2802 use_libcap=yes
2803 else
69367152 2804 if test "x$use_libcap" = "xyes"; then
ff8d255b 2805 AC_MSG_ERROR([libcap forced enabled but not available or not usable, requires libcap-2.09 or later])
b64b6030 2806 fi
69367152 2807 use_libcap=no
b64b6030
HN
2808 fi
2809fi
69367152 2810
6a4d3ec8 2811if test "x$use_libcap" = "xyes"; then
b64b6030
HN
2812 AC_DEFINE(USE_LIBCAP, 1, [use libcap to set capabilities required for TPROXY])
2813 dnl Check for libcap headader breakage.
b50f1b2b 2814 AC_CHECK_HEADERS(sys/capability.h)
ff8d255b
HN
2815 AC_CACHE_CHECK([for operational libcap2 headers], squid_cv_sys_capability_works,
2816 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2817#include <stdlib.h>
2818#include <stddef.h>
2819#include <sys/capability.h>
2820]], [[
2821capget(NULL, NULL);
2822capset(NULL, NULL);
2823 ]])],[squid_cv_sys_capability_works=yes],[squid_cv_sys_capability_works=no])
b50f1b2b 2824 )
ff8d255b
HN
2825 if test x$squid_cv_sys_capability_works != xyes; then
2826 AC_DEFINE([LIBCAP_BROKEN],1,[if libcap2 headers are broken and clashing with glibc])
2827 fi
b50f1b2b 2828fi
5b43d209 2829
b64b6030 2830
6a9f6389 2831AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,[mtyp_t is defined by the system headers]),,[#include <sys/types.h>
aea1be68 2832#include <sys/ipc.h>
6a9f6389 2833#include <sys/msg.h>])
aea1be68 2834
090089c4 2835dnl Check for needed libraries
54c95954
FC
2836AC_SEARCH_LIBS([gethostbyname],[nsl resolv bind])
2837AC_SEARCH_LIBS([res_init],[resolv])
2838AC_SEARCH_LIBS([bind],[socket])
2839AC_SEARCH_LIBS([opcom_stack_trace],[opcom_stack])
2840AC_SEARCH_LIBS([strlcpy], [bsd])
85cd85f3 2841AC_SEARCH_LIBS([yp_match], [nsl nss_nis nss_nisplus])
bfe8dedf 2842dnl Check for Winsock only on MinGW, on Cygwin we must use emulated BSD socket API
4b26fae9 2843case "$host_os" in
2844 mingw|mingw32)
2845 AC_MSG_CHECKING(for winsock)
2846 save_LIBS="$LIBS"
2847 for curlib in ws2_32 wsock32; do
2848 LIBS="$LIBS -l$curlib"
62979ab1 2849 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <winsock.h>]], [[
1635bf30
GS
2850 socket(0,0,0);
2851 select(0,NULL,NULL,NULL,NULL);
2852 closesocket(0);
2853 gethostname(NULL,0);
62979ab1 2854 ]])],[have_winsock=yes],[have_winsock=no])
4b26fae9 2855
2856 if test $have_winsock = yes; then
2857 ac_cv_func_select='yes'
2858 if test $curlib = ws2_32; then
2859 have_winsock=winsock2
2860 fi
2861 break
2862 fi
2863 LIBS="$save_LIBS"
2864 done
2865 AC_MSG_RESULT($have_winsock)
bfe8dedf
GS
2866 if test $have_winsock = winsock2; then
2867 AC_CHECK_HEADERS(winsock2.h)
2868 else
2869 AC_CHECK_HEADERS(winsock.h)
2870 fi
4b26fae9 2871 ;;
2872esac
94d48591 2873
3c641669 2874dnl Ripped from the Samba sources
2875AC_CACHE_CHECK([for unix domain sockets],squid_cv_unixsocket, [
62979ab1 2876 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3c641669 2877#include <sys/types.h>
2878#include <stdlib.h>
2879#include <stddef.h>
2880#include <sys/socket.h>
62979ab1 2881#include <sys/un.h>]], [[
3c641669 2882 struct sockaddr_un sunaddr;
2883 sunaddr.sun_family = AF_UNIX;
62979ab1 2884]])],[squid_cv_unixsocket=yes],[squid_cv_unixsocket=no])])
3c641669 2885if test x"$squid_cv_unixsocket" = x"yes"; then
6a9f6389 2886 AC_DEFINE(HAVE_UNIXSOCKET,1,[Do we have unix sockets? (required for the winbind ntlm helper])
3c641669 2887fi
2888dnl end rip
2889
94d48591 2890 AC_CHECK_LIB(gnumalloc, main)
2891 if test "$ac_cv_lib_gnumalloc_main" = "yes"; then
eed82608 2892 AC_MSG_NOTICE([Disabling extended malloc functions when using gnumalloc])
94d48591 2893 ac_cv_func_mallinfo=no
2894 ac_cv_func_mallocblksize=no
2895 ac_cv_func_mallopt=no
2896 else
2897 case "$host" in
2898 *-sun-solaris*)
eed82608 2899 AC_MSG_NOTICE([skipping libmalloc check for $host])
94d48591 2900 ;;
2901 i386-*-freebsd*)
eed82608 2902 AC_MSG_NOTICE([skipping libmalloc check for $host])
94d48591 2903 ;;
2904 *)
2905
2906 AC_CHECK_LIB(malloc, main)
2907 ;;
2908 esac
2909 fi
94d48591 2910
be79ade0 2911AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"])
08caf8c6 2912case "$host_os" in
2913mingw|mingw32)
eed82608 2914 AC_MSG_NOTICE([Use MSVCRT for math functions.])
08caf8c6 2915 ;;
2916 *)
2917 AC_CHECK_LIB(m, main)
2918 ;;
2919esac
090089c4 2920
001ad4cc
AJ
2921dnl Enable IPv6 support
2922AC_MSG_CHECKING([whether to enable IPv6])
2923use_ipng=yes
2924AC_ARG_ENABLE(ipv6,
62979ab1 2925 AS_HELP_STRING([--disable-ipv6],[Disable IPv6 support]),
001ad4cc
AJ
2926[ if test "x$enableval" = "xyes" ; then
2927 AC_MSG_RESULT(yes)
2928 else
2929 AC_MSG_RESULT(no)
2930 use_ipng=no
2931 fi
2932],[AC_MSG_RESULT(yes)])
2933
2934if test "$use_ipng" = "yes"; then
2935 SAVED_LIBS="$LIBS"
2936 dnl Solaris 10/11 requires -lsocket
2937 case "$host" in
2938 *-solaris*)
2939 LIBS="$LIBS -lsocket"
2940 ;;
2941 *)
2942 ;;
2943 esac
2944 AC_CACHE_CHECK([if PF_INET6 is available], $use_ipng,
62979ab1 2945 AC_RUN_IFELSE([AC_LANG_SOURCE([[ /* PF_INET6 available check */
001ad4cc
AJ
2946# include <sys/types.h>
2947# include <sys/socket.h>
b3167ca7 2948 int main(int argc, char **argv) {
001ad4cc
AJ
2949 if (socket(PF_INET6, SOCK_STREAM, 0) < 0)
2950 return 1;
2951 else
2952 return 0;
2953 }
62979ab1 2954 ]])],[ AC_MSG_RESULT(yes)
001ad4cc 2955 use_ipng=yes
62979ab1
AJ
2956 SAVED_LIBS="$LIBS" ],[ AC_MSG_RESULT(no)
2957 use_ipng=no ],[])
001ad4cc
AJ
2958 )
2959 LIBS="$SAVED_LIBS"
2960fi
2961
2962if test "$use_ipng" = "yes"; then
2963 AC_DEFINE(USE_IPV6,1,[Enable support for IPv6 ])
18a8e998 2964 SET_IPV6_SETTINGS=""
001ad4cc
AJ
2965 use_v4mapped=yes
2966
44770d71 2967dnl Check for forced split-stack mode
001ad4cc
AJ
2968 AC_MSG_CHECKING([for IPv6 split-stack requirement])
2969 AC_ARG_WITH(ipv6-split-stack,
62979ab1 2970 AS_HELP_STRING([--with-ipv6-split-stack],[Force-Enable experimental split-stack support for Windows XP and *BSD. Requires IPv6.]),
001ad4cc
AJ
2971 [ use_v4mapped="no"
2972 AC_MSG_RESULT(yes)],
2973 [ AC_MSG_RESULT(no) ])
2974
44770d71
AJ
2975dnl Check for IPv6 v4-mapping availability
2976dnl Useful for other OS with hybrid-stack defaults turned OFF
001ad4cc
AJ
2977dnl But only usable if it actually works...
2978 if test "$use_v4mapped" = "yes" ; then
2979 AC_MSG_CHECKING([for IPv6 v4-mapping ability])
62979ab1 2980 AC_RUN_IFELSE([AC_LANG_SOURCE([[ /* IPPROTO_V4MAPPED is usable check */
001ad4cc
AJ
2981# include <sys/types.h>
2982# include <sys/socket.h>
2983# include <netinet/in.h>
2984#if HAVE_NETINET_IN6_H
2985# include <netinet/in6.h>
2986#endif
b3167ca7 2987 int main(int argc, char **argv) {
001ad4cc
AJ
2988 int s = socket(PF_INET6, SOCK_STREAM, 0);
2989 int tos = 0;
2990 if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, (char *) &tos, sizeof(int)) < 0)
2991 return 1;
2992 else
2993 return 0;
2994 }
62979ab1 2995 ]])],[ AC_MSG_RESULT(yes)
001ad4cc
AJ
2996 use_v4mapped=yes
2997 AC_DEFINE(IPV6_SPECIAL_V4MAPPED, 1, [Enable v4-mapping through v6 sockets])
62979ab1 2998 ],[ AC_MSG_RESULT(no)
001ad4cc
AJ
2999 AC_DEFINE(IPV6_SPECIAL_V4MAPPED, 0, [Enable v4-mapping through v6 sockets])
3000 use_v4mapped=no
62979ab1 3001 ],[])
001ad4cc
AJ
3002 fi
3003
3004dnl if we can't defer v4-mapping to the OS we are forced to split-stack the FD table.
3005 AC_MSG_CHECKING([for IPv6 stack type/mode])
3006 if test "$use_v4mapped" = "yes"; then
3007 AC_DEFINE(IPV6_SPECIAL_V4MAPPED, 1, [Enable v4-mapping through v6 sockets. Requires IPv6 hybrid-stack.])
3008 AC_DEFINE(IPV6_SPECIAL_SPLITSTACK, 0, [Enable support for IPv6 on split-stack implementations])
3009 AC_MSG_RESULT(mapping hybrid)
3010 else
3011 AC_DEFINE(IPV6_SPECIAL_V4MAPPED, 0, [Enable v4-mapping through v6 sockets. Requires IPv6 hybrid-stack.])
3012 AC_DEFINE(IPV6_SPECIAL_SPLITSTACK, 1, [Enable support for IPv6 on split-stack implementations])
3013 AC_MSG_RESULT(split-stack or BSD non-mapping dual-stack)
3014 fi
3015
3016dnl Check whether this OS defines sin6_len as a member of sockaddr_in6 as a backup to ss_len
3017AC_CACHE_CHECK([for sin6_len field in struct sockaddr_in6],
3018 ac_cv_have_sin6_len_in_struct_sai, [
62979ab1 3019 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
001ad4cc
AJ
3020#include <sys/types.h>
3021#include <sys/socket.h>
3022#include <netinet/in.h>
62979ab1
AJ
3023 ]], [[ 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"
3024 ])
001ad4cc
AJ
3025 ])
3026 if test "x$ac_cv_have_sin6_len_in_struct_sai" = "xyes" ; then
3027 AC_DEFINE(HAVE_SIN6_LEN_IN_SAI, 1, [Does struct sockaddr_in6 have sin6_len? 1: Yes, 0: No])
3028 else
3029 AC_DEFINE(HAVE_SIN6_LEN_IN_SAI, 0, [Does struct sockaddr_in6 have sin6_len? 1: Yes, 0: No])
3030 fi
3031
3032else
3033 # NP: semi-silent failure as IPv4-only mode is perfectly usable on this system.
3034 AC_MSG_WARN([IPv6 is not available on this system.])
3035 AC_DEFINE(USE_IPV6,0,[Enable support for IPv6])
3036 AC_DEFINE(IPV6_SPECIAL_SPLITSTACK,0,[Enable support for IPv6 on split-stack implementations])
3037 AC_DEFINE(IPV6_SPECIAL_V4MAPPED,0,[Enable v4-mapping through v6 sockets])
18a8e998 3038 SET_IPV6_SETTINGS="\#IPv6 Not Available: "
001ad4cc 3039fi
18a8e998 3040AC_SUBST(SET_IPV6_SETTINGS)
001ad4cc
AJ
3041
3042dnl Check whether this OS defines ss_len as a member of sockaddr_storage
3043AC_CACHE_CHECK([for ss_len field in struct sockaddr_storage],
3044 ac_cv_have_ss_len_in_struct_ss, [
62979ab1 3045 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
001ad4cc
AJ
3046#include <sys/types.h>
3047#include <sys/socket.h>
3048#include <netinet/in.h>
62979ab1
AJ
3049 ]], [[ 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"
3050 ])
001ad4cc
AJ
3051])
3052if test "x$ac_cv_have_ss_len_in_struct_ss" = "xyes" ; then
3053 AC_DEFINE(HAVE_SS_LEN_IN_SS, 1, [Does struct sockaddr_storage have ss_len? 1: Yes, 0: No])
3054else
3055 AC_DEFINE(HAVE_SS_LEN_IN_SS, 0, [Does struct sockaddr_storage have ss_len? 1: Yes, 0: No])
3056fi
3057
3058dnl Check whether this OS defines sin_len as a member of sockaddr_in as a backup to ss_len
3059AC_CACHE_CHECK([for sin_len field in struct sockaddr_in],
3060 ac_cv_have_sin_len_in_struct_sai, [
62979ab1 3061 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
001ad4cc
AJ
3062#include <sys/types.h>
3063#include <sys/socket.h>
3064#include <netinet/in.h>
62979ab1
AJ
3065 ]], [[ 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"
3066 ])
001ad4cc
AJ
3067])
3068if test "x$ac_cv_have_sin_len_in_struct_sai" = "xyes" ; then
3069 AC_DEFINE(HAVE_SIN_LEN_IN_SAI, 1, [Does struct sockaddr_in have sin_len? 1: Yes, 0: No])
3070else
3071 AC_DEFINE(HAVE_SIN_LEN_IN_SAI, 0, [Does struct sockaddr_in have sin_len? 1: Yes, 0: No])
3072fi
3073
090089c4 3074dnl Check for libcrypt
0d8565ac 3075CRYPTLIB=
8154dd82 3076dnl Some of our helpers use crypt(3) which may be in libc, or in
3077dnl libcrypt (eg FreeBSD)
c1dc012a 3078AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
3d4022fa 3079dnl Solaris10 provides MD5 natively through libmd5
c1dc012a 3080AC_CHECK_LIB(md5, MD5Init, [CRYPTLIB="$CRYPTLIB -lmd5"])
be79ade0 3081AC_SUBST(CRYPTLIB)
77f675ad 3082
0d8565ac
AJ
3083# check for crypt, may require -lcrypt
3084SAVED_LIBS="$LIBS"
3085LIBS="$LIBS $CRYPTLIB"
3086AC_CHECK_FUNCS(crypt)
3087LIBS="$SAVED_LIBS"
3088
3089
042b1f8a 3090dnl Check for libdl, used by auth_modules/PAM
8154dd82 3091if test "$with_dl" = "yes"; then
3092 AC_CHECK_LIB(dl, dlopen)
3093fi
042b1f8a 3094
86ec11aa 3095dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
3096dnl Robert Side <rside@aiinc.bc.ca>
3097dnl Mon, 18 Jan 1999 17:48:00 GMT
3098case "$host" in
3099 *-pc-sco3.2*)
3100 AC_CHECK_LIB(intl, strftime)
3101 ;;
3102esac
3103
20e869bf 3104dnl On MinGW OpenLDAP is not available, so LDAP helpers can be linked
3105dnl only with Windows LDAP libraries using -lwldap32
3106case "$host_os" in
3107mingw|mingw32)
428744a1
AJ
3108 LDAPLIB="-lwldap32"
3109 LBERLIB=""
3110 ;;
20e869bf 3111*)
428744a1
AJ
3112 LDAPLIB="-lldap"
3113 dnl LDAP helpers need to know if -llber is needed or not
3114 AC_CHECK_LIB(lber, main, [LBERLIB="-llber"])
3115 ;;
20e869bf 3116esac
428744a1
AJ
3117AC_SUBST(LDAPLIB)
3118AC_SUBST(LBERLIB)
20e869bf 3119
b7a1c19e 3120dnl Check for libdb
3121DBLIB=
01b4931d 3122dnl 1.85
a258dfca 3123AC_CACHE_CHECK(if dbopen needs -ldb,ac_cv_dbopen_libdb, [
32d0bbd7 3124SAVED_LIBS="$LIBS"; LIBS="$LIBS -ldb"
62979ab1 3125 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
a258dfca 3126#if HAVE_SYS_TYPES_H
3127#include <sys/types.h>
3128#endif
3129#if HAVE_LIMITS_H
3130#include <limits.h>
3131#endif
3132#if HAVE_DB_185_H
3133#include <db_185.h>
3134#elif HAVE_DB_H
3135#include <db.h>
62979ab1 3136#endif]], [[dbopen("", 0, 0, DB_HASH, (void *)0L)]])],[ac_cv_dbopen_libdb="yes"],[ac_cv_dbopen_libdb="no"])
32d0bbd7 3137LIBS="$SAVED_LIBS"
a258dfca 3138])
2b2161bb 3139if test $ac_cv_dbopen_libdb = yes; then
32d0bbd7 3140 LIB_DB="-ldb"
3141fi
01b4931d 3142AC_SUBST(LIB_DB)
b7a1c19e 3143
77f675ad 3144dnl System-specific library modifications
3145dnl
3146case "$host" in
88738790 3147 i386-*-solaris2.*)
7149a49f 3148 if test "$GCC" = "yes"; then
eed82608 3149 AC_MSG_NOTICE([Removing -O for gcc on $host])
80e92d6d 3150 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
7149a49f 3151 fi
3152 ;;
77f675ad 3153 *-sgi-irix*)
eed82608 3154 AC_MSG_NOTICE([Removing -lsocket for IRIX...])
6716b242 3155 LIBS=`echo $LIBS | sed -e s/-lsocket//`
eed82608 3156 AC_MSG_NOTICE([Removing -lnsl for IRIX...])
6716b242 3157 LIBS=`echo $LIBS | sed -e s/-lnsl//`
c415c128 3158 ac_cv_lib_nsl_main=no
eed82608 3159 AC_MSG_NOTICE([Removing -lbsd for IRIX...])
b44c0fb4 3160 LIBS=`echo $LIBS | sed -e s/-lbsd//`
77f675ad 3161 ;;
4ba0bd0e 3162dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
3163dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
3164dnl Please change your configure script. AIX doesn't need -lbsd.
3165 *-ibm-aix*)
eed82608 3166 AC_MSG_NOTICE([Removing -lbsd for AIX...])
4ba0bd0e 3167 LIBS=`echo $LIBS | sed -e s/-lbsd//`
3168 ;;
30a4f2a8 3169 *m88k*)
fa035612 3170 SQUID_CFLAGS="$SQUID_CFLAGS -D_SQUID_MOTOROLA_"
3171 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_SQUID_MOTOROLA_"
6a9f6389 3172 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1,[If gettimeofday is known to take only one argument])
7149a49f 3173 ;;
580ce039 3174 [*-*-solaris2.[0-4]])
6a9f6389 3175 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
30a4f2a8 3176 ;;
711fa75e 3177 [*-sony-newsos[56]*])
6a9f6389 3178 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
f62c73dc 3179 ;;
77f675ad 3180esac
090089c4 3181
57faa85a 3182# Remove optimization for GCC 2.95.[123]
d20b1cd0 3183# gcc -O[2] on *BSD and Linux (x86) causes pointers to magically become NULL
3184if test "$GCC" = "yes"; then
3185 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
3186 case "$GCCVER" in
57faa85a 3187 [2.95.[123]])
eed82608 3188 AC_MSG_NOTICE([Removing -O for gcc on $host with GCC $GCCVER])
d20b1cd0 3189 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
3190 ;;
3191 esac
3192fi
3193
176d10ee 3194# Recommended by Balint Nagy Endre <bne@CareNet.hu>
3195case "$host" in
3196 *-univel-sysv4.2MP)
3197 if test `uname -v` = "2.03"; then
eed82608 3198 AC_MSG_NOTICE([disabling mallinfo for $host])
176d10ee 3199 ac_cv_func_mallinfo=no
3200 fi
3201 ;;
3202esac
3203
84cecfd2 3204dnl This has to be before AC_CHECK_FUNCS
3205# Disable poll() on certain platforms. Override by setting ac_cv_func_poll
3206# when running configure.
3207if test -z "$ac_cv_func_poll"; then
3208 case "$host" in
3209 [alpha-dec-osf3.*])
3210 # John Kay (jkay@nlanr.net) 19970818
eed82608 3211 AC_MSG_NOTICE([disabling poll for $host...])
84cecfd2 3212 ac_cv_func_poll='no'
3213 ;;
3214 [*-hp-hpux*.*])
3215 # Duane Wessels
eed82608 3216 AC_MSG_NOTICE([disabling poll for $host...])
84cecfd2 3217 ac_cv_func_poll='no'
3218 ;;
3219 [*-linux-*])
f5cec332 3220 # Henrik Nordstrom (hno@squid-cache.org) 19980817
9bb83c8b 3221 # poll is problematic on Linux. We disable it
3222 # by default until Linux gets it right.
b6a2f15e 3223 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
3224 if test $rev -lt 002002; then
eed82608 3225 AC_MSG_NOTICE([disabling poll for $host < 2.2...])
b6a2f15e 3226 ac_cv_func_poll='no'
3227 fi
84cecfd2 3228 ;;
c68e9c6b 3229 [powerpc-ibm-aix4.1.*])
3230 # Mike Laster (mlaster@metavillage.com) 19981021
eed82608 3231 AC_MSG_NOTICE([disabling poll for $host...])
c68e9c6b 3232 ac_cv_func_poll='no'
3233 ;;
86ec11aa 3234 [*-pc-sco3.2*])
3235 # Robert Side <rside@aiinc.bc.ca>
3236 # Mon, 18 Jan 1999 17:48:00 GMT
eed82608 3237 AC_MSG_NOTICE([disabling poll for $host...])
86ec11aa 3238 ac_cv_func_poll='no'
3239 ;;
84cecfd2 3240 esac
3241fi
176d10ee 3242
08caf8c6 3243dnl Override statfs() detect on MinGW becasue is emulated in source code
3244case "$host_os" in
3245mingw|mingw32)
3246 ac_cv_func_statfs='yes'
3247 ;;
3248esac
3249
6716b242 3250dnl Check for library functions
3251AC_CHECK_FUNCS(\
ce3d30fb 3252 backtrace_symbols_fd \
3a144521 3253 bcopy \
3254 bswap_16 \
3255 bswap_32 \
f9576890 3256 bswap16 \
3257 bswap32 \
4ac29a5b 3258 fchmod \
6716b242 3259 getdtablesize \
8505e57b 3260 getpagesize \
230c091c 3261 getpass \
3a144521 3262 getrlimit \
30a4f2a8 3263 getrusage \
9c1d8929 3264 getspnam \
379d5751 3265 gettimeofday \
52303a3d 3266 glob \
f9576890 3267 htobe16 \
3268 htole16 \
d474c7a6 3269 kqueue\
30a4f2a8 3270 lrand48 \
6716b242 3271 mallinfo \
0f5efab0 3272 mallocblksize \
6716b242 3273 mallopt \
2ae6b9b0 3274 memcpy \
30a4f2a8 3275 memmove \
dac27377 3276 memset \
b99a6dec 3277 mkstemp \
1812b6c7 3278 mktime \
88738790 3279 mstats \
84cecfd2 3280 poll \
62ae0622 3281 prctl \
3a144521 3282 pthread_attr_setschedparam \
cd748f27 3283 pthread_attr_setscope \
3284 pthread_setschedparam \
42b51993 3285 pthread_sigmask \
c68e9c6b 3286 putenv \
b1e77ec1 3287 random \
6716b242 3288 regcomp \
3289 regexec \
3290 regfree \
30a4f2a8 3291 res_init \
af76ec93 3292 __res_init \
4915be3b 3293 rint \
a4ba1105 3294 sbrk \
3a144521 3295 select \
234967c9 3296 seteuid \
c415c128 3297 setgroups \
30a4f2a8 3298 setpgrp \
6716b242 3299 setrlimit \
30a4f2a8 3300 setsid \
3301 sigaction \
11430c03 3302 snprintf \
1ccc0d40 3303 socketpair \
30a4f2a8 3304 srand48 \
b1e77ec1 3305 srandom \
0343b99c 3306 statfs \
6716b242 3307 sysconf \
3308 syslog \
234967c9 3309 timegm \
28da5e0d 3310 vsnprintf \
6716b242 3311)
f5e5c4cf 3312dnl ... and some we provide local replacements for
3313AC_REPLACE_FUNCS(\
3314 drand48 \
a98c2da5 3315 eui64_aton \
cc192b50 3316 inet_ntop \
3317 inet_pton \
f5e5c4cf 3318 initgroups \
cc192b50 3319 getaddrinfo \
3320 getnameinfo \
f5e5c4cf 3321 strerror \
585cddda
AJ
3322 strsep \
3323 strtoll \
f5e5c4cf 3324 tempnam \
3325)
6716b242 3326
1b3db6d9 3327dnl Magic which checks whether we are forcing a type of comm loop we
3328dnl are actually going to (ab)use
3329
3330dnl Actually do the define magic now
3331dnl mostly ripped from squid-commloops, thanks to adrian and benno
3332
d474c7a6 3333if test -n "$SELECT_TYPE"; then
3334 : # Already decided above. Nothing to do here
6564c397 3335elif test -z "$disable_epoll" && test "$ac_cv_epoll_works" = "yes" ; then
a46d2c0e 3336 SELECT_TYPE="epoll"
6564c397 3337elif test -z "$disable_kqueue" && test "$ac_cv_func_kqueue" = "yes" ; then
3338 SELECT_TYPE="kqueue"
3339elif test -z "$disable_poll" && test "$ac_cv_func_poll" = "yes" ; then
6c9797b9 3340 SELECT_TYPE="poll"
6564c397 3341elif test -z "$disable_select" && test "$ac_cv_func_select" = "yes" ; then
663c0a38 3342 case "$host_os" in
3343 mingw|mingw32)
3344 SELECT_TYPE="select_win32"
663c0a38 3345 ;;
3346 *)
3347 SELECT_TYPE="select"
663c0a38 3348 ;;
3349 esac
1b3db6d9 3350else
eed82608
AJ
3351 AC_MSG_WARN([Eep! Can't find poll, kqueue, epoll, or select!])
3352 AC_MSG_WARN([I'll try select and hope for the best.])
1b3db6d9 3353 SELECT_TYPE="select"
6a9f6389 3354 AC_DEFINE(USE_SELECT,1)
1b3db6d9 3355fi
d474c7a6 3356
eed82608 3357AC_MSG_NOTICE([Using ${SELECT_TYPE} for the IO loop.])
d474c7a6 3358
3359AM_CONDITIONAL([USE_POLL], [test $SELECT_TYPE = poll])
3360AM_CONDITIONAL([USE_EPOLL], [test $SELECT_TYPE = epoll])
3361AM_CONDITIONAL([USE_SELECT], [test $SELECT_TYPE = select])
3362AM_CONDITIONAL([USE_SELECT_SIMPLE], [test $SELECT_TYPE = select_simple])
3363AM_CONDITIONAL([USE_SELECT_WIN32], [test $SELECT_TYPE = select_win32])
3364AM_CONDITIONAL([USE_KQUEUE], [test $SELECT_TYPE = kqueue])
3365AM_CONDITIONAL([USE_DEVPOLL], [test $SELECT_TYPE = devpoll])
3366
3367case $SELECT_TYPE in
3368epoll)
3369 AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop])
3370 ;;
3371poll)
3372 AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop])
3373 ;;
3374kqueue)
3375 AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop])
3376 ;;
3377select_win32)
3378 AC_DEFINE(USE_SELECT_WIN32,1,[Use Winsock select() for the IO loop])
3379 ;;
3380select)
3381 AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop])
3382 ;;
3383esac
1b3db6d9 3384
3385
d06d566f 3386
60939927 3387dnl Yay! Another Linux brokenness. Its not good enough
3388dnl to know that setresuid() exists, because RedHat 5.0 declares
3389dnl setresuid() but doesn't implement it.
3390dnl
3391AC_CACHE_CHECK(if setresuid is implemented, ac_cv_func_setresuid,
62979ab1 3392 AC_RUN_IFELSE([AC_LANG_SOURCE([[
60939927 3393#include <stdlib.h>
b3167ca7 3394 int main(int argc, char **argv) {
5c51415d 3395 if(setresuid(-1,-1,-1)) {
3396 perror("setresuid:");
b3167ca7 3397 return 1;
60939927 3398 }
b3167ca7 3399 return 0;
5c51415d 3400 }
62979ab1 3401 ]])],[ac_cv_func_setresuid="yes"],[ac_cv_func_setresuid="no"],[])
60939927 3402)
5c51415d 3403if test "$ac_cv_func_setresuid" = "yes" ; then
6a9f6389 3404 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 3405fi
60939927 3406
cee08cbc
AJ
3407dnl Yay! This one is a MacOSX brokenness. Its not good enough
3408dnl to know that strnstr() exists, because MacOSX 10.4 have a bad
3409dnl copy that crashes with a buffer over-run!
3410dnl
3411AC_CACHE_CHECK(if strnstr is well implemented, ac_cv_func_strnstr,
62979ab1 3412 AC_RUN_IFELSE([AC_LANG_SOURCE([[
cee08cbc
AJ
3413#include <stdlib.h>
3414#include <stdio.h>
3415#include <string.h>
3416 // we expect this to succeed, or crash on over-run.
3417 // if it passes otherwise we may need a better check.
3418int main(int argc, char **argv)
3419{
3420 int size = 20;
3421 char *str = malloc(size);
3422 memset(str, 'x', size);
3423 strnstr(str, "fubar", size);
3424 return 0;
3425}
62979ab1 3426 ]])],[ac_cv_func_strnstr="yes"],[ac_cv_func_strnstr="no"],[])
cee08cbc
AJ
3427)
3428if test "$ac_cv_func_strnstr" = "yes" ; then
3429 AC_DEFINE(HAVE_STRNSTR,1,[Yay! We have a working strnstr!])
3430else
3431 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.])
3432fi
3433
eee79a2e 3434dnl
3435dnl Test for va_copy
3436dnl
3437AC_CACHE_CHECK(if va_copy is implemented, ac_cv_func_va_copy,
62979ab1 3438 AC_RUN_IFELSE([AC_LANG_SOURCE([[
eee79a2e 3439 #include <stdarg.h>
cf69e4f2 3440 #include <stdlib.h>
b3167ca7 3441 int f (int i, ...) {
eee79a2e 3442 va_list args1, args2;
3443 va_start (args1, i);
3444 va_copy (args2, args1);
3445 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
b3167ca7 3446 return 1;
eee79a2e 3447 va_end (args1); va_end (args2);
eee79a2e 3448 return 0;
3449 }
b3167ca7 3450 int main(int argc, char **argv) { return f (0, 42); }
62979ab1 3451 ]])],[ac_cv_func_va_copy="yes"],[ac_cv_func_va_copy="no"],[])
eee79a2e 3452)
3453if test "$ac_cv_func_va_copy" = "yes" ; then
a45f884d 3454 AC_DEFINE(HAVE_VA_COPY, 1, [If your system have va_copy])
eee79a2e 3455fi
3456
3457dnl
3458dnl Some systems support __va_copy
3459dnl
3460AC_CACHE_CHECK(if __va_copy is implemented, ac_cv_func___va_copy,
62979ab1 3461 AC_RUN_IFELSE([AC_LANG_SOURCE([[
eee79a2e 3462 #include <stdarg.h>
cf69e4f2 3463 #include <stdlib.h>
b3167ca7 3464 int f (int i, ...) {
eee79a2e 3465 va_list args1, args2;
3466 va_start (args1, i);
3467 __va_copy (args2, args1);
3468 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
b3167ca7 3469 return 1;
eee79a2e 3470 va_end (args1); va_end (args2);
eee79a2e 3471 return 0;
3472 }
b3167ca7 3473 int main(int argc, char **argv) { return f (0, 42); }
62979ab1 3474 ]])],[ac_cv_func___va_copy="yes"],[ac_cv_func___va_copy="no"],[])
eee79a2e 3475)
3476if test "$ac_cv_func___va_copy" = "yes" ; then
a45f884d 3477 AC_DEFINE(HAVE___VA_COPY, 1, [Some systems have __va_copy instead of va_copy])
eee79a2e 3478fi
c3d0c8b5 3479
5cafc1d6 3480dnl IP-Filter support requires ipf header files. These aren't
3481dnl installed by default, so we need to check for them
3482if test "$IPF_TRANSPARENT" ; then
3483 AC_MSG_CHECKING(if IP-Filter header files are installed)
42b51993 3484 # hold on to your hats...
3485 if test "$ac_cv_header_ip_compat_h" = "yes" ||
3486 test "$ac_cv_header_ip_fil_compat_h" = "yes" ||
87d21d8b 3487 test "$ac_cv_header_netinet_ip_compat_h" = "yes" ||
3488 test "$ac_cv_header_netinet_ip_fil_compat_h" = "yes" ; then
42b51993 3489 have_ipfilter_compat_header="yes"
3490 fi
3491 if test "x$have_ipfilter_compat_header" = "xyes" &&
eb824054 3492 test "$ac_cv_header_ip_fil_h" = "yes" &&
3493 test "$ac_cv_header_ip_nat_h" = "yes" ; then
3494 IPF_TRANSPARENT="yes"
3495 AC_DEFINE(IPF_TRANSPARENT, 1)
42b51993 3496 elif test "$have_ipfilter_compat_header" = "yes" &&
eb824054 3497 test "$ac_cv_header_netinet_ip_fil_h" = "yes" &&
3498 test "$ac_cv_header_netinet_ip_nat_h" = "yes" ; then
3499 IPF_TRANSPARENT="yes"
3500 AC_DEFINE(IPF_TRANSPARENT, 1)
3501 else
5cafc1d6 3502 IPF_TRANSPARENT="no"
3503 AC_DEFINE(IPF_TRANSPARENT, 0)
5cafc1d6 3504 fi
3505 AC_MSG_RESULT($IPF_TRANSPARENT)
3506fi
3507if test "$IPF_TRANSPARENT" = "no" ; then
eed82608
AJ
3508 AC_MSG_WARN([Cannot find necessary IP-Filter header files])
3509 AC_MSG_WARN([Transparent Proxy support WILL NOT be enabled])
5cafc1d6 3510 sleep 10
8f6ca20d 3511elif test "$IPF_TRANSPARENT" = "yes" ; then
3512dnl On Solaris Ipfilter includes expect that SOLARIS2 is defined with the
3513dnl Solaris minor version (8, 9, 10, ...)
3514 case "$host" in
3515 *-solaris*)
3516 solrev=`uname -r | sh -c 'IFS=. read j n x; echo $n'`
3517 CFLAGS="-DSOLARIS2=$solrev $CFLAGS"
20b3ae10 3518 CXXFLAGS="-DSOLARIS2=$solrev $CXXFLAGS"
8f6ca20d 3519 ;;
3520 *)
3521 ;;
3522 esac
5cafc1d6 3523fi
3524
2b0dd4ac 3525dnl PF support requires a header file.
3526if test "$PF_TRANSPARENT" ; then
3527 AC_MSG_CHECKING(if PF header file is installed)
3528 # hold on to your hats...
ec9909b0 3529 if test "$ac_cv_header_net_pfvar_h" = "yes" || test "$ac_cv_header_net_pf_pfvar_h" = "yes"; then
2b0dd4ac 3530 PF_TRANSPARENT="yes"
3531 AC_DEFINE(PF_TRANSPARENT, 1)
3532 else
3533 PF_TRANSPARENT="no"
3534 AC_DEFINE(PF_TRANSPARENT, 0)
3535 fi
3536 AC_MSG_RESULT($PF_TRANSPARENT)
3537fi
3538if test "$PF_TRANSPARENT" = "no" ; then
eed82608
AJ
3539 AC_MSG_WARN([Cannot find necessary PF header file])
3540 AC_MSG_WARN([Transparent Proxy support WILL NOT be enabled])
2b0dd4ac 3541 sleep 10
3542fi
3543
d852fbad 3544dnl Linux-Netfilter support requires Linux 2.4 kernel header files.
3545dnl Shamelessly copied from above
3546if test "$LINUX_NETFILTER" ; then
d6d62546 3547 AC_MSG_CHECKING(if Linux (Netfilter) kernel header files are installed)
d852fbad 3548 # hold on to your hats...
3549 if test "$ac_cv_header_linux_netfilter_ipv4_h" = "yes"; then
3550 LINUX_NETFILTER="yes"
3551 AC_DEFINE(LINUX_NETFILTER, 1)
3552 else
3553 LINUX_NETFILTER="no"
3554 AC_DEFINE(LINUX_NETFILTER, 0)
3555 fi
3556 AC_MSG_RESULT($LINUX_NETFILTER)
b50f1b2b 3557fi
d852fbad 3558if test "$LINUX_NETFILTER" = "no" ; then
eed82608
AJ
3559 AC_MSG_WARN([Cannot find necessary Linux kernel (Netfilter) header files])
3560 AC_MSG_WARN([Linux Transparent and Intercepting Proxy support WILL NOT be enabled])
1bffb955
HN
3561 LINUX_TPROXY2="no"
3562 AC_DEFINE(LINUX_TPROXY2, 0, [Enable real Transparent Proxy support for Netfilter TPROXY v2.])
d852fbad 3563 sleep 10
3564fi
b50f1b2b 3565dnl Netfilter TPROXY depends on libcap but the NAT parts can still work.
69367152 3566if test "$LINUX_NETFILTER" = "yes" && test "$use_libcap" != "yes" ; then
b50f1b2b
AJ
3567 AC_MSG_WARN([Missing needed capabilities (libcap or libcap2) for TPROXY])
3568 AC_MSG_WARN([Linux Transparent Proxy support WILL NOT be enabled])
3569 AC_MSG_WARN([Reduced support to Interception Proxy])
1bffb955
HN
3570 LINUX_TPROXY2="no"
3571 AC_DEFINE(LINUX_TPROXY2, 0, [Enable real Transparent Proxy support for Netfilter TPROXY v2.])
b50f1b2b
AJ
3572 sleep 10
3573fi
d852fbad 3574
f1e0717c 3575dnl Linux Netfilter/TPROXYv2 support requires some specific header files
b50f1b2b
AJ
3576dnl Shamelessly copied from above
3577if test "$LINUX_TPROXY2"; then
69367152 3578 if test "$use_libcap" = "yes"; then
f1e0717c 3579 AC_MSG_CHECKING(if TPROXYv2 header files are installed)
fc68f6b1 3580 # hold on to your hats...
3581 if test "$ac_cv_header_linux_netfilter_ipv4_ip_tproxy_h" = "yes" && test "$LINUX_NETFILTER" = "yes"; then
f1e0717c
AJ
3582 LINUX_TPROXY2="yes"
3583 AC_DEFINE(LINUX_TPROXY2, 1, [Enable real Transparent Proxy support for Netfilter TPROXY v2.])
fc68f6b1 3584 else
f1e0717c
AJ
3585 LINUX_TPROXY2="no"
3586 AC_DEFINE(LINUX_TPROXY2, 0, [Enable real Transparent Proxy support for Netfilter TPROXY v2.])
3587 fi
3588 AC_MSG_RESULT($LINUX_TPROXY2)
3589 if test "$LINUX_TPROXY2" = "no" && test "$LINUX_NETFILTER" = "yes"; then
eed82608
AJ
3590 AC_MSG_WARN([Cannot find TPROXY v2 headers, you need to patch the kernel with ])
3591 AC_MSG_WARN([tproxy package from:])
3592 AC_MSG_WARN([ - lynx http://www.balabit.com/downloads/files/tproxy/])
3593 AC_MSG_WARN([Or select the '--enable-linux-netfilter' option instead for Netfilter support.])
f1e0717c 3594 sleep 10
fc68f6b1 3595 fi
b50f1b2b
AJ
3596 else
3597 AC_MSG_WARN([Missing needed capabilities (libcap or libcap2) for TPROXY v2])
3598 AC_MSG_WARN([Linux Transparent Proxy support WILL NOT be enabled])
1bffb955
HN
3599 LINUX_TPROXY2="no"
3600 AC_DEFINE(LINUX_TPROXY2, 0, [Enable real Transparent Proxy support for Netfilter TPROXY v2.])
b50f1b2b
AJ
3601 sleep 10
3602 fi
fc68f6b1 3603fi
3604
cc937513 3605AC_ARG_ENABLE(gnuregex,
62979ab1 3606 AS_HELP_STRING([--enable-gnuregex],[Compile GNUregex. Unless you have reason to use
cc937513
AJ
3607 this option, you should not enable it.
3608 This library file is usually only required on Windows and
3609 very old Unix boxes which do not have their own regex
3610 library built in.]),
3611[USE_GNUREGEX=$enableval])
91bc414e 3612if test -z "$USE_GNUREGEX" ; then
3613 case "$host" in
3614 *-sun-solaris2.[[0-4]])
3615 USE_GNUREGEX="yes"
3616 ;;
3617 *-next-nextstep*)
3618 USE_GNUREGEX="yes"
3619 ;;
3620 esac
3621fi
7a081912 3622AC_MSG_CHECKING(if GNUregex needs to be compiled)
91bc414e 3623if test -z "$USE_GNUREGEX"; then
55878dfd 3624if test "$ac_cv_func_regcomp" = "no" || test "$USE_GNUREGEX" = "yes" ; then
74946a0f 3625 USE_GNUREGEX="yes"
00fa2c12 3626else
62979ab1
AJ
3627 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
3628#include <regex.h>]], [[regex_t t; regcomp(&t,"",0);]])],[USE_GNUREGEX="no"],[USE_GNUREGEX="yes"])
91bc414e 3629fi
00fa2c12 3630fi
74946a0f 3631AC_MSG_RESULT($USE_GNUREGEX)
3632if test "$USE_GNUREGEX" = "yes"; then
cc937513
AJ
3633 # override system regex with ours. Not good. But what was asked for.
3634 REGEXLIB=""
6a9f6389 3635 AC_DEFINE(USE_GNUREGEX,1,[Define if we should use GNU regex])
7a081912 3636fi
26675bf4 3637AC_SUBST(REGEXLIB)
cc937513 3638#AC_SUBST(LIBREGEX)
7a081912 3639
5c51415d 3640dnl Not cached since people are likely to tune this
e924600d 3641AC_MSG_CHECKING(Default FD_SETSIZE value)
62979ab1 3642AC_RUN_IFELSE([AC_LANG_SOURCE([[
e924600d 3643#if HAVE_STDIO_H
3644#include <stdio.h>
3645#endif
3646#if HAVE_UNISTD_H
3647#include <unistd.h>
3648#endif
cf69e4f2
HN
3649#if HAVE_STDLIB_H
3650#include <stdlib.h>
3651#endif
e924600d 3652#if HAVE_SYS_TIME_H
3653#include <sys/time.h>
3654#endif
3655#if HAVE_SYS_SELECT_H
3656#include <sys/select.h>
3657#endif
3658#if HAVE_SYS_TYPES_H
3659#include <sys/types.h>
3660#endif
bfe8dedf
GS
3661#if HAVE_WINSOCK_H
3662#include <winsock.h>
3663#endif
3664#if HAVE_WINSOCK2_H
3665#include <winsock2.h>
3666#endif
b3167ca7 3667int main(int argc, char **argv) {
635e6242 3668 FILE *fp = fopen("conftestval", "w");
3669 fprintf (fp, "%d\n", FD_SETSIZE);
b3167ca7 3670 return 0;
e924600d 3671}
62979ab1 3672]])],[DEFAULT_FD_SETSIZE=`cat conftestval`],[DEFAULT_FD_SETSIZE=256],[DEFAULT_FD_SETSIZE=256])
e924600d 3673AC_MSG_RESULT($DEFAULT_FD_SETSIZE)
6a9f6389 3674AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE, [Default FD_SETSIZE value])
e924600d 3675
f49be7d1 3676
5c51415d 3677dnl Not cached since people are likely to tune this
234967c9 3678AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
c76d8acc 3679dnl damn! FreeBSD's pthreads breaks dup2().
5132a9eb 3680TLDFLAGS="$LDFLAGS"
f49be7d1 3681if test -n "$squid_filedescriptors_num" ; then
3682 SQUID_MAXFD=$squid_filedescriptors_num
3683 AC_MSG_RESULT($SQUID_MAXFD (user-forced))
3684else
f49be7d1 3685 case $host in
3686 i386-unknown-freebsd*)
3687 if echo "$LDFLAGS" | grep -q pthread; then
3688 LDFLAGS=`echo $LDFLAGS | sed -e "s/-pthread//"`
3689 fi
3690 esac
62979ab1 3691 AC_RUN_IFELSE([AC_LANG_SOURCE([[
8cca06da 3692#include <stdio.h>
234967c9 3693#include <unistd.h>
cf69e4f2 3694#include <stdlib.h>
30a4f2a8 3695#include <sys/time.h> /* needed on FreeBSD */
234967c9 3696#include <sys/param.h>
3697#include <sys/resource.h>
b3167ca7 3698int main(int argc, char **argv) {
635e6242 3699 FILE *fp;
234967c9 3700 int i,j;
42b51993 3701#if defined(__CYGWIN32__) || defined (__CYGWIN__)
b05490a8 3702 /* getrlimit and sysconf returns bogous values on cygwin32.
df087e68 3703 * Number of fds is virtually unlimited in cygwin (sys/param.h)
b05490a8 3704 * __CYGWIN32__ is deprecated.
df087e68 3705 */
3706 i = NOFILE;
b05490a8 3707#else
3708#if HAVE_SETRLIMIT
234967c9 3709 struct rlimit rl;
3710#if defined(RLIMIT_NOFILE)
3711 if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
3712 perror("getrlimit: RLIMIT_NOFILE");
3713 } else {
f168f0c5
AJ
3714#if defined(__APPLE__)
3715 /* asking for more than OPEN_MAX fails on Leopard */
3716 rl.rlim_cur = (OPEN_MAX < rl.rlim_max ? OPEN_MAX : rl.rlim_max);
3717#else
234967c9 3718 rl.rlim_cur = rl.rlim_max; /* set it to the max */
f168f0c5 3719#endif
234967c9 3720 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
3721 perror("setrlimit: RLIMIT_NOFILE");
3722 }
3723 }
3724#elif defined(RLIMIT_OFILE)
3725 if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
3726 perror("getrlimit: RLIMIT_OFILE");
3727 } else {
3728 rl.rlim_cur = rl.rlim_max; /* set it to the max */
3729 if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
3730 perror("setrlimit: RLIMIT_OFILE");
3731 }
3732 }
3733#endif /* RLIMIT_NOFILE */
3734#endif /* HAVE_SETRLIMIT */
d9399075 3735 /* by starting at 2^14, we will never get higher
3736 than 2^15 for SQUID_MAXFD */
3737 i = j = 1<<14;
3738 while (j) {
3739 j >>= 1;
3740 if (dup2(0, i) < 0) {
3741 i -= j;
3742 } else {
3743 close(i);
3744 i += j;
3745 }
3746 }
3747 i++;
b05490a8 3748#endif /* IF !DEF CYGWIN */
635e6242 3749 fp = fopen("conftestval", "w");
a4d7e961 3750 fprintf (fp, "%d\n", i & ~0x3F);
b3167ca7 3751 return 0;
234967c9 3752}
62979ab1 3753 ]])],[SQUID_MAXFD=`cat conftestval`],[SQUID_MAXFD=256],[SQUID_MAXFD=256])
4b26fae9 3754 dnl Microsoft MSVCRT.DLL supports 2048 maximum FDs
3755 case "$host_os" in
3756 mingw|mingw32)
3757 SQUID_MAXFD="2048"
3758 ;;
3759 esac
f49be7d1 3760 AC_MSG_RESULT($SQUID_MAXFD)
3761fi
6a9f6389 3762AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD,[Maximum number of open filedescriptors])
b9cc811d 3763if test "$SQUID_MAXFD" -lt 512 ; then
eed82608
AJ
3764 AC_MSG_WARN([$SQUID_MAXFD may not be enough filedescriptors if your])
3765 AC_MSG_WARN([cache will be very busy. Please see the FAQ page])
3766 AC_MSG_WARN([http://wiki.squid-cache.org/SquidFaq/TroubleShooting])
3767 AC_MSG_WARN([on how to increase your filedescriptor limit])
933cc58d 3768 sleep 10
80ab193b 3769fi
c76d8acc 3770LDFLAGS="$TLDFLAGS"
234967c9 3771
d0f9207a 3772if test `expr $SQUID_MAXFD % 64` != 0; then
eed82608 3773 AC_MSG_WARN([$SQUID_MAXFD is not an multiple of 64. This may cause issues on certain platforms.])
a4d7e961 3774 sleep 10
3775fi
3776
5c51415d 3777dnl Not cached since people are likely to tune this
30a4f2a8 3778AC_MSG_CHECKING(Default UDP send buffer size)
62979ab1 3779AC_RUN_IFELSE([AC_LANG_SOURCE([[
8cca06da 3780#include <stdlib.h>
3781#include <stdio.h>
30a4f2a8 3782#include <sys/types.h>
bfe8dedf 3783#if HAVE_SYS_SOCKET_H
30a4f2a8 3784#include <sys/socket.h>
bfe8dedf
GS
3785#endif
3786#if HAVE_NETINET_IN_H
30a4f2a8 3787#include <netinet/in.h>
bfe8dedf
GS
3788#endif
3789#if HAVE_WINSOCK_H
3790#include <winsock.h>
3791#endif
3792#if HAVE_WINSOCK2_H
3793#include <winsock2.h>
3794#endif
b3167ca7 3795int main(int argc, char **argv)
30a4f2a8 3796{
635e6242 3797 FILE *fp;
eab7694a 3798 int fd,val=0;
bfe8dedf 3799#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
eab7694a 3800 int len=sizeof(int);
bfe8dedf
GS
3801 WSADATA wsaData;
3802 WSAStartup(2, &wsaData);
eab7694a
GS
3803#else
3804 socklen_t len=sizeof(socklen_t);
bfe8dedf 3805#endif
b3167ca7 3806 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) return 1;
bfe8dedf 3807#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
b3167ca7 3808 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char *)&val, &len) < 0) return 1;
bfe8dedf 3809 WSACleanup();
f3f3e961 3810#else
b3167ca7 3811 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) return 1;
bfe8dedf 3812#endif
b3167ca7 3813 if (val<=0) return 1;
635e6242 3814 fp = fopen("conftestval", "w");
3815 fprintf (fp, "%d\n", val);
b3167ca7 3816 return 0;
30a4f2a8 3817}
62979ab1 3818]])],[SQUID_DETECT_UDP_SO_SNDBUF=`cat conftestval`],[SQUID_DETECT_UDP_SO_SNDBUF=16384],[SQUID_DETECT_UDP_SO_SNDBUF=16384])
6a9f6389 3819AC_MSG_RESULT($SQUID_DETECT_UDP_SO_SNDBUF)
3820AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_SNDBUF, $SQUID_DETECT_UDP_SO_SNDBUF,[UDP send buffer size])
30a4f2a8 3821
5c51415d 3822dnl Not cached since people are likely to tune this
30a4f2a8 3823AC_MSG_CHECKING(Default UDP receive buffer size)
62979ab1 3824AC_RUN_IFELSE([AC_LANG_SOURCE([[
8cca06da 3825#include <stdlib.h>
3826#include <stdio.h>
30a4f2a8 3827#include <sys/types.h>
bfe8dedf 3828#if HAVE_SYS_SOCKET_H
30a4f2a8 3829#include <sys/socket.h>
bfe8dedf
GS
3830#endif
3831#if HAVE_NETINET_IN_H
30a4f2a8 3832#include <netinet/in.h>
bfe8dedf
GS
3833#endif
3834#if HAVE_WINSOCK_H
3835#include <winsock.h>
3836#endif
3837#if HAVE_WINSOCK2_H
3838#include <winsock2.h>
3839#endif
b3167ca7 3840int main(int argc, char **argv)
30a4f2a8 3841{
635e6242 3842 FILE *fp;
eab7694a 3843 int fd,val=0;
bfe8dedf 3844#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
eab7694a 3845 int len=sizeof(int);
bfe8dedf
GS
3846 WSADATA wsaData;
3847 WSAStartup(2, &wsaData);
eab7694a
GS
3848#else
3849 socklen_t len=sizeof(socklen_t);
bfe8dedf 3850#endif
b3167ca7 3851 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) return 1;
bfe8dedf 3852#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
b3167ca7 3853 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char *)&val, &len) < 0) return 1;
bfe8dedf 3854 WSACleanup();
f3f3e961 3855#else
b3167ca7 3856 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) return 1;
bfe8dedf 3857#endif
b3167ca7 3858 if (val <= 0) return 1;
635e6242 3859 fp = fopen("conftestval", "w");
3860 fprintf (fp, "%d\n", val);
b3167ca7 3861 return 0;
30a4f2a8 3862}
62979ab1 3863]])],[SQUID_DETECT_UDP_SO_RCVBUF=`cat conftestval`],[SQUID_DETECT_UDP_SO_RCVBUF=16384],[SQUID_DETECT_UDP_SO_RCVBUF=16384])
6a9f6389 3864AC_MSG_RESULT($SQUID_DETECT_UDP_SO_RCVBUF)
3865AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_RCVBUF, $SQUID_DETECT_UDP_SO_RCVBUF,[UDP receive buffer size])
30a4f2a8 3866
5c51415d 3867dnl Not cached since people are likely to tune this
30a4f2a8 3868AC_MSG_CHECKING(Default TCP send buffer size)
62979ab1 3869AC_RUN_IFELSE([AC_LANG_SOURCE([[
8cca06da 3870#include <stdlib.h>
3871#include <stdio.h>
30a4f2a8 3872#include <sys/types.h>
bfe8dedf 3873#if HAVE_SYS_SOCKET_H
30a4f2a8 3874#include <sys/socket.h>
bfe8dedf
GS
3875#endif
3876#if HAVE_NETINET_IN_H
30a4f2a8 3877#include <netinet/in.h>
bfe8dedf
GS
3878#endif
3879#if HAVE_WINSOCK_H
3880#include <winsock.h>
3881#endif
3882#if HAVE_WINSOCK2_H
3883#include <winsock2.h>
3884#endif
b3167ca7 3885int main(int argc, char **argv)
30a4f2a8 3886{
635e6242 3887 FILE *fp;
eab7694a 3888 int fd,val=0;
bfe8dedf 3889#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
eab7694a 3890 int len=sizeof(int);
bfe8dedf
GS
3891 WSADATA wsaData;
3892 WSAStartup(2, &wsaData);
eab7694a
GS
3893#else
3894 socklen_t len=sizeof(socklen_t);
bfe8dedf 3895#endif
b3167ca7 3896 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) return 1;
bfe8dedf 3897#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
b3167ca7 3898 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char *)&val, &len) < 0) return 1;
bfe8dedf 3899 WSACleanup();
f3f3e961 3900#else
b3167ca7 3901 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) return 1;
bfe8dedf 3902#endif
b3167ca7 3903 if (val <= 0) return 1;
635e6242 3904 fp = fopen("conftestval", "w");
3905 fprintf (fp, "%d\n", val);
b3167ca7 3906 return 0;
30a4f2a8 3907}
62979ab1 3908]])],[SQUID_TCP_SO_SNDBUF=`cat conftestval`],[SQUID_TCP_SO_SNDBUF=16384],[SQUID_TCP_SO_SNDBUF=16384])
30a4f2a8 3909AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF)
2aa6ca58 3910if test $SQUID_TCP_SO_SNDBUF -gt 32768; then
eed82608 3911 AC_MSG_NOTICE([Limiting send buffer size to 32K])
2aa6ca58 3912 SQUID_TCP_SO_SNDBUF=32768
3913fi
6a9f6389 3914AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF,[TCP send buffer size])
30a4f2a8 3915
5c51415d 3916dnl Not cached since people are likely to tune this
30a4f2a8 3917AC_MSG_CHECKING(Default TCP receive buffer size)
62979ab1 3918AC_RUN_IFELSE([AC_LANG_SOURCE([[
8cca06da 3919#include <stdlib.h>
3920#include <stdio.h>
30a4f2a8 3921#include <sys/types.h>
bfe8dedf 3922#if HAVE_SYS_SOCKET_H
30a4f2a8 3923#include <sys/socket.h>
bfe8dedf
GS
3924#endif
3925#if HAVE_NETINET_IN_H
30a4f2a8 3926#include <netinet/in.h>
bfe8dedf
GS
3927#endif
3928#if HAVE_WINSOCK_H
3929#include <winsock.h>
3930#endif
3931#if HAVE_WINSOCK2_H
3932#include <winsock2.h>
3933#endif
b3167ca7 3934int main(int argc, char **argv)
30a4f2a8 3935{
635e6242 3936 FILE *fp;
eab7694a 3937 int fd,val=0;
bfe8dedf 3938#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
eab7694a 3939 int len=sizeof(int);
bfe8dedf
GS
3940 WSADATA wsaData;
3941 WSAStartup(2, &wsaData);
eab7694a
GS
3942#else
3943 socklen_t len=sizeof(socklen_t);
bfe8dedf 3944#endif
b3167ca7 3945 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) return 1;
bfe8dedf 3946#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
b3167ca7 3947 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char *)&val, &len) < 0) return 1;
bfe8dedf 3948 WSACleanup();
f3f3e961 3949#else
b3167ca7 3950 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) return 1;
bfe8dedf 3951#endif
b3167ca7 3952 if (val <= 0) return 1;
635e6242 3953 fp = fopen("conftestval", "w");
3954 fprintf (fp, "%d\n", val);
b3167ca7 3955 return 0;
30a4f2a8 3956}
62979ab1 3957]])],[SQUID_TCP_SO_RCVBUF=`cat conftestval`],[SQUID_TCP_SO_RCVBUF=16384],[SQUID_TCP_SO_RCVBUF=16384])
30a4f2a8 3958AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF)
2aa6ca58 3959if test $SQUID_TCP_SO_RCVBUF -gt 65535; then
eed82608 3960 AC_MSG_NOTICE([Limiting receive buffer size to 64K])
2aa6ca58 3961 SQUID_TCP_SO_RCVBUF=65535
3962fi
6a9f6389 3963AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF,[TCP receive buffer size])
5c51415d 3964AC_CACHE_CHECK(if sys_errlist is already defined, ac_cv_needs_sys_errlist,
62979ab1 3965 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 3966)
3967if test "$ac_cv_needs_sys_errlist" = "yes" ; then
6a9f6389 3968 AC_DEFINE(NEED_SYS_ERRLIST,1,[If we need to declare sys_errlist[] as external])
5c51415d 3969fi
30a4f2a8 3970
5c51415d 3971dnl Not cached since people are likely to change this
6bf65235 3972AC_MSG_CHECKING(for libresolv _dns_ttl_ hack)
62979ab1
AJ
3973AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern int _dns_ttl_;]], [[return _dns_ttl_;]])],[AC_MSG_RESULT(yes)
3974AC_DEFINE(LIBRESOLV_DNS_TTL_HACK,1,[If libresolv.a has been hacked to export _dns_ttl_])],[AC_MSG_RESULT(no)])
6bf65235 3975
b6a2f15e 3976if test "$ac_cv_header_sys_statvfs_h" = "yes" ; then
c68e9c6b 3977AC_MSG_CHECKING(for working statvfs() interface)
62979ab1 3978AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
c68e9c6b 3979#include <stdlib.h>
3980#include <stdio.h>
3981#include <sys/types.h>
3982#include <sys/statvfs.h>
62979ab1 3983]], [[
c68e9c6b 3984struct statvfs sfs;
3985sfs.f_blocks = sfs.f_bfree = sfs.f_frsize =
3986sfs.f_files = sfs.f_ffree = 0;
3987statvfs("/tmp", &sfs);
62979ab1 3988]])],[ac_cv_func_statvfs=yes],[ac_cv_func_statvfs=no])
c68e9c6b 3989AC_MSG_RESULT($ac_cv_func_statvfs)
6b8e7481 3990if test "$ac_cv_func_statvfs" = "yes" ; then
6a9f6389 3991 AC_DEFINE(HAVE_STATVFS,1,[If your system has statvfs(), and if it actually works!])
b6a2f15e 3992fi
6b8e7481 3993fi
c68e9c6b 3994
cc192b50 3995dnl Detect what resolver fields we have available to use...
3996AC_CACHE_CHECK(for _res_ext.nsaddr_list, ac_cv_have_res_ext_nsaddr_list,
62979ab1 3997AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
cc192b50 3998#if HAVE_SYS_TYPES_H
3999#include <sys/types.h>
4000#endif
4001#if HAVE_NETINET_IN_H
4002#include <netinet/in.h>
4003#endif
4004#if HAVE_ARPA_INET_H
4005#include <arpa/inet.h>
4006#endif
4007#if HAVE_ARPA_NAMESER_H
4008#include <arpa/nameser.h>
4009#endif
4010#if HAVE_RESOLV_H
4011#include <resolv.h>
4012#endif
62979ab1 4013]], [[_res_ext.nsaddr_list[[0]].s_addr;]])],[ac_cv_have_res_ext_nsaddr_list="yes"],[ac_cv_have_res_ext_nsaddr_list="no"]))
cc192b50 4014if test "$ac_cv_have_res_ext_nsaddr_list" = "yes" ; then
4015 AC_DEFINE(_SQUID_RES_NSADDR6_LARRAY,_res_ext.nsaddr_list,[If _res_ext structure has nsaddr_list member])
4016 AC_DEFINE(_SQUID_RES_NSADDR6_COUNT,ns6count,[Nameserver Counter for IPv6 _res_ext])
4017fi
4018
0873b2ab 4019if test "$_SQUID_RES_NSADDR6_LIST" = ""; then
cc192b50 4020AC_CACHE_CHECK(for _res._u._ext.nsaddrs, ac_cv_have_res_ext_nsaddrs,
62979ab1 4021AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
cc192b50 4022#if HAVE_SYS_TYPES_H
4023#include <sys/types.h>
4024#endif
4025#if HAVE_NETINET_IN_H
4026#include <netinet/in.h>
4027#endif
4028#if HAVE_ARPA_INET_H
4029#include <arpa/inet.h>
4030#endif
4031#if HAVE_ARPA_NAMESER_H
4032#include <arpa/nameser.h>
4033#endif
4034#if HAVE_RESOLV_H
4035#include <resolv.h>
4036#endif
62979ab1 4037]], [[_res._u._ext.nsaddrs[[0]]->sin6_addr;]])],[ac_cv_have_res_ext_nsaddrs="yes"],[ac_cv_have_res_ext_nsaddrs="no"]))
cc192b50 4038if test "$ac_cv_have_res_ext_nsaddrs" = "yes" ; then
4039 AC_DEFINE(_SQUID_RES_NSADDR6_LPTR,_res._u._ext.nsaddrs,[If _res structure has _ext.nsaddrs member])
4040 AC_DEFINE(_SQUID_RES_NSADDR6_COUNT,_res._u._ext.nscount6,[Nameserver Counter for IPv6 _res])
4041fi
4042fi
4043
c68e9c6b 4044AC_CACHE_CHECK(for _res.nsaddr_list, ac_cv_have_res_nsaddr_list,
62979ab1 4045AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
c68e9c6b 4046#if HAVE_SYS_TYPES_H
4047#include <sys/types.h>
4048#endif
4049#if HAVE_NETINET_IN_H
4050#include <netinet/in.h>
4051#endif
4052#if HAVE_ARPA_INET_H
4053#include <arpa/inet.h>
4054#endif
4055#if HAVE_ARPA_NAMESER_H
4056#include <arpa/nameser.h>
4057#endif
4058#if HAVE_RESOLV_H
4059#include <resolv.h>
4060#endif
62979ab1 4061]], [[_res.nsaddr_list[[0]];]])],[ac_cv_have_res_nsaddr_list="yes"],[ac_cv_have_res_nsaddr_list="no"]))
c68e9c6b 4062if test $ac_cv_have_res_nsaddr_list = "yes" ; then
cc192b50 4063 AC_DEFINE(_SQUID_RES_NSADDR_LIST,_res.nsaddr_list,[If _res structure has nsaddr_list member])
4064 AC_DEFINE(_SQUID_RES_NSADDR_COUNT,_res.nscount,[Nameserver counter for IPv4 _res])
c68e9c6b 4065fi
4066
0873b2ab 4067if test "$_SQUID_RES_NSADDR_LIST" = ""; then
c68e9c6b 4068AC_CACHE_CHECK(for _res.ns_list, ac_cv_have_res_ns_list,
62979ab1 4069AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
c68e9c6b 4070#if HAVE_SYS_TYPES_H
4071#include <sys/types.h>
4072#endif
4073#if HAVE_NETINET_IN_H
4074#include <netinet/in.h>
4075#endif
4076#if HAVE_ARPA_INET_H
4077#include <arpa/inet.h>
4078#endif
4079#if HAVE_ARPA_NAMESER_H
4080#include <arpa/nameser.h>
4081#endif
4082#if HAVE_RESOLV_H
4083#include <resolv.h>
4084#endif
62979ab1 4085]], [[_res.ns_list[[0]].addr;]])],[ac_cv_have_res_ns_list="yes"],[ac_cv_have_res_ns_list="no"]))
c68e9c6b 4086if test $ac_cv_have_res_ns_list = "yes" ; then
cc192b50 4087 AC_DEFINE(_SQUID_RES_NSADDR_LIST,_res.ns_list,[If _res structure has ns_list member])
4088 AC_DEFINE(_SQUID_RES_NSADDR_COUNT,_res.nscount,[Nameserver counter for IPv4 _res])
c68e9c6b 4089fi
4090fi
4091
461b8219 4092dnl Squid will usually attempt to translate when packaging or building from VCS
44e0a249 4093use_translation="yes"
461b8219 4094AC_ARG_ENABLE(translation,
62979ab1 4095 AS_HELP_STRING([--disable-translation],[Prevent Squid generating localized error page templates and manuals.
b3fed8c3 4096 Which is usually tried, but may not be needed.]),
461b8219
AJ
4097[ if test "$enableval" = "no" ; then
4098 use_translation=no
4099 fi
4100])
e4b70b44 4101dnl Squid now has .po translation capability, given the right toolkit
461b8219
AJ
4102if test "$use_translation" = "yes" ; then
4103 AX_WITH_PROG([PO2HTML],[po2html])
4104else
4105 PO2HTML="off"
4106fi
4107AC_SUBST(PO2HTML)
ee1a8ac2 4108
43000484
AJ
4109dnl Squid now has limited locale handling ...
4110dnl on error pages
8db7a54b 4111use_errlocale=yes
43000484 4112AC_ARG_ENABLE(auto-locale,
62979ab1 4113 AS_HELP_STRING([--disable-auto-locale],[This prevents Squid providing localized error pages based on the
21d5413e
AJ
4114 clients request headers.
4115 When disabled Squid requires explicit language configuration.]),
8db7a54b
AJ
4116[ if test "$enableval" = "no" ; then
4117 use_errlocale=no
4118 fi
4119])
4120if test "$use_errlocale" = "yes" ; then
eed82608 4121 AC_MSG_NOTICE([Enabling Multi-Language Support])
43000484 4122 AC_DEFINE(USE_ERR_LOCALES,1,[Use multi-language support on error pages])
8db7a54b 4123else
eed82608 4124 AC_MSG_WARN([Disabling Multi-Language Support])
43000484 4125 AC_DEFINE(USE_ERR_LOCALES,0,[Use multi-language support on error pages])
8db7a54b 4126fi
43000484 4127
090089c4 4128dnl Need the debugging version of malloc if available
4129XTRA_OBJS=''
6509a1a0 4130if test "$ac_cv_lib_malloc_main" = "yes" ; then
090089c4 4131 if test -r /usr/lib/debug/malloc.o ; then
4132 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
4133 fi
4134 if test -r /usr/lib/debug/mallocmap.o ; then
4135 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
4136 fi
4137fi
4138AC_SUBST(XTRA_OBJS)
4139
38fea766 4140if test -z "$XTRA_LIBS"; then
4141 XTRA_LIBS="$LIBS"
0f5a16f8 4142 dnl minor cleanup
4143 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
38fea766 4144 LIBS=''
4145fi
090089c4 4146AC_SUBST(XTRA_LIBS)
4147
090089c4 4148dnl Clean up after OSF/1 core dump bug
4149rm -f core
4150
6a9f6389 4151AC_CONFIG_FILES([\
a2794549 4152 Makefile \
eee95dfe 4153 compat/Makefile \
a2794549 4154 lib/Makefile \
a2794549 4155 scripts/Makefile \
4156 scripts/RunCache \
4157 scripts/RunAccel \
4158 src/Makefile \
5bd7a218 4159 src/base/Makefile \
bcf44a2c 4160 src/acl/Makefile \
a2794549 4161 src/fs/Makefile \
4162 src/repl/Makefile \
4163 src/auth/Makefile \
5fa840c3 4164 src/adaptation/Makefile \
1f3c65fc
AR
4165 src/adaptation/icap/Makefile \
4166 src/adaptation/ecap/Makefile \
f99c2cfe 4167 src/esi/Makefile \
ee0927b6 4168 src/eui/Makefile \
663ff9aa 4169 src/icmp/Makefile \
4daaf3cb 4170 src/ident/Makefile \
f963428c 4171 src/ip/Makefile \
82b7abe3 4172 src/log/Makefile \
a2794549 4173 contrib/Makefile \
4174 snmplib/Makefile \
4175 icons/Makefile \
4176 errors/Makefile \
1077c1b8 4177 test-suite/Makefile \
99db07b3 4178 doc/Makefile \
3faa6da8 4179 doc/manuals/Makefile \
0c510f3c 4180 helpers/Makefile \
4181 helpers/basic_auth/Makefile \
4182 helpers/basic_auth/LDAP/Makefile \
4183 helpers/basic_auth/MSNT/Makefile \
4184 helpers/basic_auth/NCSA/Makefile \
4185 helpers/basic_auth/PAM/Makefile \
4186 helpers/basic_auth/SMB/Makefile \
6e785d85 4187 helpers/basic_auth/mswin_sspi/Makefile \
0c510f3c 4188 helpers/basic_auth/YP/Makefile \
4189 helpers/basic_auth/getpwnam/Makefile \
4190 helpers/basic_auth/multi-domain-NTLM/Makefile \
4191 helpers/basic_auth/SASL/Makefile \
bcf74be7 4192 helpers/basic_auth/POP3/Makefile \
002d9b03 4193 helpers/basic_auth/DB/Makefile \
d80aac12 4194 helpers/basic_auth/squid_radius_auth/Makefile \
0c510f3c 4195 helpers/digest_auth/Makefile \
4196 helpers/digest_auth/password/Makefile \
55013f9c 4197 helpers/digest_auth/ldap/Makefile \
89f77e43 4198 helpers/digest_auth/eDirectory/Makefile \
0c510f3c 4199 helpers/ntlm_auth/Makefile \
4200 helpers/ntlm_auth/fakeauth/Makefile \
4201 helpers/ntlm_auth/no_check/Makefile \
3963d7b1
AJ
4202 helpers/ntlm_auth/smb_lm/Makefile \
4203 helpers/ntlm_auth/smb_lm/smbval/Makefile \
6e785d85 4204 helpers/ntlm_auth/mswin_sspi/Makefile \
4205 helpers/negotiate_auth/Makefile \
45b2de83 4206 helpers/negotiate_auth/kerberos/Makefile \
6e785d85 4207 helpers/negotiate_auth/mswin_sspi/Makefile \
c6588c68 4208 helpers/external_acl/Makefile \
4209 helpers/external_acl/ip_user/Makefile \
4210 helpers/external_acl/ldap_group/Makefile \
74ab8d10 4211 helpers/external_acl/session/Makefile \
c6588c68 4212 helpers/external_acl/unix_group/Makefile \
736a9a4d 4213 helpers/external_acl/wbinfo_group/Makefile \
9e6e0372 4214 helpers/external_acl/mswin_ad_group/Makefile \
94ab55b0 4215 helpers/external_acl/mswin_lm_group/Makefile \
82b7abe3
AJ
4216 helpers/log_daemon/Makefile \
4217 helpers/log_daemon/file/Makefile \
fdbb3b19
AJ
4218 helpers/url_rewrite/Makefile \
4219 helpers/url_rewrite/fake/Makefile \
94ab55b0 4220 tools/Makefile
53cbe3e4 4221])
43ae1d95 4222
377792e4 4223AC_CONFIG_SUBDIRS(lib/libTrie)
4224
3e7b6055
AR
4225# must configure libltdl subdir unconditionally for "make distcheck" to work
4226AC_CONFIG_SUBDIRS(lib/libLtdl)
4227
6a9f6389 4228AC_OUTPUT