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