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