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