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