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