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