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