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