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