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