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