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