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