]> git.ipfire.org Git - thirdparty/squid.git/blame - configure.in
bootstrapped
[thirdparty/squid.git] / configure.in
CommitLineData
1b3db6d9 1
2877b8a9 2dnl Configuration input file for Squid
090089c4 3dnl
983061ed 4dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9)
090089c4 5dnl
d2e3605e 6dnl $Id: configure.in,v 1.329 2003/03/11 22:11:37 robertc Exp $
090089c4 7dnl
8dnl
090089c4 9dnl
6a9f6389 10AC_INIT
856e69c5 11AC_PREREQ(2.52)
e6ccf245 12AC_CONFIG_SRCDIR([src/main.cc])
71b12d7c 13AC_CONFIG_AUX_DIR(cfgaux)
4844c182 14AM_INIT_AUTOMAKE(squid, 3.0-DEVEL)
a2794549 15AM_CONFIG_HEADER(include/autoconf.h)
d2e3605e 16AC_REVISION($Revision: 1.329 $)dnl
a2794549 17AC_PREFIX_DEFAULT(/usr/local/squid)
246d7ffc 18AM_MAINTAINER_MODE
a2794549 19
20dnl Set default LDFLAGS
21if test -z "$LDFLAGS"; then
22 LDFLAGS="-g"
23fi
24
25PRESET_CFLAGS="$CFLAGS"
090089c4 26
a2794549 27dnl Check for GNU cc
28AC_PROG_CC
c4b0db82 29AC_LANG_C
29b8d8d6 30AC_PROG_CXX
a2794549 31AM_PROG_CC_C_O
88d50a22 32AC_CANONICAL_HOST
33
a2794549 34
26675bf4 35CRYPTLIB=''
00fa2c12 36REGEXLIB='' # -lregex
37LIBREGEX='' # libregex.a
090089c4 38
a2794549 39dnl find out the exe extension for this platform. If it's not empty, use it for CGI's as well.
40AC_EXEEXT
41AC_OBJEXT
42
43if test -z "$EXEEXT"; then
44 CGIEXT=".cgi"
45else
7aeb8001 46 # automake automatically adds .exe when installing binaries
47 CGIEXT=""
a2794549 48fi
7aeb8001 49AC_SUBST(CGIEXT)
a2794549 50
0e6d05ef 51dnl this should be expanded to a list of platform sensible support requirements.
52dnl (adding an option like --enable-cygwin-support doesn't make sense :]) - R Collins 2001
df087e68 53case "$host_os" in
a2794549 54cygwin|cygwin32)
55 AM_CONDITIONAL(ENABLE_WIN32SPECIFIC, true)
df087e68 56 ;;
57*)
a2794549 58 AM_CONDITIONAL(ENABLE_WIN32SPECIFIC, false)
df087e68 59 ;;
60esac
df087e68 61
a26bdc75 62if test -z "$CACHE_HTTP_PORT"; then
63 CACHE_HTTP_PORT="3128"
64fi
65if test -z "$CACHE_ICP_PORT"; then
66 CACHE_ICP_PORT="3130"
67fi
a26bdc75 68
090089c4 69dnl Subsitutions
6a9f6389 70AC_DEFINE_UNQUOTED(CACHE_HTTP_PORT, $CACHE_HTTP_PORT,
71[What default TCP port to use for HTTP listening?])
72AC_DEFINE_UNQUOTED(CACHE_ICP_PORT, $CACHE_ICP_PORT,
73[What default UDP port to use for ICP listening?])
090089c4 74
6a9f6389 75AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host",[Host type from configure])
30a4f2a8 76
6a9f6389 77AC_DEFINE_UNQUOTED(SQUID_CONFIGURE_OPTIONS, "$ac_configure_args", [configure command line used to configure Squid])
090089c4 78
d96ceb8e 79dnl Check for GNU cc
80AC_PROG_CC
81
6ad85e8a 82dnl Gerben Wierda <Gerben_Wierda@RnA.nl>
83case "$host" in
84 mab-next-nextstep3)
85 CC="$CC -arch m68k -arch i486 -arch hppa -arch sparc"
86 ;;
87esac
88
30a4f2a8 89dnl Set Default CFLAGS
90if test -z "$PRESET_CFLAGS"; then
91 if test "$GCC" = "yes"; then
92 case "$host" in
97b12a5b 93 *-sun-sunos*)
30a4f2a8 94 # sunos has too many warnings for this to be useful
95 # motorola too
96 ;;
97b12a5b 97 *m88k*)
98 # Motorola cc/ld does not like -02 but is ok on -O
99 CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]/-O/'`
100 ;;
30a4f2a8 101 *)
102 CFLAGS="$CFLAGS -Wall"
103 ;;
104 esac
81a820c6 105 else
106 case "$host" in
c415c128 107 *mips-sgi-irix6.*)
81a820c6 108 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
c415c128 109 CFLAGS="$CFLAGS -n32 -mips3 -O3 -OPT:Olimit=0:space=OFF \
58dc050d 110 -woff 1009,1014,1110,1116,1185,1188,1204,1230,1233 \
81a820c6 111 -Wl,-woff,85,-woff,84,-woff,134 \
112 -nostdinc -I/usr/include -D_BSD_SIGNALS"
113 ;;
e8f5fb18 114 alpha-dec-osf4.*)
553c24ae 115 # Mogul says DEC compilers take both -g and -O2
b6a2f15e 116 CFLAGS=`echo $CFLAGS | sed -e 's/-g/-g3/'`
553c24ae 117 CFLAGS="$CFLAGS -O2"
118 ;;
81a820c6 119 *)
120 ;;
121 esac
30a4f2a8 122 fi
30a4f2a8 123fi
124
d2e3605e 125dnl set squid required flags
126if test "$GCC" = "yes"; then
127 SQUID_CFLAGS="-Werror -Wall -Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wcomments"
128 SQUID_CXXFLAGS="$SQUID_CFLAGS"
129else
130 SQUID_CFLAGS=
131 SQUID_CXXFLAGS=
132fi
133AC_SUBST(SQUID_CFLAGS)
134AC_SUBST(SQUID_CXXFLAGS)
135
30a4f2a8 136dnl Set LDFLAGS
137if test -z "$PRESET_LDFLAGS"; then
138 if test "$GCC" = "yes"; then
139 case "$host" in
140 *)
141 # nothing
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>
c415c128 148 LDFLAGS="-n32 -mips3 -nostdlib -L/usr/lib32"
81a820c6 149 ;;
150 esac
30a4f2a8 151 fi
152fi
2060fa9a 153
e5f4e1b0 154dnl Enable optional modules
155AC_ARG_ENABLE(dlmalloc,
94d48591 156[ --enable-dlmalloc[=LIB] Compile & use the malloc package by Doug Lea],
e5f4e1b0 157[
94d48591 158 case "$enableval" in
159 'yes')
029ce4ae 160 use_dlmalloc="yes"
94d48591 161 LIBDLMALLOC="libdlmalloc.a"
162 LIB_MALLOC="-L../lib -ldlmalloc"
029ce4ae 163 echo "dlmalloc enabled"
94d48591 164 ;;
165 'no')
029ce4ae 166 use_dlmalloc="no"
167 echo "dlmalloc disabled"
94d48591 168 ;;
029ce4ae 169 *) use_dlmalloc="yes"
170 LIB_MALLOC="$enableval"
171 echo "dlmalloc enabled with $LIB_MALLOC"
172 esac
173])
174if test "${use_dlmalloc-unset}" = unset; then
175 case "$host" in
176 i386-*-solaris2.*)
177 echo "Enabling dlmalloc for $host"
178 use_dlmalloc="yes"
d20b1cd0 179 LIBDLMALLOC="libdlmalloc.a"
180 LIB_MALLOC="-L../lib -ldlmalloc"
029ce4ae 181 ;;
e8dbaa90 182 *-sgi-irix*)
183 echo "Enabling dlmalloc for $host"
184 use_dlmalloc="yes"
185 LIBDLMALLOC="libdlmalloc.a"
186 LIB_MALLOC="-L../lib -ldlmalloc"
187 ;;
029ce4ae 188 esac
189fi
190if test "x$ac_cv_enabled_dlmalloc" = "xyes"; then
191 # Ok. dlmalloc was enabled before, but state may be changed.
192 # we have to test these again
193 unset ac_cv_func_mallinfo
194 unset ac_cv_func_mallocblksize
195 unset ac_cv_func_free
196 unset ac_cv_func_realloc
197 unset ac_cv_func_memalign
198 unset ac_cv_func_valloc
199 unset ac_cv_func_pvalloc
200 unset ac_cv_func_calloc
201 unset ac_cv_func_cfree
202 unset ac_cv_func_malloc_trim
203 unset ac_cv_func_malloc_usable_size
204 unset ac_cv_func_malloc_stats
205 unset ac_cv_func_mallinfo
206 unset ac_cv_func_mallopt
207 unset ac_cv_lib_gnumalloc
208 unset ac_cv_header_gnumalloc_h
209 unset ac_cv_lib_malloc
210 unset ac_cv_enabled_dlmalloc
211fi
212if test "$use_dlmalloc" = yes; then
94d48591 213 ac_cv_func_mallinfo="yes"
214 ac_cv_func_mallocblksize="no"
215 ac_cv_func_free="yes"
216 ac_cv_func_realloc="yes"
217 ac_cv_func_memalign="yes"
218 ac_cv_func_valloc="yes"
219 ac_cv_func_pvalloc="yes"
220 ac_cv_func_calloc="yes"
221 ac_cv_func_cfree="yes"
222 ac_cv_func_malloc_trim="yes"
223 ac_cv_func_malloc_usable_size="yes"
224 ac_cv_func_malloc_stats="yes"
94d48591 225 ac_cv_func_mallopt="yes"
226 ac_cv_lib_gnumalloc="no"
85efe3ec 227 ac_cv_header_gnumalloc_h="no"
94d48591 228 ac_cv_lib_malloc="no"
229 ac_cv_enabled_dlmalloc="yes"
6a9f6389 230 AC_DEFINE(USE_DLMALLOC, 1, [Compile & use the malloc package by Doug Lea])
029ce4ae 231fi
232
e5f4e1b0 233AC_SUBST(LIBDLMALLOC)
234AC_SUBST(LIB_MALLOC)
235
236AC_ARG_ENABLE(gnuregex,
237[ --enable-gnuregex Compile GNUregex],
238[USE_GNUREGEX=$enableval])
239
6c0c04db 240SquidInline="yes"
241AC_ARG_ENABLE(inline,
242[ --disable-inline Don't compile trivial methods as inline. Squid
243 is coded with much of the code able to be inlined.< Inlining is good for production builds, but not
244 good for development. During development, use
245 --disable-inline to reduce compilation times and
246 allow incremental builds to be quick. For
247 production builds, or load tests, use
248 --enable-inline to have squid make all trivial
249 methods inlinable by the compiler.],
250[ if test "$enableval" = "no" ; then
251 SquidInline="no"
252 fi
253])
254
255if test "$SquidInline" = "yes" ; then
256 AC_DEFINE(_SQUID_INLINE_, inline, [Keyword used by squid for inlining methods])
257 AC_DEFINE(_USE_INLINE_,, [Include inline methods into header file])
258else
259 AC_DEFINE(_SQUID_INLINE_,, [Keyword used by squid for inlining methods])
260fi
261
fa80a8ef 262AC_ARG_ENABLE(debug-cbdata,
263[ --enable-debug-cbdata Provide some debug information in cbdata],
264[ if test "$enableval" = "yes" ; then
265 echo "cbdata debugging enabled"
6a9f6389 266 AC_DEFINE(CBDATA_DEBUG,1,[Enable for cbdata debug information])
fa80a8ef 267 fi
268])
269
0961c811 270dnl This is a developer only option.. developers know how to set defines
271dnl
272dnl AC_ARG_ENABLE(xmalloc-debug,
273dnl [ --enable-xmalloc-debug Do some simple malloc debugging],
274dnl [ if test "$enableval" = "yes" ; then
275dnl echo "Malloc debugging enabled"
6a9f6389 276dnl AC_DEFINE(XMALLOC_DEBUG,1,[Define to do simple malloc debugging])
0961c811 277dnl fi
278dnl ])
279
280dnl This is a developer only option.. developers know how to set defines
281dnl
282dnl AC_ARG_ENABLE(xmalloc-debug-trace,
283dnl [ --enable-xmalloc-debug-trace
284dnl Detailed trace of memory allocations],
285dnl [ if test "$enableval" = "yes" ; then
286dnl echo "Malloc debug trace enabled"
6a9f6389 287dnl AC_DEFINE(XMALLOC_TRACE,1,[Define to have a detailed trace of memory allocations])
288dnl AC_DEFINE(XMALLOC_DEBUG,1)
0961c811 289dnl fi
290dnl ])
e5f4e1b0 291
d9180414 292AC_ARG_ENABLE(xmalloc-statistics,
e5f4e1b0 293[ --enable-xmalloc-statistics
294 Show malloc statistics in status page],
295[ if test "$enableval" = "yes" ; then
296 echo "Malloc statistics enabled"
6a9f6389 297 AC_DEFINE(XMALLOC_STATISTICS,1,[Define to have malloc statistics])
e5f4e1b0 298 fi
299])
300
14b32873 301use_carp=1
323fe0d4 302AC_ARG_ENABLE(carp,
f7c8dc02 303[ --disable-carp Disable CARP support],
304[ if test "$enableval" = "no" ; then
305 echo "CARP disabled"
14b32873 306 use_carp=0
323fe0d4 307 fi
f7c8dc02 308])
14b32873 309if test $use_carp = 1; then
310 AC_DEFINE(USE_CARP, 1, [Cache Array Routing Protocol])
311else
312 AC_DEFINE(USE_CARP, 1)
313fi
323fe0d4 314
cd748f27 315AC_ARG_ENABLE(async-io,
9bc73deb 316[ --enable-async-io[=N_THREADS]
cd748f27 317 Shorthand for
f85c88f3 318 --with-aufs-threads=N_THREADS
cd748f27 319 --with-pthreads
320 --enable-storeio=ufs,aufs],
321[ case $enableval in
9bc73deb 322 yes)
69144041 323 with_pthreads="yes"
cd748f27 324 STORE_MODULES="ufs aufs"
9bc73deb 325 ;;
326 no)
9bc73deb 327 ;;
328 *)
f85c88f3 329 aufs_io_threads=$enableval
69144041 330 with_pthreads="yes"
cd748f27 331 STORE_MODULES="ufs aufs"
9bc73deb 332 ;;
333 esac
334])
335
f85c88f3 336AC_ARG_WITH(aufs-threads,
337[ --with-aufs-threads=N_THREADS
cd748f27 338 Tune the number of worker threads for the aufs object
339 store.],
a3310b77 340[ case $withval in
341 [[0-9]]*)
342 aufs_io_threads=$withval
343 ;;
344 *)
345 echo "ERROR: Invalid --with-aufs-threads argument"
346 exit 1
347 ;;
348 esac
349])
f85c88f3 350if test "$aufs_io_threads"; then
351 echo "With $aufs_io_threads aufs threads"
6a9f6389 352 AC_DEFINE_UNQUOTED(AUFS_IO_THREADS,$aufs_io_threads,
353 [Defines how many threads aufs uses for I/O])
cd748f27 354fi
355
356AC_ARG_WITH(pthreads,
8154dd82 357[ --with-pthreads Use POSIX Threads])
358if test "$with_pthreads" = "yes"; then
cd748f27 359 echo "With pthreads"
9bc73deb 360fi
e5f4e1b0 361
f85c88f3 362AC_ARG_WITH(aio,
8154dd82 363[ --with-aio Use POSIX AIO])
364if test "$with_aio" = "yes"; then
f85c88f3 365 echo "With aio"
f85c88f3 366fi
8154dd82 367
368AC_ARG_WITH(dl,
369[ --with-dl Use dynamic linking])
370if test "$with_dl" = "yes"; then
371 echo "With dl"
372fi
f85c88f3 373
cd748f27 374AC_ARG_ENABLE(storeio,
375[ --enable-storeio=\"list of modules\"
376 Build support for the list of store I/O modules.
377 The default is only to build the "ufs" module.
378 See src/fs for a list of available modules, or
379 Programmers Guide section <not yet written>
380 for details on how to build your custom store module],
381[ case $enableval in
382 yes)
1c690e30 383 for dir in $srcdir/src/fs/*; do
384 module="`basename $dir`"
385 if test -d "$dir" && test "$module" != CVS; then
386 STORE_MODULES="$STORE_MODULES $module"
8154dd82 387 fi
cd748f27 388 done
389 ;;
390 no)
391 ;;
1c690e30 392 *)
393 STORE_MODULES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
cd748f27 394 ;;
395 esac
396],
397[ if test -z "$STORE_MODULES"; then
398 STORE_MODULES="ufs"
399 fi
400])
1c690e30 401if test -n "$STORE_MODULES"; then
402 for module in $STORE_MODULES; do
403 if test -d $srcdir/src/fs/$module; then
404 :
405 else
406 echo "ERROR: storeio $module does not exists"
407 exit 1
408 fi
409 done
410 echo "Store modules built: $STORE_MODULES"
411 STORE_OBJS="fs/lib`echo $STORE_MODULES|sed -e 's% %.a fs/lib%g'`.a"
412 STORE_LIBS="`echo $STORE_OBJS|sed -e 's%fs/%%g'`"
413fi
a2794549 414dnl remove all but diskd - its the only module that needs to recurse
415dnl into the sub directory
416STORE_MODULE_SUBDIRS=
d3b3ab85 417UFS_FOUND=
1c690e30 418NEED_UFS=
a2794549 419for fs in $STORE_MODULES none; do
8154dd82 420 case "$fs" in
421 diskd)
a2794549 422 STORE_MODULE_SUBDIRS="$STORE_MODULE_SUBDIRS $fs"
4f46650a 423 STORE_PROGRAMS="$STORE_PROGRAMS diskd/diskd"
1c690e30 424 NEED_UFS="true"
8154dd82 425 ;;
426 aufs)
427 if test -z "$with_pthreads"; then
428 echo "aufs store used, pthreads support automatically enabled"
429 with_pthreads=yes
430 fi
1c690e30 431 NEED_UFS="true"
8154dd82 432 ;;
433 coss)
434 if test -z "$with_aio"; then
435 echo "coss store used, aio support automatically enabled"
436 with_aio=yes
437 fi
438 ;;
d3b3ab85 439 ufs)
440 UFS_FOUND="true"
8154dd82 441 esac
a2794549 442done
d3b3ab85 443
1c690e30 444if test -z "$UFS_FOUND" && test -n "$NEED_UFS"; then
d3b3ab85 445 echo "adding UFS, as it contains core logic for diskd and aufs"
446 STORE_OBJS="$STORE_OBJS fs/libufs.a"
d3b3ab85 447 STORE_LIBS="$STORE_LIBS libufs.a"
d3b3ab85 448 STORE_MODULES="$STORE_MODULES ufs"
449fi
450
1c690e30 451AC_SUBST(STORE_OBJS)
452AC_SUBST(STORE_LIBS)
a2794549 453AC_SUBST(STORE_MODULES)
4f46650a 454AC_SUBST(STORE_PROGRAMS)
a2794549 455AC_SUBST(STORE_MODULE_SUBDIRS)
456
d9180414 457AC_ARG_ENABLE(removal-policies,
6a566b9c 458[ --enable-removal-policies=\"list of policies\"
459 Build support for the list of removal policies.
460 The default is only to build the "lru" module.
461 See src/repl for a list of available modules, or
462 Programmers Guide section 9.9 for details on how
463 to build your custom policy],
464[ case $enableval in
465 yes)
1c690e30 466 for dir in $srcdir/src/repl/*; do
467 module="`basename $dir`"
468 if test -d "$dir" && test "$module" != CVS; then
469 REPL_POLICIES="$REPL_POLICIES $module"
6a566b9c 470 fi
471 done
472 ;;
473 no)
474 ;;
1c690e30 475 *)
476 REPL_POLICIES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
6a566b9c 477 ;;
478 esac
479],
480[ if test -z "$REPL_POLICIES"; then
481 REPL_POLICIES="lru"
482 fi
483])
1c690e30 484if test -n "$REPL_POLICIES"; then
485 for module in $REPL_POLICIES; do
486 if test -d $srcdir/src/repl/$module; then
487 :
488 else
489 echo "ERROR: Removal policy $module does not exists"
490 exit 1
491 fi
492 done
493 echo "Removal policies built: $REPL_POLICIES"
494 REPL_OBJS="repl/lib`echo $REPL_POLICIES|sed -e 's% %.a repl/lib%g'`.a"
495 REPL_LIBS="`echo $REPL_OBJS|sed -e 's%repl/%%g'`"
496fi
6a566b9c 497AC_SUBST(REPL_POLICIES)
6a566b9c 498AC_SUBST(REPL_OBJS)
f71946fc 499AC_SUBST(REPL_LIBS)
6a566b9c 500
d1da2d1f 501AM_CONDITIONAL(ENABLE_PINGER, false)
e5f4e1b0 502AC_ARG_ENABLE(icmp,
503[ --enable-icmp Enable ICMP pinging],
504[ if test "$enableval" = "yes" ; then
505 echo "ICMP enabled"
6a9f6389 506 AC_DEFINE(USE_ICMP,1,
507 [If you want to use Squid's ICMP features (highly recommended!) then
508 define this. When USE_ICMP is defined, Squid will send ICMP pings
509 to origin server sites. This information is used in numerous ways:
510 - Sent in ICP replies so neighbor caches know how close
511 you are to the source.
512 - For finding the closest instance of a URN.
513 - With the 'test_reachability' option. Squid will return
514 ICP_OP_MISS_NOFETCH for sites which it cannot ping.])
d1da2d1f 515 AM_CONDITIONAL(ENABLE_PINGER, true)
e5f4e1b0 516 fi
517])
518
a2794549 519AM_CONDITIONAL(USE_DELAY_POOLS, false)
d9180414 520AC_ARG_ENABLE(delay-pools,
76d83c52 521[ --enable-delay-pools Enable delay pools to limit bandwidth usage],
e5f4e1b0 522[ if test "$enableval" = "yes" ; then
95e36d02 523 echo "Delay pools enabled"
6a9f6389 524 AC_DEFINE([DELAY_POOLS],1,[Traffic management via "delay pools".])
525 AM_CONDITIONAL(USE_DELAY_POOLS, true,)
e5f4e1b0 526 fi
527])
528
43ae1d95 529AM_CONDITIONAL(USE_ESI, false)
530AC_ARG_ENABLE(esi,
531 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.]),
532 ac_cv_use_esi=$enableval, ac_cv_use_esi=no)
533AC_CACHE_CHECK(whether to enable ESI,ac_cv_use_esi, ac_cv_use_esi=no)
534if test "$ac_cv_use_esi" = "yes" ; then
535 AC_DEFINE(ESI,1,[Compile the ESI processor and Surrogate header support])
536 AM_CONDITIONAL(USE_ESI, true)
537 XTRA_LIBS="$XTRA_LIBS -lexpat"
538fi
539
0961c811 540dnl This is a developer only option. Developers know how to set defines
541dnl
542dnl AC_ARG_ENABLE(mem-gen-trace,
543dnl [ --enable-mem-gen-trace Do trace of memory stuff],
544dnl [ if test "$enableval" = "yes" ; then
545dnl echo "Memory trace (to file) enabled"
6a9f6389 546dnl AC_DEFINE(MEM_GEN_TRACE,1,[Define for log file trace of mem alloc/free])
0961c811 547dnl fi
548dnl ])
36a97e19 549
d9180414 550AC_ARG_ENABLE(useragent-log,
e5f4e1b0 551[ --enable-useragent-log Enable logging of User-Agent header],
552[ if test "$enableval" = "yes" ; then
553 echo "User-Agent logging enabled"
6a9f6389 554 AC_DEFINE(USE_USERAGENT_LOG,1,[If you want to log User-Agent request header values, define this.
555 By default, they are written to useragent.log in the Squid log
556 directory.])
e5f4e1b0 557 fi
558])
559
dfca7e1a 560AC_ARG_ENABLE(referer-log,
0961c811 561[ --enable-referer-log Enable logging of Referer header],
dfca7e1a 562[ if test "$enableval" = "yes" ; then
563 echo "Referer logging enabled"
6a9f6389 564 AC_DEFINE(USE_REFERER_LOG,1,[If you want to log Referer request header values, define this.
565 By default, they are written to referer.log in the Squid log
566 directory.])
dfca7e1a 567 fi
568])
569
14b32873 570use_wccp=1
320e9f36 571AC_ARG_ENABLE(wccp,
0961c811 572[ --disable-wccp Disable Web Cache Coordination Protocol],
eb824054 573[ if test "$enableval" = "no" ; then
574 echo "Web Cache Coordination Protocol disabled"
14b32873 575 use_wccp=0
320e9f36 576 fi
577])
14b32873 578if test $use_wccp = 1; then
579 AC_DEFINE(USE_WCCP, 1,[Define to enable WCCP])
580else
581 AC_DEFINE(USE_WCCP, 0)
582fi
320e9f36 583
d9180414 584AC_ARG_ENABLE(kill-parent-hack,
9fc0b4b8 585[ --enable-kill-parent-hack
586 Kill parent on shutdown],
e5f4e1b0 587[ if test "$enableval" = "yes" ; then
588 echo "Kill parent on shutdown"
6a9f6389 589 AC_DEFINE(KILL_PARENT_OPT,1,[A dangerous feature which causes Squid to kill its parent process
590 (presumably the RunCache script) upon receipt of SIGTERM or SIGINT.
591 Use with caution.])
e5f4e1b0 592 fi
593])
594
a2794549 595AM_CONDITIONAL(USE_SNMP, false)
e5f4e1b0 596AC_ARG_ENABLE(snmp,
597[ --enable-snmp Enable SNMP monitoring],
598[ if test "$enableval" = "yes" ; then
599 echo "SNMP monitoring enabled"
6a9f6389 600 AC_DEFINE(SQUID_SNMP,1,[Define to enable SNMP monitoring of Squid])
e5f4e1b0 601 SNMPLIB='-L../snmplib -lsnmp'
a2794549 602 AM_CONDITIONAL(USE_SNMP, true)
8a7f0105 603 SNMP_MAKEFILE=./snmplib/Makefile
e5f4e1b0 604 makesnmplib=snmplib
605 fi
606])
607AC_SUBST(SNMPLIB)
e5f4e1b0 608AC_SUBST(makesnmplib)
609
d9180414 610AC_ARG_ENABLE(cachemgr-hostname,
e5f4e1b0 611[ --enable-cachemgr-hostname[=hostname]
612 Make cachemgr.cgi default to this host],
613[ case $enableval in
614 yes)
6a9f6389 615 AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()],
616 [If you are upset that the cachemgr.cgi form comes up with the hostname field blank, then define this to getfullhostname()])
e5f4e1b0 617 echo "Cachemgr default hostname == host where cachemgr runs"
618 ;;
619 no)
620 : # Nothing to do..
621 ;;
622 *)
623 AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
624 echo "Cachemgr default hostname set to ${enableval}"
625 ;;
626 esac
627])
628
b0dd28ba 629AM_CONDITIONAL(ENABLE_ARP_ACL, false)
d9180414 630AC_ARG_ENABLE(arp-acl,
e5f4e1b0 631[ --enable-arp-acl Enable use of ARP ACL lists (ether address)],
632[ if test "$enableval" = "yes" ; then
633 echo "ARP ACL lists enabled (ether address)"
933cc58d 634 case "$host" in
ef614b1c 635 *-linux-*)
636 ;;
637 *-solaris-*)
a931a29b 638 ;;
933cc58d 639 *)
ef614b1c 640 echo "WARNING: ARP ACL support probably won't work on $host."
933cc58d 641 sleep 10
642 ;;
643 esac
6a9f6389 644 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 645 AM_CONDITIONAL(ENABLE_ARP_ACL, true)
e5f4e1b0 646 fi
647])
648
a2794549 649AM_CONDITIONAL(ENABLE_HTCP, false)
74075210 650AC_ARG_ENABLE(htcp,
88b7de25 651[ --enable-htcp Enable HTCP protocol],
b4b8b6da 652[ if test "$enableval" = "yes" ; then
653 echo "HTCP enabled"
6a9f6389 654 AC_DEFINE(USE_HTCP,1, [Define this to include code for the Hypertext Cache Protocol (HTCP)])
a2794549 655 AM_CONDITIONAL(ENABLE_HTCP, true)
b4b8b6da 656 fi
74075210 657])
a2794549 658
659AM_CONDITIONAL(ENABLE_SSL, false)
74075210 660
1f7c9178 661AC_ARG_ENABLE(ssl,
662[ --enable-ssl Enable ssl gatewaying support using OpenSSL],
663[ if test "$enableval" != "no"; then
3dff197f 664 echo "SSL gatewaying using OpenSSL enabled"
6a9f6389 665 AC_DEFINE(USE_SSL,1,[Define this to include code for SSL encryption.])
a2794549 666 AM_CONDITIONAL(ENABLE_SSL, true)
1f7c9178 667 SSLLIB='-lssl -lcrypto'
668 USE_OPENSSL=1
669 fi
670])
671
3dff197f 672AM_CONDITIONAL(NEED_OWN_MD5, true)
673
1f7c9178 674AC_ARG_WITH(openssl,
675[ --with-openssl[=prefix]
676 Compile with the OpenSSL libraries. The path to
677 the OpenSSL development libraries and headers
678 installation can be specified if outside of the
679 system standard directories],
680[
46ce628c 681 case "$with_openssl" in
1f7c9178 682 yes)
683 USE_OPENSSL=1
684 ;;
685 no)
686 USE_OPENSSL=
687 ;;
688 *)
46ce628c 689 SSLLIBDIR="$with_openssl/lib"
bcce53ce 690 CPPFLAGS="-I$with_openssl/include $CPPFLAGS"
1f7c9178 691 USE_OPENSSL=1
692 esac
693])
694
695if test -n "$USE_OPENSSL"; then
3dff197f 696 echo "Using OpenSSL MD5 implementation"
6a9f6389 697 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 698 AM_CONDITIONAL(NEED_OWN_MD5, false)
1f7c9178 699 if test -z "$SSLLIB"; then
700 SSLLIB="-lcrypto" # for MD5 routines
701 fi
702fi
703if test -n "$SSLLIBDIR"; then
704 SSLLIB="-L$SSLLIBDIR $SSLLIB"
705fi
1f7c9178 706AC_SUBST(SSLLIB)
707
02749868 708AC_ARG_ENABLE(forw-via-db,
709[ --enable-forw-via-db Enable Forw/Via database],
710[ if test "$enableval" = "yes" ; then
711 echo "FORW-VIA enabled"
6a9f6389 712 AC_DEFINE(FORW_VIA_DB,1,[Enable Forw/Via database])
02749868 713 fi
714])
715
6cfa8966 716AC_ARG_ENABLE(cache-digests,
22df58ea 717[ --enable-cache-digests Use Cache Digests
2b6662ba 718 see http://www.squid-cache.org/FAQ/FAQ-16.html],
484f2ebc 719[ if test "$enableval" = "yes" ; then
6cfa8966 720 echo "USE_CACHE_DIGESTS enabled"
6a9f6389 721 AC_DEFINE(USE_CACHE_DIGESTS,1,[Use Cache Digests for locating objects in neighbor caches. This code is still semi-experimental.])
484f2ebc 722 fi
723])
724
8c3926c5 725dnl Select Default Error language
726AC_ARG_ENABLE(default-err-language,
727[ --enable-default-err-language=lang
0961c811 728 Select default language for Error pages (see
729 errors directory) ],
933cc58d 730[
cf9d704a 731 if test -d $srcdir/errors/$enableval; then
8c3926c5 732 ERR_DEFAULT_LANGUAGE=$enableval
933cc58d 733 else
0961c811 734 echo "ERROR! Unknown language $enableval, see errors/ directory"
933cc58d 735 exit 1
736 fi
8c3926c5 737],[ERR_DEFAULT_LANGUAGE="English"])
738AC_SUBST(ERR_DEFAULT_LANGUAGE)
739
740dnl Select languages to be installed
741AC_ARG_ENABLE(err-languages,
742[ --enable-err-languages=\"lang1 lang2..\"
0961c811 743 Select languages to be installed. (All will be
744 installed by default) ],
8c3926c5 745[
746 for l in $enableval; do
747 if test -d $srcdir/errors/$l; then :; else
748 echo "ERROR! Unknown language $$l, see errors/"
749 exit 1
750 fi
751 done
752 ERR_LANGUAGES=$enableval
753],[
754 ERR_LANGUAGES=
755 for l in $srcdir/errors/*; do
cbbe101f 756 if test -f $l/ERR_ACCESS_DENIED; then
8c3926c5 757 ERR_LANGUAGES="$ERR_LANGUAGES `basename $l`"
758 fi
759 done
760])
761AC_SUBST(ERR_LANGUAGES)
933cc58d 762
cd748f27 763dnl Size of COSS memory buffer
764AC_ARG_WITH(coss-membuf-size,
765[ --with-coss-membuf-size COSS membuf size (default 1048576 bytes) ],
766[ if test "$with_coss_membuf_size"; then
767 echo "Setting COSS membuf size to $with_coss_membuf_size bytes"
6a9f6389 768 AC_DEFINE_UNQUOTED(COSS_MEMBUF_SZ, $with_coss_membuf_size,[Define if you want to set the COSS membuf size])
cd748f27 769 fi
770])
771
1b3db6d9 772dnl check for netio plugin stuff
9bb83c8b 773dnl Enable poll()
774AC_ARG_ENABLE(poll,
0961c811 775[ --enable-poll Enable poll() support.
776 --disable-poll Disable poll() support. ],
1b3db6d9 777
778[
c68e9c6b 779 case "$enableval" in
780 yes)
9bb83c8b 781 echo "Forcing poll() to be enabled"
782 ac_cv_func_poll='yes'
c68e9c6b 783 ;;
784 no)
785 echo "Forcing poll() to be disabled"
786 ac_cv_func_poll='no'
787 ;;
788 esac
9bb83c8b 789])
790
1b3db6d9 791dnl Enable select()
792AC_ARG_ENABLE(select,
0961c811 793[ --enable-select Enable select() support.
794 --disable-select Disable select() support. ],
1b3db6d9 795
796[
797 case "$enableval" in
798 yes)
799 echo "Forcing select() to be enabled"
800 ac_cv_func_select='yes'
801 ;;
802 no)
803 echo "Forcing select() to be disabled"
804 ac_cv_func_select='no'
805 ;;
806 esac
807])
808
809dnl Enable kqueue()
810AC_ARG_ENABLE(kqueue,
0961c811 811[ --enable-kqueue Enable kqueue() support.
812 --disable-kqueue Disable kqueue() support. ],
1b3db6d9 813
814[
815 case "$enableval" in
816 yes)
817 echo "Forcing kqueue() to be enabled"
818 ac_cv_func_kqueue='yes'
819 ;;
820 no)
821 echo "Forcing kqueue() to be disabled"
822 ac_cv_func_kqueue='no'
823 ;;
824esac
825])
826
a46d2c0e 827dnl Enable epoll()
828AM_CONDITIONAL(USE_EPOLL, false)
829AC_ARG_ENABLE(epoll,
830[ --enable-epoll Enable epoll() support.
831 --disable-epoll Disable epoll() support. ],
832
833[
834 case "$enableval" in
835 yes)
836 echo "Forcing epoll() to be enabled"
837 ac_cv_func_epoll='yes'
838 if test -z "$EPOLL_LIBS"; then
839 EPOLL_LIBS="-lepoll"
840 fi
841 AC_SUBST(EPOLL_LIBS)
842 AC_DEFINE(USE_EPOLL,1,[Use epoll type polling])
843 AM_CONDITIONAL(USE_EPOLL, true)
844 ;;
845 no)
846 echo "Forcing epoll() to be disabled"
847 ac_cv_func_epoll='no'
848 ;;
849esac
850])
851
852
72fd085a 853dnl Disable HTTP violations
14b32873 854http_violations=1
72fd085a 855AC_ARG_ENABLE(http-violations,
856[ --disable-http-violations
857 This allows you to remove code which is known to
c68e9c6b 858 violate the HTTP protocol specification.],
72fd085a 859[ if test "$enableval" = "no" ; then
860 echo "Disabling HTTP Violations"
14b32873 861 http_violations=0
72fd085a 862 fi
863])
14b32873 864if test $http_violations = 1; then
865 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.])
866else
867 AC_DEFINE(HTTP_VIOLATIONS, 0)
868fi
72fd085a 869
5cafc1d6 870dnl Enable IP-Filter Transparent Proxy
871AC_ARG_ENABLE(ipf-transparent,
872[ --enable-ipf-transparent
873 Enable Transparent Proxy support for systems
c68e9c6b 874 using IP-Filter network address redirection.],
5cafc1d6 875[ if test "$enableval" = "yes" ; then
876 echo "IP-Filter Transparent Proxy enabled"
6a9f6389 877 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 878 IPF_TRANSPARENT="yes"
879 fi
880])
881
2b0dd4ac 882dnl Enable PF Transparent Proxy
883AC_ARG_ENABLE(pf-transparent,
884[ --enable-pf-transparent
885 Enable Transparent Proxy support for systems
886 using PF network address redirection.],
887[ if test "$enableval" = "yes" ; then
888 echo "PF Transparent Proxy enabled"
6a9f6389 889 AC_DEFINE(PF_TRANSPARENT,1,[Enable support for Transparent Proxy on systems using PF address redirection. This provides "masquerading" support for OpenBSD.])
2b0dd4ac 890 PF_TRANSPARENT="yes"
891 fi
892])
893
d852fbad 894dnl Enable Linux Netfilter (2.4) Transparent Proxy
895AC_ARG_ENABLE(linux-netfilter,
896[ --enable-linux-netfilter
897 Enable Transparent Proxy support for Linux 2.4.],
898[ if test "$enableval" = "yes" ; then
899 echo "Linux-Netfilter Transparent Proxy enabled"
6a9f6389 900 AC_DEFINE(LINUX_NETFILTER,1,[Enable support for Transparent Proxy on Linux 2.4 systems])
d852fbad 901 LINUX_NETFILTER="yes"
902 fi
903])
904
bb7b5fd0 905dnl Enable Large file support
906AC_ARG_ENABLE(large-files,
907[ --enable-large-files Enable support for large files (>2GB). Still
908 experimental.],
909[ if test "$enableval" = "yes" ; then
910 echo "Large file support enabled"
911 CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64"
680ae450 912 CXXFLAGS="$CXXFLAGS -D_FILE_OFFSET_BITS=64"
bb7b5fd0 913 fi
914])
915
a2794549 916AM_CONDITIONAL(MAKE_LEAKFINDER, false)
5d620373 917dnl Enable Leak Finding Functions
918AC_ARG_ENABLE(leakfinder,
919[ --enable-leakfinder
920 Enable Leak Finding code. Enabling this alone
921 does nothing; you also have to modify the source
922 code to use the leak finding functions. Probably
923 Useful for hackers only.],
924[ if test "$enableval" = "yes" ; then
925 echo "Leak-Finding enabled"
6a9f6389 926 AC_DEFINE(USE_LEAKFINDER,1,[Enable code for assisting in finding memory leaks. Hacker stuff only.])
5d620373 927 USE_LEAKFINDER="yes"
a2794549 928 AM_CONDITIONAL(MAKE_LEAKFINDER, true)
5d620373 929 fi
930])
5d620373 931
14b32873 932use_ident=1
3898f57f 933AC_ARG_ENABLE(ident-lookups,
934[ --disable-ident-lookups
935 This allows you to remove code that performs
936 Ident (RFC 931) lookups.],
937[ if test "$enableval" = "no" ; then
938 echo "Disabling Ident Lookups"
14b32873 939 use_ident=0
3898f57f 940 fi
941])
14b32873 942if test $use_ident = 1; then
943 AC_DEFINE(USE_IDENT, 1,[Compile in support for Ident (RFC 931) lookups? Enabled by default.])
8000a965 944 AM_CONDITIONAL(ENABLE_IDENT, true)
14b32873 945else
946 AC_DEFINE(USE_IDENT, 0)
8000a965 947 AM_CONDITIONAL(ENABLE_IDENT, false)
14b32873 948fi
3898f57f 949
a2794549 950AM_CONDITIONAL(USE_DNSSERVER, false)
3c573763 951use_dnsserver=
eb824054 952AC_ARG_ENABLE(internal-dns,
7e3ce7b9 953[ --disable-internal-dns This prevents Squid from directly sending and
eb824054 954 receiving DNS messages, and instead enables the
955 old external 'dnsserver' processes.],
956[ if test "$enableval" = "no" ; then
957 echo "Disabling Internal DNS queries"
3c573763 958 use_dnsserver="yes"
eb824054 959 fi
960])
3c573763 961if test "$use_dnsserver" = "yes"; then
6a9f6389 962 AC_DEFINE(USE_DNSSERVERS,1,[Use dnsserver processes instead of the internal DNS protocol support])
a2794549 963 AM_CONDITIONAL(USE_DNSSERVER, true)
3c573763 964fi
eb824054 965
966AC_ARG_ENABLE(truncate,
7e3ce7b9 967[ --enable-truncate This uses truncate() instead of unlink() when
eb824054 968 removing cache files. Truncate gives a little
969 performance improvement, but may cause problems
970 when used with async I/O. Truncate uses more
971 filesystem inodes than unlink..],
972[ if test "$enableval" = "yes" ; then
973 echo "Enabling truncate instead of unlink"
6a9f6389 974 AC_DEFINE(USE_TRUNCATE,1,[Do we want to use truncate(2) or unlink(2)?])
eb824054 975 fi
976])
977
4fa7a4ba 978dnl Disable hostname checks
8fca0346 979enable_hostname_checks=0
4fa7a4ba 980AC_ARG_ENABLE(hostname_checks,
8fca0346 981[ --enable-hostname-checks
982 Tells Squid to rejects any host names with
4fa7a4ba 983 odd characters in their name to conform with
8fca0346 984 internet standards. This was the default in
985 prior Squid versions, but since Squid-3 Squid
986 no longer tries to police the use of DNS],
987[ if test "$enableval" = "yes"; then
801d5137 988 echo "Enabling hostname sanity checks"
8fca0346 989 enable_hostname_checks=1
4fa7a4ba 990 fi
991])
992if test "$enable_hostname_checks" = 1; then
993 AC_DEFINE(CHECK_HOSTNAMES, 1, [Enable hostname sanity checks])
994fi
995
9bc73deb 996dnl Enable underscore in hostnames
997AC_ARG_ENABLE(underscores,
998[ --enable-underscores Squid by default rejects any host names with _
76d83c52 999 in their name to conform with internet standards.
9bc73deb 1000 If you disagree with this you may allow _ in
1001 hostnames by using this switch, provided that
1002 the resolver library on the host where Squid runs
1003 does not reject _ in hostnames...],
1004[ if test "$enableval" = "yes" ; then
1005 echo "Enabling the use of underscores in host names"
6a9f6389 1006 AC_DEFINE(ALLOW_HOSTNAME_UNDERSCORES, 1,[Allow underscores in host names])
9bc73deb 1007 fi
1008])
1009
9d798391 1010dnl Select Default hosts file location
1011AC_ARG_ENABLE(default-hostsfile,
1012[ --enable-default-hostsfile=path
1013 Select default location for hosts file.
1014 See hosts_file directive in squid.conf for details],
1015[
1016 if test "$enableval" != "none" ; then
1017 if test -f $enableval; then
1018 OPT_DEFAULT_HOSTS=$enableval
1019 else
1020 echo "Warning Unable to find $enableval"
1021 sleep 5
1022 fi
1023 else
1024 OPT_DEFAULT_HOSTS="none"
1025 fi
1026 echo "Default hosts file set to: $enableval"
1027],[OPT_DEFAULT_HOSTS="/etc/hosts"])
1028AC_SUBST(OPT_DEFAULT_HOSTS)
1029
94439e4e 1030dnl Select auth schemes modules to build
1031AC_ARG_ENABLE(auth,
1032[ --enable-auth=\"list of auth scheme modules\"
1033 Build support for the list of authentication schemes.
1034 The default is to build support for the Basic scheme.
1035 See src/auth for a list of available modules, or
1036 Programmers Guide section authentication schemes
1037 for details on how to build your custom auth scheme
1038 module],
1039[ case $enableval in
1040 yes)
1c42c4a1 1041 for dir in $srcdir/src/auth/*; do
1042 module="`basename $dir`"
1c690e30 1043 if test -d "$dir" && test "$module" != CVS; then
1c42c4a1 1044 AUTH_MODULES="$AUTH_MODULES $module"
94439e4e 1045 fi
1046 done
1047 ;;
1048 no)
1049 ;;
1c690e30 1050 *)
1051 AUTH_MODULES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1052 ;;
94439e4e 1053 esac
1054],
1055[ if test -z "$AUTH_MODULES"; then
1056 AUTH_MODULES="basic"
1057 fi
1058])
1c690e30 1059if test -n "$AUTH_MODULES"; then
1060 for module in $AUTH_MODULES; do
1061 if test -d $srcdir/src/auth/$module; then
1062 :
1063 else
1064 echo "ERROR: Auth scheme $module does not exists"
1065 exit 1
1066 fi
1067 done
1068 echo "Auth scheme modules built: $AUTH_MODULES"
1069 AUTH_OBJS="auth/lib`echo $AUTH_MODULES|sed -e 's% %.a auth/lib%g'`.a"
1070 AUTH_LIBS="`echo $AUTH_OBJS|sed -e 's%auth/%%g'`"
1071fi
94439e4e 1072AC_SUBST(AUTH_MODULES)
94439e4e 1073AC_SUBST(AUTH_OBJS)
94439e4e 1074AC_SUBST(AUTH_LIBS)
1075
1076dnl Select basic auth scheme helpers to build
1077BASIC_AUTH_HELPERS=""
94439e4e 1078AC_ARG_ENABLE(basic-auth-helpers,
1079[ --enable-basic-auth-helpers=\"list of helpers\"
1080 This option selects which basic scheme proxy_auth
1081 helpers to build and install as part of the normal
1082 build process. For a list of available
0c510f3c 1083 helpers see the helpers/basic_auth directory.],
94439e4e 1084[ case "$enableval" in
1085 yes)
1c690e30 1086 for dir in $srcdir/helpers/basic_auth/*; do
1087 helper="`basename $dir`"
1088 if test -d "$dir" && test "$helper" != CVS; then
1089 BASIC_AUTH_HELPERS="$BASIC_AUTH_HELPERS $helper"
1090 fi
1091 done
1092 ;;
94439e4e 1093 no)
1c690e30 1094 ;;
94439e4e 1095 *)
1c690e30 1096 BASIC_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1097 ;;
94439e4e 1098 esac
1099])
fc83a946 1100if test -n "$BASIC_AUTH_HELPERS"; then
20d8bfe4 1101 for helper in $BASIC_AUTH_HELPERS; do
1c690e30 1102 if test -d $srcdir/helpers/basic_auth/$helper; then
1103 :
20d8bfe4 1104 else
1c690e30 1105 echo "ERROR: Basic auth helper $helper does not exists"
1106 exit 1
20d8bfe4 1107 fi
1108 done
fc83a946 1109 echo "Basic auth helpers built: $BASIC_AUTH_HELPERS"
94439e4e 1110fi
fc83a946 1111AC_SUBST(BASIC_AUTH_HELPERS)
94439e4e 1112
1113dnl Select ntlm auth helpers to build
1114NTLM_AUTH_HELPERS=
1115AC_ARG_ENABLE(ntlm-auth-helpers,
1116[ --enable-ntlm-auth-helpers=\"list of helpers\"
1117 This option selects which proxy_auth ntlm helpers
1118 to build and install as part of the normal build
0c510f3c 1119 process. For a list of available helpers see
1120 the helpers/ntlm_auth directory.],
380f0a87 1121[ case "$enableval" in
1122 yes)
1c690e30 1123 for dir in $srcdir/helpers/ntlm_auth/*; do
1124 helper="`basename $dir`"
1125 if test -d "$dir" && test "$helper" != CVS; then
1126 NTLM_AUTH_HELPERS="$NTLM_AUTH_HELPERS $helper"
1127 fi
1128 done
1129 ;;
380f0a87 1130 no)
1c690e30 1131 ;;
380f0a87 1132 *)
1c690e30 1133 NTLM_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1134 ;;
380f0a87 1135 esac
1136])
94439e4e 1137if test -n "$NTLM_AUTH_HELPERS"; then
20d8bfe4 1138 for helper in $NTLM_AUTH_HELPERS; do
1c690e30 1139 if test -d $srcdir/helpers/ntlm_auth/$helper; then
1140 :
20d8bfe4 1141 else
1c690e30 1142 echo "ERROR: NTLM Auth helper $helper does not exists"
1143 exit 1
20d8bfe4 1144 fi
1145 done
94439e4e 1146 echo "NTLM auth helpers built: $NTLM_AUTH_HELPERS"
380f0a87 1147fi
94439e4e 1148AC_SUBST(NTLM_AUTH_HELPERS)
1149
2d70df72 1150dnl Select digest auth scheme helpers to build
1151DIGEST_AUTH_HELPERS=
1152AC_ARG_ENABLE(digest-auth-helpers,
1153[ --enable-digest-auth-helpers=\"list of helpers\"
1154 This option selects which digest scheme authentication
1155 helpers to build and install as part of the normal build
0c510f3c 1156 process. For a list of available helpers see the
1157 helpers/digest_auth directory.],
2d70df72 1158[ case "$enableval" in
1159 yes)
1c690e30 1160 for dir in $srcdir/helpers/digest_auth/*; do
1161 helper="`basename $dir`"
1162 if test -d "$dir" && test "$helper" != CVS; then
1163 DIGEST_AUTH_HELPERS="$DIGEST_AUTH_HELPERS $helper"
1164 fi
1165 done
1166 ;;
2d70df72 1167 no)
1c690e30 1168 ;;
2d70df72 1169 *)
1c690e30 1170 DIGEST_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1171 ;;
2d70df72 1172 esac
1173])
1174if test -n "$DIGEST_AUTH_HELPERS"; then
1daefc1a 1175 for helper in $DIGEST_AUTH_HELPERS; do
1176 if test -f $srcdir/helpers/digest_auth/$helper/Makefile.in; then
1177 :
1178 else
1179 echo "ERROR: digest auth helper $helper does not exists"
1180 exit 1
1181 fi
1182 done
2d70df72 1183 echo "Digest auth helpers built: $DIGEST_AUTH_HELPERS"
1184fi
1185AC_SUBST(DIGEST_AUTH_HELPERS)
380f0a87 1186
6437ac71 1187dnl Enable "NTLM fail open"
1188AC_ARG_ENABLE(ntlm-fail-open,
1189[ --enable-ntlm-fail-open Enable NTLM fail open, where a helper that fails one of the
0961c811 1190 Authentication steps can allow squid to still authenticate
1191 the user.],
6437ac71 1192[ if test "$enableval" = "yes" ; then
6a9f6389 1193 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 1194 fi
1195])
1196
c6588c68 1197dnl Select external_acl helpers to build
1198EXTERNAL_ACL_HELPERS=
1199AC_ARG_ENABLE(external-acl-helpers,
1200[ --enable-external-acl-helpers=\"list of helpers\"
1201 This option selects which external_acl helpers to
1202 build and install as part of the normal build
1203 process. For a list of available helpers see the
1204 helpers/external_acl directory.],
1205[ case "$enableval" in
1206 yes)
1c690e30 1207 for dir in $srcdir/helpers/external_acl/*; do
1208 helper="`basename $dir`"
1209 if test -d "$dir" && test "$helper" != CVS; then
1210 EXTERNAL_ACL_HELPERS="$EXTERNAL_ACL_HELPERS $helper"
1211 fi
1212 done
1213 ;;
c6588c68 1214 no)
1c690e30 1215 ;;
c6588c68 1216 *)
1c690e30 1217 EXTERNAL_ACL_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1218 ;;
c6588c68 1219 esac
1220])
1221if test -n "$EXTERNAL_ACL_HELPERS"; then
20d8bfe4 1222 for helper in $EXTERNAL_ACL_HELPERS; do
1223 if test -f $srcdir/helpers/external_acl/$helper/Makefile.in; then
1224 :
1225 else
1daefc1a 1226 echo "ERROR: external acl helper $helper does not exists"
20d8bfe4 1227 exit 1
1228 fi
1229 done
c6588c68 1230 echo "External acl helpers built: $EXTERNAL_ACL_HELPERS"
1231fi
1232AC_SUBST(EXTERNAL_ACL_HELPERS)
1233
d96ceb8e 1234dnl Disable "memPools" code
1235AC_ARG_ENABLE(mempools,
1236[ --disable-mempools Disable memPools],
1237[ if test "$enableval" = "no" ; then
1238 echo "memPools disabled"
6a9f6389 1239 AC_DEFINE(DISABLE_POOLS, 1, [Define if you have problems with memPools and want to disable Pools])
d96ceb8e 1240 fi
1241])
1242
b1485ff8 1243
1244SAMBASOURCES='$(top_srcdir)/include/samba'
1245AC_ARG_WITH(samba-sources,
1246[ --with-samba-sources=/path/to/samba-source-tree
1247 Path where the correct Samba source files can be
1248 found while building winbind helpers. (defaults to
1249 use internal copies of the headers from Samba-2.2.7)
1250 ],
1251[ if test -f $withval/source/nsswitch/winbind_nss_config.h; then
1252 echo "Using Samba sources from $withval"
1253 SAMBASOURCES="$withval/source"
1254 else
1255 echo "ERROR: Cannot find Samba sources at $withval"
1256 exit 1
1257 fi
1258])
1259AC_SUBST(SAMBASOURCES)
1260
3c573763 1261dnl Disable "unlinkd" code
fe0810ac 1262AC_ARG_ENABLE(unlinkd,
1263[ --disable-unlinkd Do not use unlinkd],
1264[ if test "$enableval" = "no" ; then
3c573763 1265 use_unlinkd=no
fe0810ac 1266 else
3c573763 1267 use_unlinkd=yes
fe0810ac 1268 fi
1269],[
1270 # Here we should probably use some magic depending on the selected
1271 # storage models
3c573763 1272 use_unlinkd=yes
fe0810ac 1273])
3c573763 1274if test "$use_unlinkd" = "yes"; then
fe0810ac 1275 echo "unlinkd enabled"
6a9f6389 1276 AC_DEFINE(USE_UNLINKD,1,[Define this if unlinkd is required (strongly recommended for ufs storage type)])
a2794549 1277 AM_CONDITIONAL(ENABLE_UNLINKD, true)
fe0810ac 1278else
1279 echo "unlinkd disabled"
a2794549 1280 AM_CONDITIONAL(ENABLE_UNLINKD, false)
fe0810ac 1281fi
fe0810ac 1282
ce3d30fb 1283dnl Enable backtraces on fatal errors
1284AC_ARG_ENABLE(stacktraces,
1285[ --enable-stacktraces Enable automatic call backtrace on fatal errors],
1286[ if test "$enableval" = "yes" ; then
1287 echo "Enabling automatic stack backtraces on fatal errors"
6a9f6389 1288 AC_DEFINE(PRINT_STACK_TRACE, 1,[Print stacktraces on fatal errors])
ce3d30fb 1289 fi
1290])
1291
88bfe092 1292AM_CONDITIONAL(ENABLE_XPROF_STATS, false)
1293dnl Enable USE_XPROF_STATS
1294AC_ARG_ENABLE(cpu-profiling,
1295[ --enable-cpu-profiling
1296 This option allows you to see which internal functions
1297 in Squid are consuming how much CPU. Compiles in probes
1298 that measure time spent in probed functions. Needs
1299 source modifications to add new probes. This is meant
1300 for developers to assist in performance optimisations
1301 of Squid internal functions.
1302 If you are not developer and not interested in the stats
1303 you shouldn't enable this, as overhead added, although
1304 small, is still overhead. See lib/Profiler.c for more.
1305 ],
1306[ if test "$enableval" = "yes" ; then
1307 echo "Enabling cpu-profiling"
6a9f6389 1308 AC_DEFINE(USE_XPROF_STATS, 1,[Define to enable CPU profiling within Squid])
88bfe092 1309 AM_CONDITIONAL(ENABLE_XPROF_STATS, true)
1310 fi
1311])
1312
f66a9ef4 1313dnl Enable X-Accelerator-Vary for Vary support within an accelerator setup
1314AC_ARG_ENABLE(x_accelerator_vary,
0961c811 1315[ --enable-x-accelerator-vary
1316 Enable support for the X-Accelerator-Vary
1317 HTTP header. Can be used to indicate
1318 variance within an accelerator setup.
1319 Typically used together with other code
1320 that adds custom HTTP headers to the requests.],
f66a9ef4 1321[ if test "$enableval" = "yes" ; then
1322 echo "Enabling support for X-Accelerator-Vary"
6a9f6389 1323 AC_DEFINE(X_ACCELERATOR_VARY, 1, [Enable support for the X-Accelerator-Vary HTTP header])
f66a9ef4 1324 fi
1325])
1326
f49be7d1 1327AC_ARG_WITH(filedescriptors,
1328[ --with-filedescriptors=NUMBER Force squid to support NUMBER filedescriptors],
1329[ squid_filedescriptors_num=$withval ])
1330
fd9aaa3e 1331# Force some compilers to use ANSI features
1332#
1333case "$host" in
1334 alpha-dec-osf*)
1335 if test "$ac_cv_prog_CC" = "cc" ; then
1336 echo "adding '-std1' to cc args for $host"
1337 CC="cc -std1";
1338 ac_cv_prog_CC="$CC"
1339 fi
1340 ;;
c68e9c6b 1341 *-hp-hpux*)
1342 if test "$ac_cv_prog_CC" = "cc" ; then
1343 echo "adding '-Ae' to cc args for $host"
1344 CC="cc -Ae";
1345 ac_cv_prog_CC="$CC"
1346 fi
1347 ;;
fd9aaa3e 1348esac
1349
090089c4 1350dnl Check for programs
1351AC_PROG_CPP
1352AC_PROG_INSTALL
1353AC_PROG_RANLIB
1354AC_PROG_LN_S
81280a96 1355AC_PATH_PROG(SH, sh, /bin/sh)
d9f67e6f 1356AC_PATH_PROG(FALSE, false, /usr/bin/false)
1357AC_PATH_PROG(TRUE, true, /usr/bin/true)
1358AC_PATH_PROG(RM, rm, $FALSE)
1359AC_PATH_PROG(MV, mv, $FALSE)
1360AC_PATH_PROG(MKDIR, mkdir, $FALSE)
090089c4 1361AC_PATH_PROG(LN, ln, cp)
4e9d8e26 1362AC_PATH_PROG(PERL, perl, none)
a2794549 1363dnl automake handles this AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
6ad85e8a 1364AC_PATH_PROG(AR, ar, $FALSE)
1365
4e9d8e26 1366if test "$ac_cv_path_PERL" = "none"; then
1367 echo "Perl is required to compile Squid"
1368 echo "Please install Perl and then re-run configure"
1369 exit 1
1370fi
1371
6ad85e8a 1372case "$host" in
1373 *-hp-hpux*)
1374 echo "Disabling 'ranlib' for HP-UX..."
1375 RANLIB=":"
1376 ;;
1377esac
1378
1379dnl set $(AR)
1380AR_R="$AR r"
1381case "$host" in
1382 *-next-nextstep3)
1383 AR="libtool -o"
1384 ;;
1385esac
1386AC_SUBST(AR_R)
090089c4 1387
1388dnl Check for headers
1389AC_HEADER_DIRENT
1390AC_HEADER_STDC
db40ae20 1391
1392AC_CHECK_HEADERS( \
db40ae20 1393 arpa/inet.h \
30a4f2a8 1394 arpa/nameser.h \
9441aa34 1395 assert.h \
db40ae20 1396 bstring.h \
db40ae20 1397 crypt.h \
30a4f2a8 1398 ctype.h \
1399 errno.h \
ce3d30fb 1400 execinfo.h \
db40ae20 1401 fcntl.h \
9c1d8929 1402 getopt.h \
88738790 1403 gnumalloc.h \
30a4f2a8 1404 grp.h \
5cafc1d6 1405 ip_compat.h \
42b51993 1406 ip_fil_compat.h \
5cafc1d6 1407 ip_fil.h \
1408 ip_nat.h \
30a4f2a8 1409 libc.h \
6ad85e8a 1410 limits.h \
30a4f2a8 1411 malloc.h \
e0bddc45 1412 math.h \
db40ae20 1413 memory.h \
b075cbb1 1414 mount.h \
2b0dd4ac 1415 net/pfvar.h \
30a4f2a8 1416 netdb.h \
db40ae20 1417 netinet/in.h \
30a4f2a8 1418 netinet/tcp.h \
42b51993 1419 netinet/ip_fil_compat.h \
1f7c9178 1420 openssl/err.h \
1421 openssl/md5.h \
1422 openssl/ssl.h \
a7ad6e4e 1423 openssl/engine.h \
dcfe6390 1424 poll.h \
30a4f2a8 1425 pwd.h \
1426 regex.h \
1427 resolv.h \
c68e9c6b 1428 sched.h \
30a4f2a8 1429 signal.h \
1430 stdarg.h \
1431 stddef.h \
1432 stdio.h \
db40ae20 1433 stdlib.h \
1434 string.h \
1435 strings.h \
0a4e8536 1436 sys/bitypes.h \
db40ae20 1437 sys/file.h \
5cafc1d6 1438 sys/ioctl.h \
0343b99c 1439 sys/mount.h \
ebb3c3ba 1440 sys/msg.h \
30a4f2a8 1441 sys/param.h \
1442 sys/resource.h \
db40ae20 1443 sys/select.h\
30a4f2a8 1444 sys/socket.h \
1445 sys/stat.h \
b075cbb1 1446 sys/statvfs.h \
3c641669 1447 syscall.h \
30a4f2a8 1448 sys/syscall.h \
db40ae20 1449 sys/time.h \
1450 sys/types.h \
30a4f2a8 1451 sys/un.h \
b075cbb1 1452 sys/vfs.h \
30a4f2a8 1453 sys/wait.h \
db40ae20 1454 syslog.h \
30a4f2a8 1455 time.h \
1456 unistd.h \
3c641669 1457 utime.h \
30a4f2a8 1458 varargs.h \
77d6bd88 1459 byteswap.h \
1460 glib.h \
60d096f4 1461 stdint.h \
1462 inttypes.h \
3c641669 1463 grp.h \
1464 nss_common.h \
1465 nss.h
db40ae20 1466)
1467
5a3237b0 1468AC_CHECK_HEADERS(linux/netfilter_ipv4.h,,,
dcd1dc78 1469SQUID_DEFAULT_INCLUDES
1470#if HAVE_LIMITS_H
1471#include <limits.h>
1472#endif
1473)
1474
5a3237b0 1475AC_CHECK_HEADERS(net/if.h \
1476 netinet/if_ether.h\
1477 netinet/ip_compat.h\
1478 netinet/ip_fil.h\
1479 netinet/ip_nat.h,,,SQUID_BSDNET_INCLUDES)
1480
aee0606f 1481AC_C_CONST
d57288d2 1482AC_C_BIGENDIAN
aee0606f 1483
5c51415d 1484AC_CACHE_CHECK(if ANSI prototypes work,ac_cv_have_ansi_prototypes, [
1485 AC_TRY_COMPILE([int foo(char *); int foo (char *bar) {return 1;}],
1486 [foo("bar")],
1487 ac_cv_have_ansi_prototypes="yes",
1488 ac_cv_have_ansi_prototypes="no")
1489])
1490if test $ac_cv_have_ansi_prototypes = "yes" ; then
6a9f6389 1491 AC_DEFINE(HAVE_ANSI_PROTOTYPES,1,[Define if your compiler supports prototyping])
5c51415d 1492fi
20a50bb9 1493
6a9f6389 1494AC_STRUCT_TM
1495AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
1496#if TM_IN_SYS_TIME
1497#if HAVE_SYS_TIME_H
1498#include <sys/time.h>
1499#endif
1500#elif HAVE_TIME_H
1501#include <time.h>
1502#endif
5c51415d 1503])
46c883ed 1504
6a9f6389 1505AC_CHECK_TYPE(struct mallinfo,AC_DEFINE(HAVE_STRUCT_MALLINFO,1,[The system provides struct mallinfo]),,[
1506#if HAVE_SYS_TYPES_H
1507#include <sys/types.h>
1508#endif
eb824054 1509#if HAVE_MALLOC_H
1510#include <malloc.h>
6a9f6389 1511#endif])
eb824054 1512
6a9f6389 1513AC_CHECK_MEMBERS([struct mallinfo.mxfast],,,[
1514#if HAVE_SYS_TYPES_H
1515#include <sys/types.h>
1516#endif
1517#if HAVE_MALLOC_H
1518#include <malloc.h>
1519#endif])
090089c4 1520
6a9f6389 1521AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
8ff51bba 1522#if HAVE_SYS_TIME_H
1523#include <sys/time.h>
1524#endif
b54a6789 1525#if HAVE_SYS_RESOURCE_H
1526#include <sys/resource.h>
6a9f6389 1527#endif])
b54a6789 1528
6a9f6389 1529AC_CHECK_MEMBERS([struct iphdr.ip_hl],,,[
1530#if HAVE_SYS_TYPES_H
1531#include <sys/types.h>
1532#endif
a025a745 1533#include <netinet/in.h>
1534#include <netinet/in_systm.h>
6ad85e8a 1535#include <netinet/ip.h>
b05490a8 1536#if defined (__linux__) || defined (__CYGWIN__)
6ad85e8a 1537#define ip_hl ihl
1538#endif
1539#ifndef __linux__
b05490a8 1540#ifndef __CYGWIN__
6ad85e8a 1541#define iphdr ip
b05490a8 1542#endif
6a9f6389 1543#endif])
a025a745 1544
090089c4 1545dnl Check for typedefs
77d6bd88 1546AC_CHECK_SIZEOF(void *)
090089c4 1547
6a9f6389 1548dnl 16 bit integers - int16_t and u_int16_t
1549dnl if this is defined we trust it to be 16 bits
1550AC_CHECK_TYPE(int16_t,
1551 AC_DEFINE(HAVE_INT16_T,1,[int16_t is defined in system headers]),
1552 ,SQUID_DEFAULT_INCLUDES)
1553
1554dnl fallback #1
1555AC_CHECK_TYPE(short,[
856e69c5 1556 AC_CHECK_SIZEOF(short,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 1557 AC_DEFINE(HAVE_SHORT,1,[short is defined in system headers])
1558 ],,SQUID_DEFAULT_INCLUDES)
1559
1560dnl fallback #2
1561AC_CHECK_TYPE(int,[
856e69c5 1562 AC_CHECK_SIZEOF(int,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 1563 AC_DEFINE(HAVE_INT,1,[int is defined in system headers])
1564 ],,SQUID_DEFAULT_INCLUDES)
1565
1566dnl unsigned 16 bit ints - u_int16_t
1567dnl if this is defined we trust it to be 16 bits
1568AC_CHECK_TYPE(u_int16_t,
1569 AC_DEFINE(HAVE_U_INT16_T,1,[u_int16_t is defined in system headers]),
1570 ,SQUID_DEFAULT_INCLUDES)
1571
1572dnl fallback #1
1573dnl if this is defined we trust it to be 16 bits
1574AC_CHECK_TYPE(uint16_t,
1575 AC_DEFINE(HAVE_UINT16_T,1,[uint16_t is defined in system headers]),
1576 ,SQUID_DEFAULT_INCLUDES)
1577
1578dnl 32 bit signed int - int32_t
1579dnl if this is defined we trust it to be 32 bits
1580AC_CHECK_TYPE(int32_t,
1581 AC_DEFINE(HAVE_INT32_T,1,[int32_t is defined in system headers]),
1582 ,SQUID_DEFAULT_INCLUDES)
1583
1584dnl fallback #1
1585AC_CHECK_TYPE(long,[
856e69c5 1586 AC_CHECK_SIZEOF(long,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 1587 AC_DEFINE(HAVE_LONG,1,[long is defined in system headers])
1588 ],,SQUID_DEFAULT_INCLUDES)
1589
1590dnl 32 bit unsigned int - u_int32_t
1591dnl if this is defined we trust it to be 32 bits
1592AC_CHECK_TYPE(u_int32_t,
1593 AC_DEFINE(HAVE_U_INT32_T,1,[u_int32_t is defined in system headers]),
1594 ,SQUID_DEFAULT_INCLUDES)
1595
1596dnl fallback #1
1597dnl if this is defined we trust it to be 32 bits
1598AC_CHECK_TYPE(uint32_t,
1599 AC_DEFINE(HAVE_UINT32_T,1,[uint32_t is defined in system headers]),
1600 ,SQUID_DEFAULT_INCLUDES)
1601
1602dnl 64 bit signed - int64_t
1603dnl if this is defind we trust it to be 64 bits
1604AC_CHECK_TYPE(int64_t,
1605 AC_DEFINE(HAVE_INT64_T,1,[int64_t is defined in system headers]),
1606 ,SQUID_DEFAULT_INCLUDES)
1607
1608dnl fallback #1
1609dnl if this is defind we trust it to be 64 bits
1610AC_CHECK_TYPE(__int64,
1611 AC_DEFINE(HAVE___INT64,1,[__int64 is defined in system headers]),
1612 ,SQUID_DEFAULT_INCLUDES)
1613
1614dnl fallback #2
1615AC_CHECK_TYPE(long long,[
856e69c5 1616 AC_CHECK_SIZEOF(long long,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 1617 AC_DEFINE(HAVE_LONG_LONG,1,[long long is defined in system headers])
1618 ],,SQUID_DEFAULT_INCLUDES)
1619
1620dnl 64 bit unsigned - u_int64_t
1621dnl if this is defind we trust it to be 64 bits
1622AC_CHECK_TYPE(u_int64_t,
1623 AC_DEFINE(HAVE_U_INT64_T,1,[u_int64_t is defined in system headers]),
1624 ,SQUID_DEFAULT_INCLUDES)
1625
1626dnl fallback #1
1627dnl if this is defind we trust it to be 64 bits
1628AC_CHECK_TYPE(uint64_t,
1629 AC_DEFINE(HAVE_UINT64_T,1,[uint64_t is defined in system headers]),
1630 ,SQUID_DEFAULT_INCLUDES)
1631
1632AC_CHECK_TYPE(pid_t, AC_DEFINE(HAVE_PID_T,1,[pid_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
856e69c5 1633AC_CHECK_TYPE(size_t, [AC_CHECK_SIZEOF(size_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 1634 AC_DEFINE(HAVE_SIZE_T,1,[size_t is defined by the system headers])],,SQUID_DEFAULT_INCLUDES)
1635AC_CHECK_TYPE(ssize_t, AC_DEFINE(HAVE_SSIZE_T,1,[ssize_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
856e69c5 1636AC_CHECK_TYPE(off_t,[ AC_CHECK_SIZEOF(off_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 1637 AC_DEFINE(HAVE_OFF_T,1,[off_t is defined by the system headers])],,SQUID_DEFAULT_INCLUDES)
1638AC_CHECK_TYPE(mode_t, AC_DEFINE(HAVE_MODE_T,1,[mode_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
1639AC_CHECK_TYPE(fd_mask, AC_DEFINE(HAVE_FD_MASK,1,[fd_mask is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
adcceb47 1640
77d6bd88 1641dnl Check for special functions
1642AC_FUNC_ALLOCA
1643
6a9f6389 1644AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the system headers]),,[
1645#include <sys/types.h>
6637e3a5 1646#include <sys/socket.h>
1647#if STDC_HEADERS
1648#include <stdlib.h>
1649#include <stddef.h>
6a9f6389 1650#endif])
6637e3a5 1651
6a9f6389 1652AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,[mtyp_t is defined by the system headers]),,[#include <sys/types.h>
aea1be68 1653#include <sys/ipc.h>
6a9f6389 1654#include <sys/msg.h>])
aea1be68 1655
090089c4 1656dnl Check for needed libraries
30a4f2a8 1657AC_CHECK_LIB(nsl, main)
6716b242 1658AC_CHECK_LIB(socket, main)
94d48591 1659
3c641669 1660dnl Ripped from the Samba sources
1661AC_CACHE_CHECK([for unix domain sockets],squid_cv_unixsocket, [
1662 AC_TRY_COMPILE([
1663#include <sys/types.h>
1664#include <stdlib.h>
1665#include <stddef.h>
1666#include <sys/socket.h>
1667#include <sys/un.h>],
1668[
1669 struct sockaddr_un sunaddr;
1670 sunaddr.sun_family = AF_UNIX;
1671],
1672 squid_cv_unixsocket=yes,squid_cv_unixsocket=no)])
1673if test x"$squid_cv_unixsocket" = x"yes"; then
6a9f6389 1674 AC_DEFINE(HAVE_UNIXSOCKET,1,[Do we have unix sockets? (required for the winbind ntlm helper])
3c641669 1675fi
1676dnl end rip
1677
94d48591 1678if test "x$ac_cv_enabled_dlmalloc" = "xyes" ; then
1679 echo "skipping libmalloc check (--enable-dlmalloc specified)"
5c51415d 1680else
94d48591 1681 AC_CHECK_LIB(gnumalloc, main)
1682 if test "$ac_cv_lib_gnumalloc_main" = "yes"; then
1683 echo "Disabling extended malloc functions when using gnumalloc"
1684 ac_cv_func_mallinfo=no
1685 ac_cv_func_mallocblksize=no
1686 ac_cv_func_mallopt=no
1687 else
1688 case "$host" in
1689 *-sun-solaris*)
1690 echo "skipping libmalloc check for $host"
1691 ;;
1692 i386-*-freebsd*)
1693 echo "skipping libmalloc check for $host"
1694 ;;
1695 *)
1696
1697 AC_CHECK_LIB(malloc, main)
1698 ;;
1699 esac
1700 fi
8a15e65e 1701fi
94d48591 1702
6716b242 1703AC_CHECK_LIB(bsd, main)
be79ade0 1704AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"])
04a56fa3 1705AC_CHECK_LIB(bind, gethostbyname)
1706if test $ac_cv_lib_bind_gethostbyname = "no" ; then
1707 case "$host" in
78743365 1708 i386-*-freebsd*)
1709 echo "skipping libresolv checks for $host"
1710 ;;
1711 *)
1712 AC_CHECK_LIB(resolv, inet_aton, AC_CHECK_LIB(44bsd, inet_aton))
1713 AC_CHECK_LIB(resolv, main)
1714 ;;
04a56fa3 1715 esac
1716fi
e0bddc45 1717AC_CHECK_LIB(m, main)
090089c4 1718
1719dnl Check for libcrypt
8154dd82 1720dnl Some of our helpers use crypt(3) which may be in libc, or in
1721dnl libcrypt (eg FreeBSD)
042b1f8a 1722AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
be79ade0 1723AC_SUBST(CRYPTLIB)
77f675ad 1724
042b1f8a 1725dnl Check for libdl, used by auth_modules/PAM
8154dd82 1726if test "$with_dl" = "yes"; then
1727 AC_CHECK_LIB(dl, dlopen)
1728fi
042b1f8a 1729
e5f4e1b0 1730dnl Check for pthreads
1731dnl We use pthreads when doing ASYNC I/O
8154dd82 1732if test "$with_pthreads" = "yes"; then
e685e3c6 1733 CFLAGS="$CFLAGS -D_REENTRANT"
1734 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
1735 case "$host" in
1736 i386-unknown-freebsd*)
1737 if test "$GCC" = "yes" ; then
1738 if test -z "$PRESET_LDFLAGS"; then
1739 LDFLAGS="$LDFLAGS -pthread"
1740 fi
1741 fi
1742 ;;
1743 *-solaris2.*)
1744 if test "$GCC" = "yes" ; then
1745 CFLAGS="$CFLAGS -pthreads"
1746 CXXFLAGS="$CXXFLAGS -pthreads"
1747 else
1748 CFLAGS="$CFLAGS -mt"
1749 CXXFLAGS="$CXXFLAGS -mt"
1750 fi
1751 ;;
1752 esac
8154dd82 1753 AC_CHECK_LIB(pthread, main)
1754fi
71f8abc8 1755
f85c88f3 1756dnl Check for librt
1757dnl We use AIO in the coss store
8154dd82 1758if test "$with_aio" = "yes"; then
1759 AC_CHECK_LIB(rt, aio_read)
1760fi
f85c88f3 1761
86ec11aa 1762dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
1763dnl Robert Side <rside@aiinc.bc.ca>
1764dnl Mon, 18 Jan 1999 17:48:00 GMT
1765case "$host" in
1766 *-pc-sco3.2*)
1767 AC_CHECK_LIB(intl, strftime)
1768 ;;
1769esac
1770
77f675ad 1771dnl System-specific library modifications
1772dnl
1773case "$host" in
88738790 1774 i386-*-solaris2.*)
7149a49f 1775 if test "$GCC" = "yes"; then
1776 echo "Removing -O for gcc on $host"
80e92d6d 1777 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
7149a49f 1778 fi
1779 ;;
77f675ad 1780 *-sgi-irix*)
1781 echo "Removing -lsocket for IRIX..."
6716b242 1782 LIBS=`echo $LIBS | sed -e s/-lsocket//`
77f675ad 1783 echo "Removing -lnsl for IRIX..."
6716b242 1784 LIBS=`echo $LIBS | sed -e s/-lnsl//`
c415c128 1785 ac_cv_lib_nsl_main=no
b44c0fb4 1786 echo "Removing -lbsd for IRIX..."
1787 LIBS=`echo $LIBS | sed -e s/-lbsd//`
77f675ad 1788 ;;
4ba0bd0e 1789dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
1790dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
1791dnl Please change your configure script. AIX doesn't need -lbsd.
1792 *-ibm-aix*)
1793 echo "Removing -lbsd for AIX..."
1794 LIBS=`echo $LIBS | sed -e s/-lbsd//`
c68e9c6b 1795dnl From: mlaster@metavillage.com (Mike Laster)
1796dnl AIX 4.1.4.x does not have header files for snprintf/vsnprintf
1797dnl So using the internal versions generates a load of warnings
1798dnl during compile.
1799 echo "disabling snprintf/vsnprintf for $host"
1800 ac_cv_func_snprintf=no
1801 ac_cv_func_vsnprintf=no
4ba0bd0e 1802 ;;
30a4f2a8 1803 *m88k*)
1804 CFLAGS="$CFLAGS -D_SQUID_MOTOROLA_"
680ae450 1805 CXXFLAGS="$CXXFLAGS -D_SQUID_MOTOROLA_"
6a9f6389 1806 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1,[If gettimeofday is known to take only one argument])
7149a49f 1807 ;;
580ce039 1808 [*-*-solaris2.[0-4]])
6a9f6389 1809 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
30a4f2a8 1810 ;;
711fa75e 1811 [*-sony-newsos[56]*])
6a9f6389 1812 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
f62c73dc 1813 ;;
77f675ad 1814esac
090089c4 1815
57faa85a 1816# Remove optimization for GCC 2.95.[123]
d20b1cd0 1817# gcc -O[2] on *BSD and Linux (x86) causes pointers to magically become NULL
1818if test "$GCC" = "yes"; then
1819 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
1820 case "$GCCVER" in
57faa85a 1821 [2.95.[123]])
d20b1cd0 1822 echo "Removing -O for gcc on $host with GCC $GCCVER"
1823 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
1824 ;;
1825 esac
1826fi
1827
176d10ee 1828# Recommended by Balint Nagy Endre <bne@CareNet.hu>
1829case "$host" in
1830 *-univel-sysv4.2MP)
1831 if test `uname -v` = "2.03"; then
1832 echo "disabling mallinfo for $host"
1833 ac_cv_func_mallinfo=no
1834 fi
1835 ;;
1836esac
1837
84cecfd2 1838dnl This has to be before AC_CHECK_FUNCS
1839# Disable poll() on certain platforms. Override by setting ac_cv_func_poll
1840# when running configure.
1841if test -z "$ac_cv_func_poll"; then
1842 case "$host" in
1843 [alpha-dec-osf3.*])
1844 # John Kay (jkay@nlanr.net) 19970818
1845 echo "disabling poll for $host..."
1846 ac_cv_func_poll='no'
1847 ;;
1848 [*-hp-hpux*.*])
1849 # Duane Wessels
1850 echo "disabling poll for $host..."
1851 ac_cv_func_poll='no'
1852 ;;
1853 [*-linux-*])
f5cec332 1854 # Henrik Nordstrom (hno@squid-cache.org) 19980817
9bb83c8b 1855 # poll is problematic on Linux. We disable it
1856 # by default until Linux gets it right.
b6a2f15e 1857 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
1858 if test $rev -lt 002002; then
1859 echo "disabling poll for $host < 2.2..."
1860 ac_cv_func_poll='no'
1861 fi
84cecfd2 1862 ;;
c68e9c6b 1863 [powerpc-ibm-aix4.1.*])
1864 # Mike Laster (mlaster@metavillage.com) 19981021
1865 echo "disabling poll for $host..."
1866 ac_cv_func_poll='no'
1867 ;;
86ec11aa 1868 [*-pc-sco3.2*])
1869 # Robert Side <rside@aiinc.bc.ca>
1870 # Mon, 18 Jan 1999 17:48:00 GMT
1871 echo "disabling poll for $host..."
1872 ac_cv_func_poll='no'
1873 ;;
84cecfd2 1874 esac
1875fi
176d10ee 1876
6716b242 1877dnl Check for library functions
1878AC_CHECK_FUNCS(\
ce3d30fb 1879 backtrace_symbols_fd \
3a144521 1880 bcopy \
1881 bswap_16 \
1882 bswap_32 \
df087e68 1883 crypt \
4ac29a5b 1884 fchmod \
6716b242 1885 getdtablesize \
8505e57b 1886 getpagesize \
230c091c 1887 getpass \
3a144521 1888 getrlimit \
30a4f2a8 1889 getrusage \
9c1d8929 1890 getspnam \
30a4f2a8 1891 lrand48 \
6716b242 1892 mallinfo \
0f5efab0 1893 mallocblksize \
6716b242 1894 mallopt \
2ae6b9b0 1895 memcpy \
30a4f2a8 1896 memmove \
dac27377 1897 memset \
b99a6dec 1898 mkstemp \
1812b6c7 1899 mktime \
88738790 1900 mstats \
84cecfd2 1901 poll \
3a144521 1902 pthread_attr_setschedparam \
cd748f27 1903 pthread_attr_setscope \
1904 pthread_setschedparam \
42b51993 1905 pthread_sigmask \
c68e9c6b 1906 putenv \
b1e77ec1 1907 random \
6716b242 1908 regcomp \
1909 regexec \
1910 regfree \
30a4f2a8 1911 res_init \
4915be3b 1912 rint \
a4ba1105 1913 sbrk \
3a144521 1914 select \
234967c9 1915 seteuid \
c415c128 1916 setgroups \
30a4f2a8 1917 setpgrp \
6716b242 1918 setrlimit \
30a4f2a8 1919 setsid \
1920 sigaction \
11430c03 1921 snprintf \
1ccc0d40 1922 socketpair \
30a4f2a8 1923 srand48 \
b1e77ec1 1924 srandom \
0343b99c 1925 statfs \
6716b242 1926 sysconf \
1927 syslog \
234967c9 1928 timegm \
28da5e0d 1929 vsnprintf \
6716b242 1930)
1931
1b3db6d9 1932dnl Magic which checks whether we are forcing a type of comm loop we
1933dnl are actually going to (ab)use
1934
1935dnl Actually do the define magic now
1936dnl mostly ripped from squid-commloops, thanks to adrian and benno
1937
1938if test "$ac_cv_func_poll" = "yes" ; then
1939 SELECT_TYPE="poll"
6a9f6389 1940 AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop])
1b3db6d9 1941elif test "$ac_cv_func_select" = "yes" ; then
1942 SELECT_TYPE="select"
6a9f6389 1943 AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop])
92b9f1fd 1944elif test "$ac_cv_func_kqueue" = "yes" ; then
1945 SELECT_TYPE="kqueue"
6a9f6389 1946 AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop])
a46d2c0e 1947elif test "$ac_cv_func_epoll" = "yes" ; then
1948 SELECT_TYPE="epoll"
1949 AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop])
1b3db6d9 1950else
a46d2c0e 1951 echo "Eep! Can't find poll, kqueue, epoll, or select!"
1b3db6d9 1952 echo "I'll try select and hope for the best."
1953 SELECT_TYPE="select"
6a9f6389 1954 AC_DEFINE(USE_SELECT,1)
1b3db6d9 1955fi
1956echo "Using ${SELECT_TYPE} for select loop."
1b3db6d9 1957
1958
60939927 1959dnl Yay! Another Linux brokenness. Its not good enough
1960dnl to know that setresuid() exists, because RedHat 5.0 declares
1961dnl setresuid() but doesn't implement it.
1962dnl
1963AC_CACHE_CHECK(if setresuid is implemented, ac_cv_func_setresuid,
5c51415d 1964 AC_TRY_RUN([
60939927 1965#include <stdlib.h>
5c51415d 1966 int main() {
1967 if(setresuid(-1,-1,-1)) {
1968 perror("setresuid:");
1969 exit(1);
60939927 1970 }
1971 exit(0);
5c51415d 1972 }
1973 ],ac_cv_func_setresuid="yes",ac_cv_func_setresuid="no")
60939927 1974)
5c51415d 1975if test "$ac_cv_func_setresuid" = "yes" ; then
6a9f6389 1976 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 1977fi
60939927 1978
c3d0c8b5 1979AM_CONDITIONAL(NEED_OWN_SNPRINTF, false)
1980if test "$ac_cv_func_snprintf" = "no" || test "$ac_cv_func_vsnprintf" = "no" ; then
1981 AM_CONDITIONAL(NEED_OWN_SNPRINTF, true)
1982fi
1983
5cafc1d6 1984dnl IP-Filter support requires ipf header files. These aren't
1985dnl installed by default, so we need to check for them
1986if test "$IPF_TRANSPARENT" ; then
1987 AC_MSG_CHECKING(if IP-Filter header files are installed)
42b51993 1988 # hold on to your hats...
1989 if test "$ac_cv_header_ip_compat_h" = "yes" ||
1990 test "$ac_cv_header_ip_fil_compat_h" = "yes" ||
87d21d8b 1991 test "$ac_cv_header_netinet_ip_compat_h" = "yes" ||
1992 test "$ac_cv_header_netinet_ip_fil_compat_h" = "yes" ; then
42b51993 1993 have_ipfilter_compat_header="yes"
1994 fi
1995 if test "x$have_ipfilter_compat_header" = "xyes" &&
eb824054 1996 test "$ac_cv_header_ip_fil_h" = "yes" &&
1997 test "$ac_cv_header_ip_nat_h" = "yes" ; then
1998 IPF_TRANSPARENT="yes"
1999 AC_DEFINE(IPF_TRANSPARENT, 1)
42b51993 2000 elif test "$have_ipfilter_compat_header" = "yes" &&
eb824054 2001 test "$ac_cv_header_netinet_ip_fil_h" = "yes" &&
2002 test "$ac_cv_header_netinet_ip_nat_h" = "yes" ; then
2003 IPF_TRANSPARENT="yes"
2004 AC_DEFINE(IPF_TRANSPARENT, 1)
2005 else
5cafc1d6 2006 IPF_TRANSPARENT="no"
2007 AC_DEFINE(IPF_TRANSPARENT, 0)
5cafc1d6 2008 fi
2009 AC_MSG_RESULT($IPF_TRANSPARENT)
2010fi
2011if test "$IPF_TRANSPARENT" = "no" ; then
2012 echo "WARNING: Cannot find necessary IP-Filter header files"
2013 echo " Transparent Proxy support WILL NOT be enabled"
2014 sleep 10
2015fi
2016
2b0dd4ac 2017dnl PF support requires a header file.
2018if test "$PF_TRANSPARENT" ; then
2019 AC_MSG_CHECKING(if PF header file is installed)
2020 # hold on to your hats...
2021 if test "$ac_cv_header_net_pfvar_h" = "yes"; then
2022 PF_TRANSPARENT="yes"
2023 AC_DEFINE(PF_TRANSPARENT, 1)
2024 else
2025 PF_TRANSPARENT="no"
2026 AC_DEFINE(PF_TRANSPARENT, 0)
2027 fi
2028 AC_MSG_RESULT($PF_TRANSPARENT)
2029fi
2030if test "$PF_TRANSPARENT" = "no" ; then
2031 echo "WARNING: Cannot find necessary PF header file"
2032 echo " Transparent Proxy support WILL NOT be enabled"
2033 sleep 10
2034fi
2035
d852fbad 2036dnl Linux-Netfilter support requires Linux 2.4 kernel header files.
2037dnl Shamelessly copied from above
2038if test "$LINUX_NETFILTER" ; then
2039 AC_MSG_CHECKING(if Linux 2.4 kernel header files are installed)
2040 # hold on to your hats...
2041 if test "$ac_cv_header_linux_netfilter_ipv4_h" = "yes"; then
2042 LINUX_NETFILTER="yes"
2043 AC_DEFINE(LINUX_NETFILTER, 1)
2044 else
2045 LINUX_NETFILTER="no"
2046 AC_DEFINE(LINUX_NETFILTER, 0)
2047 fi
2048 AC_MSG_RESULT($LINUX_NETFILTER)
2049fi
2050if test "$LINUX_NETFILTER" = "no" ; then
2051 echo "WARNING: Cannot find necessary Linux 2.4 kernel header files"
2052 echo " Linux 2.4 Transparent Proxy support WILL NOT be enabled"
2053 sleep 10
2054fi
2055
91bc414e 2056if test -z "$USE_GNUREGEX" ; then
2057 case "$host" in
2058 *-sun-solaris2.[[0-4]])
2059 USE_GNUREGEX="yes"
2060 ;;
2061 *-next-nextstep*)
2062 USE_GNUREGEX="yes"
2063 ;;
2064 esac
2065fi
7a081912 2066AC_MSG_CHECKING(if GNUregex needs to be compiled)
91bc414e 2067if test -z "$USE_GNUREGEX"; then
55878dfd 2068if test "$ac_cv_func_regcomp" = "no" || test "$USE_GNUREGEX" = "yes" ; then
74946a0f 2069 USE_GNUREGEX="yes"
00fa2c12 2070else
0cccc031 2071 AC_TRY_COMPILE([#include <sys/types.h>
2072#include <regex.h>],[regex_t t; regcomp(&t,"",0);],
91bc414e 2073 USE_GNUREGEX="no",
2074 USE_GNUREGEX="yes")
2075fi
00fa2c12 2076fi
74946a0f 2077AC_MSG_RESULT($USE_GNUREGEX)
2078if test "$USE_GNUREGEX" = "yes"; then
26675bf4 2079 REGEXLIB="-lregex"
7a081912 2080 LIBREGEX="libregex.a"
6a9f6389 2081 AC_DEFINE(USE_GNUREGEX,1,[Define if we should use GNU regex])
7a081912 2082fi
26675bf4 2083AC_SUBST(REGEXLIB)
00fa2c12 2084AC_SUBST(LIBREGEX)
7a081912 2085
3f6fcd8a 2086AC_REPLACE_FUNCS(\
3d0cf10e 2087 drand48 \
3f6fcd8a 2088 tempnam \
4d38fc7e 2089 strerror \
3f6fcd8a 2090)
2091
5c51415d 2092dnl Not cached since people are likely to tune this
e924600d 2093AC_MSG_CHECKING(Default FD_SETSIZE value)
2094AC_TRY_RUN([
2095#if HAVE_STDIO_H
2096#include <stdio.h>
2097#endif
2098#if HAVE_UNISTD_H
2099#include <unistd.h>
2100#endif
2101#if HAVE_SYS_TIME_H
2102#include <sys/time.h>
2103#endif
2104#if HAVE_SYS_SELECT_H
2105#include <sys/select.h>
2106#endif
2107#if HAVE_SYS_TYPES_H
2108#include <sys/types.h>
2109#endif
2110main() {
635e6242 2111 FILE *fp = fopen("conftestval", "w");
2112 fprintf (fp, "%d\n", FD_SETSIZE);
e924600d 2113 exit(0);
2114}
2115],
2116DEFAULT_FD_SETSIZE=`cat conftestval`,
2117DEFAULT_FD_SETSIZE=256,
2118DEFAULT_FD_SETSIZE=256)
2119AC_MSG_RESULT($DEFAULT_FD_SETSIZE)
6a9f6389 2120AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE, [Default FD_SETSIZE value])
e924600d 2121
f49be7d1 2122
5c51415d 2123dnl Not cached since people are likely to tune this
234967c9 2124AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
c76d8acc 2125dnl damn! FreeBSD's pthreads breaks dup2().
f49be7d1 2126if test -n "$squid_filedescriptors_num" ; then
2127 SQUID_MAXFD=$squid_filedescriptors_num
2128 AC_MSG_RESULT($SQUID_MAXFD (user-forced))
2129else
2130 TLDFLAGS="$LDFLAGS"
2131 case $host in
2132 i386-unknown-freebsd*)
2133 if echo "$LDFLAGS" | grep -q pthread; then
2134 LDFLAGS=`echo $LDFLAGS | sed -e "s/-pthread//"`
2135 fi
2136 esac
2137 AC_TRY_RUN([
8cca06da 2138#include <stdio.h>
234967c9 2139#include <unistd.h>
30a4f2a8 2140#include <sys/time.h> /* needed on FreeBSD */
234967c9 2141#include <sys/param.h>
2142#include <sys/resource.h>
2143main() {
635e6242 2144 FILE *fp;
234967c9 2145 int i,j;
42b51993 2146#if defined(__CYGWIN32__) || defined (__CYGWIN__)
b05490a8 2147 /* getrlimit and sysconf returns bogous values on cygwin32.
df087e68 2148 * Number of fds is virtually unlimited in cygwin (sys/param.h)
b05490a8 2149 * __CYGWIN32__ is deprecated.
df087e68 2150 */
2151 i = NOFILE;
b05490a8 2152#else
2153#if HAVE_SETRLIMIT
234967c9 2154 struct rlimit rl;
2155#if defined(RLIMIT_NOFILE)
2156 if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
2157 perror("getrlimit: RLIMIT_NOFILE");
2158 } else {
2159 rl.rlim_cur = rl.rlim_max; /* set it to the max */
2160 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
2161 perror("setrlimit: RLIMIT_NOFILE");
2162 }
2163 }
2164#elif defined(RLIMIT_OFILE)
2165 if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
2166 perror("getrlimit: RLIMIT_OFILE");
2167 } else {
2168 rl.rlim_cur = rl.rlim_max; /* set it to the max */
2169 if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
2170 perror("setrlimit: RLIMIT_OFILE");
2171 }
2172 }
2173#endif /* RLIMIT_NOFILE */
2174#endif /* HAVE_SETRLIMIT */
d9399075 2175 /* by starting at 2^14, we will never get higher
2176 than 2^15 for SQUID_MAXFD */
2177 i = j = 1<<14;
2178 while (j) {
2179 j >>= 1;
2180 if (dup2(0, i) < 0) {
2181 i -= j;
2182 } else {
2183 close(i);
2184 i += j;
2185 }
2186 }
2187 i++;
b05490a8 2188#endif /* IF !DEF CYGWIN */
635e6242 2189 fp = fopen("conftestval", "w");
2190 fprintf (fp, "%d\n", i);
234967c9 2191 exit(0);
2192}
f49be7d1 2193 ],
2194 SQUID_MAXFD=`cat conftestval`,
2195 SQUID_MAXFD=256,
2196 SQUID_MAXFD=256)
2197 AC_MSG_RESULT($SQUID_MAXFD)
2198fi
6a9f6389 2199AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD,[Maximum number of open filedescriptors])
b9cc811d 2200if test "$SQUID_MAXFD" -lt 512 ; then
80ab193b 2201 echo "WARNING: $SQUID_MAXFD may not be enough filedescriptors if your"
2202 echo " cache will be very busy. Please see the FAQ page"
2b6662ba 2203 echo " http://www.squid-cache.org/FAQ/FAQ-11.html#filedescriptors"
e692ff35 2204 echo " on how to increase your filedescriptor limit"
933cc58d 2205 sleep 10
80ab193b 2206fi
c76d8acc 2207LDFLAGS="$TLDFLAGS"
234967c9 2208
5c51415d 2209dnl Not cached since people are likely to tune this
30a4f2a8 2210AC_MSG_CHECKING(Default UDP send buffer size)
2211AC_TRY_RUN([
8cca06da 2212#include <stdlib.h>
2213#include <stdio.h>
30a4f2a8 2214#include <sys/types.h>
2215#include <sys/socket.h>
2216#include <netinet/in.h>
2217main ()
2218{
635e6242 2219 FILE *fp;
30a4f2a8 2220 int fd,val=0,len=sizeof(int);
2221 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
2222 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
2223 if (val<=0) exit(1);
635e6242 2224 fp = fopen("conftestval", "w");
2225 fprintf (fp, "%d\n", val);
30a4f2a8 2226 exit(0);
2227}
2228],
6a9f6389 2229SQUID_DETECT_UDP_SO_SNDBUF=`cat conftestval`,
2230SQUID_DETECT_UDP_SO_SNDBUF=16384,
2231SQUID_DETECT_UDP_SO_SNDBUF=16384)
2232AC_MSG_RESULT($SQUID_DETECT_UDP_SO_SNDBUF)
2233AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_SNDBUF, $SQUID_DETECT_UDP_SO_SNDBUF,[UDP send buffer size])
30a4f2a8 2234
5c51415d 2235dnl Not cached since people are likely to tune this
30a4f2a8 2236AC_MSG_CHECKING(Default UDP receive buffer size)
2237AC_TRY_RUN([
8cca06da 2238#include <stdlib.h>
2239#include <stdio.h>
30a4f2a8 2240#include <sys/types.h>
2241#include <sys/socket.h>
2242#include <netinet/in.h>
2243main ()
2244{
635e6242 2245 FILE *fp;
30a4f2a8 2246 int fd,val=0,len=sizeof(int);
2247 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
2248 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
2249 if (val <= 0) exit(1);
635e6242 2250 fp = fopen("conftestval", "w");
2251 fprintf (fp, "%d\n", val);
30a4f2a8 2252 exit(0);
2253}
2254],
6a9f6389 2255SQUID_DETECT_UDP_SO_RCVBUF=`cat conftestval`,
2256SQUID_DETECT_UDP_SO_RCVBUF=16384,
2257SQUID_DETECT_UDP_SO_RCVBUF=16384)
2258AC_MSG_RESULT($SQUID_DETECT_UDP_SO_RCVBUF)
2259AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_RCVBUF, $SQUID_DETECT_UDP_SO_RCVBUF,[UDP receive buffer size])
30a4f2a8 2260
5c51415d 2261dnl Not cached since people are likely to tune this
30a4f2a8 2262AC_MSG_CHECKING(Default TCP send buffer size)
2263AC_TRY_RUN([
8cca06da 2264#include <stdlib.h>
2265#include <stdio.h>
30a4f2a8 2266#include <sys/types.h>
2267#include <sys/socket.h>
2268#include <netinet/in.h>
2269main ()
2270{
635e6242 2271 FILE *fp;
30a4f2a8 2272 int fd,val=0,len=sizeof(int);
2273 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
2274 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
2275 if (val <= 0) exit(1);
635e6242 2276 fp = fopen("conftestval", "w");
2277 fprintf (fp, "%d\n", val);
30a4f2a8 2278 exit(0);
2279}
2280],
2281SQUID_TCP_SO_SNDBUF=`cat conftestval`,
1c481e00 2282SQUID_TCP_SO_SNDBUF=16384,
2283SQUID_TCP_SO_SNDBUF=16384)
30a4f2a8 2284AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF)
6a9f6389 2285AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF,[TCP send buffer size])
30a4f2a8 2286
5c51415d 2287dnl Not cached since people are likely to tune this
30a4f2a8 2288AC_MSG_CHECKING(Default TCP receive buffer size)
2289AC_TRY_RUN([
8cca06da 2290#include <stdlib.h>
2291#include <stdio.h>
30a4f2a8 2292#include <sys/types.h>
2293#include <sys/socket.h>
2294#include <netinet/in.h>
2295main ()
2296{
635e6242 2297 FILE *fp;
30a4f2a8 2298 int fd,val=0,len=sizeof(int);
2299 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
2300 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
2301 if (val <= 0) exit(1);
635e6242 2302 fp = fopen("conftestval", "w");
2303 fprintf (fp, "%d\n", val);
30a4f2a8 2304 exit(0);
2305}
2306],
2307SQUID_TCP_SO_RCVBUF=`cat conftestval`,
1c481e00 2308SQUID_TCP_SO_RCVBUF=16384,
2309SQUID_TCP_SO_RCVBUF=16384)
30a4f2a8 2310AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF)
6a9f6389 2311AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF,[TCP receive buffer size])
30a4f2a8 2312
5c51415d 2313AC_CACHE_CHECK(if sys_errlist is already defined, ac_cv_needs_sys_errlist,
9bc73deb 2314 AC_TRY_COMPILE([#include <stdio.h>],[char *s = sys_errlist;],
5c51415d 2315 ac_cv_needs_sys_errlist="no",
2316 ac_cv_needs_sys_errlist="yes")
2317)
2318if test "$ac_cv_needs_sys_errlist" = "yes" ; then
6a9f6389 2319 AC_DEFINE(NEED_SYS_ERRLIST,1,[If we need to declare sys_errlist[] as external])
5c51415d 2320fi
30a4f2a8 2321
5c51415d 2322dnl Not cached since people are likely to change this
6bf65235 2323AC_MSG_CHECKING(for libresolv _dns_ttl_ hack)
2324AC_TRY_LINK(extern int _dns_ttl_;,return _dns_ttl_;,
2325[AC_MSG_RESULT(yes)
6a9f6389 2326AC_DEFINE(LIBRESOLV_DNS_TTL_HACK,1,[If libresolv.a has been hacked to export _dns_ttl_])],
6bf65235 2327AC_MSG_RESULT(no))
2328
a937d5e3 2329AC_MSG_CHECKING(if inet_ntoa() actually works)
2330AC_TRY_RUN([
2331#include <stdlib.h>
2332#include <stdio.h>
2333#include <sys/types.h>
2334#include <netinet/in.h>
2335#include <arpa/inet.h>
2336main ()
2337{
635e6242 2338 FILE *fp;
a937d5e3 2339 struct in_addr in;
2340 in.s_addr = inet_addr("1.2.3.4");
635e6242 2341 fp = fopen("conftestval", "w");
2342 fprintf (fp, "%s\n", inet_ntoa(in));
a937d5e3 2343 exit(0);
2344}
2345],
2346INET_NTOA_RESULT=`cat conftestval`,
2347INET_NTOA_RESULT="broken",
2348INET_NTOA_RESULT="broken")
2349if test "$INET_NTOA_RESULT" = "1.2.3.4" ; then
2350 AC_MSG_RESULT("yes")
2351else
2352 AC_MSG_RESULT("no")
b6a2f15e 2353 echo "Will use our own inet_ntoa()."
33f5f8b9 2354 AC_LIBOBJ(inet_ntoa)
b6a2f15e 2355# echo "WARNING: This looks bad, and probably prevents Squid from working."
2356# echo " If you're on IRIX and using GCC 2.8, you probably need"
2357# echo " to use the IRIX C compiler instead."
2358# sleep 10
a937d5e3 2359fi
2360
b6a2f15e 2361if test "$ac_cv_header_sys_statvfs_h" = "yes" ; then
c68e9c6b 2362AC_MSG_CHECKING(for working statvfs() interface)
2363AC_TRY_COMPILE([
2364#include <stdlib.h>
2365#include <stdio.h>
2366#include <sys/types.h>
2367#include <sys/statvfs.h>
2368],
2369[
2370struct statvfs sfs;
2371sfs.f_blocks = sfs.f_bfree = sfs.f_frsize =
2372sfs.f_files = sfs.f_ffree = 0;
2373statvfs("/tmp", &sfs);
2374],
2375 ac_cv_func_statvfs=yes,
2376 ac_cv_func_statvfs=no)
2377AC_MSG_RESULT($ac_cv_func_statvfs)
6b8e7481 2378if test "$ac_cv_func_statvfs" = "yes" ; then
6a9f6389 2379 AC_DEFINE(HAVE_STATVFS,1,[If your system has statvfs(), and if it actually works!])
b6a2f15e 2380fi
6b8e7481 2381fi
c68e9c6b 2382
2383AC_CACHE_CHECK(for _res.nsaddr_list, ac_cv_have_res_nsaddr_list,
2384AC_TRY_COMPILE([
2385#if HAVE_SYS_TYPES_H
2386#include <sys/types.h>
2387#endif
2388#if HAVE_NETINET_IN_H
2389#include <netinet/in.h>
2390#endif
2391#if HAVE_ARPA_INET_H
2392#include <arpa/inet.h>
2393#endif
2394#if HAVE_ARPA_NAMESER_H
2395#include <arpa/nameser.h>
2396#endif
2397#if HAVE_RESOLV_H
2398#include <resolv.h>
2399#endif
2400],
2401[_res.nsaddr_list[[0]];],
2402ac_cv_have_res_nsaddr_list="yes",
2403ac_cv_have_res_nsaddr_list="no"))
2404if test $ac_cv_have_res_nsaddr_list = "yes" ; then
6a9f6389 2405 AC_DEFINE(HAVE_RES_NSADDR_LIST,1,[If _res structure has nsaddr_list member])
c68e9c6b 2406fi
2407
2408if test $ac_cv_have_res_nsaddr_list = "no" ; then
2409AC_CACHE_CHECK(for _res.ns_list, ac_cv_have_res_ns_list,
2410AC_TRY_COMPILE([
2411#if HAVE_SYS_TYPES_H
2412#include <sys/types.h>
2413#endif
2414#if HAVE_NETINET_IN_H
2415#include <netinet/in.h>
2416#endif
2417#if HAVE_ARPA_INET_H
2418#include <arpa/inet.h>
2419#endif
2420#if HAVE_ARPA_NAMESER_H
2421#include <arpa/nameser.h>
2422#endif
2423#if HAVE_RESOLV_H
2424#include <resolv.h>
2425#endif
2426],
2427[_res.ns_list[[0]].addr;],
2428ac_cv_have_res_ns_list="yes",
2429ac_cv_have_res_ns_list="no"))
2430if test $ac_cv_have_res_ns_list = "yes" ; then
6a9f6389 2431 AC_DEFINE(HAVE_RES_NS_LIST,1,[If _res structure has ns_list member])
c68e9c6b 2432fi
2433fi
2434
090089c4 2435dnl Need the debugging version of malloc if available
2436XTRA_OBJS=''
6509a1a0 2437if test "$ac_cv_lib_malloc_main" = "yes" ; then
090089c4 2438 if test -r /usr/lib/debug/malloc.o ; then
2439 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
2440 fi
2441 if test -r /usr/lib/debug/mallocmap.o ; then
2442 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
2443 fi
2444fi
2bbd722b 2445
090089c4 2446AC_SUBST(XTRA_OBJS)
2447
38fea766 2448if test -z "$XTRA_LIBS"; then
2449 XTRA_LIBS="$LIBS"
0f5a16f8 2450 dnl minor cleanup
2451 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
38fea766 2452 LIBS=''
2453fi
090089c4 2454AC_SUBST(XTRA_LIBS)
2455
090089c4 2456dnl Clean up after OSF/1 core dump bug
2457rm -f core
2458
6a9f6389 2459AC_CONFIG_FILES([\
a2794549 2460 Makefile \
2461 lib/Makefile \
a2794549 2462 scripts/Makefile \
2463 scripts/RunCache \
2464 scripts/RunAccel \
2465 src/Makefile \
2466 src/fs/Makefile \
2467 src/repl/Makefile \
2468 src/auth/Makefile \
a2794549 2469 contrib/Makefile \
2470 snmplib/Makefile \
2471 icons/Makefile \
2472 errors/Makefile \
1077c1b8 2473 test-suite/Makefile \
99db07b3 2474 doc/Makefile \
0c510f3c 2475 helpers/Makefile \
2476 helpers/basic_auth/Makefile \
2477 helpers/basic_auth/LDAP/Makefile \
2478 helpers/basic_auth/MSNT/Makefile \
2479 helpers/basic_auth/NCSA/Makefile \
2480 helpers/basic_auth/PAM/Makefile \
2481 helpers/basic_auth/SMB/Makefile \
2482 helpers/basic_auth/YP/Makefile \
2483 helpers/basic_auth/getpwnam/Makefile \
2484 helpers/basic_auth/multi-domain-NTLM/Makefile \
2485 helpers/basic_auth/SASL/Makefile \
2486 helpers/basic_auth/winbind/Makefile \
2487 helpers/digest_auth/Makefile \
2488 helpers/digest_auth/password/Makefile \
2489 helpers/ntlm_auth/Makefile \
2490 helpers/ntlm_auth/fakeauth/Makefile \
2491 helpers/ntlm_auth/no_check/Makefile \
2492 helpers/ntlm_auth/SMB/Makefile \
2493 helpers/ntlm_auth/SMB/smbval/Makefile \
2494 helpers/ntlm_auth/winbind/Makefile \
c6588c68 2495 helpers/external_acl/Makefile \
2496 helpers/external_acl/ip_user/Makefile \
2497 helpers/external_acl/ldap_group/Makefile \
2498 helpers/external_acl/unix_group/Makefile \
2499 helpers/external_acl/wbinfo_group/Makefile \
aa0f9348 2500 helpers/external_acl/winbind_group/Makefile
53cbe3e4 2501])
43ae1d95 2502
2503AC_CONFIG_SUBDIRS(lib/libTrie)
2504
6a9f6389 2505AC_OUTPUT