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