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