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