]> git.ipfire.org Git - thirdparty/squid.git/blame - configure.in
Bug #1839: Cosmetic debug message cleanup in peerHandleHtcpReply.
[thirdparty/squid.git] / configure.in
CommitLineData
1b3db6d9 1
2877b8a9 2dnl Configuration input file for Squid
090089c4 3dnl
bb559ad3 4dnl $Id: configure.in,v 1.443 2006/11/07 02:13:40 hno Exp $
090089c4 5dnl
090089c4 6dnl
7dnl
bb559ad3 8AC_INIT(Squid Web Proxy, 3.0.PRE5-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])
bb559ad3 14AC_REVISION($Revision: 1.443 $)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 ;;
5700029a 897 *-cygwin*)
898 LIBS="$LIBS -liphlpapi"
899 ;;
900 *-mingw*)
901 LIBS="$LIBS -liphlpapi"
902 ;;
933cc58d 903 *)
ef614b1c 904 echo "WARNING: ARP ACL support probably won't work on $host."
933cc58d 905 sleep 10
906 ;;
907 esac
6a9f6389 908 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 909 AM_CONDITIONAL(ENABLE_ARP_ACL, true)
e5f4e1b0 910 fi
911])
912
a2794549 913AM_CONDITIONAL(ENABLE_HTCP, false)
74075210 914AC_ARG_ENABLE(htcp,
88b7de25 915[ --enable-htcp Enable HTCP protocol],
b4b8b6da 916[ if test "$enableval" = "yes" ; then
917 echo "HTCP enabled"
6a9f6389 918 AC_DEFINE(USE_HTCP,1, [Define this to include code for the Hypertext Cache Protocol (HTCP)])
a2794549 919 AM_CONDITIONAL(ENABLE_HTCP, true)
b4b8b6da 920 fi
74075210 921])
a2794549 922
923AM_CONDITIONAL(ENABLE_SSL, false)
74075210 924
1f7c9178 925AC_ARG_ENABLE(ssl,
926[ --enable-ssl Enable ssl gatewaying support using OpenSSL],
927[ if test "$enableval" != "no"; then
3dff197f 928 echo "SSL gatewaying using OpenSSL enabled"
6a9f6389 929 AC_DEFINE(USE_SSL,1,[Define this to include code for SSL encryption.])
a2794549 930 AM_CONDITIONAL(ENABLE_SSL, true)
4b26fae9 931 case "$host_os" in
932 mingw|mingw32)
933 dnl Native Windows port of OpenSSL needs -lgdi32
934 SSLLIB='-lssl -lcrypto -lgdi32'
935 ;;
936 *)
937 SSLLIB='-lssl -lcrypto'
938 ;;
939 esac
1f7c9178 940 USE_OPENSSL=1
941 fi
942])
943
3dff197f 944AM_CONDITIONAL(NEED_OWN_MD5, true)
945
1f7c9178 946AC_ARG_WITH(openssl,
947[ --with-openssl[=prefix]
948 Compile with the OpenSSL libraries. The path to
949 the OpenSSL development libraries and headers
950 installation can be specified if outside of the
951 system standard directories],
952[
46ce628c 953 case "$with_openssl" in
1f7c9178 954 yes)
955 USE_OPENSSL=1
956 ;;
957 no)
958 USE_OPENSSL=
959 ;;
960 *)
46ce628c 961 SSLLIBDIR="$with_openssl/lib"
bcce53ce 962 CPPFLAGS="-I$with_openssl/include $CPPFLAGS"
1f7c9178 963 USE_OPENSSL=1
964 esac
965])
966
967if test -n "$USE_OPENSSL"; then
3dff197f 968 echo "Using OpenSSL MD5 implementation"
6a9f6389 969 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 970 AM_CONDITIONAL(NEED_OWN_MD5, false)
1f7c9178 971 if test -z "$SSLLIB"; then
972 SSLLIB="-lcrypto" # for MD5 routines
973 fi
f11555e0 974 dnl This is a workaround for RedHat 9 brain damage..
975 if test -d /usr/kerberos/include && test -z "$SSLLIBDIR" && test -f /usr/include/openssl/kssl.h; then
976 echo "OpenSSL depends on Kerberos"
977 SSLLIBDIR="/usr/kerberos/lib"
978 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
979 fi
1f7c9178 980fi
981if test -n "$SSLLIBDIR"; then
982 SSLLIB="-L$SSLLIBDIR $SSLLIB"
983fi
1f7c9178 984AC_SUBST(SSLLIB)
985
02749868 986AC_ARG_ENABLE(forw-via-db,
987[ --enable-forw-via-db Enable Forw/Via database],
988[ if test "$enableval" = "yes" ; then
989 echo "FORW-VIA enabled"
6a9f6389 990 AC_DEFINE(FORW_VIA_DB,1,[Enable Forw/Via database])
02749868 991 fi
992])
993
6cfa8966 994AC_ARG_ENABLE(cache-digests,
22df58ea 995[ --enable-cache-digests Use Cache Digests
2b6662ba 996 see http://www.squid-cache.org/FAQ/FAQ-16.html],
484f2ebc 997[ if test "$enableval" = "yes" ; then
6cfa8966 998 echo "USE_CACHE_DIGESTS enabled"
6a9f6389 999 AC_DEFINE(USE_CACHE_DIGESTS,1,[Use Cache Digests for locating objects in neighbor caches. This code is still semi-experimental.])
484f2ebc 1000 fi
1001])
1002
8c3926c5 1003dnl Select Default Error language
1004AC_ARG_ENABLE(default-err-language,
1005[ --enable-default-err-language=lang
0961c811 1006 Select default language for Error pages (see
1007 errors directory) ],
933cc58d 1008[
cf9d704a 1009 if test -d $srcdir/errors/$enableval; then
8c3926c5 1010 ERR_DEFAULT_LANGUAGE=$enableval
933cc58d 1011 else
0961c811 1012 echo "ERROR! Unknown language $enableval, see errors/ directory"
933cc58d 1013 exit 1
1014 fi
8c3926c5 1015],[ERR_DEFAULT_LANGUAGE="English"])
1016AC_SUBST(ERR_DEFAULT_LANGUAGE)
1017
1018dnl Select languages to be installed
1019AC_ARG_ENABLE(err-languages,
1020[ --enable-err-languages=\"lang1 lang2..\"
0961c811 1021 Select languages to be installed. (All will be
1022 installed by default) ],
8c3926c5 1023[
1024 for l in $enableval; do
1025 if test -d $srcdir/errors/$l; then :; else
1026 echo "ERROR! Unknown language $$l, see errors/"
1027 exit 1
1028 fi
1029 done
1030 ERR_LANGUAGES=$enableval
1031],[
1032 ERR_LANGUAGES=
1033 for l in $srcdir/errors/*; do
cbbe101f 1034 if test -f $l/ERR_ACCESS_DENIED; then
8c3926c5 1035 ERR_LANGUAGES="$ERR_LANGUAGES `basename $l`"
1036 fi
1037 done
1038])
1039AC_SUBST(ERR_LANGUAGES)
933cc58d 1040
cd748f27 1041dnl Size of COSS memory buffer
1042AC_ARG_WITH(coss-membuf-size,
1043[ --with-coss-membuf-size COSS membuf size (default 1048576 bytes) ],
1044[ if test "$with_coss_membuf_size"; then
1045 echo "Setting COSS membuf size to $with_coss_membuf_size bytes"
6a9f6389 1046 AC_DEFINE_UNQUOTED(COSS_MEMBUF_SZ, $with_coss_membuf_size,[Define if you want to set the COSS membuf size])
cd748f27 1047 fi
1048])
1049
1b3db6d9 1050dnl check for netio plugin stuff
9bb83c8b 1051dnl Enable poll()
1052AC_ARG_ENABLE(poll,
2df6213e 1053[ --enable-poll Enable poll() support.
0961c811 1054 --disable-poll Disable poll() support. ],
1b3db6d9 1055
1056[
c68e9c6b 1057 case "$enableval" in
1058 yes)
9bb83c8b 1059 echo "Forcing poll() to be enabled"
1060 ac_cv_func_poll='yes'
c68e9c6b 1061 ;;
1062 no)
1063 echo "Forcing poll() to be disabled"
1064 ac_cv_func_poll='no'
1065 ;;
1066 esac
9bb83c8b 1067])
1068
1b3db6d9 1069dnl Enable select()
1070AC_ARG_ENABLE(select,
2df6213e 1071[ --enable-select Enable select() support.
0961c811 1072 --disable-select Disable select() support. ],
1b3db6d9 1073
1074[
1075 case "$enableval" in
1076 yes)
1077 echo "Forcing select() to be enabled"
1078 ac_cv_func_select='yes'
1079 ;;
1080 no)
1081 echo "Forcing select() to be disabled"
1082 ac_cv_func_select='no'
1083 ;;
1084 esac
1085])
1086
1087dnl Enable kqueue()
1088AC_ARG_ENABLE(kqueue,
2df6213e 1089[ --enable-kqueue Enable kqueue() support.
0961c811 1090 --disable-kqueue Disable kqueue() support. ],
1b3db6d9 1091
1092[
1093 case "$enableval" in
1094 yes)
1095 echo "Forcing kqueue() to be enabled"
1096 ac_cv_func_kqueue='yes'
1097 ;;
1098 no)
1099 echo "Forcing kqueue() to be disabled"
1100 ac_cv_func_kqueue='no'
1101 ;;
1102esac
1103])
1104
a46d2c0e 1105dnl Enable epoll()
a46d2c0e 1106AC_ARG_ENABLE(epoll,
2df6213e 1107[ --enable-epoll Enable epoll() support.
1108 --disable-epoll Disable epoll() support. ],
a46d2c0e 1109
1110[
1111 case "$enableval" in
1112 yes)
1113 echo "Forcing epoll() to be enabled"
1114 ac_cv_func_epoll='yes'
a46d2c0e 1115 ;;
1116 no)
1117 echo "Forcing epoll() to be disabled"
1118 ac_cv_func_epoll='no'
1119 ;;
1120esac
1121])
1122
1123
72fd085a 1124dnl Disable HTTP violations
14b32873 1125http_violations=1
72fd085a 1126AC_ARG_ENABLE(http-violations,
1127[ --disable-http-violations
1128 This allows you to remove code which is known to
c68e9c6b 1129 violate the HTTP protocol specification.],
72fd085a 1130[ if test "$enableval" = "no" ; then
1131 echo "Disabling HTTP Violations"
14b32873 1132 http_violations=0
72fd085a 1133 fi
1134])
14b32873 1135if test $http_violations = 1; then
1136 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.])
1137else
1138 AC_DEFINE(HTTP_VIOLATIONS, 0)
1139fi
72fd085a 1140
5cafc1d6 1141dnl Enable IP-Filter Transparent Proxy
1142AC_ARG_ENABLE(ipf-transparent,
1143[ --enable-ipf-transparent
1144 Enable Transparent Proxy support for systems
c68e9c6b 1145 using IP-Filter network address redirection.],
5cafc1d6 1146[ if test "$enableval" = "yes" ; then
1147 echo "IP-Filter Transparent Proxy enabled"
6a9f6389 1148 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 1149 IPF_TRANSPARENT="yes"
1150 fi
1151])
1152
2b0dd4ac 1153dnl Enable PF Transparent Proxy
1154AC_ARG_ENABLE(pf-transparent,
1155[ --enable-pf-transparent
1156 Enable Transparent Proxy support for systems
1157 using PF network address redirection.],
1158[ if test "$enableval" = "yes" ; then
1159 echo "PF Transparent Proxy enabled"
6a9f6389 1160 AC_DEFINE(PF_TRANSPARENT,1,[Enable support for Transparent Proxy on systems using PF address redirection. This provides "masquerading" support for OpenBSD.])
2b0dd4ac 1161 PF_TRANSPARENT="yes"
1162 fi
1163])
1164
d6d62546 1165dnl Enable Linux Netfilter Transparent Proxy
d852fbad 1166AC_ARG_ENABLE(linux-netfilter,
1167[ --enable-linux-netfilter
d6d62546 1168 Enable Transparent Proxy support for Linux (Netfilter) systems.],
d852fbad 1169[ if test "$enableval" = "yes" ; then
d6d62546 1170 echo "Linux (Netfilter) Transparent Proxy enabled"
1171 AC_DEFINE(LINUX_NETFILTER,1,[Enable support for Transparent Proxy on Linux (Netfilter) systems])
d852fbad 1172 LINUX_NETFILTER="yes"
1173 fi
1174])
1175
bb7b5fd0 1176dnl Enable Large file support
2df6213e 1177buildmodel=""
1178needlargefiles=
1179
1180AC_ARG_WITH(large-files,
1181[ --with-large-files Enable support for large files (logs etc). Still
bb7b5fd0 1182 experimental.],
2df6213e 1183[ if test "$withval" = yes; then
1184 needlargefiles=1
bb7b5fd0 1185 fi
1186])
1187
2df6213e 1188dnl UNIX Build environment
1189AC_ARG_WITH(build-environment,
1190[ --with-build-environment=model
1191 The build environment to use. Normally one of
1192 POSIX_V6_ILP32_OFF32 32 bits
1193 POSIX_V6_ILP32_OFFBIG 32 bits with large file support
1194 POSIX_V6_LP64_OFF64 64 bits
1195 POSIX_V6_LPBIG_OFFBIG large pointers and files
1196 XBS5_ILP32_OFF32 32 bits (legacy)
1197 XBS5_ILP32_OFFBIG 32 bits with large file support (legacy)
1198 XBS5_LP64_OFF64 64 bits (legacy)
1199 XBS5_LPBIG_OFFBIG large pointers and files (legacy)
1200 default The default for your OS],
1201[ case "$withval" in
1202 yes|no)
1203 echo "--with-build-environment expects a build environment string as used by getconf"
1204 exit 1
1205 ;;
1206 *)
1207 buildmodel="$withval"
1208 ;;
1209 esac
1210])
1211
1212if test $needlargefiles && test -z "$buildmodel"; then
1213 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
1214 if test "`getconf _$model 2>/dev/null || true`" = 1 || test "`getconf $model 2>/dev/null || true`" ; then
1215 buildmodel=$model
1216 break
1217 fi
1218 done
1219 if test -z "$buildmodel"; then
1220 echo "WARNING: No suitable build environment found for large files. Trying to use _FILE_OFFSET_BITS=64"
1221 sleep 1
1222 CFLAGS="-D_FILE_OFFSET_BITS=64 $CFLAGS"
cca81db1 1223 CXXFLAGS="-D_FILE_OFFSET_BITS=64 $CXXFLAGS"
2df6213e 1224 fi
1225fi
1226if test -n "$buildmodel" && test "$buildmodel" != "default"; then
1227 echo "Using $buildmodel build environment"
1228 if test "`getconf _$buildmodel 2>/dev/null || true`" = 1 || test "`getconf $buildmodel 2>/dev/null || true`" ; then
1229 : # All fine
1230 else
1231 echo "ERROR: Build environment $buildmodel not known to getconf."
1232 exit 1
1233 fi
1234 CFLAGS="`getconf ${buildmodel}_CFLAGS` $CFLAGS"
cca81db1 1235 CXXFLAGS="`getconf ${buildmodel}_CFLAGS` $CXXFLAGS"
2df6213e 1236 LIBS="`getconf ${buildmodel}_LIBS` $LIBS"
1237 LDFLAGS="`getconf ${buildmodel}_LDFLAGS` $LDFLAGS"
63e02610 1238 case "$host" in
2df6213e 1239dnl
1240dnl On Solaris getconf returns for CFLAGS -Xa and -Usun options, but:
1241dnl -Xa is supported only by Sun cc, so we need to remove it when using gcc
1242dnl The 'sun' define is needed by ipfilter includes, so we must remove -Usun
2df6213e 1243 *-solaris*)
1244 if test "$GCC" = "yes"; then
1245 echo "Removing -Xa for gcc on $host"
1246 CFLAGS="`echo $CFLAGS | sed -e 's/-Xa//'`"
cca81db1 1247 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Xa//'`"
2df6213e 1248 fi
2ddacc29 1249 echo "Removing -Usun on $host"
2df6213e 1250 CFLAGS="`echo $CFLAGS | sed -e 's/-Usun//'`"
cca81db1 1251 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Usun//'`"
2df6213e 1252 ;;
63e02610 1253dnl
1254dnl On Irix 6.x getconf returns options valid only for the SGI MipsPRO compiler,
1255dnl so we must adjust something to avoid gcc errors.
1256dnl On Irix 6.x 32/64 bit we must replace "-n32" with "-mabi=n32" in CFLAGS and
1257dnl remove "-n32" from LDFLAGS
1258dnl On Irix 6.x 64 bit we must replace "-64" with "-mabi=64" in CFLAGS and remove
1259dnl "-64" from LDFLAGS
1260 *-sgi-irix6.*)
1261 if test "$GCC" = "yes"; then
1262 CFLAGS="`echo $CFLAGS | sed -e 's/-n32/-mabi=n32/'`"
ff37fe61 1263 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-n32/-mabi=n32/'`"
63e02610 1264 LDFLAGS="`echo $LDFLAGS | sed -e 's/-n32//'`"
1265 CFLAGS="`echo $CFLAGS | sed -e 's/-64/-mabi=64/'`"
ff37fe61 1266 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-64/-mabi=64/'`"
63e02610 1267 LDFLAGS="`echo $LDFLAGS | sed -e 's/-64//'`"
1268 fi
1269 ;;
2df6213e 1270 *)
1271 ;;
1272 esac
1273fi
1274
a2794549 1275AM_CONDITIONAL(MAKE_LEAKFINDER, false)
5d620373 1276dnl Enable Leak Finding Functions
1277AC_ARG_ENABLE(leakfinder,
1278[ --enable-leakfinder
1279 Enable Leak Finding code. Enabling this alone
1280 does nothing; you also have to modify the source
1281 code to use the leak finding functions. Probably
1282 Useful for hackers only.],
1283[ if test "$enableval" = "yes" ; then
1284 echo "Leak-Finding enabled"
6a9f6389 1285 AC_DEFINE(USE_LEAKFINDER,1,[Enable code for assisting in finding memory leaks. Hacker stuff only.])
5d620373 1286 USE_LEAKFINDER="yes"
a2794549 1287 AM_CONDITIONAL(MAKE_LEAKFINDER, true)
5d620373 1288 fi
1289])
5d620373 1290
14b32873 1291use_ident=1
3898f57f 1292AC_ARG_ENABLE(ident-lookups,
1293[ --disable-ident-lookups
1294 This allows you to remove code that performs
1295 Ident (RFC 931) lookups.],
1296[ if test "$enableval" = "no" ; then
1297 echo "Disabling Ident Lookups"
14b32873 1298 use_ident=0
3898f57f 1299 fi
1300])
14b32873 1301if test $use_ident = 1; then
1302 AC_DEFINE(USE_IDENT, 1,[Compile in support for Ident (RFC 931) lookups? Enabled by default.])
8000a965 1303 AM_CONDITIONAL(ENABLE_IDENT, true)
14b32873 1304else
1305 AC_DEFINE(USE_IDENT, 0)
8000a965 1306 AM_CONDITIONAL(ENABLE_IDENT, false)
14b32873 1307fi
3898f57f 1308
a2794549 1309AM_CONDITIONAL(USE_DNSSERVER, false)
3c573763 1310use_dnsserver=
eb824054 1311AC_ARG_ENABLE(internal-dns,
7e3ce7b9 1312[ --disable-internal-dns This prevents Squid from directly sending and
eb824054 1313 receiving DNS messages, and instead enables the
1314 old external 'dnsserver' processes.],
1315[ if test "$enableval" = "no" ; then
1316 echo "Disabling Internal DNS queries"
3c573763 1317 use_dnsserver="yes"
eb824054 1318 fi
1319])
3c573763 1320if test "$use_dnsserver" = "yes"; then
6a9f6389 1321 AC_DEFINE(USE_DNSSERVERS,1,[Use dnsserver processes instead of the internal DNS protocol support])
a2794549 1322 AM_CONDITIONAL(USE_DNSSERVER, true)
3c573763 1323fi
eb824054 1324
1325AC_ARG_ENABLE(truncate,
7e3ce7b9 1326[ --enable-truncate This uses truncate() instead of unlink() when
eb824054 1327 removing cache files. Truncate gives a little
1328 performance improvement, but may cause problems
1329 when used with async I/O. Truncate uses more
1330 filesystem inodes than unlink..],
1331[ if test "$enableval" = "yes" ; then
1332 echo "Enabling truncate instead of unlink"
6a9f6389 1333 AC_DEFINE(USE_TRUNCATE,1,[Do we want to use truncate(2) or unlink(2)?])
eb824054 1334 fi
1335])
1336
4fa7a4ba 1337dnl Disable hostname checks
338b5499 1338AC_ARG_ENABLE(hostname-checks,
8fca0346 1339[ --enable-hostname-checks
1340 Tells Squid to rejects any host names with
4fa7a4ba 1341 odd characters in their name to conform with
8fca0346 1342 internet standards. This was the default in
1343 prior Squid versions, but since Squid-3 Squid
1344 no longer tries to police the use of DNS],
1345[ if test "$enableval" = "yes"; then
801d5137 1346 echo "Enabling hostname sanity checks"
338b5499 1347 AC_DEFINE(CHECK_HOSTNAMES, 1, [Enable hostname sanity checks])
4fa7a4ba 1348 fi
1349])
4fa7a4ba 1350
9bc73deb 1351dnl Enable underscore in hostnames
1352AC_ARG_ENABLE(underscores,
1353[ --enable-underscores Squid by default rejects any host names with _
76d83c52 1354 in their name to conform with internet standards.
9bc73deb 1355 If you disagree with this you may allow _ in
1356 hostnames by using this switch, provided that
1357 the resolver library on the host where Squid runs
1358 does not reject _ in hostnames...],
1359[ if test "$enableval" = "yes" ; then
1360 echo "Enabling the use of underscores in host names"
6a9f6389 1361 AC_DEFINE(ALLOW_HOSTNAME_UNDERSCORES, 1,[Allow underscores in host names])
9bc73deb 1362 fi
1363])
1364
9d798391 1365dnl Select Default hosts file location
1366AC_ARG_ENABLE(default-hostsfile,
1367[ --enable-default-hostsfile=path
1368 Select default location for hosts file.
1369 See hosts_file directive in squid.conf for details],
1370[
1371 if test "$enableval" != "none" ; then
1372 if test -f $enableval; then
1373 OPT_DEFAULT_HOSTS=$enableval
1374 else
1375 echo "Warning Unable to find $enableval"
1376 sleep 5
1377 fi
1378 else
1379 OPT_DEFAULT_HOSTS="none"
1380 fi
1381 echo "Default hosts file set to: $enableval"
1382],[OPT_DEFAULT_HOSTS="/etc/hosts"])
1383AC_SUBST(OPT_DEFAULT_HOSTS)
1384
94439e4e 1385dnl Select auth schemes modules to build
1386AC_ARG_ENABLE(auth,
1387[ --enable-auth=\"list of auth scheme modules\"
1388 Build support for the list of authentication schemes.
1389 The default is to build support for the Basic scheme.
1390 See src/auth for a list of available modules, or
1391 Programmers Guide section authentication schemes
1392 for details on how to build your custom auth scheme
1393 module],
1394[ case $enableval in
1395 yes)
1c42c4a1 1396 for dir in $srcdir/src/auth/*; do
1397 module="`basename $dir`"
1c690e30 1398 if test -d "$dir" && test "$module" != CVS; then
1c42c4a1 1399 AUTH_MODULES="$AUTH_MODULES $module"
94439e4e 1400 fi
1401 done
1402 ;;
1403 no)
1404 ;;
1c690e30 1405 *)
1406 AUTH_MODULES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1407 ;;
94439e4e 1408 esac
1409],
1410[ if test -z "$AUTH_MODULES"; then
6bf4f823 1411 AUTH_MODULES="ntlm basic digest negotiate"
94439e4e 1412 fi
1413])
1c690e30 1414if test -n "$AUTH_MODULES"; then
1415 for module in $AUTH_MODULES; do
1416 if test -d $srcdir/src/auth/$module; then
1417 :
1418 else
1419 echo "ERROR: Auth scheme $module does not exists"
1420 exit 1
1421 fi
7f18d2bd 1422 eval AUTH_MODULE_${module}=yes
1c690e30 1423 done
1424 echo "Auth scheme modules built: $AUTH_MODULES"
1425 AUTH_OBJS="auth/lib`echo $AUTH_MODULES|sed -e 's% %.a auth/lib%g'`.a"
1426 AUTH_LIBS="`echo $AUTH_OBJS|sed -e 's%auth/%%g'`"
d0571da6 1427else
1428 echo "Auth scheme modules built: None"
1c690e30 1429fi
f5691f9c 1430AUTH_LINKOBJS=
1431for module in $AUTH_MODULES; do
1432 AUTH_LINKOBJS="$AUTH_LINKOBJS auth/${module}/${module}Scheme.o"
1433done
94439e4e 1434AC_SUBST(AUTH_MODULES)
94439e4e 1435AC_SUBST(AUTH_LIBS)
f5691f9c 1436AC_SUBST(AUTH_LINKOBJS)
1437AC_SUBST(AUTH_OBJS)
94439e4e 1438
1439dnl Select basic auth scheme helpers to build
7f18d2bd 1440if test -n "$AUTH_MODULE_basic"; then
1441 BASIC_AUTH_HELPERS="all"
1442fi
94439e4e 1443AC_ARG_ENABLE(basic-auth-helpers,
1444[ --enable-basic-auth-helpers=\"list of helpers\"
1445 This option selects which basic scheme proxy_auth
1446 helpers to build and install as part of the normal
1447 build process. For a list of available
0c510f3c 1448 helpers see the helpers/basic_auth directory.],
94439e4e 1449[ case "$enableval" in
7f18d2bd 1450 yes)
1451 BASIC_AUTH_HELPERS="all"
1c690e30 1452 ;;
94439e4e 1453 no)
7f18d2bd 1454 BASIC_AUTH_HELPERS=""
1c690e30 1455 ;;
94439e4e 1456 *)
7f18d2bd 1457 if test -z "$AUTH_MODULE_basic"; then
1458 echo "WARNING: Basic auth helpers selected without the basic scheme enabled"
1459 sleep 15
1460 fi
1c690e30 1461 BASIC_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1462 ;;
94439e4e 1463 esac
1464])
7f18d2bd 1465if test "$BASIC_AUTH_HELPERS" = "all" ; then
1466 BASIC_AUTH_HELPERS=""
1467 for dir in $srcdir/helpers/basic_auth/*; do
1468 helper="`basename $dir`"
1469 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1470 BASIC_AUTH_HELPERS="$BASIC_AUTH_HELPERS $helper"
1471 fi
1472 done
1473fi
fc83a946 1474if test -n "$BASIC_AUTH_HELPERS"; then
20d8bfe4 1475 for helper in $BASIC_AUTH_HELPERS; do
1c690e30 1476 if test -d $srcdir/helpers/basic_auth/$helper; then
2adff954 1477 case $helper in
1478 SASL)
1479 require_sasl=yes
1480 ;;
1481 esac
20d8bfe4 1482 else
1c690e30 1483 echo "ERROR: Basic auth helper $helper does not exists"
1484 exit 1
20d8bfe4 1485 fi
1486 done
fc83a946 1487 echo "Basic auth helpers built: $BASIC_AUTH_HELPERS"
94439e4e 1488fi
fc83a946 1489AC_SUBST(BASIC_AUTH_HELPERS)
94439e4e 1490
1491dnl Select ntlm auth helpers to build
7f18d2bd 1492if test -n "$AUTH_MODULE_ntlm"; then
1493 NTLM_AUTH_HELPERS="all"
1494fi
94439e4e 1495AC_ARG_ENABLE(ntlm-auth-helpers,
1496[ --enable-ntlm-auth-helpers=\"list of helpers\"
1497 This option selects which proxy_auth ntlm helpers
1498 to build and install as part of the normal build
0c510f3c 1499 process. For a list of available helpers see
1500 the helpers/ntlm_auth directory.],
380f0a87 1501[ case "$enableval" in
1502 yes)
7f18d2bd 1503 NTLM_AUTH_HELPERS="all"
1c690e30 1504 ;;
380f0a87 1505 no)
7f18d2bd 1506 NTLM_AUTH_HELPERS=""
1c690e30 1507 ;;
380f0a87 1508 *)
1c690e30 1509 NTLM_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1510 ;;
380f0a87 1511 esac
1512])
7f18d2bd 1513if test "$NTLM_AUTH_HELPERS" = "all" ; then
1514 NTLM_AUTH_HELPERS=""
1515 for dir in $srcdir/helpers/ntlm_auth/*; do
1516 helper="`basename $dir`"
1517 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1518 NTLM_AUTH_HELPERS="$NTLM_AUTH_HELPERS $helper"
1519 fi
1520 done
1521fi
94439e4e 1522if test -n "$NTLM_AUTH_HELPERS"; then
20d8bfe4 1523 for helper in $NTLM_AUTH_HELPERS; do
1c690e30 1524 if test -d $srcdir/helpers/ntlm_auth/$helper; then
1525 :
20d8bfe4 1526 else
1c690e30 1527 echo "ERROR: NTLM Auth helper $helper does not exists"
1528 exit 1
20d8bfe4 1529 fi
1530 done
94439e4e 1531 echo "NTLM auth helpers built: $NTLM_AUTH_HELPERS"
380f0a87 1532fi
94439e4e 1533AC_SUBST(NTLM_AUTH_HELPERS)
1534
6e785d85 1535dnl Select negotiate auth helpers to build
7f18d2bd 1536if test -n "$AUTH_MODULE_negotiate"; then
1537 NEGOTIATE_AUTH_HELPERS="all"
1538fi
6e785d85 1539AC_ARG_ENABLE(negotiate-auth-helpers,
1540[ --enable-negotiate-auth-helpers=\"list of helpers\"
1541 This option selects which proxy_auth negotiate helpers
1542 to build and install as part of the normal build
1543 process. For a list of available helpers see
1544 the helpers/negotiate_auth directory.],
1545[ case "$enableval" in
1546 yes)
7f18d2bd 1547 NEGOTIATE_AUTH_HELPERS="all"
6e785d85 1548 ;;
1549 no)
7f18d2bd 1550 NEGOTIATE_AUTH_HELPERS=""
6e785d85 1551 ;;
1552 *)
1553 NEGOTIATE_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1554 ;;
1555 esac
1556])
7f18d2bd 1557if test "$NEGOTIATE_AUTH_HELPERS" = "all" ; then
1558 NEGOTIATE_AUTH_HELPERS=""
1559 for dir in $srcdir/helpers/negotiate_auth/*; do
1560 helper="`basename $dir`"
1561 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1562 NEGOTIATE_AUTH_HELPERS="$NEGOTIATE_AUTH_HELPERS $helper"
1563 fi
1564 done
1565fi
6e785d85 1566if test -n "$NEGOTIATE_AUTH_HELPERS"; then
1567 for helper in $NEGOTIATE_AUTH_HELPERS; do
1568 if test -d $srcdir/helpers/negotiate_auth/$helper; then
1569 :
1570 else
1571 echo "ERROR: Negotiate Auth helper $helper does not exists"
1572 exit 1
1573 fi
1574 done
1575 echo "Negotiate auth helpers built: $NEGOTIATE_AUTH_HELPERS"
1576fi
1577AC_SUBST(NEGOTIATE_AUTH_HELPERS)
1578
2d70df72 1579dnl Select digest auth scheme helpers to build
7f18d2bd 1580if test -n "$AUTH_MODULE_digest"; then
1581 DIGEST_AUTH_HELPERS=all
1582fi
2d70df72 1583AC_ARG_ENABLE(digest-auth-helpers,
1584[ --enable-digest-auth-helpers=\"list of helpers\"
1585 This option selects which digest scheme authentication
1586 helpers to build and install as part of the normal build
0c510f3c 1587 process. For a list of available helpers see the
1588 helpers/digest_auth directory.],
2d70df72 1589[ case "$enableval" in
1590 yes)
7f18d2bd 1591 DIGEST_AUTH_HELPERS="all"
1c690e30 1592 ;;
2d70df72 1593 no)
7f18d2bd 1594 DIGEST_AUTH_HELPERS=""
1c690e30 1595 ;;
2d70df72 1596 *)
1c690e30 1597 DIGEST_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1598 ;;
2d70df72 1599 esac
1600])
7f18d2bd 1601if test "$DIGEST_AUTH_HELPERS" = "all" ; then
1602 DIGEST_AUTH_HELPERS=""
1603 for dir in $srcdir/helpers/digest_auth/*; do
1604 helper="`basename $dir`"
1605 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1606 DIGEST_AUTH_HELPERS="$DIGEST_AUTH_HELPERS $helper"
1607 fi
1608 done
1609fi
2d70df72 1610if test -n "$DIGEST_AUTH_HELPERS"; then
1daefc1a 1611 for helper in $DIGEST_AUTH_HELPERS; do
1612 if test -f $srcdir/helpers/digest_auth/$helper/Makefile.in; then
1613 :
1614 else
1615 echo "ERROR: digest auth helper $helper does not exists"
1616 exit 1
1617 fi
1618 done
2d70df72 1619 echo "Digest auth helpers built: $DIGEST_AUTH_HELPERS"
1620fi
1621AC_SUBST(DIGEST_AUTH_HELPERS)
380f0a87 1622
6437ac71 1623dnl Enable "NTLM fail open"
1624AC_ARG_ENABLE(ntlm-fail-open,
1625[ --enable-ntlm-fail-open Enable NTLM fail open, where a helper that fails one of the
0961c811 1626 Authentication steps can allow squid to still authenticate
1627 the user.],
6437ac71 1628[ if test "$enableval" = "yes" ; then
6a9f6389 1629 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 1630 fi
1631])
1632
c6588c68 1633dnl Select external_acl helpers to build
7f18d2bd 1634EXTERNAL_ACL_HELPERS=all
c6588c68 1635AC_ARG_ENABLE(external-acl-helpers,
1636[ --enable-external-acl-helpers=\"list of helpers\"
1637 This option selects which external_acl helpers to
1638 build and install as part of the normal build
1639 process. For a list of available helpers see the
1640 helpers/external_acl directory.],
1641[ case "$enableval" in
1642 yes)
7f18d2bd 1643 EXTERNAL_ACL_HELPERS=all
1c690e30 1644 ;;
c6588c68 1645 no)
7f18d2bd 1646 EXTERNAL_ACL_HELPERS=""
1c690e30 1647 ;;
c6588c68 1648 *)
1c690e30 1649 EXTERNAL_ACL_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1650 ;;
c6588c68 1651 esac
1652])
7f18d2bd 1653if test "$EXTERNAL_ACL_HELPERS" = "all" ; then
39ee7289 1654 EXTERNAL_ACL_HELPERS=""
7f18d2bd 1655 for dir in $srcdir/helpers/external_acl/*; do
1656 helper="`basename $dir`"
1657 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1658 EXTERNAL_ACL_HELPERS="$EXTERNAL_ACL_HELPERS $helper"
1659 fi
1660 done
1661fi
c6588c68 1662if test -n "$EXTERNAL_ACL_HELPERS"; then
20d8bfe4 1663 for helper in $EXTERNAL_ACL_HELPERS; do
1664 if test -f $srcdir/helpers/external_acl/$helper/Makefile.in; then
1665 :
1666 else
1daefc1a 1667 echo "ERROR: external acl helper $helper does not exists"
20d8bfe4 1668 exit 1
1669 fi
1670 done
c6588c68 1671 echo "External acl helpers built: $EXTERNAL_ACL_HELPERS"
1672fi
1673AC_SUBST(EXTERNAL_ACL_HELPERS)
1674
b4bab919 1675AC_ARG_WITH(valgrind,
1676[ --with-valgrind Include debug instrumentation for use with valgrind],
1677[ case $withval in
1678 yes)
1679 valgrind=1
1680 ;;
1681 no)
1682 valgrind=
1683 ;;
1684 *)
1685 CPPFLAGS="$CPPFLAGS -I${enableval}/include"
1686 valgrind=1
1687 ;;
1688 esac
1689 if test $valgrind; then
1690 AC_DEFINE(WITH_VALGRIND, 1, [Valgrind memory debugger support])
1691 echo "Valgrind debug support enabled"
1692 fi
1693])
1694
d96ceb8e 1695dnl Disable "memPools" code
b001e822 1696AC_DEFINE(DISABLE_POOLS, 0, [Define if you have problems with memPools and want to disable Pools.])
d96ceb8e 1697AC_ARG_ENABLE(mempools,
b001e822 1698[ --disable-mempools Disable memPools. Note that this option now simply sets the
2df6213e 1699 default behaviour. Specific classes can override this at runtime, and
1700 only lib/MemPool.c needs to be altered to change the squid-wide
1701 default for all classes.],
d96ceb8e 1702[ if test "$enableval" = "no" ; then
1703 echo "memPools disabled"
6a9f6389 1704 AC_DEFINE(DISABLE_POOLS, 1, [Define if you have problems with memPools and want to disable Pools])
d96ceb8e 1705 fi
1706])
1707
0e657244 1708dnl Enable WIN32 Service compile mode
1709AC_ARG_ENABLE(win32-service,
1710[ --enable-win32-service Compile Squid as a WIN32 Service
1711 Works only on Windows NT and Windows 2000 Platforms.],
1712[ if test "$enableval" = "yes" ; then
1713 echo "Enabling WIN32 run service mode"
1714 AC_DEFINE(USE_WIN32_SERVICE,1,[Define Windows NT & Windows 2000 run service mode])
1715 fi
1716])
1717
b1485ff8 1718
2adff954 1719dnl Check for Cyrus SASL
1720if test "$require_sasl" = "yes"; then
1721 AC_CHECK_HEADERS(sasl/sasl.h sasl.h)
1722 if test "$ac_cv_header_sasl_sasl_h" = "yes"; then
1723 echo "using SASL2"
1724 LIBSASL="-lsasl2"
1725 else
1726 if test "$ac_cv_header_sasl_h" = "yes"; then
1727 echo "using SASL"
1728 LIBSASL="-lsasl"
1729 else
1730 echo "ERROR: Neither SASL nor SASL2 found"
1731 exit 1
1732 fi
1733 fi
1734 AC_SUBST(LIBSASL)
1735fi
1736
3c573763 1737dnl Disable "unlinkd" code
fe0810ac 1738AC_ARG_ENABLE(unlinkd,
1739[ --disable-unlinkd Do not use unlinkd],
1740[ if test "$enableval" = "no" ; then
3c573763 1741 use_unlinkd=no
fe0810ac 1742 else
3c573763 1743 use_unlinkd=yes
fe0810ac 1744 fi
1745],[
1746 # Here we should probably use some magic depending on the selected
1747 # storage models
3c573763 1748 use_unlinkd=yes
fe0810ac 1749])
3c573763 1750if test "$use_unlinkd" = "yes"; then
fe0810ac 1751 echo "unlinkd enabled"
6a9f6389 1752 AC_DEFINE(USE_UNLINKD,1,[Define this if unlinkd is required (strongly recommended for ufs storage type)])
a2794549 1753 AM_CONDITIONAL(ENABLE_UNLINKD, true)
fe0810ac 1754else
1755 echo "unlinkd disabled"
a2794549 1756 AM_CONDITIONAL(ENABLE_UNLINKD, false)
fe0810ac 1757fi
fe0810ac 1758
ce3d30fb 1759dnl Enable backtraces on fatal errors
1760AC_ARG_ENABLE(stacktraces,
1761[ --enable-stacktraces Enable automatic call backtrace on fatal errors],
1762[ if test "$enableval" = "yes" ; then
1763 echo "Enabling automatic stack backtraces on fatal errors"
6a9f6389 1764 AC_DEFINE(PRINT_STACK_TRACE, 1,[Print stacktraces on fatal errors])
ce3d30fb 1765 fi
1766])
1767
88bfe092 1768AM_CONDITIONAL(ENABLE_XPROF_STATS, false)
1769dnl Enable USE_XPROF_STATS
1770AC_ARG_ENABLE(cpu-profiling,
1771[ --enable-cpu-profiling
1772 This option allows you to see which internal functions
1773 in Squid are consuming how much CPU. Compiles in probes
1774 that measure time spent in probed functions. Needs
1775 source modifications to add new probes. This is meant
1776 for developers to assist in performance optimisations
1777 of Squid internal functions.
1778 If you are not developer and not interested in the stats
1779 you shouldn't enable this, as overhead added, although
1780 small, is still overhead. See lib/Profiler.c for more.
1781 ],
1782[ if test "$enableval" = "yes" ; then
1783 echo "Enabling cpu-profiling"
6a9f6389 1784 AC_DEFINE(USE_XPROF_STATS, 1,[Define to enable CPU profiling within Squid])
88bfe092 1785 AM_CONDITIONAL(ENABLE_XPROF_STATS, true)
1786 fi
1787])
1788
f66a9ef4 1789dnl Enable X-Accelerator-Vary for Vary support within an accelerator setup
1790AC_ARG_ENABLE(x_accelerator_vary,
0961c811 1791[ --enable-x-accelerator-vary
1792 Enable support for the X-Accelerator-Vary
1793 HTTP header. Can be used to indicate
1794 variance within an accelerator setup.
1795 Typically used together with other code
1796 that adds custom HTTP headers to the requests.],
f66a9ef4 1797[ if test "$enableval" = "yes" ; then
1798 echo "Enabling support for X-Accelerator-Vary"
6a9f6389 1799 AC_DEFINE(X_ACCELERATOR_VARY, 1, [Enable support for the X-Accelerator-Vary HTTP header])
f66a9ef4 1800 fi
1801])
1802
f49be7d1 1803AC_ARG_WITH(filedescriptors,
1804[ --with-filedescriptors=NUMBER Force squid to support NUMBER filedescriptors],
1805[ squid_filedescriptors_num=$withval ])
1806
8b5e106b 1807AC_PATH_PROG(CPPUNITCONFIG, cppunit-config, false)
1808if $CPPUNITCONFIG --help >/dev/null; then
f5691f9c 1809 echo "using system installed cppunit"
1810 SQUID_CPPUNIT_DIR=''
8b5e106b 1811 SQUID_CPPUNIT_LIBS="`$CPPUNITCONFIG --libs`"
1812 SQUID_CPPUNIT_LA=''
1813 SQUID_CPPUNIT_INC="`$CPPUNITCONFIG --cflags`"
1814else
1815 SQUID_CPPUNIT_DIR='cppunit-1.10.0'
1816 SQUID_CPPUNIT_LA='$(top_builddir)/lib/cppunit-1.10.0/src/cppunit/libcppunit.la'
1817 SQUID_CPPUNIT_LIBS='$(SQUID_CPPUNIT_LA)'
1818 SQUID_CPPUNIT_INC='-I$(top_builddir)/lib/cppunit-1.10.0/include -I $(top_srcdir)/lib/cppunit-1.10.0/include'
f5691f9c 1819fi
8b5e106b 1820
f5691f9c 1821AC_ARG_WITH(cppunit-basedir,
1822[ --with-cppunit-basedir=/path/to/cppunit-base
1823 Path where the cppunit headers are libraries are found
1824 for unit testing. (defaults to use internal copies -
1825 version 1.10.0)
1826 ],
1827[ if test -f $withval/include/cppunit/TestCase.h; then
1828 echo "Using cppunit includes from $withval"
1829 SQUID_CPPUNIT_INC="-I${withval}/include"
1830 else
1831 echo "ERROR: Cannot find cppunit at $withval"
1832 exit 1
1833 fi
1834 if test -f $withval/lib/libcppunit.la; then
1835 echo "Using cppunit lib from $withval"
1836 SQUID_CPPUNIT_LA="-I${withval}/lib/libcppunit.la"
8b5e106b 1837 SQUID_CPPUNIT_LIBS='$(SQUID_CPPUNIT_LA)'
f5691f9c 1838 else
1839 echo "ERROR: Cannot find cppunit at $withval"
1840 exit 1
1841 fi
1842 SQUID_CPPUNIT_DIR=''
1843])
8b5e106b 1844AC_SUBST(SQUID_CPPUNIT_LIBS)
f5691f9c 1845AC_SUBST(SQUID_CPPUNIT_LA)
1846AC_SUBST(SQUID_CPPUNIT_INC)
1847AC_SUBST(SQUID_CPPUNIT_DIR)
1848
fd9aaa3e 1849# Force some compilers to use ANSI features
1850#
1851case "$host" in
1852 alpha-dec-osf*)
1853 if test "$ac_cv_prog_CC" = "cc" ; then
1854 echo "adding '-std1' to cc args for $host"
1855 CC="cc -std1";
1856 ac_cv_prog_CC="$CC"
1857 fi
1858 ;;
c68e9c6b 1859 *-hp-hpux*)
1860 if test "$ac_cv_prog_CC" = "cc" ; then
1861 echo "adding '-Ae' to cc args for $host"
1862 CC="cc -Ae";
1863 ac_cv_prog_CC="$CC"
1864 fi
1865 ;;
fd9aaa3e 1866esac
1867
090089c4 1868dnl Check for programs
1869AC_PROG_CPP
1870AC_PROG_INSTALL
090089c4 1871AC_PROG_LN_S
81280a96 1872AC_PATH_PROG(SH, sh, /bin/sh)
d9f67e6f 1873AC_PATH_PROG(FALSE, false, /usr/bin/false)
1874AC_PATH_PROG(TRUE, true, /usr/bin/true)
1875AC_PATH_PROG(RM, rm, $FALSE)
1876AC_PATH_PROG(MV, mv, $FALSE)
1877AC_PATH_PROG(MKDIR, mkdir, $FALSE)
090089c4 1878AC_PATH_PROG(LN, ln, cp)
4e9d8e26 1879AC_PATH_PROG(PERL, perl, none)
a2794549 1880dnl automake handles this AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
6ad85e8a 1881AC_PATH_PROG(AR, ar, $FALSE)
1882
4e9d8e26 1883if test "$ac_cv_path_PERL" = "none"; then
1884 echo "Perl is required to compile Squid"
1885 echo "Please install Perl and then re-run configure"
1886 exit 1
1887fi
1888
6ad85e8a 1889case "$host" in
1890 *-hp-hpux*)
1891 echo "Disabling 'ranlib' for HP-UX..."
1892 RANLIB=":"
1893 ;;
1894esac
1895
1896dnl set $(AR)
1897AR_R="$AR r"
1898case "$host" in
1899 *-next-nextstep3)
1900 AR="libtool -o"
1901 ;;
1902esac
1903AC_SUBST(AR_R)
090089c4 1904
1905dnl Check for headers
1906AC_HEADER_DIRENT
1907AC_HEADER_STDC
db40ae20 1908
1909AC_CHECK_HEADERS( \
db40ae20 1910 arpa/inet.h \
30a4f2a8 1911 arpa/nameser.h \
9441aa34 1912 assert.h \
db40ae20 1913 bstring.h \
db40ae20 1914 crypt.h \
30a4f2a8 1915 ctype.h \
1916 errno.h \
ce3d30fb 1917 execinfo.h \
db40ae20 1918 fcntl.h \
42ad37af 1919 fnmatch.h \
9c1d8929 1920 getopt.h \
88738790 1921 gnumalloc.h \
30a4f2a8 1922 grp.h \
5cafc1d6 1923 ip_compat.h \
42b51993 1924 ip_fil_compat.h \
5cafc1d6 1925 ip_fil.h \
1926 ip_nat.h \
dbc5782a 1927 ipl.h \
30a4f2a8 1928 libc.h \
6ad85e8a 1929 limits.h \
30a4f2a8 1930 malloc.h \
e0bddc45 1931 math.h \
db40ae20 1932 memory.h \
b075cbb1 1933 mount.h \
2b0dd4ac 1934 net/pfvar.h \
30a4f2a8 1935 netdb.h \
db40ae20 1936 netinet/in.h \
30a4f2a8 1937 netinet/tcp.h \
42b51993 1938 netinet/ip_fil_compat.h \
1f7c9178 1939 openssl/err.h \
1940 openssl/md5.h \
1941 openssl/ssl.h \
a7ad6e4e 1942 openssl/engine.h \
4da086c4 1943 paths.h \
dcfe6390 1944 poll.h \
30a4f2a8 1945 pwd.h \
b5e4d7d4 1946 shadow.h \
30a4f2a8 1947 regex.h \
c68e9c6b 1948 sched.h \
30a4f2a8 1949 signal.h \
1950 stdarg.h \
1951 stddef.h \
1952 stdio.h \
db40ae20 1953 stdlib.h \
1954 string.h \
1955 strings.h \
0a4e8536 1956 sys/bitypes.h \
f9576890 1957 sys/bswap.h \
1958 sys/endian.h \
db40ae20 1959 sys/file.h \
5cafc1d6 1960 sys/ioctl.h \
30a4f2a8 1961 sys/param.h \
62ae0622 1962 sys/prctl.h \
77e4c0c9 1963 sys/msg.h \
30a4f2a8 1964 sys/resource.h \
db40ae20 1965 sys/select.h\
30a4f2a8 1966 sys/socket.h \
1967 sys/stat.h \
b075cbb1 1968 sys/statvfs.h \
3c641669 1969 syscall.h \
30a4f2a8 1970 sys/syscall.h \
db40ae20 1971 sys/time.h \
1972 sys/types.h \
30a4f2a8 1973 sys/un.h \
b075cbb1 1974 sys/vfs.h \
30a4f2a8 1975 sys/wait.h \
db40ae20 1976 syslog.h \
30a4f2a8 1977 time.h \
1978 unistd.h \
3c641669 1979 utime.h \
30a4f2a8 1980 varargs.h \
77d6bd88 1981 byteswap.h \
1982 glib.h \
60d096f4 1983 stdint.h \
1984 inttypes.h \
3c641669 1985 grp.h \
1986 nss_common.h \
94331f58 1987 nss.h \
1988 db.h \
1989 db_185.h
db40ae20 1990)
1991
5a3237b0 1992AC_CHECK_HEADERS(linux/netfilter_ipv4.h,,,
dcd1dc78 1993SQUID_DEFAULT_INCLUDES
1994#if HAVE_LIMITS_H
1995#include <limits.h>
1996#endif
1997)
1998
5a3237b0 1999AC_CHECK_HEADERS(net/if.h \
2000 netinet/if_ether.h\
2001 netinet/ip_compat.h\
2002 netinet/ip_fil.h\
77e4c0c9 2003 netinet/ip_nat.h\
dbc5782a 2004 netinet/ipl.h \
77e4c0c9 2005 sys/mount.h\
2006 resolv.h,,,SQUID_BSDNET_INCLUDES)
5a3237b0 2007
a1559187 2008AC_CHECK_HEADERS([libxml/parser.h], [], [
2009 SAVED_CPPFLAGS="$CPPFLAGS"
2010 CPPFLAGS="-I/usr/include/libxml2 $CPPFLAGS"
2011 unset ac_cv_header_libxml_parser_h
2012 AC_CHECK_HEADERS([libxml/parser.h], [], [
2013 CPPFLAGS="$SAVED_CPPFLAGS"
2014 ])
2015 ])
2016
aee0606f 2017AC_C_CONST
d57288d2 2018AC_C_BIGENDIAN
aee0606f 2019
5c51415d 2020AC_CACHE_CHECK(if ANSI prototypes work,ac_cv_have_ansi_prototypes, [
2021 AC_TRY_COMPILE([int foo(char *); int foo (char *bar) {return 1;}],
2022 [foo("bar")],
2023 ac_cv_have_ansi_prototypes="yes",
2024 ac_cv_have_ansi_prototypes="no")
2025])
2026if test $ac_cv_have_ansi_prototypes = "yes" ; then
6a9f6389 2027 AC_DEFINE(HAVE_ANSI_PROTOTYPES,1,[Define if your compiler supports prototyping])
5c51415d 2028fi
20a50bb9 2029
6a9f6389 2030AC_STRUCT_TM
2031AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
2032#if TM_IN_SYS_TIME
2033#if HAVE_SYS_TIME_H
2034#include <sys/time.h>
2035#endif
2036#elif HAVE_TIME_H
2037#include <time.h>
2038#endif
5c51415d 2039])
46c883ed 2040
6a9f6389 2041AC_CHECK_TYPE(struct mallinfo,AC_DEFINE(HAVE_STRUCT_MALLINFO,1,[The system provides struct mallinfo]),,[
2042#if HAVE_SYS_TYPES_H
2043#include <sys/types.h>
2044#endif
eb824054 2045#if HAVE_MALLOC_H
2046#include <malloc.h>
6a9f6389 2047#endif])
eb824054 2048
6a9f6389 2049AC_CHECK_MEMBERS([struct mallinfo.mxfast],,,[
2050#if HAVE_SYS_TYPES_H
2051#include <sys/types.h>
2052#endif
2053#if HAVE_MALLOC_H
2054#include <malloc.h>
2055#endif])
090089c4 2056
08caf8c6 2057dnl Override rusage() detect on MinGW because is emulated in source code
2058case "$host_os" in
2059 mingw|mingw32)
2060 AC_DEFINE(HAVE_STRUCT_RUSAGE)
2061 ac_cv_func_getrusage='yes'
d750d7bf 2062 echo "Using own rusage on Windows."
08caf8c6 2063 ;;
2064 *)
2065 AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
8ff51bba 2066#if HAVE_SYS_TIME_H
2067#include <sys/time.h>
2068#endif
b54a6789 2069#if HAVE_SYS_RESOURCE_H
2070#include <sys/resource.h>
6a9f6389 2071#endif])
08caf8c6 2072 ;;
2073esac
b54a6789 2074
6a9f6389 2075AC_CHECK_MEMBERS([struct iphdr.ip_hl],,,[
2076#if HAVE_SYS_TYPES_H
2077#include <sys/types.h>
2078#endif
a025a745 2079#include <netinet/in.h>
2080#include <netinet/in_systm.h>
6ad85e8a 2081#include <netinet/ip.h>
b05490a8 2082#if defined (__linux__) || defined (__CYGWIN__)
6ad85e8a 2083#define ip_hl ihl
2084#endif
2085#ifndef __linux__
b05490a8 2086#ifndef __CYGWIN__
6ad85e8a 2087#define iphdr ip
b05490a8 2088#endif
6a9f6389 2089#endif])
a025a745 2090
090089c4 2091dnl Check for typedefs
77d6bd88 2092AC_CHECK_SIZEOF(void *)
090089c4 2093
0409a509 2094dnl 8 bit integers - int8_t
2095dnl if this is defined we trust it to be 8 bits
2096AC_CHECK_TYPE(int8_t,[
2097 AC_CHECK_SIZEOF(int8_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2098 AC_DEFINE(HAVE_INT8_T,1,[int8_t is defined in system headers])
2099 ],,SQUID_DEFAULT_INCLUDES)
2100
2101dnl fallback #1
2102AC_CHECK_TYPE(char,[
2103 AC_CHECK_SIZEOF(char,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2104 AC_DEFINE(HAVE_CHAR,1,[char is defined in system headers])
2105 ],,SQUID_DEFAULT_INCLUDES)
2106
2107dnl unsigned 8 bit ints - u_int8_t
2108dnl if this is defined we trust it to be 8 bits
2109AC_CHECK_TYPE(u_int8_t,[
2110 AC_CHECK_SIZEOF(u_int8_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2111 AC_DEFINE(HAVE_U_INT8_T,1,[u_int8_t is defined in system headers])
2112 ],,SQUID_DEFAULT_INCLUDES)
2113
2114dnl fallback #1
2115dnl if this is defined we trust it to be 8 bits
2116AC_CHECK_TYPE(uint8_t,[
2117 AC_CHECK_SIZEOF(uint8_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2118 AC_DEFINE(HAVE_UINT8_T,1,[uint8_t is defined in system headers])
2119 ],,SQUID_DEFAULT_INCLUDES)
2120
2121dnl 16 bit integers - int16_t
6a9f6389 2122dnl if this is defined we trust it to be 16 bits
62266438 2123AC_CHECK_TYPE(int16_t,[
2124 AC_CHECK_SIZEOF(int16_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2125 AC_DEFINE(HAVE_INT16_T,1,[int16_t is defined in system headers])
2126 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2127
2128dnl fallback #1
2129AC_CHECK_TYPE(short,[
856e69c5 2130 AC_CHECK_SIZEOF(short,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2131 AC_DEFINE(HAVE_SHORT,1,[short is defined in system headers])
2132 ],,SQUID_DEFAULT_INCLUDES)
2133
2134dnl fallback #2
2135AC_CHECK_TYPE(int,[
856e69c5 2136 AC_CHECK_SIZEOF(int,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2137 AC_DEFINE(HAVE_INT,1,[int is defined in system headers])
2138 ],,SQUID_DEFAULT_INCLUDES)
2139
2140dnl unsigned 16 bit ints - u_int16_t
2141dnl if this is defined we trust it to be 16 bits
62266438 2142AC_CHECK_TYPE(u_int16_t,[
2143 AC_CHECK_SIZEOF(u_int16_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2144 AC_DEFINE(HAVE_U_INT16_T,1,[u_int16_t is defined in system headers])
2145 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2146
2147dnl fallback #1
2148dnl if this is defined we trust it to be 16 bits
62266438 2149AC_CHECK_TYPE(uint16_t,[
2150 AC_CHECK_SIZEOF(uint16_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2151 AC_DEFINE(HAVE_UINT16_T,1,[uint16_t is defined in system headers])
2152 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2153
2154dnl 32 bit signed int - int32_t
2155dnl if this is defined we trust it to be 32 bits
62266438 2156AC_CHECK_TYPE(int32_t,[
2157 AC_CHECK_SIZEOF(int32_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2158 AC_DEFINE(HAVE_INT32_T,1,[int32_t is defined in system headers])
2159 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2160
2161dnl fallback #1
2162AC_CHECK_TYPE(long,[
856e69c5 2163 AC_CHECK_SIZEOF(long,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2164 AC_DEFINE(HAVE_LONG,1,[long is defined in system headers])
2165 ],,SQUID_DEFAULT_INCLUDES)
2166
2167dnl 32 bit unsigned int - u_int32_t
2168dnl if this is defined we trust it to be 32 bits
62266438 2169AC_CHECK_TYPE(u_int32_t,[
2170 AC_CHECK_SIZEOF(u_int32_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2171 AC_DEFINE(HAVE_U_INT32_T,1,[u_int32_t is defined in system headers])
2172 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2173
2174dnl fallback #1
2175dnl if this is defined we trust it to be 32 bits
62266438 2176AC_CHECK_TYPE(uint32_t,[
2177 AC_CHECK_SIZEOF(uint32_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2178 AC_DEFINE(HAVE_UINT32_T,1,[uint32_t is defined in system headers])
2179 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2180
2181dnl 64 bit signed - int64_t
2182dnl if this is defind we trust it to be 64 bits
62266438 2183AC_CHECK_TYPE(int64_t,[
2184 AC_CHECK_SIZEOF(int64_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2185 AC_DEFINE(HAVE_INT64_T,1,[int64_t is defined in system headers])
2186 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2187
2188dnl fallback #1
2189dnl if this is defind we trust it to be 64 bits
62266438 2190AC_CHECK_TYPE(__int64,[
2191 AC_CHECK_SIZEOF(__int64,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2192 AC_DEFINE(HAVE___INT64,1,[__int64 is defined in system headers])
2193 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2194
2195dnl fallback #2
2196AC_CHECK_TYPE(long long,[
856e69c5 2197 AC_CHECK_SIZEOF(long long,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2198 AC_DEFINE(HAVE_LONG_LONG,1,[long long is defined in system headers])
2199 ],,SQUID_DEFAULT_INCLUDES)
2200
2201dnl 64 bit unsigned - u_int64_t
2202dnl if this is defind we trust it to be 64 bits
62266438 2203AC_CHECK_TYPE(u_int64_t,[
2204 AC_CHECK_SIZEOF(u_int64_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2205 AC_DEFINE(HAVE_U_INT64_T,1,[u_int64_t is defined in system headers])
2206 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2207
2208dnl fallback #1
2209dnl if this is defind we trust it to be 64 bits
62266438 2210AC_CHECK_TYPE(uint64_t,[
2211 AC_CHECK_SIZEOF(uint64_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2212 AC_DEFINE(HAVE_UINT64_T,1,[uint64_t is defined in system headers])
2213 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2214
588e71df 2215dnl On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
2216dnl that is incompatible with the updated Solaris header files.
2217dnl For this reason, we must check if pad128_t and upad128_t are defined.
2218AC_CHECK_TYPE(pad128_t,
2219 AC_DEFINE(HAVE_PAD128_T,1,[pad128_t is defined in system headers]),
2220 ,SQUID_DEFAULT_INCLUDES)
2221
2222AC_CHECK_TYPE(upad128_t,
2223 AC_DEFINE(HAVE_UPAD128_T,1,[upad128_t is defined in system headers]),
2224 ,SQUID_DEFAULT_INCLUDES)
2225
6a9f6389 2226AC_CHECK_TYPE(pid_t, AC_DEFINE(HAVE_PID_T,1,[pid_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
856e69c5 2227AC_CHECK_TYPE(size_t, [AC_CHECK_SIZEOF(size_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2228 AC_DEFINE(HAVE_SIZE_T,1,[size_t is defined by the system headers])],,SQUID_DEFAULT_INCLUDES)
2229AC_CHECK_TYPE(ssize_t, AC_DEFINE(HAVE_SSIZE_T,1,[ssize_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
856e69c5 2230AC_CHECK_TYPE(off_t,[ AC_CHECK_SIZEOF(off_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2231 AC_DEFINE(HAVE_OFF_T,1,[off_t is defined by the system headers])],,SQUID_DEFAULT_INCLUDES)
2232AC_CHECK_TYPE(mode_t, AC_DEFINE(HAVE_MODE_T,1,[mode_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2233AC_CHECK_TYPE(fd_mask, AC_DEFINE(HAVE_FD_MASK,1,[fd_mask is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
adcceb47 2234
77d6bd88 2235dnl Check for special functions
2236AC_FUNC_ALLOCA
2237
6a9f6389 2238AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the system headers]),,[
2239#include <sys/types.h>
6637e3a5 2240#include <sys/socket.h>
2241#if STDC_HEADERS
2242#include <stdlib.h>
2243#include <stddef.h>
6a9f6389 2244#endif])
6637e3a5 2245
6a9f6389 2246AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,[mtyp_t is defined by the system headers]),,[#include <sys/types.h>
aea1be68 2247#include <sys/ipc.h>
6a9f6389 2248#include <sys/msg.h>])
aea1be68 2249
090089c4 2250dnl Check for needed libraries
30a4f2a8 2251AC_CHECK_LIB(nsl, main)
6716b242 2252AC_CHECK_LIB(socket, main)
4b26fae9 2253case "$host_os" in
2254 mingw|mingw32)
2255 AC_MSG_CHECKING(for winsock)
2256 save_LIBS="$LIBS"
2257 for curlib in ws2_32 wsock32; do
2258 LIBS="$LIBS -l$curlib"
2259 AC_TRY_LINK([
2260 char __attribute__((stdcall)) socket(int,int,int);
2261 char __attribute__((stdcall)) select(int,int,int,int,int);
2262 char __attribute__((stdcall)) closesocket(int);
2263 char __attribute__((stdcall)) gethostname(int,int);
2264 ],
2265 [
2266 socket(1,2,3);
2267 select(1,2,3,4,5);
2268 closesocket(1);
2269 gethostname(1,2);
2270 ],
2271 have_winsock=yes, have_winsock=no)
2272
2273 if test $have_winsock = yes; then
2274 ac_cv_func_select='yes'
2275 if test $curlib = ws2_32; then
2276 have_winsock=winsock2
2277 fi
2278 break
2279 fi
2280 LIBS="$save_LIBS"
2281 done
2282 AC_MSG_RESULT($have_winsock)
2283 ;;
2284esac
94d48591 2285
3c641669 2286dnl Ripped from the Samba sources
2287AC_CACHE_CHECK([for unix domain sockets],squid_cv_unixsocket, [
2288 AC_TRY_COMPILE([
2289#include <sys/types.h>
2290#include <stdlib.h>
2291#include <stddef.h>
2292#include <sys/socket.h>
2293#include <sys/un.h>],
2294[
2295 struct sockaddr_un sunaddr;
2296 sunaddr.sun_family = AF_UNIX;
2297],
2298 squid_cv_unixsocket=yes,squid_cv_unixsocket=no)])
2299if test x"$squid_cv_unixsocket" = x"yes"; then
6a9f6389 2300 AC_DEFINE(HAVE_UNIXSOCKET,1,[Do we have unix sockets? (required for the winbind ntlm helper])
3c641669 2301fi
2302dnl end rip
2303
94d48591 2304if test "x$ac_cv_enabled_dlmalloc" = "xyes" ; then
2305 echo "skipping libmalloc check (--enable-dlmalloc specified)"
5c51415d 2306else
94d48591 2307 AC_CHECK_LIB(gnumalloc, main)
2308 if test "$ac_cv_lib_gnumalloc_main" = "yes"; then
2309 echo "Disabling extended malloc functions when using gnumalloc"
2310 ac_cv_func_mallinfo=no
2311 ac_cv_func_mallocblksize=no
2312 ac_cv_func_mallopt=no
2313 else
2314 case "$host" in
2315 *-sun-solaris*)
2316 echo "skipping libmalloc check for $host"
2317 ;;
2318 i386-*-freebsd*)
2319 echo "skipping libmalloc check for $host"
2320 ;;
2321 *)
2322
2323 AC_CHECK_LIB(malloc, main)
2324 ;;
2325 esac
2326 fi
8a15e65e 2327fi
94d48591 2328
6716b242 2329AC_CHECK_LIB(bsd, main)
be79ade0 2330AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"])
04a56fa3 2331AC_CHECK_LIB(bind, gethostbyname)
2332if test $ac_cv_lib_bind_gethostbyname = "no" ; then
2333 case "$host" in
78743365 2334 i386-*-freebsd*)
2335 echo "skipping libresolv checks for $host"
2336 ;;
2337 *)
2338 AC_CHECK_LIB(resolv, inet_aton, AC_CHECK_LIB(44bsd, inet_aton))
2339 AC_CHECK_LIB(resolv, main)
2340 ;;
04a56fa3 2341 esac
2342fi
08caf8c6 2343case "$host_os" in
2344mingw|mingw32)
2345 echo "Use MSVCRT for math functions."
2346 ;;
2347 *)
2348 AC_CHECK_LIB(m, main)
2349 ;;
2350esac
090089c4 2351
2352dnl Check for libcrypt
8154dd82 2353dnl Some of our helpers use crypt(3) which may be in libc, or in
2354dnl libcrypt (eg FreeBSD)
042b1f8a 2355AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
be79ade0 2356AC_SUBST(CRYPTLIB)
77f675ad 2357
042b1f8a 2358dnl Check for libdl, used by auth_modules/PAM
8154dd82 2359if test "$with_dl" = "yes"; then
2360 AC_CHECK_LIB(dl, dlopen)
2361fi
042b1f8a 2362
e5f4e1b0 2363dnl Check for pthreads
2364dnl We use pthreads when doing ASYNC I/O
8154dd82 2365if test "$with_pthreads" = "yes"; then
fa035612 2366 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
2367 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
e685e3c6 2368 case "$host" in
2369 i386-unknown-freebsd*)
2370 if test "$GCC" = "yes" ; then
2371 if test -z "$PRESET_LDFLAGS"; then
2372 LDFLAGS="$LDFLAGS -pthread"
2373 fi
2374 fi
2375 ;;
2376 *-solaris2.*)
2377 if test "$GCC" = "yes" ; then
fa035612 2378 SQUID_CFLAGS="$SQUID_CFLAGS -pthreads"
2379 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -pthreads"
e685e3c6 2380 else
fa035612 2381 SQUID_CFLAGS="$SQUID_CFLAGS -mt"
2382 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -mt"
e685e3c6 2383 fi
2384 ;;
2385 esac
8154dd82 2386 AC_CHECK_LIB(pthread, main)
2387fi
71f8abc8 2388
f85c88f3 2389dnl Check for librt
2390dnl We use AIO in the coss store
8154dd82 2391if test "$with_aio" = "yes"; then
580e2134 2392 dnl On some systems POSIX AIO functions are in libaio
2393 AC_CHECK_LIB(rt, aio_read,,AC_CHECK_LIB(aio, aio_read))
8154dd82 2394fi
f85c88f3 2395
86ec11aa 2396dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
2397dnl Robert Side <rside@aiinc.bc.ca>
2398dnl Mon, 18 Jan 1999 17:48:00 GMT
2399case "$host" in
2400 *-pc-sco3.2*)
2401 AC_CHECK_LIB(intl, strftime)
2402 ;;
2403esac
2404
20e869bf 2405dnl On MinGW OpenLDAP is not available, so LDAP helpers can be linked
2406dnl only with Windows LDAP libraries using -lwldap32
2407case "$host_os" in
2408mingw|mingw32)
2409 LIB_LDAP="-lwldap32"
2410 LIB_LBER=""
2411 ;;
2412*)
2413 LIB_LDAP="-lldap"
2414 dnl LDAP helpers need to know if -llber is needed or not
2415 AC_CHECK_LIB(lber, main, [LIB_LBER="-llber"])
2416 ;;
2417esac
2418AC_SUBST(LIB_LDAP)
2419AC_SUBST(LIB_LBER)
2420
b7a1c19e 2421dnl Check for libdb
2422DBLIB=
01b4931d 2423dnl 1.85
a258dfca 2424AC_CACHE_CHECK(if dbopen needs -ldb,ac_cv_dbopen_libdb, [
32d0bbd7 2425SAVED_LIBS="$LIBS"; LIBS="$LIBS -ldb"
2426 AC_TRY_LINK([
a258dfca 2427#if HAVE_SYS_TYPES_H
2428#include <sys/types.h>
2429#endif
2430#if HAVE_LIMITS_H
2431#include <limits.h>
2432#endif
2433#if HAVE_DB_185_H
2434#include <db_185.h>
2435#elif HAVE_DB_H
2436#include <db.h>
2437#endif],
2438 [dbopen((void *)0L, 0, 0, DB_HASH, (void *)0L)],
a258dfca 2439 ac_cv_dbopen_libdb="yes",
2440 ac_cv_dbopen_libdb="no")
32d0bbd7 2441LIBS="$SAVED_LIBS"
a258dfca 2442])
2b2161bb 2443if test $ac_cv_dbopen_libdb = yes; then
32d0bbd7 2444 LIB_DB="-ldb"
2445fi
01b4931d 2446AC_SUBST(LIB_DB)
b7a1c19e 2447
77f675ad 2448dnl System-specific library modifications
2449dnl
2450case "$host" in
88738790 2451 i386-*-solaris2.*)
7149a49f 2452 if test "$GCC" = "yes"; then
2453 echo "Removing -O for gcc on $host"
80e92d6d 2454 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
7149a49f 2455 fi
2456 ;;
77f675ad 2457 *-sgi-irix*)
2458 echo "Removing -lsocket for IRIX..."
6716b242 2459 LIBS=`echo $LIBS | sed -e s/-lsocket//`
77f675ad 2460 echo "Removing -lnsl for IRIX..."
6716b242 2461 LIBS=`echo $LIBS | sed -e s/-lnsl//`
c415c128 2462 ac_cv_lib_nsl_main=no
b44c0fb4 2463 echo "Removing -lbsd for IRIX..."
2464 LIBS=`echo $LIBS | sed -e s/-lbsd//`
77f675ad 2465 ;;
4ba0bd0e 2466dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
2467dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
2468dnl Please change your configure script. AIX doesn't need -lbsd.
2469 *-ibm-aix*)
2470 echo "Removing -lbsd for AIX..."
2471 LIBS=`echo $LIBS | sed -e s/-lbsd//`
a6e0ad1e 2472 case "$host" in
c68e9c6b 2473dnl From: mlaster@metavillage.com (Mike Laster)
2474dnl AIX 4.1.4.x does not have header files for snprintf/vsnprintf
2475dnl So using the internal versions generates a load of warnings
2476dnl during compile.
a6e0ad1e 2477 *-ibm-aix4*)
2478 echo "disabling snprintf/vsnprintf for $host"
2479 ac_cv_func_snprintf=no
2480 ac_cv_func_vsnprintf=no
2481 ;;
2482 esac
4ba0bd0e 2483 ;;
30a4f2a8 2484 *m88k*)
fa035612 2485 SQUID_CFLAGS="$SQUID_CFLAGS -D_SQUID_MOTOROLA_"
2486 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_SQUID_MOTOROLA_"
6a9f6389 2487 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1,[If gettimeofday is known to take only one argument])
7149a49f 2488 ;;
580ce039 2489 [*-*-solaris2.[0-4]])
6a9f6389 2490 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
30a4f2a8 2491 ;;
711fa75e 2492 [*-sony-newsos[56]*])
6a9f6389 2493 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
f62c73dc 2494 ;;
77f675ad 2495esac
090089c4 2496
57faa85a 2497# Remove optimization for GCC 2.95.[123]
d20b1cd0 2498# gcc -O[2] on *BSD and Linux (x86) causes pointers to magically become NULL
2499if test "$GCC" = "yes"; then
2500 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
2501 case "$GCCVER" in
57faa85a 2502 [2.95.[123]])
d20b1cd0 2503 echo "Removing -O for gcc on $host with GCC $GCCVER"
2504 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
2505 ;;
2506 esac
2507fi
2508
176d10ee 2509# Recommended by Balint Nagy Endre <bne@CareNet.hu>
2510case "$host" in
2511 *-univel-sysv4.2MP)
2512 if test `uname -v` = "2.03"; then
2513 echo "disabling mallinfo for $host"
2514 ac_cv_func_mallinfo=no
2515 fi
2516 ;;
2517esac
2518
84cecfd2 2519dnl This has to be before AC_CHECK_FUNCS
2520# Disable poll() on certain platforms. Override by setting ac_cv_func_poll
2521# when running configure.
2522if test -z "$ac_cv_func_poll"; then
2523 case "$host" in
2524 [alpha-dec-osf3.*])
2525 # John Kay (jkay@nlanr.net) 19970818
2526 echo "disabling poll for $host..."
2527 ac_cv_func_poll='no'
2528 ;;
2529 [*-hp-hpux*.*])
2530 # Duane Wessels
2531 echo "disabling poll for $host..."
2532 ac_cv_func_poll='no'
2533 ;;
2534 [*-linux-*])
f5cec332 2535 # Henrik Nordstrom (hno@squid-cache.org) 19980817
9bb83c8b 2536 # poll is problematic on Linux. We disable it
2537 # by default until Linux gets it right.
b6a2f15e 2538 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
2539 if test $rev -lt 002002; then
2540 echo "disabling poll for $host < 2.2..."
2541 ac_cv_func_poll='no'
2542 fi
84cecfd2 2543 ;;
c68e9c6b 2544 [powerpc-ibm-aix4.1.*])
2545 # Mike Laster (mlaster@metavillage.com) 19981021
2546 echo "disabling poll for $host..."
2547 ac_cv_func_poll='no'
2548 ;;
86ec11aa 2549 [*-pc-sco3.2*])
2550 # Robert Side <rside@aiinc.bc.ca>
2551 # Mon, 18 Jan 1999 17:48:00 GMT
2552 echo "disabling poll for $host..."
2553 ac_cv_func_poll='no'
2554 ;;
84cecfd2 2555 esac
2556fi
176d10ee 2557
08caf8c6 2558dnl Override statfs() detect on MinGW becasue is emulated in source code
2559case "$host_os" in
2560mingw|mingw32)
2561 ac_cv_func_statfs='yes'
2562 ;;
2563esac
2564
6716b242 2565dnl Check for library functions
2566AC_CHECK_FUNCS(\
ce3d30fb 2567 backtrace_symbols_fd \
3a144521 2568 bcopy \
2569 bswap_16 \
2570 bswap_32 \
f9576890 2571 bswap16 \
2572 bswap32 \
df087e68 2573 crypt \
4ac29a5b 2574 fchmod \
6716b242 2575 getdtablesize \
8505e57b 2576 getpagesize \
230c091c 2577 getpass \
3a144521 2578 getrlimit \
30a4f2a8 2579 getrusage \
9c1d8929 2580 getspnam \
f9576890 2581 htobe16 \
2582 htole16 \
30a4f2a8 2583 lrand48 \
6716b242 2584 mallinfo \
0f5efab0 2585 mallocblksize \
6716b242 2586 mallopt \
2ae6b9b0 2587 memcpy \
30a4f2a8 2588 memmove \
dac27377 2589 memset \
b99a6dec 2590 mkstemp \
1812b6c7 2591 mktime \
88738790 2592 mstats \
84cecfd2 2593 poll \
62ae0622 2594 prctl \
3a144521 2595 pthread_attr_setschedparam \
cd748f27 2596 pthread_attr_setscope \
2597 pthread_setschedparam \
42b51993 2598 pthread_sigmask \
c68e9c6b 2599 putenv \
b1e77ec1 2600 random \
6716b242 2601 regcomp \
2602 regexec \
2603 regfree \
30a4f2a8 2604 res_init \
4915be3b 2605 rint \
a4ba1105 2606 sbrk \
3a144521 2607 select \
234967c9 2608 seteuid \
c415c128 2609 setgroups \
30a4f2a8 2610 setpgrp \
6716b242 2611 setrlimit \
30a4f2a8 2612 setsid \
2613 sigaction \
11430c03 2614 snprintf \
1ccc0d40 2615 socketpair \
30a4f2a8 2616 srand48 \
b1e77ec1 2617 srandom \
0343b99c 2618 statfs \
1cd53467 2619 strsep \
6716b242 2620 sysconf \
2621 syslog \
234967c9 2622 timegm \
28da5e0d 2623 vsnprintf \
6716b242 2624)
2625
1b3db6d9 2626dnl Magic which checks whether we are forcing a type of comm loop we
2627dnl are actually going to (ab)use
2628
2629dnl Actually do the define magic now
2630dnl mostly ripped from squid-commloops, thanks to adrian and benno
2631
6c9797b9 2632if test "$ac_cv_func_kqueue" = "yes" ; then
92b9f1fd 2633 SELECT_TYPE="kqueue"
6a9f6389 2634 AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop])
a46d2c0e 2635elif test "$ac_cv_func_epoll" = "yes" ; then
2636 SELECT_TYPE="epoll"
2637 AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop])
48510020 2638 AC_CHECK_LIB(epoll, epoll_create, [EPOLL_LIBS="-lepoll"])
2639 AC_SUBST(EPOLL_LIBS)
6c9797b9 2640elif test "$ac_cv_func_poll" = "yes" ; then
2641 SELECT_TYPE="poll"
2642 AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop])
2643elif test "$ac_cv_func_select" = "yes" ; then
663c0a38 2644 case "$host_os" in
2645 mingw|mingw32)
2646 SELECT_TYPE="select_win32"
2647 AC_DEFINE(USE_SELECT_WIN32,1,[Use Winsock select() for the IO loop])
2648 ;;
2649 *)
2650 SELECT_TYPE="select"
2651 AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop])
2652 ;;
2653 esac
1b3db6d9 2654else
a46d2c0e 2655 echo "Eep! Can't find poll, kqueue, epoll, or select!"
1b3db6d9 2656 echo "I'll try select and hope for the best."
2657 SELECT_TYPE="select"
6a9f6389 2658 AC_DEFINE(USE_SELECT,1)
1b3db6d9 2659fi
2660echo "Using ${SELECT_TYPE} for select loop."
1b3db6d9 2661
2662
60939927 2663dnl Yay! Another Linux brokenness. Its not good enough
2664dnl to know that setresuid() exists, because RedHat 5.0 declares
2665dnl setresuid() but doesn't implement it.
2666dnl
2667AC_CACHE_CHECK(if setresuid is implemented, ac_cv_func_setresuid,
5c51415d 2668 AC_TRY_RUN([
60939927 2669#include <stdlib.h>
5c51415d 2670 int main() {
2671 if(setresuid(-1,-1,-1)) {
2672 perror("setresuid:");
2673 exit(1);
60939927 2674 }
2675 exit(0);
5c51415d 2676 }
2677 ],ac_cv_func_setresuid="yes",ac_cv_func_setresuid="no")
60939927 2678)
5c51415d 2679if test "$ac_cv_func_setresuid" = "yes" ; then
6a9f6389 2680 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 2681fi
60939927 2682
c3d0c8b5 2683AM_CONDITIONAL(NEED_OWN_SNPRINTF, false)
2684if test "$ac_cv_func_snprintf" = "no" || test "$ac_cv_func_vsnprintf" = "no" ; then
2685 AM_CONDITIONAL(NEED_OWN_SNPRINTF, true)
2686fi
eee79a2e 2687
1cd53467 2688AM_CONDITIONAL(NEED_OWN_STRSEP, false)
2689if test "$ac_cv_func_strsep" = "no" ; then
2690 AM_CONDITIONAL(NEED_OWN_STRSEP, true)
2691fi
2692
eee79a2e 2693dnl
2694dnl Test for va_copy
2695dnl
2696AC_CACHE_CHECK(if va_copy is implemented, ac_cv_func_va_copy,
2697 AC_TRY_RUN([
2698 #include <stdarg.h>
2699 void f (int i, ...) {
2700 va_list args1, args2;
2701 va_start (args1, i);
2702 va_copy (args2, args1);
2703 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
2704 exit (1);
2705 va_end (args1); va_end (args2);
2706 }
2707 int main() {
2708 f (0, 42);
2709 return 0;
2710 }
2711 ],ac_cv_func_va_copy="yes",ac_cv_func_va_copy="no")
2712)
2713if test "$ac_cv_func_va_copy" = "yes" ; then
a45f884d 2714 AC_DEFINE(HAVE_VA_COPY, 1, [If your system have va_copy])
eee79a2e 2715fi
2716
2717dnl
2718dnl Some systems support __va_copy
2719dnl
2720AC_CACHE_CHECK(if __va_copy is implemented, ac_cv_func___va_copy,
2721 AC_TRY_RUN([
2722 #include <stdarg.h>
2723 void f (int i, ...) {
2724 va_list args1, args2;
2725 va_start (args1, i);
2726 __va_copy (args2, args1);
2727 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
2728 exit (1);
2729 va_end (args1); va_end (args2);
2730 }
2731 int main() {
2732 f (0, 42);
2733 return 0;
2734 }
2735 ],ac_cv_func___va_copy="yes",ac_cv_func___va_copy="no")
2736)
2737if test "$ac_cv_func___va_copy" = "yes" ; then
a45f884d 2738 AC_DEFINE(HAVE___VA_COPY, 1, [Some systems have __va_copy instead of va_copy])
eee79a2e 2739fi
c3d0c8b5 2740
5cafc1d6 2741dnl IP-Filter support requires ipf header files. These aren't
2742dnl installed by default, so we need to check for them
2743if test "$IPF_TRANSPARENT" ; then
2744 AC_MSG_CHECKING(if IP-Filter header files are installed)
42b51993 2745 # hold on to your hats...
2746 if test "$ac_cv_header_ip_compat_h" = "yes" ||
2747 test "$ac_cv_header_ip_fil_compat_h" = "yes" ||
87d21d8b 2748 test "$ac_cv_header_netinet_ip_compat_h" = "yes" ||
2749 test "$ac_cv_header_netinet_ip_fil_compat_h" = "yes" ; then
42b51993 2750 have_ipfilter_compat_header="yes"
2751 fi
2752 if test "x$have_ipfilter_compat_header" = "xyes" &&
eb824054 2753 test "$ac_cv_header_ip_fil_h" = "yes" &&
2754 test "$ac_cv_header_ip_nat_h" = "yes" ; then
2755 IPF_TRANSPARENT="yes"
2756 AC_DEFINE(IPF_TRANSPARENT, 1)
42b51993 2757 elif test "$have_ipfilter_compat_header" = "yes" &&
eb824054 2758 test "$ac_cv_header_netinet_ip_fil_h" = "yes" &&
2759 test "$ac_cv_header_netinet_ip_nat_h" = "yes" ; then
2760 IPF_TRANSPARENT="yes"
2761 AC_DEFINE(IPF_TRANSPARENT, 1)
2762 else
5cafc1d6 2763 IPF_TRANSPARENT="no"
2764 AC_DEFINE(IPF_TRANSPARENT, 0)
5cafc1d6 2765 fi
2766 AC_MSG_RESULT($IPF_TRANSPARENT)
2767fi
2768if test "$IPF_TRANSPARENT" = "no" ; then
2769 echo "WARNING: Cannot find necessary IP-Filter header files"
2770 echo " Transparent Proxy support WILL NOT be enabled"
2771 sleep 10
8f6ca20d 2772elif test "$IPF_TRANSPARENT" = "yes" ; then
2773dnl On Solaris Ipfilter includes expect that SOLARIS2 is defined with the
2774dnl Solaris minor version (8, 9, 10, ...)
2775 case "$host" in
2776 *-solaris*)
2777 solrev=`uname -r | sh -c 'IFS=. read j n x; echo $n'`
2778 CFLAGS="-DSOLARIS2=$solrev $CFLAGS"
20b3ae10 2779 CXXFLAGS="-DSOLARIS2=$solrev $CXXFLAGS"
8f6ca20d 2780 ;;
2781 *)
2782 ;;
2783 esac
5cafc1d6 2784fi
2785
2b0dd4ac 2786dnl PF support requires a header file.
2787if test "$PF_TRANSPARENT" ; then
2788 AC_MSG_CHECKING(if PF header file is installed)
2789 # hold on to your hats...
2790 if test "$ac_cv_header_net_pfvar_h" = "yes"; then
2791 PF_TRANSPARENT="yes"
2792 AC_DEFINE(PF_TRANSPARENT, 1)
2793 else
2794 PF_TRANSPARENT="no"
2795 AC_DEFINE(PF_TRANSPARENT, 0)
2796 fi
2797 AC_MSG_RESULT($PF_TRANSPARENT)
2798fi
2799if test "$PF_TRANSPARENT" = "no" ; then
2800 echo "WARNING: Cannot find necessary PF header file"
2801 echo " Transparent Proxy support WILL NOT be enabled"
2802 sleep 10
2803fi
2804
d852fbad 2805dnl Linux-Netfilter support requires Linux 2.4 kernel header files.
2806dnl Shamelessly copied from above
2807if test "$LINUX_NETFILTER" ; then
d6d62546 2808 AC_MSG_CHECKING(if Linux (Netfilter) kernel header files are installed)
d852fbad 2809 # hold on to your hats...
2810 if test "$ac_cv_header_linux_netfilter_ipv4_h" = "yes"; then
2811 LINUX_NETFILTER="yes"
2812 AC_DEFINE(LINUX_NETFILTER, 1)
2813 else
2814 LINUX_NETFILTER="no"
2815 AC_DEFINE(LINUX_NETFILTER, 0)
2816 fi
2817 AC_MSG_RESULT($LINUX_NETFILTER)
2818fi
2819if test "$LINUX_NETFILTER" = "no" ; then
d6d62546 2820 echo "WARNING: Cannot find necessary Linux kernel (Netfilter) header files"
2821 echo " Linux Transparent Proxy support WILL NOT be enabled"
d852fbad 2822 sleep 10
2823fi
2824
91bc414e 2825if test -z "$USE_GNUREGEX" ; then
2826 case "$host" in
2827 *-sun-solaris2.[[0-4]])
2828 USE_GNUREGEX="yes"
2829 ;;
2830 *-next-nextstep*)
2831 USE_GNUREGEX="yes"
2832 ;;
2833 esac
2834fi
7a081912 2835AC_MSG_CHECKING(if GNUregex needs to be compiled)
91bc414e 2836if test -z "$USE_GNUREGEX"; then
55878dfd 2837if test "$ac_cv_func_regcomp" = "no" || test "$USE_GNUREGEX" = "yes" ; then
74946a0f 2838 USE_GNUREGEX="yes"
00fa2c12 2839else
0cccc031 2840 AC_TRY_COMPILE([#include <sys/types.h>
2841#include <regex.h>],[regex_t t; regcomp(&t,"",0);],
91bc414e 2842 USE_GNUREGEX="no",
2843 USE_GNUREGEX="yes")
2844fi
00fa2c12 2845fi
74946a0f 2846AC_MSG_RESULT($USE_GNUREGEX)
2847if test "$USE_GNUREGEX" = "yes"; then
26675bf4 2848 REGEXLIB="-lregex"
7a081912 2849 LIBREGEX="libregex.a"
6a9f6389 2850 AC_DEFINE(USE_GNUREGEX,1,[Define if we should use GNU regex])
7a081912 2851fi
26675bf4 2852AC_SUBST(REGEXLIB)
00fa2c12 2853AC_SUBST(LIBREGEX)
7a081912 2854
3f6fcd8a 2855AC_REPLACE_FUNCS(\
3d0cf10e 2856 drand48 \
3f6fcd8a 2857 tempnam \
4d38fc7e 2858 strerror \
e3d74828 2859 initgroups
3f6fcd8a 2860)
2861
5c51415d 2862dnl Not cached since people are likely to tune this
e924600d 2863AC_MSG_CHECKING(Default FD_SETSIZE value)
2864AC_TRY_RUN([
2865#if HAVE_STDIO_H
2866#include <stdio.h>
2867#endif
2868#if HAVE_UNISTD_H
2869#include <unistd.h>
2870#endif
2871#if HAVE_SYS_TIME_H
2872#include <sys/time.h>
2873#endif
2874#if HAVE_SYS_SELECT_H
2875#include <sys/select.h>
2876#endif
2877#if HAVE_SYS_TYPES_H
2878#include <sys/types.h>
2879#endif
2880main() {
635e6242 2881 FILE *fp = fopen("conftestval", "w");
2882 fprintf (fp, "%d\n", FD_SETSIZE);
e924600d 2883 exit(0);
2884}
2885],
2886DEFAULT_FD_SETSIZE=`cat conftestval`,
2887DEFAULT_FD_SETSIZE=256,
2888DEFAULT_FD_SETSIZE=256)
2889AC_MSG_RESULT($DEFAULT_FD_SETSIZE)
6a9f6389 2890AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE, [Default FD_SETSIZE value])
e924600d 2891
f49be7d1 2892
5c51415d 2893dnl Not cached since people are likely to tune this
234967c9 2894AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
c76d8acc 2895dnl damn! FreeBSD's pthreads breaks dup2().
f49be7d1 2896if test -n "$squid_filedescriptors_num" ; then
2897 SQUID_MAXFD=$squid_filedescriptors_num
2898 AC_MSG_RESULT($SQUID_MAXFD (user-forced))
2899else
2900 TLDFLAGS="$LDFLAGS"
2901 case $host in
2902 i386-unknown-freebsd*)
2903 if echo "$LDFLAGS" | grep -q pthread; then
2904 LDFLAGS=`echo $LDFLAGS | sed -e "s/-pthread//"`
2905 fi
2906 esac
2907 AC_TRY_RUN([
8cca06da 2908#include <stdio.h>
234967c9 2909#include <unistd.h>
30a4f2a8 2910#include <sys/time.h> /* needed on FreeBSD */
234967c9 2911#include <sys/param.h>
2912#include <sys/resource.h>
2913main() {
635e6242 2914 FILE *fp;
234967c9 2915 int i,j;
42b51993 2916#if defined(__CYGWIN32__) || defined (__CYGWIN__)
b05490a8 2917 /* getrlimit and sysconf returns bogous values on cygwin32.
df087e68 2918 * Number of fds is virtually unlimited in cygwin (sys/param.h)
b05490a8 2919 * __CYGWIN32__ is deprecated.
df087e68 2920 */
2921 i = NOFILE;
b05490a8 2922#else
2923#if HAVE_SETRLIMIT
234967c9 2924 struct rlimit rl;
2925#if defined(RLIMIT_NOFILE)
2926 if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
2927 perror("getrlimit: RLIMIT_NOFILE");
2928 } else {
2929 rl.rlim_cur = rl.rlim_max; /* set it to the max */
2930 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
2931 perror("setrlimit: RLIMIT_NOFILE");
2932 }
2933 }
2934#elif defined(RLIMIT_OFILE)
2935 if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
2936 perror("getrlimit: RLIMIT_OFILE");
2937 } else {
2938 rl.rlim_cur = rl.rlim_max; /* set it to the max */
2939 if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
2940 perror("setrlimit: RLIMIT_OFILE");
2941 }
2942 }
2943#endif /* RLIMIT_NOFILE */
2944#endif /* HAVE_SETRLIMIT */
d9399075 2945 /* by starting at 2^14, we will never get higher
2946 than 2^15 for SQUID_MAXFD */
2947 i = j = 1<<14;
2948 while (j) {
2949 j >>= 1;
2950 if (dup2(0, i) < 0) {
2951 i -= j;
2952 } else {
2953 close(i);
2954 i += j;
2955 }
2956 }
2957 i++;
b05490a8 2958#endif /* IF !DEF CYGWIN */
635e6242 2959 fp = fopen("conftestval", "w");
a4d7e961 2960 fprintf (fp, "%d\n", i & ~0x3F);
234967c9 2961 exit(0);
2962}
f49be7d1 2963 ],
2964 SQUID_MAXFD=`cat conftestval`,
2965 SQUID_MAXFD=256,
2966 SQUID_MAXFD=256)
4b26fae9 2967 dnl Microsoft MSVCRT.DLL supports 2048 maximum FDs
2968 case "$host_os" in
2969 mingw|mingw32)
2970 SQUID_MAXFD="2048"
2971 ;;
2972 esac
f49be7d1 2973 AC_MSG_RESULT($SQUID_MAXFD)
2974fi
6a9f6389 2975AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD,[Maximum number of open filedescriptors])
b9cc811d 2976if test "$SQUID_MAXFD" -lt 512 ; then
80ab193b 2977 echo "WARNING: $SQUID_MAXFD may not be enough filedescriptors if your"
2978 echo " cache will be very busy. Please see the FAQ page"
2b6662ba 2979 echo " http://www.squid-cache.org/FAQ/FAQ-11.html#filedescriptors"
e692ff35 2980 echo " on how to increase your filedescriptor limit"
933cc58d 2981 sleep 10
80ab193b 2982fi
c76d8acc 2983LDFLAGS="$TLDFLAGS"
234967c9 2984
d0f9207a 2985if test `expr $SQUID_MAXFD % 64` != 0; then
a4d7e961 2986 echo "WARNING: $SQUID_MAXFD is not an multiple of 64. This may cause issues"
2987 echo " on certain platforms."
2988 sleep 10
2989fi
2990
5c51415d 2991dnl Not cached since people are likely to tune this
30a4f2a8 2992AC_MSG_CHECKING(Default UDP send buffer size)
2993AC_TRY_RUN([
8cca06da 2994#include <stdlib.h>
2995#include <stdio.h>
30a4f2a8 2996#include <sys/types.h>
2997#include <sys/socket.h>
2998#include <netinet/in.h>
2999main ()
3000{
635e6242 3001 FILE *fp;
30a4f2a8 3002 int fd,val=0,len=sizeof(int);
3003 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
3004 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
3005 if (val<=0) exit(1);
635e6242 3006 fp = fopen("conftestval", "w");
3007 fprintf (fp, "%d\n", val);
30a4f2a8 3008 exit(0);
3009}
3010],
6a9f6389 3011SQUID_DETECT_UDP_SO_SNDBUF=`cat conftestval`,
3012SQUID_DETECT_UDP_SO_SNDBUF=16384,
3013SQUID_DETECT_UDP_SO_SNDBUF=16384)
3014AC_MSG_RESULT($SQUID_DETECT_UDP_SO_SNDBUF)
3015AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_SNDBUF, $SQUID_DETECT_UDP_SO_SNDBUF,[UDP send buffer size])
30a4f2a8 3016
5c51415d 3017dnl Not cached since people are likely to tune this
30a4f2a8 3018AC_MSG_CHECKING(Default UDP receive buffer size)
3019AC_TRY_RUN([
8cca06da 3020#include <stdlib.h>
3021#include <stdio.h>
30a4f2a8 3022#include <sys/types.h>
3023#include <sys/socket.h>
3024#include <netinet/in.h>
3025main ()
3026{
635e6242 3027 FILE *fp;
30a4f2a8 3028 int fd,val=0,len=sizeof(int);
3029 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
3030 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
3031 if (val <= 0) exit(1);
635e6242 3032 fp = fopen("conftestval", "w");
3033 fprintf (fp, "%d\n", val);
30a4f2a8 3034 exit(0);
3035}
3036],
6a9f6389 3037SQUID_DETECT_UDP_SO_RCVBUF=`cat conftestval`,
3038SQUID_DETECT_UDP_SO_RCVBUF=16384,
3039SQUID_DETECT_UDP_SO_RCVBUF=16384)
3040AC_MSG_RESULT($SQUID_DETECT_UDP_SO_RCVBUF)
3041AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_RCVBUF, $SQUID_DETECT_UDP_SO_RCVBUF,[UDP receive buffer size])
30a4f2a8 3042
5c51415d 3043dnl Not cached since people are likely to tune this
30a4f2a8 3044AC_MSG_CHECKING(Default TCP send buffer size)
3045AC_TRY_RUN([
8cca06da 3046#include <stdlib.h>
3047#include <stdio.h>
30a4f2a8 3048#include <sys/types.h>
3049#include <sys/socket.h>
3050#include <netinet/in.h>
3051main ()
3052{
635e6242 3053 FILE *fp;
30a4f2a8 3054 int fd,val=0,len=sizeof(int);
3055 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
3056 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
3057 if (val <= 0) exit(1);
635e6242 3058 fp = fopen("conftestval", "w");
3059 fprintf (fp, "%d\n", val);
30a4f2a8 3060 exit(0);
3061}
3062],
3063SQUID_TCP_SO_SNDBUF=`cat conftestval`,
1c481e00 3064SQUID_TCP_SO_SNDBUF=16384,
3065SQUID_TCP_SO_SNDBUF=16384)
30a4f2a8 3066AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF)
2aa6ca58 3067if test $SQUID_TCP_SO_SNDBUF -gt 32768; then
3068 echo "Limiting send buffer size to 32K"
3069 SQUID_TCP_SO_SNDBUF=32768
3070fi
6a9f6389 3071AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF,[TCP send buffer size])
30a4f2a8 3072
5c51415d 3073dnl Not cached since people are likely to tune this
30a4f2a8 3074AC_MSG_CHECKING(Default TCP receive buffer size)
3075AC_TRY_RUN([
8cca06da 3076#include <stdlib.h>
3077#include <stdio.h>
30a4f2a8 3078#include <sys/types.h>
3079#include <sys/socket.h>
3080#include <netinet/in.h>
3081main ()
3082{
635e6242 3083 FILE *fp;
30a4f2a8 3084 int fd,val=0,len=sizeof(int);
3085 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
3086 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
3087 if (val <= 0) exit(1);
635e6242 3088 fp = fopen("conftestval", "w");
3089 fprintf (fp, "%d\n", val);
30a4f2a8 3090 exit(0);
3091}
3092],
3093SQUID_TCP_SO_RCVBUF=`cat conftestval`,
1c481e00 3094SQUID_TCP_SO_RCVBUF=16384,
3095SQUID_TCP_SO_RCVBUF=16384)
30a4f2a8 3096AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF)
2aa6ca58 3097if test $SQUID_TCP_SO_RCVBUF -gt 65535; then
3098 echo "Limiting receive buffer size to 64K"
3099 SQUID_TCP_SO_RCVBUF=65535
3100fi
6a9f6389 3101AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF,[TCP receive buffer size])
5c51415d 3102AC_CACHE_CHECK(if sys_errlist is already defined, ac_cv_needs_sys_errlist,
9bc73deb 3103 AC_TRY_COMPILE([#include <stdio.h>],[char *s = sys_errlist;],
5c51415d 3104 ac_cv_needs_sys_errlist="no",
3105 ac_cv_needs_sys_errlist="yes")
3106)
3107if test "$ac_cv_needs_sys_errlist" = "yes" ; then
6a9f6389 3108 AC_DEFINE(NEED_SYS_ERRLIST,1,[If we need to declare sys_errlist[] as external])
5c51415d 3109fi
30a4f2a8 3110
5c51415d 3111dnl Not cached since people are likely to change this
6bf65235 3112AC_MSG_CHECKING(for libresolv _dns_ttl_ hack)
3113AC_TRY_LINK(extern int _dns_ttl_;,return _dns_ttl_;,
3114[AC_MSG_RESULT(yes)
6a9f6389 3115AC_DEFINE(LIBRESOLV_DNS_TTL_HACK,1,[If libresolv.a has been hacked to export _dns_ttl_])],
6bf65235 3116AC_MSG_RESULT(no))
3117
a937d5e3 3118AC_MSG_CHECKING(if inet_ntoa() actually works)
3119AC_TRY_RUN([
3120#include <stdlib.h>
3121#include <stdio.h>
3122#include <sys/types.h>
3123#include <netinet/in.h>
3124#include <arpa/inet.h>
3125main ()
3126{
635e6242 3127 FILE *fp;
a937d5e3 3128 struct in_addr in;
3129 in.s_addr = inet_addr("1.2.3.4");
635e6242 3130 fp = fopen("conftestval", "w");
3131 fprintf (fp, "%s\n", inet_ntoa(in));
a937d5e3 3132 exit(0);
3133}
3134],
3135INET_NTOA_RESULT=`cat conftestval`,
3136INET_NTOA_RESULT="broken",
3137INET_NTOA_RESULT="broken")
3138if test "$INET_NTOA_RESULT" = "1.2.3.4" ; then
3139 AC_MSG_RESULT("yes")
3140else
3141 AC_MSG_RESULT("no")
4b26fae9 3142 case "$host_os" in
3143 mingw|mingw32)
3144 echo "Using Win32 resolver instead."
3145 ;;
3146 *)
3147 echo "Will use our own inet_ntoa()."
3148 AC_LIBOBJ(inet_ntoa)
3149# echo "WARNING: This looks bad, and probably prevents Squid from working."
3150# echo " If you're on IRIX and using GCC 2.8, you probably need"
3151# echo " to use the IRIX C compiler instead."
3152# sleep 10
3153 ;;
3154 esac
a937d5e3 3155fi
3156
b6a2f15e 3157if test "$ac_cv_header_sys_statvfs_h" = "yes" ; then
c68e9c6b 3158AC_MSG_CHECKING(for working statvfs() interface)
3159AC_TRY_COMPILE([
3160#include <stdlib.h>
3161#include <stdio.h>
3162#include <sys/types.h>
3163#include <sys/statvfs.h>
3164],
3165[
3166struct statvfs sfs;
3167sfs.f_blocks = sfs.f_bfree = sfs.f_frsize =
3168sfs.f_files = sfs.f_ffree = 0;
3169statvfs("/tmp", &sfs);
3170],
3171 ac_cv_func_statvfs=yes,
3172 ac_cv_func_statvfs=no)
3173AC_MSG_RESULT($ac_cv_func_statvfs)
6b8e7481 3174if test "$ac_cv_func_statvfs" = "yes" ; then
6a9f6389 3175 AC_DEFINE(HAVE_STATVFS,1,[If your system has statvfs(), and if it actually works!])
b6a2f15e 3176fi
6b8e7481 3177fi
c68e9c6b 3178
3179AC_CACHE_CHECK(for _res.nsaddr_list, ac_cv_have_res_nsaddr_list,
3180AC_TRY_COMPILE([
3181#if HAVE_SYS_TYPES_H
3182#include <sys/types.h>
3183#endif
3184#if HAVE_NETINET_IN_H
3185#include <netinet/in.h>
3186#endif
3187#if HAVE_ARPA_INET_H
3188#include <arpa/inet.h>
3189#endif
3190#if HAVE_ARPA_NAMESER_H
3191#include <arpa/nameser.h>
3192#endif
3193#if HAVE_RESOLV_H
3194#include <resolv.h>
3195#endif
3196],
3197[_res.nsaddr_list[[0]];],
3198ac_cv_have_res_nsaddr_list="yes",
3199ac_cv_have_res_nsaddr_list="no"))
3200if test $ac_cv_have_res_nsaddr_list = "yes" ; then
6a9f6389 3201 AC_DEFINE(HAVE_RES_NSADDR_LIST,1,[If _res structure has nsaddr_list member])
c68e9c6b 3202fi
3203
3204if test $ac_cv_have_res_nsaddr_list = "no" ; then
3205AC_CACHE_CHECK(for _res.ns_list, ac_cv_have_res_ns_list,
3206AC_TRY_COMPILE([
3207#if HAVE_SYS_TYPES_H
3208#include <sys/types.h>
3209#endif
3210#if HAVE_NETINET_IN_H
3211#include <netinet/in.h>
3212#endif
3213#if HAVE_ARPA_INET_H
3214#include <arpa/inet.h>
3215#endif
3216#if HAVE_ARPA_NAMESER_H
3217#include <arpa/nameser.h>
3218#endif
3219#if HAVE_RESOLV_H
3220#include <resolv.h>
3221#endif
3222],
3223[_res.ns_list[[0]].addr;],
3224ac_cv_have_res_ns_list="yes",
3225ac_cv_have_res_ns_list="no"))
3226if test $ac_cv_have_res_ns_list = "yes" ; then
6a9f6389 3227 AC_DEFINE(HAVE_RES_NS_LIST,1,[If _res structure has ns_list member])
c68e9c6b 3228fi
3229fi
3230
090089c4 3231dnl Need the debugging version of malloc if available
3232XTRA_OBJS=''
6509a1a0 3233if test "$ac_cv_lib_malloc_main" = "yes" ; then
090089c4 3234 if test -r /usr/lib/debug/malloc.o ; then
3235 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
3236 fi
3237 if test -r /usr/lib/debug/mallocmap.o ; then
3238 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
3239 fi
3240fi
2bbd722b 3241
090089c4 3242AC_SUBST(XTRA_OBJS)
3243
38fea766 3244if test -z "$XTRA_LIBS"; then
3245 XTRA_LIBS="$LIBS"
0f5a16f8 3246 dnl minor cleanup
3247 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
38fea766 3248 LIBS=''
3249fi
090089c4 3250AC_SUBST(XTRA_LIBS)
3251
090089c4 3252dnl Clean up after OSF/1 core dump bug
3253rm -f core
3254
6a9f6389 3255AC_CONFIG_FILES([\
a2794549 3256 Makefile \
3257 lib/Makefile \
a2794549 3258 scripts/Makefile \
3259 scripts/RunCache \
3260 scripts/RunAccel \
3261 src/Makefile \
3262 src/fs/Makefile \
3263 src/repl/Makefile \
3264 src/auth/Makefile \
a2794549 3265 contrib/Makefile \
3266 snmplib/Makefile \
3267 icons/Makefile \
3268 errors/Makefile \
1077c1b8 3269 test-suite/Makefile \
99db07b3 3270 doc/Makefile \
0c510f3c 3271 helpers/Makefile \
3272 helpers/basic_auth/Makefile \
3273 helpers/basic_auth/LDAP/Makefile \
3274 helpers/basic_auth/MSNT/Makefile \
3275 helpers/basic_auth/NCSA/Makefile \
3276 helpers/basic_auth/PAM/Makefile \
3277 helpers/basic_auth/SMB/Makefile \
6e785d85 3278 helpers/basic_auth/mswin_sspi/Makefile \
0c510f3c 3279 helpers/basic_auth/YP/Makefile \
3280 helpers/basic_auth/getpwnam/Makefile \
3281 helpers/basic_auth/multi-domain-NTLM/Makefile \
3282 helpers/basic_auth/SASL/Makefile \
0c510f3c 3283 helpers/digest_auth/Makefile \
3284 helpers/digest_auth/password/Makefile \
55013f9c 3285 helpers/digest_auth/ldap/Makefile \
0c510f3c 3286 helpers/ntlm_auth/Makefile \
3287 helpers/ntlm_auth/fakeauth/Makefile \
3288 helpers/ntlm_auth/no_check/Makefile \
3289 helpers/ntlm_auth/SMB/Makefile \
3290 helpers/ntlm_auth/SMB/smbval/Makefile \
6e785d85 3291 helpers/ntlm_auth/mswin_sspi/Makefile \
3292 helpers/negotiate_auth/Makefile \
3293 helpers/negotiate_auth/mswin_sspi/Makefile \
c6588c68 3294 helpers/external_acl/Makefile \
3295 helpers/external_acl/ip_user/Makefile \
3296 helpers/external_acl/ldap_group/Makefile \
74ab8d10 3297 helpers/external_acl/session/Makefile \
c6588c68 3298 helpers/external_acl/unix_group/Makefile \
736a9a4d 3299 helpers/external_acl/wbinfo_group/Makefile \
94ab55b0 3300 helpers/external_acl/mswin_lm_group/Makefile \
3301 tools/Makefile
53cbe3e4 3302])
43ae1d95 3303
3304AC_CONFIG_SUBDIRS(lib/libTrie)
f5691f9c 3305AC_CONFIG_SUBDIRS(lib/cppunit-1.10.0)
43ae1d95 3306
6a9f6389 3307AC_OUTPUT