]> 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,
e702812e
FC
1598 AC_HELP_STRING([--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.]),
6e785d85 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,
e702812e
FC
1650 AC_HELP_STRING([--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
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,
e702812e
FC
1690 AC_HELP_STRING([--enable-ntlm-fail-open],
1691 [Enable NTLM fail open, where a helper that fails one of the
1692 Authentication steps can allow squid to still authenticate
1693 the user.]),
6437ac71 1694[ if test "$enableval" = "yes" ; then
6a9f6389 1695 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 1696 fi
1697])
1698
c6588c68 1699dnl Select external_acl helpers to build
7f18d2bd 1700EXTERNAL_ACL_HELPERS=all
c6588c68 1701AC_ARG_ENABLE(external-acl-helpers,
e702812e
FC
1702 AC_HELP_STRING([--enable-external-acl-helpers="list of helpers"],
1703 [This option selects which external_acl helpers to
1704 build and install as part of the normal build
1705 process. For a list of available helpers see the
1706 helpers/external_acl directory.]),
c6588c68 1707[ case "$enableval" in
1708 yes)
7f18d2bd 1709 EXTERNAL_ACL_HELPERS=all
1c690e30 1710 ;;
c6588c68 1711 no)
7f18d2bd 1712 EXTERNAL_ACL_HELPERS=""
1c690e30 1713 ;;
c6588c68 1714 *)
1c690e30 1715 EXTERNAL_ACL_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1716 ;;
c6588c68 1717 esac
1718])
7f18d2bd 1719if test "$EXTERNAL_ACL_HELPERS" = "all" ; then
39ee7289 1720 EXTERNAL_ACL_HELPERS=""
7f18d2bd 1721 for dir in $srcdir/helpers/external_acl/*; do
1722 helper="`basename $dir`"
1723 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1724 EXTERNAL_ACL_HELPERS="$EXTERNAL_ACL_HELPERS $helper"
1725 fi
1726 done
1727fi
c6588c68 1728if test -n "$EXTERNAL_ACL_HELPERS"; then
20d8bfe4 1729 for helper in $EXTERNAL_ACL_HELPERS; do
1730 if test -f $srcdir/helpers/external_acl/$helper/Makefile.in; then
1731 :
1732 else
8b0d8e31 1733 AC_MSG_ERROR(external acl helper $helper does not exist)
20d8bfe4 1734 fi
1735 done
c6588c68 1736 echo "External acl helpers built: $EXTERNAL_ACL_HELPERS"
1737fi
1738AC_SUBST(EXTERNAL_ACL_HELPERS)
1739
3a125142 1740AC_ARG_WITH(valgrind-debug,
e702812e
FC
1741 AC_HELP_STRING([--with-valgrind-debug],
1742 [Include debug instrumentation for use with valgrind]),
b4bab919 1743[ case $withval in
1744 yes)
1745 valgrind=1
1746 ;;
1747 no)
1748 valgrind=
1749 ;;
1750 *)
1751 CPPFLAGS="$CPPFLAGS -I${enableval}/include"
1752 valgrind=1
1753 ;;
1754 esac
1755 if test $valgrind; then
1756 AC_DEFINE(WITH_VALGRIND, 1, [Valgrind memory debugger support])
1757 echo "Valgrind debug support enabled"
1758 fi
1759])
1760
d96ceb8e 1761dnl Disable "memPools" code
1762AC_ARG_ENABLE(mempools,
e702812e
FC
1763 AC_HELP_STRING([--disable-mempools],
1764 [Disable memPools. Note that this option now simply sets the
1765 default behaviour. Specific classes can override this at runtime, and
1766 only lib/MemPool.c needs to be altered to change the squid-wide
1767 default for all classes.]),
d96ceb8e 1768[ if test "$enableval" = "no" ; then
1769 echo "memPools disabled"
6a9f6389 1770 AC_DEFINE(DISABLE_POOLS, 1, [Define if you have problems with memPools and want to disable Pools])
3e0dc9a8 1771 else
1772 AC_DEFINE(DISABLE_POOLS, 0, [Define if you have problems with memPools and want to disable Pools.])
d96ceb8e 1773 fi
3e0dc9a8 1774],
1775[ AC_DEFINE(DISABLE_POOLS, 0, [Define if you have problems with memPools and want to disable Pools.])
d96ceb8e 1776])
1777
0e657244 1778dnl Enable WIN32 Service compile mode
1779AC_ARG_ENABLE(win32-service,
e702812e
FC
1780 AC_HELP_STRING([--enable-win32-service],
1781 [Compile Squid as a WIN32 Service.
1782 Works only on MS-Windows platforms (NT and up).]),
0e657244 1783[ if test "$enableval" = "yes" ; then
1784 echo "Enabling WIN32 run service mode"
1785 AC_DEFINE(USE_WIN32_SERVICE,1,[Define Windows NT & Windows 2000 run service mode])
1786 fi
1787])
1788
b1485ff8 1789
2adff954 1790dnl Check for Cyrus SASL
1791if test "$require_sasl" = "yes"; then
1792 AC_CHECK_HEADERS(sasl/sasl.h sasl.h)
1793 if test "$ac_cv_header_sasl_sasl_h" = "yes"; then
1794 echo "using SASL2"
1795 LIBSASL="-lsasl2"
1796 else
1797 if test "$ac_cv_header_sasl_h" = "yes"; then
1798 echo "using SASL"
1799 LIBSASL="-lsasl"
1800 else
8b0d8e31 1801 AC_MSG_ERROR(Neither SASL nor SASL2 found)
2adff954 1802 fi
1803 fi
1804 AC_SUBST(LIBSASL)
1805fi
1806
3c573763 1807dnl Disable "unlinkd" code
fe0810ac 1808AC_ARG_ENABLE(unlinkd,
e702812e 1809 AC_HELP_STRING([--disable-unlinkd],[Do not use unlinkd]),
fe0810ac 1810[ if test "$enableval" = "no" ; then
3c573763 1811 use_unlinkd=no
fe0810ac 1812 else
3c573763 1813 use_unlinkd=yes
fe0810ac 1814 fi
1815],[
1816 # Here we should probably use some magic depending on the selected
1817 # storage models
3c573763 1818 use_unlinkd=yes
fe0810ac 1819])
3c573763 1820if test "$use_unlinkd" = "yes"; then
fe0810ac 1821 echo "unlinkd enabled"
6a9f6389 1822 AC_DEFINE(USE_UNLINKD,1,[Define this if unlinkd is required (strongly recommended for ufs storage type)])
a2794549 1823 AM_CONDITIONAL(ENABLE_UNLINKD, true)
fe0810ac 1824else
1825 echo "unlinkd disabled"
a2794549 1826 AM_CONDITIONAL(ENABLE_UNLINKD, false)
fe0810ac 1827fi
fe0810ac 1828
ce3d30fb 1829dnl Enable backtraces on fatal errors
1830AC_ARG_ENABLE(stacktraces,
e702812e
FC
1831 AC_HELP_STRING([--enable-stacktraces],
1832 [Enable automatic call backtrace on fatal errors]),
ce3d30fb 1833[ if test "$enableval" = "yes" ; then
1834 echo "Enabling automatic stack backtraces on fatal errors"
6a9f6389 1835 AC_DEFINE(PRINT_STACK_TRACE, 1,[Print stacktraces on fatal errors])
ce3d30fb 1836 fi
1837])
1838
88bfe092 1839AM_CONDITIONAL(ENABLE_XPROF_STATS, false)
1840dnl Enable USE_XPROF_STATS
1841AC_ARG_ENABLE(cpu-profiling,
e702812e
FC
1842 AC_HELP_STRING([--enable-cpu-profiling],
1843 [Enable instrumentation to try and understand how CPU power
1844 is spent by squid, by enabling specific probes in selected
1845 functions. New probes can only be added by modifying the source code.
1846 It is meant to help developers in optimizing performance
1847 of Squid internal functions.
1848 If you are not developer you shouldn't enable this,
1849 as it slows squid down somewhat. See lib/Profiler.c for more details.]),
88bfe092 1850[ if test "$enableval" = "yes" ; then
1851 echo "Enabling cpu-profiling"
6a9f6389 1852 AC_DEFINE(USE_XPROF_STATS, 1,[Define to enable CPU profiling within Squid])
88bfe092 1853 AM_CONDITIONAL(ENABLE_XPROF_STATS, true)
1854 fi
1855])
1856
f66a9ef4 1857dnl Enable X-Accelerator-Vary for Vary support within an accelerator setup
1858AC_ARG_ENABLE(x_accelerator_vary,
e702812e
FC
1859 AC_HELP_STRING([--enable-x-accelerator-vary],
1860 [Enable support for the X-Accelerator-Vary
1861 HTTP header. Can be used to indicate
1862 variance within an accelerator setup.
1863 Typically used together with other code
1864 that adds custom HTTP headers to the requests.]),
f66a9ef4 1865[ if test "$enableval" = "yes" ; then
1866 echo "Enabling support for X-Accelerator-Vary"
6a9f6389 1867 AC_DEFINE(X_ACCELERATOR_VARY, 1, [Enable support for the X-Accelerator-Vary HTTP header])
f66a9ef4 1868 fi
1869])
1870
cc192b50 1871dnl Enable IPv6 support
1872AC_MSG_CHECKING([whether to enable IPv6])
2c520d90 1873use_ipng=yes
cc192b50 1874AC_ARG_ENABLE(ipv6,
2c520d90 1875 AC_HELP_STRING([--disable-ipv6],[Disable IPv6 support]),
cc192b50 1876[ AC_MSG_RESULT(yes)
1877 AC_CACHE_CHECK([if PF_INET6 is available], $enableval,
1878 AC_TRY_RUN(
1879 [ /* PF_INET6 available check */
1880# include <sys/types.h>
1881# include <sys/socket.h>
1882 void main() {
1883 if (socket(PF_INET6, SOCK_STREAM, 0) < 0)
1884 exit(1);
1885 else
1886 exit(0);
1887 }
1888 ],
1889 [ AC_DEFINE(USE_IPV6,1,[Enable support for IPv6 ])
1890 AC_MSG_RESULT(yes)
7f85cca1 1891 use_ipng=yes
cc192b50 1892 ],
2c520d90
AJ
1893 [ AC_MSG_RESULT(no)
1894 use_ipng=no
cc192b50 1895 ])
1896 )
1897],
2c520d90
AJ
1898[ AC_MSG_RESULT(no)
1899 use_ipng=no
cc192b50 1900])
7f85cca1
AJ
1901
1902if test "$use_ipng" = "yes"; then
1903
48f05c97
AJ
1904dnl Check for IPv6 Windows Vista option
1905dnl Also useful for other OS with hybrid-stack defaults turned OFF
1906AC_DEFINE(IPV6_SPECIAL_V4MAPPED, 1, [Enable v4-mapping through v6 sockets])
1907
cc192b50 1908dnl Check for Windows XP option
1909AC_MSG_CHECKING([for IPv6 split-stack requirement])
1910AC_ARG_WITH(ipv6-split-stack,
e702812e
FC
1911 AC_HELP_STRING([--with-ipv6-split-stack],
1912 [Require IPv6 split-stack support. Requires IPv6 Support.]),
48f05c97
AJ
1913 [ AC_DEFINE(IPV6_SPECIAL_SPLITSTACK, 1, [Enable support for IPv6 on split-stack implementations])
1914 AC_DEFINE(IPV6_SPECIAL_V4MAPPED, 0, [Enable v4-mapping through v6 sockets. Requires IPv6 hybrid-stack.])
1915 AC_MSG_RESULT(yes)
1916 ],
7f85cca1 1917 [AC_DEFINE(IPV6_SPECIAL_SPLITSTACK, 0, [Enable support for IPv6 on split-stack implementations]) AC_MSG_RESULT(no)]
cc192b50 1918)
1919
2c520d90 1920dnl Check for IPv6-localhost option
cc192b50 1921AC_MSG_CHECKING([for IPv6-Localhost requirement])
1922AC_ARG_WITH(localhost-ipv6,
e702812e
FC
1923 AC_HELP_STRING([--with-localhost-ipv6],
1924 [WARNING: This is an RFC violation!
2c520d90 1925 Treat 127.0.0.1 and ::1 as identical and convert all inputs of localhost to ::1
e702812e
FC
1926 This depends on IPv6 support and all applications squid contacts
1927 via localhost being IPv6 enabled.]),
7f85cca1
AJ
1928 [AC_DEFINE(IPV6_SPECIAL_LOCALHOST, 1, [Convert IPv4-localhost requests to IPv6. Default: keep seperate.]) AC_MSG_RESULT(yes)],
1929 [AC_DEFINE(IPV6_SPECIAL_LOCALHOST, 0, [Convert IPv4-localhost requests to IPv6. Default: Keep seperate.]) AC_MSG_RESULT(no)]
cc192b50 1930)
7f85cca1 1931
2c520d90
AJ
1932else
1933 # NP: semi-silent failure as IPv4-only mode is perfectly usable on this system.
1934 echo "WARNING: IPv6 is not available on this system."
1935 AC_DEFINE(USE_IPV6,0,[Enable support for IPv6])
1936 AC_DEFINE(IPV6_SPECIAL_SPLITSTACK,0,[Enable support for IPv6 on split-stack implementations])
1937 AC_DEFINE(IPV6_SPECIAL_LOCALHOST,0,[Convert IPv4-localhost requests to IPv6. Default: Keep seperate.])
1938 AC_DEFINE(IPV6_SPECIAL_V4MAPPED,0,[Enable v4-mapping through v6 sockets])
cc192b50 1939fi
1940
7172612f 1941AC_ARG_ENABLE(zph-qos,
e702812e 1942 AC_HELP_STRING([--enable-zph-qos],[Enable ZPH QOS support]),
7172612f
AJ
1943[ if test "$enableval" = "yes" ; then
1944 echo "ZPH QOS enabled"
1945 AC_DEFINE(USE_ZPH_QOS,1,
1946 [ Define this to use Squid's ZPH (Zero Penalty Hit) QOS features.
1947 When enabled, Squid will alter TOS field of HIT responses for better QOS on intermediate routing/shaping devices.])
1948 fi
1949])
1950
8c37ea44
AJ
1951dnl Check whether this OS defines ss_len as a member of sockaddr_storage
1952AC_CACHE_CHECK([for ss_len field in struct sockaddr_storage],
1953 ac_cv_have_ss_len_in_struct_ss, [
1954 AC_TRY_COMPILE([
1955#include <sys/types.h>
1956#include <sys/socket.h>
cda4116f 1957#include <netinet/in.h>
8c37ea44
AJ
1958 ],
1959 [ struct sockaddr_storage s; s.ss_len = 1; ],
1960 [ ac_cv_have_ss_len_in_struct_ss="yes" ],
1961 [ ac_cv_have_ss_len_in_struct_ss="no" ]
1962 )
1963])
1964if test "x$ac_cv_have_ss_len_in_struct_ss" = "xyes" ; then
1965 AC_DEFINE(HAVE_SS_LEN_IN_SS, 1, [Does struct sockaddr_storage have ss_len? 1: Yes, 0: No])
1966else
1967 AC_DEFINE(HAVE_SS_LEN_IN_SS, 0, [Does struct sockaddr_storage have ss_len? 1: Yes, 0: No])
1968fi
1969
1970dnl Check whether this OS defines sin_len as a member of sockaddr_in as a backup to ss_len
1971AC_CACHE_CHECK([for sin_len field in struct sockaddr_in],
1972 ac_cv_have_sin_len_in_struct_sai, [
1973 AC_TRY_COMPILE([
1974#include <sys/types.h>
1975#include <sys/socket.h>
1976 ],
1977 [ struct sockaddr_in s; s.sin_len = 1; ],
1978 [ ac_cv_have_sin_len_in_struct_sai="yes" ],
1979 [ ac_cv_have_sin_len_in_struct_sai="no" ]
1980 )
1981])
1982if test "x$ac_cv_have_sin_len_in_struct_sai" = "xyes" ; then
1983 AC_DEFINE(HAVE_SIN_LEN_IN_SAI, 1, [Does struct sockaddr_in have sin_len? 1: Yes, 0: No])
1984else
1985 AC_DEFINE(HAVE_SIN_LEN_IN_SAI, 0, [Does struct sockaddr_in have sin_len? 1: Yes, 0: No])
1986fi
1987
1988dnl Check whether this OS defines sin6_len as a member of sockaddr_in6 as a backup to ss_len
1989AC_CACHE_CHECK([for sin6_len field in struct sockaddr_in6],
1990 ac_cv_have_sin6_len_in_struct_sai, [
1991 AC_TRY_COMPILE([
1992#include <sys/types.h>
1993#include <sys/socket.h>
1994 ],
1995 [ struct sockaddr_in6 s; s.sin6_len = 1; ],
1996 [ ac_cv_have_sin6_len_in_struct_sai="yes" ],
1997 [ ac_cv_have_sin6_len_in_struct_sai="no" ]
1998 )
1999])
2000if test "x$ac_cv_have_sin6_len_in_struct_sai" = "xyes" ; then
2001 AC_DEFINE(HAVE_SIN6_LEN_IN_SAI, 1, [Does struct sockaddr_in6 have sin6_len? 1: Yes, 0: No])
2002else
2003 AC_DEFINE(HAVE_SIN6_LEN_IN_SAI, 0, [Does struct sockaddr_in6 have sin6_len? 1: Yes, 0: No])
2004fi
2005
bae9832d 2006
f49be7d1 2007AC_ARG_WITH(filedescriptors,
e702812e
FC
2008 AC_HELP_STRING([--with-filedescriptors=NUMBER],
2009 [Force squid to support NUMBER filedescriptors]),
8b0d8e31
AJ
2010[
2011 case ${withval} in
2012 [[0-9]]*)
2013 squid_filedescriptors_num=$withval
2014 ;;
2015 *)
2016 AC_MSG_ERROR(--with-filedescriptors expects a numeric argument)
2017 ;;
2018 esac
2019])
f49be7d1 2020
8b5e106b 2021AC_PATH_PROG(CPPUNITCONFIG, cppunit-config, false)
2022if $CPPUNITCONFIG --help >/dev/null; then
f5691f9c 2023 echo "using system installed cppunit"
8b5e106b 2024 SQUID_CPPUNIT_LIBS="`$CPPUNITCONFIG --libs`"
2025 SQUID_CPPUNIT_LA=''
2026 SQUID_CPPUNIT_INC="`$CPPUNITCONFIG --cflags`"
2027else
f646b959 2028 echo "cppunit does not appear to be installed. squid does not require this, but code testing with 'make check' will fail."
63d03edb 2029 SQUID_CPPUNIT_LA=''
2030 SQUID_CPPUNIT_LIBS=''
2031 SQUID_CPPUNIT_INC=''
f5691f9c 2032fi
8b5e106b 2033
f5691f9c 2034AC_ARG_WITH(cppunit-basedir,
2035[ --with-cppunit-basedir=/path/to/cppunit-base
2036 Path where the cppunit headers are libraries are found
63d03edb 2037 for unit testing.
f5691f9c 2038 ],
2039[ if test -f $withval/include/cppunit/TestCase.h; then
2040 echo "Using cppunit includes from $withval"
2041 SQUID_CPPUNIT_INC="-I${withval}/include"
2042 else
8b0d8e31 2043 AC_MSG_ERROR(Cannot find cppunit at $withval)
f5691f9c 2044 fi
2045 if test -f $withval/lib/libcppunit.la; then
2046 echo "Using cppunit lib from $withval"
549b1e60 2047 SQUID_CPPUNIT_LA="${withval}/lib/libcppunit.la"
8b5e106b 2048 SQUID_CPPUNIT_LIBS='$(SQUID_CPPUNIT_LA)'
f5691f9c 2049 else
8b0d8e31 2050 AC_MSG_ERROR(Cannot find cppunit at $withval)
f5691f9c 2051 exit 1
2052 fi
f5691f9c 2053])
8b5e106b 2054AC_SUBST(SQUID_CPPUNIT_LIBS)
f5691f9c 2055AC_SUBST(SQUID_CPPUNIT_LA)
2056AC_SUBST(SQUID_CPPUNIT_INC)
f5691f9c 2057
fd9aaa3e 2058# Force some compilers to use ANSI features
2059#
2060case "$host" in
2061 alpha-dec-osf*)
2062 if test "$ac_cv_prog_CC" = "cc" ; then
2063 echo "adding '-std1' to cc args for $host"
2064 CC="cc -std1";
2065 ac_cv_prog_CC="$CC"
2066 fi
2067 ;;
c68e9c6b 2068 *-hp-hpux*)
2069 if test "$ac_cv_prog_CC" = "cc" ; then
2070 echo "adding '-Ae' to cc args for $host"
2071 CC="cc -Ae";
2072 ac_cv_prog_CC="$CC"
2073 fi
2074 ;;
fd9aaa3e 2075esac
2076
090089c4 2077dnl Check for programs
2078AC_PROG_CPP
2079AC_PROG_INSTALL
090089c4 2080AC_PROG_LN_S
81280a96 2081AC_PATH_PROG(SH, sh, /bin/sh)
d9f67e6f 2082AC_PATH_PROG(FALSE, false, /usr/bin/false)
2083AC_PATH_PROG(TRUE, true, /usr/bin/true)
2084AC_PATH_PROG(RM, rm, $FALSE)
2085AC_PATH_PROG(MV, mv, $FALSE)
2086AC_PATH_PROG(MKDIR, mkdir, $FALSE)
090089c4 2087AC_PATH_PROG(LN, ln, cp)
4e9d8e26 2088AC_PATH_PROG(PERL, perl, none)
a2794549 2089dnl automake handles this AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
6ad85e8a 2090AC_PATH_PROG(AR, ar, $FALSE)
2091
4e9d8e26 2092if test "$ac_cv_path_PERL" = "none"; then
2093 echo "Perl is required to compile Squid"
2094 echo "Please install Perl and then re-run configure"
2095 exit 1
2096fi
2097
6ad85e8a 2098case "$host" in
2099 *-hp-hpux*)
2100 echo "Disabling 'ranlib' for HP-UX..."
2101 RANLIB=":"
2102 ;;
2103esac
2104
2105dnl set $(AR)
2106AR_R="$AR r"
2107case "$host" in
2108 *-next-nextstep3)
2109 AR="libtool -o"
2110 ;;
2111esac
2112AC_SUBST(AR_R)
090089c4 2113
2114dnl Check for headers
2115AC_HEADER_DIRENT
2116AC_HEADER_STDC
db40ae20 2117
2118AC_CHECK_HEADERS( \
db40ae20 2119 arpa/inet.h \
30a4f2a8 2120 arpa/nameser.h \
9441aa34 2121 assert.h \
db40ae20 2122 bstring.h \
db40ae20 2123 crypt.h \
30a4f2a8 2124 ctype.h \
2125 errno.h \
ce3d30fb 2126 execinfo.h \
db40ae20 2127 fcntl.h \
42ad37af 2128 fnmatch.h \
9c1d8929 2129 getopt.h \
52303a3d 2130 glob.h \
88738790 2131 gnumalloc.h \
30a4f2a8 2132 grp.h \
5cafc1d6 2133 ip_compat.h \
42b51993 2134 ip_fil_compat.h \
5cafc1d6 2135 ip_fil.h \
2136 ip_nat.h \
dbc5782a 2137 ipl.h \
30a4f2a8 2138 libc.h \
6ad85e8a 2139 limits.h \
30a4f2a8 2140 malloc.h \
e0bddc45 2141 math.h \
db40ae20 2142 memory.h \
b075cbb1 2143 mount.h \
30a4f2a8 2144 netdb.h \
db40ae20 2145 netinet/in.h \
cc192b50 2146 netinet/in_systm.h \
42b51993 2147 netinet/ip_fil_compat.h \
1f7c9178 2148 openssl/err.h \
2149 openssl/md5.h \
2150 openssl/ssl.h \
cc192b50 2151 netinet/tcp.h \
a7ad6e4e 2152 openssl/engine.h \
4da086c4 2153 paths.h \
dcfe6390 2154 poll.h \
30a4f2a8 2155 pwd.h \
b5e4d7d4 2156 shadow.h \
30a4f2a8 2157 regex.h \
c68e9c6b 2158 sched.h \
30a4f2a8 2159 signal.h \
2160 stdarg.h \
2161 stddef.h \
2162 stdio.h \
db40ae20 2163 stdlib.h \
2164 string.h \
2165 strings.h \
0a4e8536 2166 sys/bitypes.h \
f9576890 2167 sys/bswap.h \
2168 sys/endian.h \
db40ae20 2169 sys/file.h \
5cafc1d6 2170 sys/ioctl.h \
30a4f2a8 2171 sys/param.h \
62ae0622 2172 sys/prctl.h \
3d4022fa 2173 sys/md5.h \
77e4c0c9 2174 sys/msg.h \
30a4f2a8 2175 sys/resource.h \
db40ae20 2176 sys/select.h\
30a4f2a8 2177 sys/socket.h \
2178 sys/stat.h \
b075cbb1 2179 sys/statvfs.h \
3c641669 2180 syscall.h \
30a4f2a8 2181 sys/syscall.h \
db40ae20 2182 sys/time.h \
2183 sys/types.h \
30a4f2a8 2184 sys/un.h \
b075cbb1 2185 sys/vfs.h \
30a4f2a8 2186 sys/wait.h \
db40ae20 2187 syslog.h \
30a4f2a8 2188 time.h \
2189 unistd.h \
3c641669 2190 utime.h \
30a4f2a8 2191 varargs.h \
77d6bd88 2192 byteswap.h \
2193 glib.h \
60d096f4 2194 stdint.h \
2195 inttypes.h \
3c641669 2196 grp.h \
2197 nss_common.h \
94331f58 2198 nss.h \
2199 db.h \
329ce686 2200 db_185.h \
2201 sys/capability.h
db40ae20 2202)
2203
fc68f6b1 2204AC_CHECK_HEADERS(
2205 linux/netfilter_ipv4.h \
2206 linux/netfilter_ipv4/ip_tproxy.h \
2207,,,
dcd1dc78 2208SQUID_DEFAULT_INCLUDES
2209#if HAVE_LIMITS_H
2210#include <limits.h>
2211#endif
a74968c2
AJ
2212/* Netfilter ip(6)tables v1.4.0 has broken headers */
2213#if HAVE_NETINET_IN_H
2214#include <netinet/in.h>
2215#endif
dcd1dc78 2216)
2217
d1e5191e 2218dnl *BSD dont include the depenencies for all their net/ and netinet/ files
c92b4732 2219dnl We must include a few basic type headers for them to work.
d1e5191e
AJ
2220AC_CHECK_HEADERS( \
2221 net/if.h \
5a3237b0 2222 netinet/if_ether.h\
d1e5191e
AJ
2223 netinet/icmp6.h \
2224 netinet/ip.h \
2225 netinet/ip6.h \
5a3237b0 2226 netinet/ip_compat.h\
2227 netinet/ip_fil.h\
d1e5191e 2228 netinet/ip_icmp.h \
77e4c0c9 2229 netinet/ip_nat.h\
dbc5782a 2230 netinet/ipl.h \
d1e5191e 2231 net/pfvar.h \
77e4c0c9 2232 sys/mount.h\
d1e5191e
AJ
2233 resolv.h \
2234,,,
2235SQUID_BSDNET_INCLUDES)
5a3237b0 2236
a1559187 2237AC_CHECK_HEADERS([libxml/parser.h], [], [
2238 SAVED_CPPFLAGS="$CPPFLAGS"
2239 CPPFLAGS="-I/usr/include/libxml2 $CPPFLAGS"
2240 unset ac_cv_header_libxml_parser_h
2241 AC_CHECK_HEADERS([libxml/parser.h], [], [
2242 CPPFLAGS="$SAVED_CPPFLAGS"
2243 ])
2244 ])
2245
aee0606f 2246AC_C_CONST
d57288d2 2247AC_C_BIGENDIAN
aee0606f 2248
6a9f6389 2249AC_STRUCT_TM
2250AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
2251#if TM_IN_SYS_TIME
2252#if HAVE_SYS_TIME_H
2253#include <sys/time.h>
2254#endif
2255#elif HAVE_TIME_H
2256#include <time.h>
2257#endif
5c51415d 2258])
46c883ed 2259
6a9f6389 2260AC_CHECK_TYPE(struct mallinfo,AC_DEFINE(HAVE_STRUCT_MALLINFO,1,[The system provides struct mallinfo]),,[
2261#if HAVE_SYS_TYPES_H
2262#include <sys/types.h>
2263#endif
eb824054 2264#if HAVE_MALLOC_H
2265#include <malloc.h>
6a9f6389 2266#endif])
eb824054 2267
6a9f6389 2268AC_CHECK_MEMBERS([struct mallinfo.mxfast],,,[
2269#if HAVE_SYS_TYPES_H
2270#include <sys/types.h>
2271#endif
2272#if HAVE_MALLOC_H
2273#include <malloc.h>
2274#endif])
090089c4 2275
08caf8c6 2276dnl Override rusage() detect on MinGW because is emulated in source code
2277case "$host_os" in
2278 mingw|mingw32)
2279 AC_DEFINE(HAVE_STRUCT_RUSAGE)
2280 ac_cv_func_getrusage='yes'
d750d7bf 2281 echo "Using own rusage on Windows."
08caf8c6 2282 ;;
2283 *)
2284 AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
8ff51bba 2285#if HAVE_SYS_TIME_H
2286#include <sys/time.h>
2287#endif
b54a6789 2288#if HAVE_SYS_RESOURCE_H
2289#include <sys/resource.h>
6a9f6389 2290#endif])
08caf8c6 2291 ;;
2292esac
b54a6789 2293
6a9f6389 2294AC_CHECK_MEMBERS([struct iphdr.ip_hl],,,[
2295#if HAVE_SYS_TYPES_H
2296#include <sys/types.h>
2297#endif
a025a745 2298#include <netinet/in.h>
2299#include <netinet/in_systm.h>
6ad85e8a 2300#include <netinet/ip.h>
b05490a8 2301#if defined (__linux__) || defined (__CYGWIN__)
6ad85e8a 2302#define ip_hl ihl
2303#endif
2304#ifndef __linux__
b05490a8 2305#ifndef __CYGWIN__
6ad85e8a 2306#define iphdr ip
b05490a8 2307#endif
6a9f6389 2308#endif])
a025a745 2309
090089c4 2310dnl Check for typedefs
77d6bd88 2311AC_CHECK_SIZEOF(void *)
090089c4 2312
0409a509 2313dnl 8 bit integers - int8_t
2314dnl if this is defined we trust it to be 8 bits
2315AC_CHECK_TYPE(int8_t,[
2316 AC_CHECK_SIZEOF(int8_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2317 AC_DEFINE(HAVE_INT8_T,1,[int8_t is defined in system headers])
2318 ],,SQUID_DEFAULT_INCLUDES)
2319
2320dnl fallback #1
2321AC_CHECK_TYPE(char,[
2322 AC_CHECK_SIZEOF(char,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2323 AC_DEFINE(HAVE_CHAR,1,[char is defined in system headers])
2324 ],,SQUID_DEFAULT_INCLUDES)
2325
2326dnl unsigned 8 bit ints - u_int8_t
2327dnl if this is defined we trust it to be 8 bits
2328AC_CHECK_TYPE(u_int8_t,[
2329 AC_CHECK_SIZEOF(u_int8_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2330 AC_DEFINE(HAVE_U_INT8_T,1,[u_int8_t is defined in system headers])
2331 ],,SQUID_DEFAULT_INCLUDES)
2332
2333dnl fallback #1
2334dnl if this is defined we trust it to be 8 bits
2335AC_CHECK_TYPE(uint8_t,[
2336 AC_CHECK_SIZEOF(uint8_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2337 AC_DEFINE(HAVE_UINT8_T,1,[uint8_t is defined in system headers])
2338 ],,SQUID_DEFAULT_INCLUDES)
2339
2340dnl 16 bit integers - int16_t
6a9f6389 2341dnl if this is defined we trust it to be 16 bits
62266438 2342AC_CHECK_TYPE(int16_t,[
2343 AC_CHECK_SIZEOF(int16_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2344 AC_DEFINE(HAVE_INT16_T,1,[int16_t is defined in system headers])
2345 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2346
2347dnl fallback #1
2348AC_CHECK_TYPE(short,[
856e69c5 2349 AC_CHECK_SIZEOF(short,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2350 AC_DEFINE(HAVE_SHORT,1,[short is defined in system headers])
2351 ],,SQUID_DEFAULT_INCLUDES)
2352
2353dnl fallback #2
2354AC_CHECK_TYPE(int,[
856e69c5 2355 AC_CHECK_SIZEOF(int,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2356 AC_DEFINE(HAVE_INT,1,[int is defined in system headers])
2357 ],,SQUID_DEFAULT_INCLUDES)
2358
2359dnl unsigned 16 bit ints - u_int16_t
2360dnl if this is defined we trust it to be 16 bits
62266438 2361AC_CHECK_TYPE(u_int16_t,[
2362 AC_CHECK_SIZEOF(u_int16_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2363 AC_DEFINE(HAVE_U_INT16_T,1,[u_int16_t is defined in system headers])
2364 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2365
2366dnl fallback #1
2367dnl if this is defined we trust it to be 16 bits
62266438 2368AC_CHECK_TYPE(uint16_t,[
2369 AC_CHECK_SIZEOF(uint16_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2370 AC_DEFINE(HAVE_UINT16_T,1,[uint16_t is defined in system headers])
2371 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2372
2373dnl 32 bit signed int - int32_t
2374dnl if this is defined we trust it to be 32 bits
62266438 2375AC_CHECK_TYPE(int32_t,[
2376 AC_CHECK_SIZEOF(int32_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2377 AC_DEFINE(HAVE_INT32_T,1,[int32_t is defined in system headers])
2378 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2379
2380dnl fallback #1
2381AC_CHECK_TYPE(long,[
856e69c5 2382 AC_CHECK_SIZEOF(long,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2383 AC_DEFINE(HAVE_LONG,1,[long is defined in system headers])
2384 ],,SQUID_DEFAULT_INCLUDES)
2385
2386dnl 32 bit unsigned int - u_int32_t
2387dnl if this is defined we trust it to be 32 bits
62266438 2388AC_CHECK_TYPE(u_int32_t,[
2389 AC_CHECK_SIZEOF(u_int32_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2390 AC_DEFINE(HAVE_U_INT32_T,1,[u_int32_t is defined in system headers])
2391 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2392
2393dnl fallback #1
2394dnl if this is defined we trust it to be 32 bits
62266438 2395AC_CHECK_TYPE(uint32_t,[
2396 AC_CHECK_SIZEOF(uint32_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2397 AC_DEFINE(HAVE_UINT32_T,1,[uint32_t is defined in system headers])
2398 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2399
2400dnl 64 bit signed - int64_t
2401dnl if this is defind we trust it to be 64 bits
62266438 2402AC_CHECK_TYPE(int64_t,[
2403 AC_CHECK_SIZEOF(int64_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2404 AC_DEFINE(HAVE_INT64_T,1,[int64_t is defined in system headers])
2405 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2406
2407dnl fallback #1
2408dnl if this is defind we trust it to be 64 bits
62266438 2409AC_CHECK_TYPE(__int64,[
2410 AC_CHECK_SIZEOF(__int64,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2411 AC_DEFINE(HAVE___INT64,1,[__int64 is defined in system headers])
2412 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2413
2414dnl fallback #2
2415AC_CHECK_TYPE(long long,[
856e69c5 2416 AC_CHECK_SIZEOF(long long,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2417 AC_DEFINE(HAVE_LONG_LONG,1,[long long is defined in system headers])
2418 ],,SQUID_DEFAULT_INCLUDES)
2419
2420dnl 64 bit unsigned - u_int64_t
2421dnl if this is defind we trust it to be 64 bits
62266438 2422AC_CHECK_TYPE(u_int64_t,[
2423 AC_CHECK_SIZEOF(u_int64_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2424 AC_DEFINE(HAVE_U_INT64_T,1,[u_int64_t is defined in system headers])
2425 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2426
2427dnl fallback #1
2428dnl if this is defind we trust it to be 64 bits
62266438 2429AC_CHECK_TYPE(uint64_t,[
2430 AC_CHECK_SIZEOF(uint64_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2431 AC_DEFINE(HAVE_UINT64_T,1,[uint64_t is defined in system headers])
2432 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2433
588e71df 2434dnl On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
2435dnl that is incompatible with the updated Solaris header files.
2436dnl For this reason, we must check if pad128_t and upad128_t are defined.
2437AC_CHECK_TYPE(pad128_t,
2438 AC_DEFINE(HAVE_PAD128_T,1,[pad128_t is defined in system headers]),
2439 ,SQUID_DEFAULT_INCLUDES)
2440
2441AC_CHECK_TYPE(upad128_t,
2442 AC_DEFINE(HAVE_UPAD128_T,1,[upad128_t is defined in system headers]),
2443 ,SQUID_DEFAULT_INCLUDES)
2444
6a9f6389 2445AC_CHECK_TYPE(pid_t, AC_DEFINE(HAVE_PID_T,1,[pid_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
856e69c5 2446AC_CHECK_TYPE(size_t, [AC_CHECK_SIZEOF(size_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2447 AC_DEFINE(HAVE_SIZE_T,1,[size_t is defined by the system headers])],,SQUID_DEFAULT_INCLUDES)
2448AC_CHECK_TYPE(ssize_t, AC_DEFINE(HAVE_SSIZE_T,1,[ssize_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
856e69c5 2449AC_CHECK_TYPE(off_t,[ AC_CHECK_SIZEOF(off_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2450 AC_DEFINE(HAVE_OFF_T,1,[off_t is defined by the system headers])],,SQUID_DEFAULT_INCLUDES)
2451AC_CHECK_TYPE(mode_t, AC_DEFINE(HAVE_MODE_T,1,[mode_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2452AC_CHECK_TYPE(fd_mask, AC_DEFINE(HAVE_FD_MASK,1,[fd_mask is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
adcceb47 2453
77d6bd88 2454dnl Check for special functions
2455AC_FUNC_ALLOCA
2456
6a9f6389 2457AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the system headers]),,[
2458#include <sys/types.h>
6637e3a5 2459#include <sys/socket.h>
2460#if STDC_HEADERS
2461#include <stdlib.h>
2462#include <stddef.h>
6a9f6389 2463#endif])
6637e3a5 2464
6a9f6389 2465AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,[mtyp_t is defined by the system headers]),,[#include <sys/types.h>
aea1be68 2466#include <sys/ipc.h>
6a9f6389 2467#include <sys/msg.h>])
aea1be68 2468
090089c4 2469dnl Check for needed libraries
30a4f2a8 2470AC_CHECK_LIB(nsl, main)
6716b242 2471AC_CHECK_LIB(socket, main)
bfe8dedf 2472dnl Check for Winsock only on MinGW, on Cygwin we must use emulated BSD socket API
4b26fae9 2473case "$host_os" in
2474 mingw|mingw32)
2475 AC_MSG_CHECKING(for winsock)
2476 save_LIBS="$LIBS"
2477 for curlib in ws2_32 wsock32; do
2478 LIBS="$LIBS -l$curlib"
2479 AC_TRY_LINK([
2480 char __attribute__((stdcall)) socket(int,int,int);
2481 char __attribute__((stdcall)) select(int,int,int,int,int);
2482 char __attribute__((stdcall)) closesocket(int);
2483 char __attribute__((stdcall)) gethostname(int,int);
2484 ],
2485 [
2486 socket(1,2,3);
2487 select(1,2,3,4,5);
2488 closesocket(1);
2489 gethostname(1,2);
2490 ],
2491 have_winsock=yes, have_winsock=no)
2492
2493 if test $have_winsock = yes; then
2494 ac_cv_func_select='yes'
2495 if test $curlib = ws2_32; then
2496 have_winsock=winsock2
2497 fi
2498 break
2499 fi
2500 LIBS="$save_LIBS"
2501 done
2502 AC_MSG_RESULT($have_winsock)
bfe8dedf
GS
2503 if test $have_winsock = winsock2; then
2504 AC_CHECK_HEADERS(winsock2.h)
2505 else
2506 AC_CHECK_HEADERS(winsock.h)
2507 fi
4b26fae9 2508 ;;
2509esac
94d48591 2510
3c641669 2511dnl Ripped from the Samba sources
2512AC_CACHE_CHECK([for unix domain sockets],squid_cv_unixsocket, [
2513 AC_TRY_COMPILE([
2514#include <sys/types.h>
2515#include <stdlib.h>
2516#include <stddef.h>
2517#include <sys/socket.h>
2518#include <sys/un.h>],
2519[
2520 struct sockaddr_un sunaddr;
2521 sunaddr.sun_family = AF_UNIX;
2522],
2523 squid_cv_unixsocket=yes,squid_cv_unixsocket=no)])
2524if test x"$squid_cv_unixsocket" = x"yes"; then
6a9f6389 2525 AC_DEFINE(HAVE_UNIXSOCKET,1,[Do we have unix sockets? (required for the winbind ntlm helper])
3c641669 2526fi
2527dnl end rip
2528
94d48591 2529 AC_CHECK_LIB(gnumalloc, main)
2530 if test "$ac_cv_lib_gnumalloc_main" = "yes"; then
2531 echo "Disabling extended malloc functions when using gnumalloc"
2532 ac_cv_func_mallinfo=no
2533 ac_cv_func_mallocblksize=no
2534 ac_cv_func_mallopt=no
2535 else
2536 case "$host" in
2537 *-sun-solaris*)
2538 echo "skipping libmalloc check for $host"
2539 ;;
2540 i386-*-freebsd*)
2541 echo "skipping libmalloc check for $host"
2542 ;;
2543 *)
2544
2545 AC_CHECK_LIB(malloc, main)
2546 ;;
2547 esac
2548 fi
94d48591 2549
6716b242 2550AC_CHECK_LIB(bsd, main)
be79ade0 2551AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"])
04a56fa3 2552AC_CHECK_LIB(bind, gethostbyname)
2553if test $ac_cv_lib_bind_gethostbyname = "no" ; then
2554 case "$host" in
78743365 2555 i386-*-freebsd*)
2556 echo "skipping libresolv checks for $host"
2557 ;;
2558 *)
78743365 2559 AC_CHECK_LIB(resolv, main)
2560 ;;
04a56fa3 2561 esac
2562fi
08caf8c6 2563case "$host_os" in
2564mingw|mingw32)
2565 echo "Use MSVCRT for math functions."
2566 ;;
2567 *)
2568 AC_CHECK_LIB(m, main)
2569 ;;
2570esac
090089c4 2571
2572dnl Check for libcrypt
8154dd82 2573dnl Some of our helpers use crypt(3) which may be in libc, or in
2574dnl libcrypt (eg FreeBSD)
c1dc012a 2575AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
3d4022fa 2576
2577dnl Solaris10 provides MD5 natively through libmd5
c1dc012a 2578AC_CHECK_LIB(md5, MD5Init, [CRYPTLIB="$CRYPTLIB -lmd5"])
3d4022fa 2579
be79ade0 2580AC_SUBST(CRYPTLIB)
77f675ad 2581
042b1f8a 2582dnl Check for libdl, used by auth_modules/PAM
8154dd82 2583if test "$with_dl" = "yes"; then
2584 AC_CHECK_LIB(dl, dlopen)
2585fi
042b1f8a 2586
e5f4e1b0 2587dnl Check for pthreads
2588dnl We use pthreads when doing ASYNC I/O
8154dd82 2589if test "$with_pthreads" = "yes"; then
fa035612 2590 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
2591 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
e685e3c6 2592 case "$host" in
2593 i386-unknown-freebsd*)
2594 if test "$GCC" = "yes" ; then
2595 if test -z "$PRESET_LDFLAGS"; then
2596 LDFLAGS="$LDFLAGS -pthread"
2597 fi
2598 fi
2599 ;;
2600 *-solaris2.*)
2601 if test "$GCC" = "yes" ; then
fa035612 2602 SQUID_CFLAGS="$SQUID_CFLAGS -pthreads"
2603 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -pthreads"
e685e3c6 2604 else
fa035612 2605 SQUID_CFLAGS="$SQUID_CFLAGS -mt"
2606 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -mt"
e685e3c6 2607 fi
2608 ;;
2609 esac
8154dd82 2610 AC_CHECK_LIB(pthread, main)
2611fi
71f8abc8 2612
f85c88f3 2613dnl Check for librt
2614dnl We use AIO in the coss store
8154dd82 2615if test "$with_aio" = "yes"; then
580e2134 2616 dnl On some systems POSIX AIO functions are in libaio
2617 AC_CHECK_LIB(rt, aio_read,,AC_CHECK_LIB(aio, aio_read))
8154dd82 2618fi
f85c88f3 2619
86ec11aa 2620dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
2621dnl Robert Side <rside@aiinc.bc.ca>
2622dnl Mon, 18 Jan 1999 17:48:00 GMT
2623case "$host" in
2624 *-pc-sco3.2*)
2625 AC_CHECK_LIB(intl, strftime)
2626 ;;
2627esac
2628
20e869bf 2629dnl On MinGW OpenLDAP is not available, so LDAP helpers can be linked
2630dnl only with Windows LDAP libraries using -lwldap32
2631case "$host_os" in
2632mingw|mingw32)
2633 LIB_LDAP="-lwldap32"
2634 LIB_LBER=""
2635 ;;
2636*)
2637 LIB_LDAP="-lldap"
2638 dnl LDAP helpers need to know if -llber is needed or not
2639 AC_CHECK_LIB(lber, main, [LIB_LBER="-llber"])
2640 ;;
2641esac
2642AC_SUBST(LIB_LDAP)
2643AC_SUBST(LIB_LBER)
2644
b7a1c19e 2645dnl Check for libdb
2646DBLIB=
01b4931d 2647dnl 1.85
a258dfca 2648AC_CACHE_CHECK(if dbopen needs -ldb,ac_cv_dbopen_libdb, [
32d0bbd7 2649SAVED_LIBS="$LIBS"; LIBS="$LIBS -ldb"
2650 AC_TRY_LINK([
a258dfca 2651#if HAVE_SYS_TYPES_H
2652#include <sys/types.h>
2653#endif
2654#if HAVE_LIMITS_H
2655#include <limits.h>
2656#endif
2657#if HAVE_DB_185_H
2658#include <db_185.h>
2659#elif HAVE_DB_H
2660#include <db.h>
2661#endif],
2662 [dbopen((void *)0L, 0, 0, DB_HASH, (void *)0L)],
a258dfca 2663 ac_cv_dbopen_libdb="yes",
2664 ac_cv_dbopen_libdb="no")
32d0bbd7 2665LIBS="$SAVED_LIBS"
a258dfca 2666])
2b2161bb 2667if test $ac_cv_dbopen_libdb = yes; then
32d0bbd7 2668 LIB_DB="-ldb"
2669fi
01b4931d 2670AC_SUBST(LIB_DB)
b7a1c19e 2671
77f675ad 2672dnl System-specific library modifications
2673dnl
2674case "$host" in
88738790 2675 i386-*-solaris2.*)
7149a49f 2676 if test "$GCC" = "yes"; then
2677 echo "Removing -O for gcc on $host"
80e92d6d 2678 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
7149a49f 2679 fi
2680 ;;
77f675ad 2681 *-sgi-irix*)
2682 echo "Removing -lsocket for IRIX..."
6716b242 2683 LIBS=`echo $LIBS | sed -e s/-lsocket//`
77f675ad 2684 echo "Removing -lnsl for IRIX..."
6716b242 2685 LIBS=`echo $LIBS | sed -e s/-lnsl//`
c415c128 2686 ac_cv_lib_nsl_main=no
b44c0fb4 2687 echo "Removing -lbsd for IRIX..."
2688 LIBS=`echo $LIBS | sed -e s/-lbsd//`
77f675ad 2689 ;;
4ba0bd0e 2690dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
2691dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
2692dnl Please change your configure script. AIX doesn't need -lbsd.
2693 *-ibm-aix*)
2694 echo "Removing -lbsd for AIX..."
2695 LIBS=`echo $LIBS | sed -e s/-lbsd//`
2696 ;;
30a4f2a8 2697 *m88k*)
fa035612 2698 SQUID_CFLAGS="$SQUID_CFLAGS -D_SQUID_MOTOROLA_"
2699 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_SQUID_MOTOROLA_"
6a9f6389 2700 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1,[If gettimeofday is known to take only one argument])
7149a49f 2701 ;;
580ce039 2702 [*-*-solaris2.[0-4]])
6a9f6389 2703 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
30a4f2a8 2704 ;;
711fa75e 2705 [*-sony-newsos[56]*])
6a9f6389 2706 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
f62c73dc 2707 ;;
77f675ad 2708esac
090089c4 2709
57faa85a 2710# Remove optimization for GCC 2.95.[123]
d20b1cd0 2711# gcc -O[2] on *BSD and Linux (x86) causes pointers to magically become NULL
2712if test "$GCC" = "yes"; then
2713 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
2714 case "$GCCVER" in
57faa85a 2715 [2.95.[123]])
d20b1cd0 2716 echo "Removing -O for gcc on $host with GCC $GCCVER"
2717 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
2718 ;;
2719 esac
2720fi
2721
176d10ee 2722# Recommended by Balint Nagy Endre <bne@CareNet.hu>
2723case "$host" in
2724 *-univel-sysv4.2MP)
2725 if test `uname -v` = "2.03"; then
2726 echo "disabling mallinfo for $host"
2727 ac_cv_func_mallinfo=no
2728 fi
2729 ;;
2730esac
2731
84cecfd2 2732dnl This has to be before AC_CHECK_FUNCS
2733# Disable poll() on certain platforms. Override by setting ac_cv_func_poll
2734# when running configure.
2735if test -z "$ac_cv_func_poll"; then
2736 case "$host" in
2737 [alpha-dec-osf3.*])
2738 # John Kay (jkay@nlanr.net) 19970818
2739 echo "disabling poll for $host..."
2740 ac_cv_func_poll='no'
2741 ;;
2742 [*-hp-hpux*.*])
2743 # Duane Wessels
2744 echo "disabling poll for $host..."
2745 ac_cv_func_poll='no'
2746 ;;
2747 [*-linux-*])
f5cec332 2748 # Henrik Nordstrom (hno@squid-cache.org) 19980817
9bb83c8b 2749 # poll is problematic on Linux. We disable it
2750 # by default until Linux gets it right.
b6a2f15e 2751 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
2752 if test $rev -lt 002002; then
2753 echo "disabling poll for $host < 2.2..."
2754 ac_cv_func_poll='no'
2755 fi
84cecfd2 2756 ;;
c68e9c6b 2757 [powerpc-ibm-aix4.1.*])
2758 # Mike Laster (mlaster@metavillage.com) 19981021
2759 echo "disabling poll for $host..."
2760 ac_cv_func_poll='no'
2761 ;;
86ec11aa 2762 [*-pc-sco3.2*])
2763 # Robert Side <rside@aiinc.bc.ca>
2764 # Mon, 18 Jan 1999 17:48:00 GMT
2765 echo "disabling poll for $host..."
2766 ac_cv_func_poll='no'
2767 ;;
84cecfd2 2768 esac
2769fi
176d10ee 2770
08caf8c6 2771dnl Override statfs() detect on MinGW becasue is emulated in source code
2772case "$host_os" in
2773mingw|mingw32)
2774 ac_cv_func_statfs='yes'
2775 ;;
2776esac
2777
6716b242 2778dnl Check for library functions
2779AC_CHECK_FUNCS(\
ce3d30fb 2780 backtrace_symbols_fd \
3a144521 2781 bcopy \
2782 bswap_16 \
2783 bswap_32 \
f9576890 2784 bswap16 \
2785 bswap32 \
4ac29a5b 2786 fchmod \
6716b242 2787 getdtablesize \
8505e57b 2788 getpagesize \
230c091c 2789 getpass \
3a144521 2790 getrlimit \
30a4f2a8 2791 getrusage \
9c1d8929 2792 getspnam \
379d5751 2793 gettimeofday \
52303a3d 2794 glob \
f9576890 2795 htobe16 \
2796 htole16 \
d474c7a6 2797 kqueue\
30a4f2a8 2798 lrand48 \
6716b242 2799 mallinfo \
0f5efab0 2800 mallocblksize \
6716b242 2801 mallopt \
2ae6b9b0 2802 memcpy \
30a4f2a8 2803 memmove \
dac27377 2804 memset \
b99a6dec 2805 mkstemp \
1812b6c7 2806 mktime \
88738790 2807 mstats \
84cecfd2 2808 poll \
62ae0622 2809 prctl \
3a144521 2810 pthread_attr_setschedparam \
cd748f27 2811 pthread_attr_setscope \
2812 pthread_setschedparam \
42b51993 2813 pthread_sigmask \
c68e9c6b 2814 putenv \
b1e77ec1 2815 random \
6716b242 2816 regcomp \
2817 regexec \
2818 regfree \
30a4f2a8 2819 res_init \
af76ec93 2820 __res_init \
4915be3b 2821 rint \
a4ba1105 2822 sbrk \
3a144521 2823 select \
234967c9 2824 seteuid \
c415c128 2825 setgroups \
30a4f2a8 2826 setpgrp \
6716b242 2827 setrlimit \
30a4f2a8 2828 setsid \
2829 sigaction \
11430c03 2830 snprintf \
1ccc0d40 2831 socketpair \
30a4f2a8 2832 srand48 \
b1e77ec1 2833 srandom \
0343b99c 2834 statfs \
1cd53467 2835 strsep \
2733d426 2836 strtoll \
6716b242 2837 sysconf \
2838 syslog \
234967c9 2839 timegm \
28da5e0d 2840 vsnprintf \
6716b242 2841)
f5e5c4cf 2842dnl ... and some we provide local replacements for
2843AC_REPLACE_FUNCS(\
2844 drand48 \
cc192b50 2845 inet_ntop \
2846 inet_pton \
f5e5c4cf 2847 initgroups \
cc192b50 2848 getaddrinfo \
2849 getnameinfo \
f5e5c4cf 2850 strerror \
2851 tempnam \
2852)
6716b242 2853
d06d566f 2854# check for crypt, may require -lcrypt
2855SAVED_LIBS="$LIBS"
2856LIBS="$LIBS $CRYPTLIB"
2857AC_CHECK_FUNCS(crypt)
2858LIBS="$SAVED_LIBS"
2859
d474c7a6 2860# Check for libepoll
2861EPOLL_LIB=
2862AC_CHECK_LIB(epoll, epoll_ctl, [EPOLL_LIBS="-lepoll"])
2863AC_SUBST(EPOLL_LIBS)
2864
2865# Check for epoll_ctl, may need -lepoll
2866SAVED_LIBS="$LIBS"
2867LIBS="$LIBS $LIB_EPOLL"
2868AC_CHECK_FUNCS(epoll_ctl)
2869LIBS="$SAVED_LIBS"
2870
2871dnl Verify that epoll really works
2872if test $ac_cv_func_epoll_ctl = yes; then
2873 AC_CACHE_CHECK(if epoll works, ac_cv_epoll_works,
2874 AC_TRY_RUN([
2875#include <sys/epoll.h>
2876#include <stdlib.h>
2877#include <stdio.h>
2878int main(int argc, char **argv)
2879{
2880 int fd = epoll_create(256);
2881 if (fd < 0) {
2882 perror("epoll_create:");
2883 exit(1);
2884 }
2885 exit(0);
2886}
2887 ], [ac_cv_epoll_works=yes], [ac_cv_epoll_works=no]))
328c40de 2888fi
d474c7a6 2889
1b3db6d9 2890dnl Magic which checks whether we are forcing a type of comm loop we
2891dnl are actually going to (ab)use
2892
2893dnl Actually do the define magic now
2894dnl mostly ripped from squid-commloops, thanks to adrian and benno
2895
d474c7a6 2896if test -n "$SELECT_TYPE"; then
2897 : # Already decided above. Nothing to do here
6564c397 2898elif test -z "$disable_epoll" && test "$ac_cv_epoll_works" = "yes" ; then
a46d2c0e 2899 SELECT_TYPE="epoll"
6564c397 2900elif test -z "$disable_kqueue" && test "$ac_cv_func_kqueue" = "yes" ; then
2901 SELECT_TYPE="kqueue"
2902elif test -z "$disable_poll" && test "$ac_cv_func_poll" = "yes" ; then
6c9797b9 2903 SELECT_TYPE="poll"
6564c397 2904elif test -z "$disable_select" && test "$ac_cv_func_select" = "yes" ; then
663c0a38 2905 case "$host_os" in
2906 mingw|mingw32)
2907 SELECT_TYPE="select_win32"
663c0a38 2908 ;;
2909 *)
2910 SELECT_TYPE="select"
663c0a38 2911 ;;
2912 esac
1b3db6d9 2913else
a46d2c0e 2914 echo "Eep! Can't find poll, kqueue, epoll, or select!"
1b3db6d9 2915 echo "I'll try select and hope for the best."
2916 SELECT_TYPE="select"
6a9f6389 2917 AC_DEFINE(USE_SELECT,1)
1b3db6d9 2918fi
d474c7a6 2919
2920echo "Using ${SELECT_TYPE} for the IO loop."
2921
2922AM_CONDITIONAL([USE_POLL], [test $SELECT_TYPE = poll])
2923AM_CONDITIONAL([USE_EPOLL], [test $SELECT_TYPE = epoll])
2924AM_CONDITIONAL([USE_SELECT], [test $SELECT_TYPE = select])
2925AM_CONDITIONAL([USE_SELECT_SIMPLE], [test $SELECT_TYPE = select_simple])
2926AM_CONDITIONAL([USE_SELECT_WIN32], [test $SELECT_TYPE = select_win32])
2927AM_CONDITIONAL([USE_KQUEUE], [test $SELECT_TYPE = kqueue])
2928AM_CONDITIONAL([USE_DEVPOLL], [test $SELECT_TYPE = devpoll])
2929
2930case $SELECT_TYPE in
2931epoll)
2932 AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop])
2933 ;;
2934poll)
2935 AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop])
2936 ;;
2937kqueue)
2938 AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop])
2939 ;;
2940select_win32)
2941 AC_DEFINE(USE_SELECT_WIN32,1,[Use Winsock select() for the IO loop])
2942 ;;
2943select)
2944 AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop])
2945 ;;
2946esac
1b3db6d9 2947
2948
d06d566f 2949
60939927 2950dnl Yay! Another Linux brokenness. Its not good enough
2951dnl to know that setresuid() exists, because RedHat 5.0 declares
2952dnl setresuid() but doesn't implement it.
2953dnl
2954AC_CACHE_CHECK(if setresuid is implemented, ac_cv_func_setresuid,
5c51415d 2955 AC_TRY_RUN([
60939927 2956#include <stdlib.h>
5c51415d 2957 int main() {
2958 if(setresuid(-1,-1,-1)) {
2959 perror("setresuid:");
2960 exit(1);
60939927 2961 }
2962 exit(0);
5c51415d 2963 }
2964 ],ac_cv_func_setresuid="yes",ac_cv_func_setresuid="no")
60939927 2965)
5c51415d 2966if test "$ac_cv_func_setresuid" = "yes" ; then
6a9f6389 2967 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 2968fi
60939927 2969
cee08cbc
AJ
2970dnl Yay! This one is a MacOSX brokenness. Its not good enough
2971dnl to know that strnstr() exists, because MacOSX 10.4 have a bad
2972dnl copy that crashes with a buffer over-run!
2973dnl
2974AC_CACHE_CHECK(if strnstr is well implemented, ac_cv_func_strnstr,
2975 AC_TRY_RUN([
2976#include <stdlib.h>
2977#include <stdio.h>
2978#include <string.h>
2979 // we expect this to succeed, or crash on over-run.
2980 // if it passes otherwise we may need a better check.
2981int main(int argc, char **argv)
2982{
2983 int size = 20;
2984 char *str = malloc(size);
2985 memset(str, 'x', size);
2986 strnstr(str, "fubar", size);
2987 return 0;
2988}
2989 ],ac_cv_func_strnstr="yes",ac_cv_func_strnstr="no")
2990)
2991if test "$ac_cv_func_strnstr" = "yes" ; then
2992 AC_DEFINE(HAVE_STRNSTR,1,[Yay! We have a working strnstr!])
2993else
2994 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.])
2995fi
2996
2997
1cd53467 2998AM_CONDITIONAL(NEED_OWN_STRSEP, false)
2999if test "$ac_cv_func_strsep" = "no" ; then
3000 AM_CONDITIONAL(NEED_OWN_STRSEP, true)
3001fi
3002
2733d426 3003AM_CONDITIONAL(NEED_OWN_STRTOLL, false)
3004if test "$ac_cv_func_strtoll" = "no" ; then
3005 AM_CONDITIONAL(NEED_OWN_STRTOLL, true)
3006fi
3007
eee79a2e 3008dnl
3009dnl Test for va_copy
3010dnl
3011AC_CACHE_CHECK(if va_copy is implemented, ac_cv_func_va_copy,
3012 AC_TRY_RUN([
3013 #include <stdarg.h>
3014 void f (int i, ...) {
3015 va_list args1, args2;
3016 va_start (args1, i);
3017 va_copy (args2, args1);
3018 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3019 exit (1);
3020 va_end (args1); va_end (args2);
3021 }
3022 int main() {
3023 f (0, 42);
3024 return 0;
3025 }
3026 ],ac_cv_func_va_copy="yes",ac_cv_func_va_copy="no")
3027)
3028if test "$ac_cv_func_va_copy" = "yes" ; then
a45f884d 3029 AC_DEFINE(HAVE_VA_COPY, 1, [If your system have va_copy])
eee79a2e 3030fi
3031
3032dnl
3033dnl Some systems support __va_copy
3034dnl
3035AC_CACHE_CHECK(if __va_copy is implemented, ac_cv_func___va_copy,
3036 AC_TRY_RUN([
3037 #include <stdarg.h>
3038 void f (int i, ...) {
3039 va_list args1, args2;
3040 va_start (args1, i);
3041 __va_copy (args2, args1);
3042 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3043 exit (1);
3044 va_end (args1); va_end (args2);
3045 }
3046 int main() {
3047 f (0, 42);
3048 return 0;
3049 }
3050 ],ac_cv_func___va_copy="yes",ac_cv_func___va_copy="no")
3051)
3052if test "$ac_cv_func___va_copy" = "yes" ; then
a45f884d 3053 AC_DEFINE(HAVE___VA_COPY, 1, [Some systems have __va_copy instead of va_copy])
eee79a2e 3054fi
c3d0c8b5 3055
5cafc1d6 3056dnl IP-Filter support requires ipf header files. These aren't
3057dnl installed by default, so we need to check for them
3058if test "$IPF_TRANSPARENT" ; then
3059 AC_MSG_CHECKING(if IP-Filter header files are installed)
42b51993 3060 # hold on to your hats...
3061 if test "$ac_cv_header_ip_compat_h" = "yes" ||
3062 test "$ac_cv_header_ip_fil_compat_h" = "yes" ||
87d21d8b 3063 test "$ac_cv_header_netinet_ip_compat_h" = "yes" ||
3064 test "$ac_cv_header_netinet_ip_fil_compat_h" = "yes" ; then
42b51993 3065 have_ipfilter_compat_header="yes"
3066 fi
3067 if test "x$have_ipfilter_compat_header" = "xyes" &&
eb824054 3068 test "$ac_cv_header_ip_fil_h" = "yes" &&
3069 test "$ac_cv_header_ip_nat_h" = "yes" ; then
3070 IPF_TRANSPARENT="yes"
3071 AC_DEFINE(IPF_TRANSPARENT, 1)
42b51993 3072 elif test "$have_ipfilter_compat_header" = "yes" &&
eb824054 3073 test "$ac_cv_header_netinet_ip_fil_h" = "yes" &&
3074 test "$ac_cv_header_netinet_ip_nat_h" = "yes" ; then
3075 IPF_TRANSPARENT="yes"
3076 AC_DEFINE(IPF_TRANSPARENT, 1)
3077 else
5cafc1d6 3078 IPF_TRANSPARENT="no"
3079 AC_DEFINE(IPF_TRANSPARENT, 0)
5cafc1d6 3080 fi
3081 AC_MSG_RESULT($IPF_TRANSPARENT)
3082fi
3083if test "$IPF_TRANSPARENT" = "no" ; then
3084 echo "WARNING: Cannot find necessary IP-Filter header files"
3085 echo " Transparent Proxy support WILL NOT be enabled"
3086 sleep 10
8f6ca20d 3087elif test "$IPF_TRANSPARENT" = "yes" ; then
3088dnl On Solaris Ipfilter includes expect that SOLARIS2 is defined with the
3089dnl Solaris minor version (8, 9, 10, ...)
3090 case "$host" in
3091 *-solaris*)
3092 solrev=`uname -r | sh -c 'IFS=. read j n x; echo $n'`
3093 CFLAGS="-DSOLARIS2=$solrev $CFLAGS"
20b3ae10 3094 CXXFLAGS="-DSOLARIS2=$solrev $CXXFLAGS"
8f6ca20d 3095 ;;
3096 *)
3097 ;;
3098 esac
5cafc1d6 3099fi
3100
2b0dd4ac 3101dnl PF support requires a header file.
3102if test "$PF_TRANSPARENT" ; then
3103 AC_MSG_CHECKING(if PF header file is installed)
3104 # hold on to your hats...
3105 if test "$ac_cv_header_net_pfvar_h" = "yes"; then
3106 PF_TRANSPARENT="yes"
3107 AC_DEFINE(PF_TRANSPARENT, 1)
3108 else
3109 PF_TRANSPARENT="no"
3110 AC_DEFINE(PF_TRANSPARENT, 0)
3111 fi
3112 AC_MSG_RESULT($PF_TRANSPARENT)
3113fi
3114if test "$PF_TRANSPARENT" = "no" ; then
3115 echo "WARNING: Cannot find necessary PF header file"
3116 echo " Transparent Proxy support WILL NOT be enabled"
3117 sleep 10
3118fi
3119
d852fbad 3120dnl Linux-Netfilter support requires Linux 2.4 kernel header files.
3121dnl Shamelessly copied from above
3122if test "$LINUX_NETFILTER" ; then
d6d62546 3123 AC_MSG_CHECKING(if Linux (Netfilter) kernel header files are installed)
d852fbad 3124 # hold on to your hats...
3125 if test "$ac_cv_header_linux_netfilter_ipv4_h" = "yes"; then
3126 LINUX_NETFILTER="yes"
3127 AC_DEFINE(LINUX_NETFILTER, 1)
3128 else
3129 LINUX_NETFILTER="no"
3130 AC_DEFINE(LINUX_NETFILTER, 0)
3131 fi
3132 AC_MSG_RESULT($LINUX_NETFILTER)
3133fi
3134if test "$LINUX_NETFILTER" = "no" ; then
d6d62546 3135 echo "WARNING: Cannot find necessary Linux kernel (Netfilter) header files"
7b0a0d1f 3136 echo " Linux Transparent and Intercepting Proxy support WILL NOT be enabled"
d852fbad 3137 sleep 10
3138fi
3139
f1e0717c 3140dnl Linux Netfilter/TPROXYv2 support requires some specific header files
fc68f6b1 3141dnl Shamelessly copied from shamelessly copied from above
f1e0717c
AJ
3142if test "$LINUX_TPROXY2" ; then
3143 AC_MSG_CHECKING(if TPROXYv2 header files are installed)
fc68f6b1 3144 # hold on to your hats...
3145 if test "$ac_cv_header_linux_netfilter_ipv4_ip_tproxy_h" = "yes" && test "$LINUX_NETFILTER" = "yes"; then
f1e0717c
AJ
3146 LINUX_TPROXY2="yes"
3147 AC_DEFINE(LINUX_TPROXY2, 1, [Enable real Transparent Proxy support for Netfilter TPROXY v2.])
fc68f6b1 3148 else
f1e0717c
AJ
3149 LINUX_TPROXY2="no"
3150 AC_DEFINE(LINUX_TPROXY2, 0, [Enable real Transparent Proxy support for Netfilter TPROXY v2.])
3151 fi
3152 AC_MSG_RESULT($LINUX_TPROXY2)
3153 if test "$LINUX_TPROXY2" = "no" && test "$LINUX_NETFILTER" = "yes"; then
57ef5f69 3154 echo "WARNING: Cannot find TPROXY v2 headers, you need to patch the kernel with "
f1e0717c 3155 echo "tproxy package from:"
57ef5f69 3156 echo " - lynx http://www.balabit.com/downloads/files/tproxy/"
7b0a0d1f 3157 echo "Or select the '--enable-linux-netfilter' option instead for Netfilter support."
f1e0717c 3158 sleep 10
fc68f6b1 3159 fi
fc68f6b1 3160fi
3161
91bc414e 3162if test -z "$USE_GNUREGEX" ; then
3163 case "$host" in
3164 *-sun-solaris2.[[0-4]])
3165 USE_GNUREGEX="yes"
3166 ;;
3167 *-next-nextstep*)
3168 USE_GNUREGEX="yes"
3169 ;;
3170 esac
3171fi
7a081912 3172AC_MSG_CHECKING(if GNUregex needs to be compiled)
91bc414e 3173if test -z "$USE_GNUREGEX"; then
55878dfd 3174if test "$ac_cv_func_regcomp" = "no" || test "$USE_GNUREGEX" = "yes" ; then
74946a0f 3175 USE_GNUREGEX="yes"
00fa2c12 3176else
0cccc031 3177 AC_TRY_COMPILE([#include <sys/types.h>
3178#include <regex.h>],[regex_t t; regcomp(&t,"",0);],
91bc414e 3179 USE_GNUREGEX="no",
3180 USE_GNUREGEX="yes")
3181fi
00fa2c12 3182fi
74946a0f 3183AC_MSG_RESULT($USE_GNUREGEX)
3184if test "$USE_GNUREGEX" = "yes"; then
26675bf4 3185 REGEXLIB="-lregex"
7a081912 3186 LIBREGEX="libregex.a"
6a9f6389 3187 AC_DEFINE(USE_GNUREGEX,1,[Define if we should use GNU regex])
7a081912 3188fi
26675bf4 3189AC_SUBST(REGEXLIB)
00fa2c12 3190AC_SUBST(LIBREGEX)
7a081912 3191
5c51415d 3192dnl Not cached since people are likely to tune this
e924600d 3193AC_MSG_CHECKING(Default FD_SETSIZE value)
3194AC_TRY_RUN([
3195#if HAVE_STDIO_H
3196#include <stdio.h>
3197#endif
3198#if HAVE_UNISTD_H
3199#include <unistd.h>
3200#endif
3201#if HAVE_SYS_TIME_H
3202#include <sys/time.h>
3203#endif
3204#if HAVE_SYS_SELECT_H
3205#include <sys/select.h>
3206#endif
3207#if HAVE_SYS_TYPES_H
3208#include <sys/types.h>
3209#endif
bfe8dedf
GS
3210#if HAVE_WINSOCK_H
3211#include <winsock.h>
3212#endif
3213#if HAVE_WINSOCK2_H
3214#include <winsock2.h>
3215#endif
e924600d 3216main() {
635e6242 3217 FILE *fp = fopen("conftestval", "w");
3218 fprintf (fp, "%d\n", FD_SETSIZE);
e924600d 3219 exit(0);
3220}
3221],
3222DEFAULT_FD_SETSIZE=`cat conftestval`,
3223DEFAULT_FD_SETSIZE=256,
3224DEFAULT_FD_SETSIZE=256)
3225AC_MSG_RESULT($DEFAULT_FD_SETSIZE)
6a9f6389 3226AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE, [Default FD_SETSIZE value])
e924600d 3227
f49be7d1 3228
5c51415d 3229dnl Not cached since people are likely to tune this
234967c9 3230AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
c76d8acc 3231dnl damn! FreeBSD's pthreads breaks dup2().
5132a9eb 3232TLDFLAGS="$LDFLAGS"
f49be7d1 3233if test -n "$squid_filedescriptors_num" ; then
3234 SQUID_MAXFD=$squid_filedescriptors_num
3235 AC_MSG_RESULT($SQUID_MAXFD (user-forced))
3236else
f49be7d1 3237 case $host in
3238 i386-unknown-freebsd*)
3239 if echo "$LDFLAGS" | grep -q pthread; then
3240 LDFLAGS=`echo $LDFLAGS | sed -e "s/-pthread//"`
3241 fi
3242 esac
3243 AC_TRY_RUN([
8cca06da 3244#include <stdio.h>
234967c9 3245#include <unistd.h>
30a4f2a8 3246#include <sys/time.h> /* needed on FreeBSD */
234967c9 3247#include <sys/param.h>
3248#include <sys/resource.h>
3249main() {
635e6242 3250 FILE *fp;
234967c9 3251 int i,j;
42b51993 3252#if defined(__CYGWIN32__) || defined (__CYGWIN__)
b05490a8 3253 /* getrlimit and sysconf returns bogous values on cygwin32.
df087e68 3254 * Number of fds is virtually unlimited in cygwin (sys/param.h)
b05490a8 3255 * __CYGWIN32__ is deprecated.
df087e68 3256 */
3257 i = NOFILE;
b05490a8 3258#else
3259#if HAVE_SETRLIMIT
234967c9 3260 struct rlimit rl;
3261#if defined(RLIMIT_NOFILE)
3262 if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
3263 perror("getrlimit: RLIMIT_NOFILE");
3264 } else {
f168f0c5
AJ
3265#if defined(__APPLE__)
3266 /* asking for more than OPEN_MAX fails on Leopard */
3267 rl.rlim_cur = (OPEN_MAX < rl.rlim_max ? OPEN_MAX : rl.rlim_max);
3268#else
234967c9 3269 rl.rlim_cur = rl.rlim_max; /* set it to the max */
f168f0c5 3270#endif
234967c9 3271 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
3272 perror("setrlimit: RLIMIT_NOFILE");
3273 }
3274 }
3275#elif defined(RLIMIT_OFILE)
3276 if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
3277 perror("getrlimit: RLIMIT_OFILE");
3278 } else {
3279 rl.rlim_cur = rl.rlim_max; /* set it to the max */
3280 if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
3281 perror("setrlimit: RLIMIT_OFILE");
3282 }
3283 }
3284#endif /* RLIMIT_NOFILE */
3285#endif /* HAVE_SETRLIMIT */
d9399075 3286 /* by starting at 2^14, we will never get higher
3287 than 2^15 for SQUID_MAXFD */
3288 i = j = 1<<14;
3289 while (j) {
3290 j >>= 1;
3291 if (dup2(0, i) < 0) {
3292 i -= j;
3293 } else {
3294 close(i);
3295 i += j;
3296 }
3297 }
3298 i++;
b05490a8 3299#endif /* IF !DEF CYGWIN */
635e6242 3300 fp = fopen("conftestval", "w");
a4d7e961 3301 fprintf (fp, "%d\n", i & ~0x3F);
234967c9 3302 exit(0);
3303}
f49be7d1 3304 ],
3305 SQUID_MAXFD=`cat conftestval`,
3306 SQUID_MAXFD=256,
3307 SQUID_MAXFD=256)
4b26fae9 3308 dnl Microsoft MSVCRT.DLL supports 2048 maximum FDs
3309 case "$host_os" in
3310 mingw|mingw32)
3311 SQUID_MAXFD="2048"
3312 ;;
3313 esac
f49be7d1 3314 AC_MSG_RESULT($SQUID_MAXFD)
3315fi
6a9f6389 3316AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD,[Maximum number of open filedescriptors])
b9cc811d 3317if test "$SQUID_MAXFD" -lt 512 ; then
80ab193b 3318 echo "WARNING: $SQUID_MAXFD may not be enough filedescriptors if your"
3319 echo " cache will be very busy. Please see the FAQ page"
ebd9849d 3320 echo " http://wiki.squid-cache.org/SquidFaq/TroubleShooting"
e692ff35 3321 echo " on how to increase your filedescriptor limit"
933cc58d 3322 sleep 10
80ab193b 3323fi
c76d8acc 3324LDFLAGS="$TLDFLAGS"
234967c9 3325
d0f9207a 3326if test `expr $SQUID_MAXFD % 64` != 0; then
a4d7e961 3327 echo "WARNING: $SQUID_MAXFD is not an multiple of 64. This may cause issues"
3328 echo " on certain platforms."
3329 sleep 10
3330fi
3331
5c51415d 3332dnl Not cached since people are likely to tune this
30a4f2a8 3333AC_MSG_CHECKING(Default UDP send buffer size)
3334AC_TRY_RUN([
8cca06da 3335#include <stdlib.h>
3336#include <stdio.h>
30a4f2a8 3337#include <sys/types.h>
bfe8dedf 3338#if HAVE_SYS_SOCKET_H
30a4f2a8 3339#include <sys/socket.h>
bfe8dedf
GS
3340#endif
3341#if HAVE_NETINET_IN_H
30a4f2a8 3342#include <netinet/in.h>
bfe8dedf
GS
3343#endif
3344#if HAVE_WINSOCK_H
3345#include <winsock.h>
3346#endif
3347#if HAVE_WINSOCK2_H
3348#include <winsock2.h>
3349#endif
30a4f2a8 3350main ()
3351{
635e6242 3352 FILE *fp;
30a4f2a8 3353 int fd,val=0,len=sizeof(int);
bfe8dedf
GS
3354#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
3355 WSADATA wsaData;
3356 WSAStartup(2, &wsaData);
3357#endif
30a4f2a8 3358 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
3359 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
bfe8dedf
GS
3360#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
3361 WSACleanup();
3362#endif
30a4f2a8 3363 if (val<=0) exit(1);
635e6242 3364 fp = fopen("conftestval", "w");
3365 fprintf (fp, "%d\n", val);
30a4f2a8 3366 exit(0);
3367}
3368],
6a9f6389 3369SQUID_DETECT_UDP_SO_SNDBUF=`cat conftestval`,
3370SQUID_DETECT_UDP_SO_SNDBUF=16384,
3371SQUID_DETECT_UDP_SO_SNDBUF=16384)
3372AC_MSG_RESULT($SQUID_DETECT_UDP_SO_SNDBUF)
3373AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_SNDBUF, $SQUID_DETECT_UDP_SO_SNDBUF,[UDP send buffer size])
30a4f2a8 3374
5c51415d 3375dnl Not cached since people are likely to tune this
30a4f2a8 3376AC_MSG_CHECKING(Default UDP receive buffer size)
3377AC_TRY_RUN([
8cca06da 3378#include <stdlib.h>
3379#include <stdio.h>
30a4f2a8 3380#include <sys/types.h>
bfe8dedf 3381#if HAVE_SYS_SOCKET_H
30a4f2a8 3382#include <sys/socket.h>
bfe8dedf
GS
3383#endif
3384#if HAVE_NETINET_IN_H
30a4f2a8 3385#include <netinet/in.h>
bfe8dedf
GS
3386#endif
3387#if HAVE_WINSOCK_H
3388#include <winsock.h>
3389#endif
3390#if HAVE_WINSOCK2_H
3391#include <winsock2.h>
3392#endif
30a4f2a8 3393main ()
3394{
635e6242 3395 FILE *fp;
30a4f2a8 3396 int fd,val=0,len=sizeof(int);
bfe8dedf
GS
3397#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
3398 WSADATA wsaData;
3399 WSAStartup(2, &wsaData);
3400#endif
30a4f2a8 3401 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
3402 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
bfe8dedf
GS
3403#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
3404 WSACleanup();
3405#endif
30a4f2a8 3406 if (val <= 0) exit(1);
635e6242 3407 fp = fopen("conftestval", "w");
3408 fprintf (fp, "%d\n", val);
30a4f2a8 3409 exit(0);
3410}
3411],
6a9f6389 3412SQUID_DETECT_UDP_SO_RCVBUF=`cat conftestval`,
3413SQUID_DETECT_UDP_SO_RCVBUF=16384,
3414SQUID_DETECT_UDP_SO_RCVBUF=16384)
3415AC_MSG_RESULT($SQUID_DETECT_UDP_SO_RCVBUF)
3416AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_RCVBUF, $SQUID_DETECT_UDP_SO_RCVBUF,[UDP receive buffer size])
30a4f2a8 3417
5c51415d 3418dnl Not cached since people are likely to tune this
30a4f2a8 3419AC_MSG_CHECKING(Default TCP send buffer size)
3420AC_TRY_RUN([
8cca06da 3421#include <stdlib.h>
3422#include <stdio.h>
30a4f2a8 3423#include <sys/types.h>
bfe8dedf 3424#if HAVE_SYS_SOCKET_H
30a4f2a8 3425#include <sys/socket.h>
bfe8dedf
GS
3426#endif
3427#if HAVE_NETINET_IN_H
30a4f2a8 3428#include <netinet/in.h>
bfe8dedf
GS
3429#endif
3430#if HAVE_WINSOCK_H
3431#include <winsock.h>
3432#endif
3433#if HAVE_WINSOCK2_H
3434#include <winsock2.h>
3435#endif
30a4f2a8 3436main ()
3437{
635e6242 3438 FILE *fp;
30a4f2a8 3439 int fd,val=0,len=sizeof(int);
bfe8dedf
GS
3440#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
3441 WSADATA wsaData;
3442 WSAStartup(2, &wsaData);
3443#endif
30a4f2a8 3444 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
3445 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
bfe8dedf
GS
3446#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
3447 WSACleanup();
3448#endif
30a4f2a8 3449 if (val <= 0) exit(1);
635e6242 3450 fp = fopen("conftestval", "w");
3451 fprintf (fp, "%d\n", val);
30a4f2a8 3452 exit(0);
3453}
3454],
3455SQUID_TCP_SO_SNDBUF=`cat conftestval`,
1c481e00 3456SQUID_TCP_SO_SNDBUF=16384,
3457SQUID_TCP_SO_SNDBUF=16384)
30a4f2a8 3458AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF)
2aa6ca58 3459if test $SQUID_TCP_SO_SNDBUF -gt 32768; then
3460 echo "Limiting send buffer size to 32K"
3461 SQUID_TCP_SO_SNDBUF=32768
3462fi
6a9f6389 3463AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF,[TCP send buffer size])
30a4f2a8 3464
5c51415d 3465dnl Not cached since people are likely to tune this
30a4f2a8 3466AC_MSG_CHECKING(Default TCP receive buffer size)
3467AC_TRY_RUN([
8cca06da 3468#include <stdlib.h>
3469#include <stdio.h>
30a4f2a8 3470#include <sys/types.h>
bfe8dedf 3471#if HAVE_SYS_SOCKET_H
30a4f2a8 3472#include <sys/socket.h>
bfe8dedf
GS
3473#endif
3474#if HAVE_NETINET_IN_H
30a4f2a8 3475#include <netinet/in.h>
bfe8dedf
GS
3476#endif
3477#if HAVE_WINSOCK_H
3478#include <winsock.h>
3479#endif
3480#if HAVE_WINSOCK2_H
3481#include <winsock2.h>
3482#endif
30a4f2a8 3483main ()
3484{
635e6242 3485 FILE *fp;
30a4f2a8 3486 int fd,val=0,len=sizeof(int);
bfe8dedf
GS
3487#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
3488 WSADATA wsaData;
3489 WSAStartup(2, &wsaData);
3490#endif
30a4f2a8 3491 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
3492 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
bfe8dedf
GS
3493#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
3494 WSACleanup();
3495#endif
30a4f2a8 3496 if (val <= 0) exit(1);
635e6242 3497 fp = fopen("conftestval", "w");
3498 fprintf (fp, "%d\n", val);
30a4f2a8 3499 exit(0);
3500}
3501],
3502SQUID_TCP_SO_RCVBUF=`cat conftestval`,
1c481e00 3503SQUID_TCP_SO_RCVBUF=16384,
3504SQUID_TCP_SO_RCVBUF=16384)
30a4f2a8 3505AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF)
2aa6ca58 3506if test $SQUID_TCP_SO_RCVBUF -gt 65535; then
3507 echo "Limiting receive buffer size to 64K"
3508 SQUID_TCP_SO_RCVBUF=65535
3509fi
6a9f6389 3510AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF,[TCP receive buffer size])
5c51415d 3511AC_CACHE_CHECK(if sys_errlist is already defined, ac_cv_needs_sys_errlist,
9bc73deb 3512 AC_TRY_COMPILE([#include <stdio.h>],[char *s = sys_errlist;],
5c51415d 3513 ac_cv_needs_sys_errlist="no",
3514 ac_cv_needs_sys_errlist="yes")
3515)
3516if test "$ac_cv_needs_sys_errlist" = "yes" ; then
6a9f6389 3517 AC_DEFINE(NEED_SYS_ERRLIST,1,[If we need to declare sys_errlist[] as external])
5c51415d 3518fi
30a4f2a8 3519
5c51415d 3520dnl Not cached since people are likely to change this
6bf65235 3521AC_MSG_CHECKING(for libresolv _dns_ttl_ hack)
3522AC_TRY_LINK(extern int _dns_ttl_;,return _dns_ttl_;,
3523[AC_MSG_RESULT(yes)
6a9f6389 3524AC_DEFINE(LIBRESOLV_DNS_TTL_HACK,1,[If libresolv.a has been hacked to export _dns_ttl_])],
6bf65235 3525AC_MSG_RESULT(no))
3526
a937d5e3 3527AC_MSG_CHECKING(if inet_ntoa() actually works)
3528AC_TRY_RUN([
3529#include <stdlib.h>
3530#include <stdio.h>
3531#include <sys/types.h>
3532#include <netinet/in.h>
3533#include <arpa/inet.h>
3534main ()
3535{
635e6242 3536 FILE *fp;
a937d5e3 3537 struct in_addr in;
3538 in.s_addr = inet_addr("1.2.3.4");
635e6242 3539 fp = fopen("conftestval", "w");
3540 fprintf (fp, "%s\n", inet_ntoa(in));
a937d5e3 3541 exit(0);
3542}
3543],
3544INET_NTOA_RESULT=`cat conftestval`,
3545INET_NTOA_RESULT="broken",
3546INET_NTOA_RESULT="broken")
3547if test "$INET_NTOA_RESULT" = "1.2.3.4" ; then
3548 AC_MSG_RESULT("yes")
3549else
3550 AC_MSG_RESULT("no")
4b26fae9 3551 case "$host_os" in
3552 mingw|mingw32)
3553 echo "Using Win32 resolver instead."
3554 ;;
f5e5c4cf 3555 *)
4b26fae9 3556 echo "Will use our own inet_ntoa()."
3557 AC_LIBOBJ(inet_ntoa)
3558# echo "WARNING: This looks bad, and probably prevents Squid from working."
3559# echo " If you're on IRIX and using GCC 2.8, you probably need"
3560# echo " to use the IRIX C compiler instead."
3561# sleep 10
3562 ;;
3563 esac
a937d5e3 3564fi
3565
b6a2f15e 3566if test "$ac_cv_header_sys_statvfs_h" = "yes" ; then
c68e9c6b 3567AC_MSG_CHECKING(for working statvfs() interface)
3568AC_TRY_COMPILE([
3569#include <stdlib.h>
3570#include <stdio.h>
3571#include <sys/types.h>
3572#include <sys/statvfs.h>
3573],
3574[
3575struct statvfs sfs;
3576sfs.f_blocks = sfs.f_bfree = sfs.f_frsize =
3577sfs.f_files = sfs.f_ffree = 0;
3578statvfs("/tmp", &sfs);
3579],
3580 ac_cv_func_statvfs=yes,
3581 ac_cv_func_statvfs=no)
3582AC_MSG_RESULT($ac_cv_func_statvfs)
6b8e7481 3583if test "$ac_cv_func_statvfs" = "yes" ; then
6a9f6389 3584 AC_DEFINE(HAVE_STATVFS,1,[If your system has statvfs(), and if it actually works!])
b6a2f15e 3585fi
6b8e7481 3586fi
c68e9c6b 3587
cc192b50 3588dnl Detect what resolver fields we have available to use...
3589AC_CACHE_CHECK(for _res_ext.nsaddr_list, ac_cv_have_res_ext_nsaddr_list,
3590AC_TRY_COMPILE([
3591#if HAVE_SYS_TYPES_H
3592#include <sys/types.h>
3593#endif
3594#if HAVE_NETINET_IN_H
3595#include <netinet/in.h>
3596#endif
3597#if HAVE_ARPA_INET_H
3598#include <arpa/inet.h>
3599#endif
3600#if HAVE_ARPA_NAMESER_H
3601#include <arpa/nameser.h>
3602#endif
3603#if HAVE_RESOLV_H
3604#include <resolv.h>
3605#endif
3606],
3607[_res_ext.nsaddr_list[[0]].s_addr;],
3608ac_cv_have_res_ext_nsaddr_list="yes",
3609ac_cv_have_res_ext_nsaddr_list="no"))
3610if test "$ac_cv_have_res_ext_nsaddr_list" = "yes" ; then
3611 AC_DEFINE(_SQUID_RES_NSADDR6_LARRAY,_res_ext.nsaddr_list,[If _res_ext structure has nsaddr_list member])
3612 AC_DEFINE(_SQUID_RES_NSADDR6_COUNT,ns6count,[Nameserver Counter for IPv6 _res_ext])
3613fi
3614
3615if test "$_SQUID_RES_NSADDR6_LIST" == ""; then
3616AC_CACHE_CHECK(for _res._u._ext.nsaddrs, ac_cv_have_res_ext_nsaddrs,
3617AC_TRY_COMPILE([
3618#if HAVE_SYS_TYPES_H
3619#include <sys/types.h>
3620#endif
3621#if HAVE_NETINET_IN_H
3622#include <netinet/in.h>
3623#endif
3624#if HAVE_ARPA_INET_H
3625#include <arpa/inet.h>
3626#endif
3627#if HAVE_ARPA_NAMESER_H
3628#include <arpa/nameser.h>
3629#endif
3630#if HAVE_RESOLV_H
3631#include <resolv.h>
3632#endif
3633],
3634[_res._u._ext.nsaddrs[[0]]->sin6_addr;],
3635ac_cv_have_res_ext_nsaddrs="yes",
3636ac_cv_have_res_ext_nsaddrs="no"))
3637if test "$ac_cv_have_res_ext_nsaddrs" = "yes" ; then
3638 AC_DEFINE(_SQUID_RES_NSADDR6_LPTR,_res._u._ext.nsaddrs,[If _res structure has _ext.nsaddrs member])
3639 AC_DEFINE(_SQUID_RES_NSADDR6_COUNT,_res._u._ext.nscount6,[Nameserver Counter for IPv6 _res])
3640fi
3641fi
3642
c68e9c6b 3643AC_CACHE_CHECK(for _res.nsaddr_list, ac_cv_have_res_nsaddr_list,
3644AC_TRY_COMPILE([
3645#if HAVE_SYS_TYPES_H
3646#include <sys/types.h>
3647#endif
3648#if HAVE_NETINET_IN_H
3649#include <netinet/in.h>
3650#endif
3651#if HAVE_ARPA_INET_H
3652#include <arpa/inet.h>
3653#endif
3654#if HAVE_ARPA_NAMESER_H
3655#include <arpa/nameser.h>
3656#endif
3657#if HAVE_RESOLV_H
3658#include <resolv.h>
3659#endif
3660],
3661[_res.nsaddr_list[[0]];],
3662ac_cv_have_res_nsaddr_list="yes",
3663ac_cv_have_res_nsaddr_list="no"))
3664if test $ac_cv_have_res_nsaddr_list = "yes" ; then
cc192b50 3665 AC_DEFINE(_SQUID_RES_NSADDR_LIST,_res.nsaddr_list,[If _res structure has nsaddr_list member])
3666 AC_DEFINE(_SQUID_RES_NSADDR_COUNT,_res.nscount,[Nameserver counter for IPv4 _res])
c68e9c6b 3667fi
3668
cc192b50 3669if test "$_SQUID_RES_NSADDR_LIST" == ""; then
c68e9c6b 3670AC_CACHE_CHECK(for _res.ns_list, ac_cv_have_res_ns_list,
3671AC_TRY_COMPILE([
3672#if HAVE_SYS_TYPES_H
3673#include <sys/types.h>
3674#endif
3675#if HAVE_NETINET_IN_H
3676#include <netinet/in.h>
3677#endif
3678#if HAVE_ARPA_INET_H
3679#include <arpa/inet.h>
3680#endif
3681#if HAVE_ARPA_NAMESER_H
3682#include <arpa/nameser.h>
3683#endif
3684#if HAVE_RESOLV_H
3685#include <resolv.h>
3686#endif
3687],
3688[_res.ns_list[[0]].addr;],
3689ac_cv_have_res_ns_list="yes",
3690ac_cv_have_res_ns_list="no"))
3691if test $ac_cv_have_res_ns_list = "yes" ; then
cc192b50 3692 AC_DEFINE(_SQUID_RES_NSADDR_LIST,_res.ns_list,[If _res structure has ns_list member])
3693 AC_DEFINE(_SQUID_RES_NSADDR_COUNT,_res.nscount,[Nameserver counter for IPv4 _res])
c68e9c6b 3694fi
3695fi
3696
e4b70b44
AJ
3697dnl Squid now has .po translation capability, given the right toolkit
3698AX_WITH_PROG([PO2HTML],[po2html])
3699AC_SUBST(PO2HTML)
ee1a8ac2 3700
43000484
AJ
3701dnl Squid now has limited locale handling ...
3702dnl on error pages
8db7a54b 3703use_errlocale=yes
43000484 3704AC_ARG_ENABLE(auto-locale,
8db7a54b
AJ
3705 AC_HELP_STRING([--disable-auto-locale],
3706 [This prevets Squid providing localized error pages based on the clients request headers.
3707 When disabled Squid requires explicit language configuration.]),
3708[ if test "$enableval" = "no" ; then
3709 use_errlocale=no
3710 fi
3711])
3712if test "$use_errlocale" = "yes" ; then
43000484
AJ
3713 echo "Enabling Multi-Language Support"
3714 AC_DEFINE(USE_ERR_LOCALES,1,[Use multi-language support on error pages])
8db7a54b 3715else
43000484
AJ
3716 echo "Disabling Multi-Language Support"
3717 AC_DEFINE(USE_ERR_LOCALES,0,[Use multi-language support on error pages])
8db7a54b 3718fi
43000484 3719
090089c4 3720dnl Need the debugging version of malloc if available
3721XTRA_OBJS=''
6509a1a0 3722if test "$ac_cv_lib_malloc_main" = "yes" ; then
090089c4 3723 if test -r /usr/lib/debug/malloc.o ; then
3724 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
3725 fi
3726 if test -r /usr/lib/debug/mallocmap.o ; then
3727 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
3728 fi
3729fi
3730AC_SUBST(XTRA_OBJS)
3731
38fea766 3732if test -z "$XTRA_LIBS"; then
3733 XTRA_LIBS="$LIBS"
0f5a16f8 3734 dnl minor cleanup
3735 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
38fea766 3736 LIBS=''
3737fi
090089c4 3738AC_SUBST(XTRA_LIBS)
3739
090089c4 3740dnl Clean up after OSF/1 core dump bug
3741rm -f core
3742
6a9f6389 3743AC_CONFIG_FILES([\
a2794549 3744 Makefile \
3745 lib/Makefile \
a2794549 3746 scripts/Makefile \
3747 scripts/RunCache \
3748 scripts/RunAccel \
3749 src/Makefile \
3750 src/fs/Makefile \
3751 src/repl/Makefile \
3752 src/auth/Makefile \
5fa840c3
AR
3753 src/adaptation/Makefile \
3754 src/ICAP/Makefile \
663ff9aa 3755 src/icmp/Makefile \
3e7b6055 3756 src/eCAP/Makefile \
a2794549 3757 contrib/Makefile \
3758 snmplib/Makefile \
3759 icons/Makefile \
3760 errors/Makefile \
1077c1b8 3761 test-suite/Makefile \
99db07b3 3762 doc/Makefile \
0c510f3c 3763 helpers/Makefile \
3764 helpers/basic_auth/Makefile \
3765 helpers/basic_auth/LDAP/Makefile \
3766 helpers/basic_auth/MSNT/Makefile \
3767 helpers/basic_auth/NCSA/Makefile \
3768 helpers/basic_auth/PAM/Makefile \
3769 helpers/basic_auth/SMB/Makefile \
6e785d85 3770 helpers/basic_auth/mswin_sspi/Makefile \
0c510f3c 3771 helpers/basic_auth/YP/Makefile \
3772 helpers/basic_auth/getpwnam/Makefile \
3773 helpers/basic_auth/multi-domain-NTLM/Makefile \
3774 helpers/basic_auth/SASL/Makefile \
bcf74be7 3775 helpers/basic_auth/POP3/Makefile \
002d9b03 3776 helpers/basic_auth/DB/Makefile \
d80aac12 3777 helpers/basic_auth/squid_radius_auth/Makefile \
0c510f3c 3778 helpers/digest_auth/Makefile \
3779 helpers/digest_auth/password/Makefile \
55013f9c 3780 helpers/digest_auth/ldap/Makefile \
89f77e43 3781 helpers/digest_auth/eDirectory/Makefile \
0c510f3c 3782 helpers/ntlm_auth/Makefile \
3783 helpers/ntlm_auth/fakeauth/Makefile \
3784 helpers/ntlm_auth/no_check/Makefile \
3785 helpers/ntlm_auth/SMB/Makefile \
3786 helpers/ntlm_auth/SMB/smbval/Makefile \
6e785d85 3787 helpers/ntlm_auth/mswin_sspi/Makefile \
3788 helpers/negotiate_auth/Makefile \
3789 helpers/negotiate_auth/mswin_sspi/Makefile \
c6588c68 3790 helpers/external_acl/Makefile \
3791 helpers/external_acl/ip_user/Makefile \
3792 helpers/external_acl/ldap_group/Makefile \
74ab8d10 3793 helpers/external_acl/session/Makefile \
c6588c68 3794 helpers/external_acl/unix_group/Makefile \
736a9a4d 3795 helpers/external_acl/wbinfo_group/Makefile \
9e6e0372 3796 helpers/external_acl/mswin_ad_group/Makefile \
94ab55b0 3797 helpers/external_acl/mswin_lm_group/Makefile \
3798 tools/Makefile
53cbe3e4 3799])
43ae1d95 3800
377792e4 3801AC_CONFIG_SUBDIRS(lib/libTrie)
3802
3e7b6055
AR
3803# must configure libltdl subdir unconditionally for "make distcheck" to work
3804AC_CONFIG_SUBDIRS(lib/libLtdl)
3805
6a9f6389 3806AC_OUTPUT