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