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