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