]> git.ipfire.org Git - thirdparty/squid.git/blob - configure.ac
Cleanup: avoid mentioning compiler directives in configure output
[thirdparty/squid.git] / configure.ac
1 ## Copyright (C) 1996-2015 The Squid Software Foundation and contributors
2 ##
3 ## Squid software is distributed under GPLv2+ license and includes
4 ## contributions from numerous individuals and organizations.
5 ## Please see the COPYING and CONTRIBUTORS files for details.
6 ##
7
8 AC_INIT([Squid Web Proxy],[4.0.0-BZR],[http://bugs.squid-cache.org/],[squid])
9 AC_PREREQ(2.61)
10 AC_CONFIG_HEADERS([include/autoconf.h])
11 AC_CONFIG_AUX_DIR(cfgaux)
12 AC_CONFIG_SRCDIR([src/main.cc])
13 AM_INIT_AUTOMAKE([tar-ustar nostdinc])
14 AC_REVISION($Revision$)dnl
15 AC_PREFIX_DEFAULT(/usr/local/squid)
16 AM_MAINTAINER_MODE
17
18 m4_include([acinclude/ax_with_prog.m4])
19 m4_include([acinclude/init.m4])
20 m4_include([acinclude/squid-util.m4])
21 m4_include([acinclude/compiler-flags.m4])
22 m4_include([acinclude/os-deps.m4])
23 m4_include([acinclude/krb5.m4])
24 m4_include([acinclude/pam.m4])
25 m4_include([acinclude/pkg.m4])
26 m4_include([acinclude/lib-checks.m4])
27 m4_include([acinclude/ax_cxx_compile_stdcxx_11.m4])
28 m4_include([acinclude/ax_cxx_0x_types.m4])
29
30 PRESET_CFLAGS="$CFLAGS"
31 PRESET_CXXFLAGS="$CXXFLAGS"
32 PRESET_LDFLAGS="$LDFLAGS"
33
34 dnl Set default LDFLAGS
35 if test "x$LDFLAGS" = "x" ; then
36 LDFLAGS="-g"
37 fi
38
39 # Check for GNU cc
40 AC_PROG_CC
41 AM_PROG_CC_C_O
42 AC_PROG_CXX
43 AC_LANG([C++])
44 AC_CANONICAL_HOST
45
46 # Clang 3.2 on some CPUs requires -march-native to detect correctly.
47 # GCC 4.3+ can also produce faster executables when its used.
48 # But building inside a virtual machine environment has been found to
49 # cause random Illegal Instruction errors due to mis-detection of CPU.
50 AC_ARG_ENABLE(arch-native,
51 AS_HELP_STRING([--disable-arch-native],[Some compilers offer CPU-specific
52 optimizations with the -march=native parameter.
53 This flag disables the optimization. The default is to
54 auto-detect compiler support and use where available.]), [
55 SQUID_YESNO([$enableval],
56 [Unrecognized argument to --disable-arch-native: $enableval])
57 ])
58 AC_MSG_NOTICE([CPU arch native optimization enabled: ${enable_arch_native:=auto}])
59 if test "x${enable_arch_native}" != "xno"; then
60 SQUID_CC_CHECK_ARGUMENT([squid_cv_check_marchnative],[-march=native])
61 fi
62
63 # might be cross-compiling.
64 # NP: BUILDCXXFLAGS defined at the end of configure after CXXFLAGS fully known.
65 AC_ARG_VAR([BUILDCXX],[path to compiler for building compile-time tools. e.g. cf_gen])
66 if test "x$HOSTCXX" != "x" -a "x$BUILDCXX" = "x"; then
67 AC_MSG_WARN([Cross-compiling with HOSTCXX is deprecated. Uses BUILDCXX instead.])
68 BUILDCXX="$HOSTCXX"
69 fi
70 if test "x$BUILDCXX" = "x"; then
71 BUILDCXX="$CXX"
72 if test "x$squid_cv_check_marchnative" = "xyes"; then
73 CXXFLAGS="$CXXFLAGS -march=native"
74 fi
75 fi
76 AC_SUBST(BUILDCXX)
77
78 AC_MSG_CHECKING([simplified host os])
79 simple_host_os=`echo $host_os|sed 's/[0-9].*//g;s/-.*//g'`
80 squid_host_os_version=`echo $host_os|tr -d "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"`
81 if test -n "$squid_host_os_version"; then
82 squid_host_os="`echo $simple_host_os| sed s/$squid_host_os_version//g`"
83 else
84 squid_host_os="$simple_host_os"
85 fi
86 AC_MSG_RESULT($squid_host_os (version $squid_host_os_version))
87 # on windows squid_host_os is either mingw or cygwin, version is 32
88
89 # this needs to be before any test is run, to have more standard
90 # functions available on some Unix sysems (e.g. Solaris)
91 if test "x$squid_host_os" = "solaris" -a "x$GCC" != "x" ; then
92 AC_USE_SYSTEM_EXTENSIONS
93 fi
94
95 # Check for C++11 compiler support
96 AX_CXX_COMPILE_STDCXX_11([noext],[mandatory])
97
98 # test for programs
99 AC_PROG_RANLIB
100 AC_PROG_CPP
101 AC_PROG_INSTALL
102 AC_PROG_LN_S
103 AC_PROG_EGREP
104
105 AC_PATH_PROG(SH, sh, /bin/sh)
106 AC_PATH_PROG(FALSE, false, /usr/bin/false)
107 AC_PATH_PROG(TRUE, true, /usr/bin/true)
108 AC_PATH_PROG(MV, mv, $FALSE)
109 AC_PATH_PROG(MKDIR, mkdir, $FALSE)
110 AC_PATH_PROG(LN, ln, cp)
111 AC_PATH_PROG(CHMOD, chmod, $FALSE)
112 AC_PATH_PROG(TR, tr, $FALSE)
113 AC_PATH_PROG(RM, rm, $FALSE)
114 AC_PATH_PROG(CPPUNITCONFIG, cppunit-config, false)
115 dnl Libtool 2.2.6 requires: rm -f
116 RM="$RM -f"
117
118 AC_PATH_PROG(PERL, perl, none)
119 if test "x$ac_cv_path_PERL" = "xnone"; then
120 AC_MSG_FAILURE([Perl is required to compile Squid. Please install Perl and then re-run configure ])
121 fi
122 AC_PATH_PROG(POD2MAN, pod2man, $FALSE)
123 AM_CONDITIONAL(ENABLE_POD2MAN_DOC, test "x${ac_cv_path_POD2MAN}" != "x$FALSE")
124
125 dnl set $(AR) if not provided by the build environment
126 if test "x$AR" = "x"; then
127 AC_PATH_PROG(AR, ar, $FALSE)
128 fi
129 AR_R="$AR r"
130 AC_SUBST(AR_R)
131
132 # pre-define DEFAULT_PREFIX, some modules need it.
133 if test "${prefix}" = "NONE" ; then
134 squid_prefix=$ac_default_prefix
135 else
136 squid_prefix=$prefix
137 fi
138 AC_DEFINE_UNQUOTED(DEFAULT_PREFIX,[$squid_prefix],[The install prefix])
139
140 AC_ARG_ENABLE(strict-error-checking,
141 AS_HELP_STRING([--disable-strict-error-checking],[By default squid is compiled
142 with all possible static compiler error-checks enabled.
143 This flag disables the behavior]), [
144 SQUID_YESNO([$enableval],
145 [Unrecognized argument to --disable-strict-error-checking: $enableval])
146 ])
147 AC_MSG_NOTICE([strict error checking enabled: ${enable_strict_error_checking:=yes}])
148
149 AC_MSG_CHECKING(whether to use loadable modules)
150 AC_ARG_ENABLE(loadable-modules,
151 AS_HELP_STRING([--disable-loadable-modules],[do not support loadable modules]) , [
152 SQUID_YESNO([$enableval],
153 [Unrecognized argument to --disable-loadable-modules: $enableval])
154 ])
155 AM_CONDITIONAL(ENABLE_LOADABLE_MODULES, test "x${enable_loadable_modules:=yes}" = "xyes")
156 AC_MSG_RESULT([$enable_loadable_modules])
157
158 if test "x$enable_loadable_modules" = "xyes";
159 then
160 AC_DEFINE(USE_LOADABLE_MODULES, 1, [Support Loadable Modules])
161 AC_ENABLE_SHARED
162 else
163 AC_DISABLE_SHARED
164 fi
165
166 # LT_INIT requires libtool v2, might as well state it loud
167 LT_PREREQ([2.2])
168 LT_INIT([dlopen],[disable-shared])
169 if ! test "${ac_top_build_prefix}" = "";
170 then
171 # LTDL v3-v7 macros assume the autoconf 2.62 variable top_build_prefix is defined
172 # But from autoconf 2.64 its called ac_top_build_prefix and not automatically added to the Makefile
173 # This fixes Linux LTDLv3-v7, and BSD LTDL v2.2
174 top_build_prefix=${ac_top_build_prefix}
175 AC_SUBST(top_build_prefix)
176 fi
177 LTDL_INIT
178
179 dnl LibTool environment is now prepared for setup. Check that it is usable and initialize.
180 LT_LIB_DLLOAD
181
182 # Do we need these unconditionally for "make distcheck" to work?
183 AC_SUBST(INCLTDL)
184 AC_SUBST(LIBLTDL)
185
186 if test "x$enable_loadable_modules" = "xyes";
187 then
188 # Why is this needed? Should not LT_INIT (or LT_LIB_DLLOAD) from libtool do that?
189 LIBADD_DL=${lt_cv_dlopen_libs}
190 AC_SUBST([LIBADD_DL])
191 fi
192
193 SQUID_CC_GUESS_VARIANT
194 SQUID_CC_GUESS_OPTIONS
195
196 dnl find out the exe extension for this platform.
197 dnl If it is not empty, use it for CGI as well.
198 AC_EXEEXT
199 AC_OBJEXT
200
201 if test "x$EXEEXT" = "x" ; then
202 CGIEXT=".cgi"
203 else
204 # automake automatically adds .exe when installing binaries
205 CGIEXT=""
206 fi
207 AC_SUBST(CGIEXT)
208
209 AM_CONDITIONAL(ENABLE_WIN32SPECIFIC,[test "x$squid_host_os" = "xmingw"])
210 AM_CONDITIONAL(ENABLE_WIN32_IPC,[test "x$squid_host_os" = "xmingw"])
211
212 case "$squid_host_os" in
213 mingw)
214 AC_PATH_PROG(WIN32_PSAPI, psapi.dll, none)
215 CFLAGS="$CFLAGS -mthreads"
216 CXXFLAGS="$CXXFLAGS -mthreads -static-libgcc -static-libstdc++"
217 if test "x$ac_cv_path_WIN32_PSAPI" = "xnone"; then
218 AC_MSG_NOTICE([PSAPI.DLL is recommended to run Squid on Windows NT Platform])
219 AC_MSG_NOTICE([Please see PSAPI.DLL section on doc/win32-relnotes.html.])
220 else
221 AC_DEFINE(HAVE_WIN32_PSAPI,1,[Define if you have PSAPI.DLL on Windows systems])
222 LIBS="$LIBS -lpsapi"
223 fi
224 MINGW_LIBS="-lmingwex"
225 AC_SUBST(MINGW_LIBS)
226 ;;
227 freebsd)
228 # FreeBSD places local libraries and packages in /usr/local
229 CFLAGS="$CFLAGS -I/usr/local/include"
230 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
231 LDFLAGS="$LDFLAGS -L/usr/local/lib -Wl,-R/usr/local/lib"
232 ;;
233 *)
234 ;;
235 esac
236
237 dnl Substitutions
238 AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host",[Host type from configure])
239
240 AC_DEFINE_UNQUOTED(SQUID_CONFIGURE_OPTIONS, "$ac_configure_args",
241 [configure command line used to configure Squid])
242
243 CACHE_EFFECTIVE_USER="nobody"
244 AC_ARG_WITH(default-user,
245 AS_HELP_STRING([--with-default-user=USER],[System user account for squid permissions. Default: nobody]),
246 [ CACHE_EFFECTIVE_USER="$withval" ]
247 )
248 AC_SUBST(CACHE_EFFECTIVE_USER)
249
250 DEFAULT_LOG_DIR="$localstatedir/logs"
251 AC_ARG_WITH(logdir,
252 AS_HELP_STRING([--with-logdir=PATH],
253 [Default location for squid logs. default: PREFIX/var/logs]), [
254 case $withval in
255 yes|no)
256 AC_MSG_ERROR( --with-logdir requires a directory PATH. --with-logdir=PATH )
257 ;;
258 *)
259 DEFAULT_LOG_DIR="$withval"
260 ;;
261 esac
262 ]
263 )
264 AC_SUBST(DEFAULT_LOG_DIR)
265
266 DEFAULT_PID_FILE="$localstatedir/run/squid.pid"
267 AC_ARG_WITH(pidfile,
268 AS_HELP_STRING([--with-pidfile=PATH],
269 [Default location for squid pid file. Default: PREFIX/var/run/squid.pid]), [
270 case $withval in
271 yes|no)
272 AC_MSG_ERROR( --with-pidfile requires a file PATH. --with-pidfile=PATH )
273 ;;
274 *)
275 DEFAULT_PID_FILE="$withval"
276 ;;
277 esac
278 ])
279 AC_SUBST(DEFAULT_PID_FILE)
280
281 DEFAULT_SWAP_DIR="$localstatedir/cache/squid"
282 AC_ARG_WITH(swapdir,
283 AS_HELP_STRING([--with-swapdir=PATH],
284 [Default location for squid cache directories. Default: PREFIX/var/cache/squid]), [
285 case $withval in
286 yes|no)
287 AC_MSG_ERROR( --with-swapdir requires a directory PATH. --with-swapdir=PATH )
288 ;;
289 *)
290 DEFAULT_SWAP_DIR="$withval"
291 ;;
292 esac
293 ])
294 AC_SUBST(DEFAULT_SWAP_DIR)
295
296 if test "$squid_cv_compiler" = "gcc"; then
297 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
298 GCCVER2=`echo $GCCVER | awk '{print $1 * 100}'`
299 case "$host" in
300 i386-*-freebsd*)
301 if test $GCCVER2 -lt 300 ; then
302 AC_MSG_FAILURE([GCC $GCCVER causes a coredump on $host.
303 Please use a more recent GCC version])
304 fi
305 ;;
306 esac
307 unset GCCVER
308 unset GCCVER2
309 fi
310
311 dnl Set Default CFLAGS
312 if test "x$PRESET_CFLAGS" = "x"; then
313 if test "$squid_cv_compiler" = "gcc"; then
314 case "$host" in
315 *-sun-sunos*)
316 # sunos has too many warnings for this to be useful
317 # motorola too
318 ;;
319 *m88k*)
320 # Motorola cc/ld does not like -02 but is ok on -O
321 CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]/-O/'`
322 ;;
323 *)
324 CFLAGS="$squid_cv_cc_option_wall $CFLAGS"
325 ;;
326 esac
327 else
328 case "$host" in
329 *mips-sgi-irix6.*)
330 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
331 CFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \
332 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
333 -Wl,-woff,85,-woff,84,-woff,134 \
334 -nostdinc -I/usr/include -D_BSD_SIGNALS $CFLAGS"
335 CXXFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \
336 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
337 -Wl,-woff,85,-woff,84,-woff,134 \
338 -nostdinc -I/usr/include -D_BSD_SIGNALS $CXXFLAGS"
339 ;;
340 *)
341 ;;
342 esac
343 fi
344 fi
345
346 dnl set squid required flags
347 if test "$squid_cv_compiler" = "gcc"; then
348 case "$squid_host_os" in
349 mingw)
350 dnl Guido Serassio (serassio@squid-cache.org) 20070811
351 dnl Using the latest MinGW (gcc 3.4.5 + mingw-runtime 3.13) cannot build with
352 dnl -Werror -Wmissing-prototypes -Wmissing-declarations
353 dnl TODO: check if the problem will be present in any other newer MinGW release.
354 SQUID_CFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow"
355 ;;
356 *)
357 SQUID_CFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wcomments -Wshadow"
358 ;;
359 esac
360 SQUID_CXXFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow"
361 else
362 SQUID_CFLAGS=
363 SQUID_CXXFLAGS=
364 fi
365
366 dnl CentOS (and RHEL) still define ntohs() using deprecated C++ features
367 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_wno_deprecated_register],[-Werror -Wno-deprecated-register],[[#include <arpa/inet.h>]],[[int fox=ntohs(1);]])
368
369 if test "x$enable_strict_error_checking" != "xno"; then
370 SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_option_werror"
371 SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cxx_option_werror"
372 fi
373
374 if test "x$ac_cv_require_wno_deprecated_register" = "xyes"; then
375 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -Wno-deprecated-register"
376 fi
377
378 # squid_cv_cc_arg_pipe is set by SQUID_CC_GUESS_OPTIONS
379 SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cc_arg_pipe"
380 SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_arg_pipe"
381
382 # possibly include some build info tag into squid -v
383 SQUID_EMBED_BUILD_INFO
384
385 AC_ARG_ENABLE(optimizations,
386 AS_HELP_STRING([--disable-optimizations],
387 [Do not compile Squid with compiler optimizations enabled.
388 Optimization is good for production builds, but not
389 good for debugging. During development, use
390 --disable-optimizations to reduce compilation times
391 and allow easier debugging. This option implies
392 --disable-inline]), [
393 if test "x$enableval" = "xno" ; then
394 AC_MSG_NOTICE([Disabling compiler optimizations (-O flag)])
395 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
396 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-O[[0-9]]*//'`"
397 enable_inline="no"
398 fi
399 ])
400
401 AH_TEMPLATE(_USE_INLINE_,[Include inline methods into header file])
402 AC_ARG_ENABLE(inline,
403 AS_HELP_STRING([--disable-inline],
404 [Do not compile trivial methods as inline. Squid
405 is coded with much of the code able to be inlined.
406 Inlining is good for production builds, but not
407 good for development. During development, use
408 --disable-inline to reduce compilation times and
409 allow incremental builds to be quick. For
410 production builds, or load tests, use
411 --enable-inline to have squid make all trivial
412 methods inlinable by the compiler.]), [
413 SQUID_YESNO([$enableval],
414 [Unrecognized argument to --disable-inline: $enableval])
415 ])
416 AC_MSG_NOTICE([inlining optimizations enabled: ${enable_inline:=yes}])
417 SQUID_DEFINE_BOOL(_USE_INLINE_,$enable_inline,
418 [Include inline methods into header file])
419 # to be used by sub-commands
420 export enable_inline
421
422 AC_ARG_ENABLE(debug-cbdata,
423 AS_HELP_STRING([--enable-debug-cbdata],
424 [Provide some debug information in cbdata]), [
425 SQUID_YESNO([$enableval],
426 [unrecognized argument to --enable-debug-cbdata: $enableval])
427 ])
428 SQUID_DEFINE_BOOL(USE_CBDATA_DEBUG,${enable_debug_cbdata:=no},
429 [Enable support for cbdata debug information])
430 AC_MSG_NOTICE([cbdata debugging enabled: $enable_debug_cbdata])
431
432
433 dnl Nasty hack to get autoconf 2.64 on Linux to run.
434 dnl all other uses of RUN_IFELSE are wrapped inside CACHE_CHECK which breaks on 2.64
435 AC_RUN_IFELSE([AC_LANG_SOURCE([[ int main(int argc, char **argv) { return 0; } ]])],[],[],[:])
436
437 AH_TEMPLATE(XMALLOC_STATISTICS,[Define to have malloc statistics])
438 AC_ARG_ENABLE(xmalloc-statistics,
439 AS_HELP_STRING([--enable-xmalloc-statistics],
440 [Show malloc statistics in status page]), [
441 SQUID_YESNO([$enableval],
442 [unrecognized argument to --enable-xmalloc-statistics: $enableval])
443 ])
444 SQUID_DEFINE_BOOL(XMALLOC_STATISTICS,${enable_xmalloc_statistics:=no},
445 [Show malloc statistics in status page])
446 AC_MSG_NOTICE([xmalloc stats display: $enable_xmalloc_statistics])
447
448 squid_opt_aufs_threads=""
449 AC_ARG_WITH(aufs-threads,
450 AS_HELP_STRING([--with-aufs-threads=N_THREADS],
451 [Tune the number of worker threads for the aufs object store.]), [
452 case $withval in
453 [[0-9]]*)
454 squid_opt_aufs_threads=$withval
455 ;;
456 *)
457 AC_MSG_ERROR(--with-aufs-threads expects a numeric argument)
458 ;;
459 esac
460 ])
461 if test "x$squid_opt_aufs_threads" != "x"; then
462 AC_MSG_NOTICE([With $squid_opt_aufs_threads aufs threads])
463 AC_DEFINE_UNQUOTED(AUFS_IO_THREADS,$squid_opt_aufs_threads,
464 [Defines how many threads aufs uses for I/O])
465 fi
466
467 AC_ARG_WITH(dl, AS_HELP_STRING([--with-dl],[Use dynamic linking]))
468 if test "x$with_dl" = "xyes"; then
469 AC_MSG_NOTICE([With dl])
470 fi
471
472 AC_SEARCH_LIBS([shm_open], [rt])
473 if test "x$ac_cv_search_shm_open" != "xno" ; then
474 AC_DEFINE(HAVE_SHM,1,[Support shared memory features])
475 fi
476
477 AC_MSG_CHECKING([for DiskIO modules to be enabled])
478 squid_disk_module_candidates=""
479 squid_opt_enable_diskio="auto" #values: no, yes, "auto"(=yes+detect modules)
480 AC_ARG_ENABLE(disk-io,
481 AS_HELP_STRING([--enable-disk-io="list of modules"],
482 [Build support for the list of disk I/O modules.
483 Set without a value or omitted, all available modules will be built.
484 See src/DiskIO for a list of available modules, or
485 Programmers Guide section on DiskIO
486 for details on how to build your custom disk module]), [
487 case $enableval in
488 yes)
489 ${TRUE}
490 #do nothing, "auto" is ok
491 ;;
492 no)
493 squid_opt_enable_diskio="no"
494 ;;
495 *)
496 squid_opt_enable_diskio="yes"
497 squid_disk_module_candidates=" `echo $enableval| sed -e 's/,/ /g;s/ */ /g'` "
498 SQUID_CLEANUP_MODULES_LIST([squid_disk_module_candidates])
499 ;;
500 esac
501 ])
502
503 # if requested to autodetect, find out what we have
504 if test "x$squid_opt_enable_diskio" = "xauto"; then
505 squid_opt_enable_diskio="yes"
506 SQUID_LOOK_FOR_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates])
507 if test "x$ac_cv_search_shm_open" = "xno" ; then
508 # disable IpcIo
509 squid_disk_module_candidates=`echo $squid_disk_module_candidates|sed 's/IpcIo//'`
510 fi
511 fi
512
513 AC_MSG_RESULT([${squid_disk_module_candidates:-none}])
514 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates])
515 SQUID_DEFINE_BOOL(USE_DISKIO,$squid_opt_enable_diskio,
516 [DiskIO modules are expected to be available.])
517
518
519
520 dnl Some autoconf.h defines we might enable later...
521 AC_ARG_WITH(pthreads,AS_HELP_STRING([--without-pthreads],[Disable POSIX Threads]))
522 AC_ARG_WITH(aio, AS_HELP_STRING([--without-aio],[Do not use POSIX AIO. Default: auto-detect]))
523 AH_TEMPLATE(USE_DISKIO_AIO, [Whether POSIX AIO support is needed. Automatic])
524 AH_TEMPLATE(USE_DISKIO_DISKTHREADS, [Whether pthreads support is needed. Automatic])
525 ENABLE_WIN32_AIOPS=0
526 squid_opt_use_aio=
527 squid_opt_use_diskthreads=
528 AIOLIB=
529
530 dnl Setup the module paths etc.
531 DISK_LIBS=
532 DISK_OS_LIBS=
533 DISK_MODULES=
534 DISK_LINKOBJS=
535 for module in $squid_disk_module_candidates none; do
536 # maybe not needed
537 if test "x$module" = "xnone"; then
538 continue
539 fi
540 if ! test -d "$srcdir/src/DiskIO/$module"; then
541 AC_MSG_ERROR(disk-io $module does not exist)
542 fi
543 case "$module" in
544 DiskDaemon)
545 case "$squid_host_os" in
546 mingw)
547 AC_MSG_NOTICE(["DiskDaemon not supported on MinGW"])
548 ;;
549 *)
550 AC_MSG_NOTICE([Enabling DiskDaemon DiskIO module])
551 DISK_LIBS="$DISK_LIBS libDiskDaemon.a"
552 DISK_MODULES="$DISK_MODULES DiskDaemon"
553 DISK_PROGRAMS="$DISK_PROGRAMS DiskIO/DiskDaemon/diskd"
554 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/DiskDaemon/DiskDaemonDiskIOModule.o"
555 ;;
556 esac
557 ;;
558 DiskThreads)
559 squid_opt_use_diskthreads="yes"
560 LIBPTHREADS=
561 SQUID_STATE_SAVE([diskthreads_state],[SQUID_CFLAGS SQUID_CXXFLAGS])
562 if test "x$with_pthreads" != "xno"; then
563 dnl TODO: this needs to be extended to handle more systems and better
564 dnl REF: http://www.openldap.org/lists/openldap-bugs/200006/msg00070.html
565 dnl REF: http://autoconf-archive.cryp.to/acx_pthread.html
566 case "$squid_host_os" in
567 mingw)
568 ENABLE_WIN32_AIOPS=1
569 AC_MSG_NOTICE([Windows threads support automatically enabled])
570 ;;
571 freebsd)
572 if test `echo "$squid_host_os_version" | tr -d .` -lt 70 ; then
573 AC_MSG_NOTICE(pthread library requires FreeBSD 7 or later)
574 squid_opt_use_diskthreads="no"
575 else
576 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
577 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
578 if test "x$GCC" = "xyes" -a "x$PRESET_LDFLAGS" = "x" ; then
579 LDFLAGS="$LDFLAGS -pthread"
580 fi
581 fi
582 ;;
583 openbsd)
584 if test `echo "$squid_host_os_version" | tr -d .` -lt 52 ; then
585 AC_MSG_NOTICE(pthread library requires OpenBSD 5.2 or later)
586 squid_opt_use_diskthreads="no"
587 else
588 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
589 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
590 LDFLAGS="$LDFLAGS -lpthread"
591 fi
592 ;;
593 solaris)
594 if test "x$GCC" = "xyes" ; then
595 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT -pthreads"
596 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT -pthreads"
597 AC_CHECK_LIB(pthread, pthread_create ,[LIBPTHREADS="-lpthread"], [
598 AC_MSG_NOTICE(pthread library required but cannot be found.)
599 squid_opt_use_diskthreads="no"
600 ])
601 else
602 dnl test for -lpthread first. libc version is a stub apparently on Solaris.
603 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT -lpthread"
604 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT -lpthread"
605 AC_SEARCH_LIBS([pthread_create],[pthread thread],[
606 LIBPTHREADS="" #in LIBS
607 ],[
608 AC_MSG_NOTICE(pthread library required but cannot be found.)
609 squid_opt_use_diskthreads="no"
610 ])
611 fi
612 ;;
613 *)
614 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
615 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
616 AC_CHECK_LIB(pthread, pthread_create ,[LIBPTHREADS="-lpthread"], [
617 AC_MSG_NOTICE(pthread library required but cannot be found.)
618 squid_opt_use_diskthreads="no"
619 ])
620 ;;
621 esac
622 else
623 AC_MSG_NOTICE([Native pthreads support manually disabled.])
624 squid_opt_use_diskthreads="no"
625 fi
626 if test "x$squid_opt_use_diskthreads" = "xyes" ; then
627 AC_DEFINE(USE_DISKIO_DISKTHREADS, 1, [Whether pthreads support is needed. Automatic])
628 AC_MSG_NOTICE([Enabling DiskThreads DiskIO module])
629 DISK_LIBS="$DISK_LIBS libDiskThreads.a"
630 DISK_OS_LIBS="$DISK_OS_LIBS $LIBPTHREADS"
631 DISK_MODULES="$DISK_MODULES DiskThreads"
632 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/DiskThreads/DiskThreadsDiskIOModule.o"
633 else
634 AC_DEFINE(USE_DISKIO_DISKTHREADS, 0, [Whether pthreads support is needed. Automatic])
635 AC_MSG_NOTICE([Native pthreads support disabled. DiskThreads module automaticaly disabled.])
636 SQUID_STATE_ROLLBACK([diskthreads_state])
637 fi
638 ;;
639
640 AIO)
641 dnl Check for POSIX AIO availability
642 squid_opt_use_aio="yes"
643 AIOLIB=
644 if test "x$with_aio" != "xno"; then
645 have_aio_header=no
646 AC_CHECK_HEADERS(aio.h,[have_aio_header=yes])
647 dnl On some systems POSIX AIO functions are in librt
648 dnl On some systems POSIX AIO functions are in libaio
649 AC_CHECK_LIB(rt,aio_read,[AIOLIB="-lrt"],AC_CHECK_LIB(aio,aio_read,[AIOLIB="-laio"],[]))
650 dnl Enable AIO if the library and headers are found
651 if test "x$AIOLIB" != "x" && test "x$have_aio_header" = "xyes"; then
652 AC_MSG_NOTICE([Native POSIX AIO support detected.])
653 squid_opt_use_aio="yes"
654 else
655 dnl Windows does things differently. We provide wrappers.
656 dnl TODO: Windows really needs its own DiskIO module or its Overlaped IO
657 case "$squid_host_os" in
658 mingw)
659 squid_opt_use_aio="yes"
660 AC_MSG_NOTICE([Windows being built. Maybe-enable POSIX AIO.])
661 ;;
662 *)
663 AC_MSG_NOTICE([Native POSIX AIO support not detected. AIO automatically disabled.])
664 squid_opt_use_aio="no"
665 ;;
666 esac
667 fi
668 else
669 AC_MSG_NOTICE([POSIX AIO support manually disabled.])
670 squid_opt_use_aio="no"
671 fi
672 dnl Use the POSIX AIO pieces if we actually need them.
673 if test "x$squid_opt_use_aio" = "xyes" ; then
674 AC_DEFINE(USE_DISKIO_AIO, 1, [Whether POSIX AIO support is needed. Automatic])
675 DISK_MODULES="$DISK_MODULES AIO"
676 DISK_LIBS="$DISK_LIBS libAIO.a"
677 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/AIO/AIODiskIOModule.o"
678 case "$squid_host_os" in
679 mingw)
680 ENABLE_WIN32_AIO=1
681 AC_MSG_NOTICE([Replacing AIO DiskIO module with: Windows overlapped I/O support])
682 ;;
683 *)
684 AC_MSG_NOTICE([Enabling AIO DiskIO module])
685 DISK_OS_LIBS="$DISK_OS_LIBS $AIOLIB"
686 ;;
687 esac
688 else
689 AC_DEFINE(USE_DISKIO_AIO, 0, [Whether POSIX AIO support is needed. Automatic])
690 AC_MSG_NOTICE([AIO DiskIO Module disabled. Missing POSIX AIO support.])
691 fi
692 ;;
693
694 Mmapped)
695 dnl TODO: use availability of sys/mman.h and/or mmap to define
696 dnl OR support windows mmap functions
697 if test "x$squid_host_os" = "xmingw" ; then
698 AC_MSG_NOTICE([Mmapped DiskIO is not available on Mingw])
699 else
700 AC_MSG_NOTICE([Enabling Mmapped DiskIO module])
701 DISK_LIBS="$DISK_LIBS libMmapped.a"
702 DISK_MODULES="$DISK_MODULES Mmapped"
703 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/Mmapped/MmappedDiskIOModule.o"
704 fi
705 ;;
706
707 IpcIo)
708 AC_MSG_NOTICE([Enabling IpcIo DiskIO module])
709 if test "x$ac_cv_search_shm_open" = "xno" ; then
710 AC_MSG_ERROR([DiskIO IpcIo module requires shared memory support])
711 fi
712 DISK_LIBS="$DISK_LIBS libIpcIo.a"
713 DISK_MODULES="$DISK_MODULES IpcIo"
714 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/IpcIo/IpcIoDiskIOModule.o"
715 AC_DEFINE(USE_DISKIO_IPCIO, 1, [Enable DiskIO IpcIo module.])
716 ;;
717
718 Blocking)
719 AC_MSG_NOTICE([Enabling Blocking DiskIO module])
720 DISK_LIBS="$DISK_LIBS libBlocking.a"
721 DISK_MODULES="$DISK_MODULES Blocking"
722 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/Blocking/BlockingDiskIOModule.o"
723 ;;
724
725 *)
726 AC_MSG_NOTICE([Enabling $module DiskIO module])
727 DISK_LIBS="$DISK_LIBS lib${module}.a"
728 DISK_MODULES="$DISK_MODULES ${module}"
729 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/${module}/${module}DiskIOModule.o"
730 ;;
731 esac
732 done
733 AC_MSG_NOTICE([IO Modules built: $DISK_MODULES])
734 AC_SUBST(DISK_MODULES)
735 AC_SUBST(DISK_LIBS)
736 AC_SUBST(DISK_PROGRAMS)
737 AC_SUBST(DISK_LINKOBJS)
738 AC_SUBST(DISK_OS_LIBS)
739 AM_CONDITIONAL([ENABLE_WIN32_AIOPS], [test "$ENABLE_WIN32_AIOPS" = "1"])
740 AM_CONDITIONAL([ENABLE_WIN32_AIO], [test "$ENABLE_WIN32_AIO" = "1"])
741
742
743 dnl Check what Storage formats are wanted.
744 dnl This version will error out with a message saying why if a required DiskIO is missing.
745 squid_opt_enable_storeio=auto
746 AC_ARG_ENABLE([storeio],
747 AS_HELP_STRING([--enable-storeio="list of modules"],
748 [Build support for the list of store I/O modules.
749 The default is only to build the "ufs" module.
750 See src/fs for a list of available modules, or
751 Programmers Guide section <not yet written>
752 for details on how to build your custom store module]), [
753 case $enableval in
754 yes)
755 squid_opt_enable_storeio=auto
756 ;;
757 no)
758 squid_opt_enable_storeio=no
759 ;;
760 *)
761 squid_opt_enable_storeio=yes
762 squid_storeio_module_candidates="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
763 # ufs is really always needed as it has low-level routines
764 # if it is a dupe it will be cleaned-up later
765 squid_storeio_module_candidates="$squid_storeio_module_candidates ufs"
766 ;;
767 esac
768 ])
769 if test "x$squid_opt_enable_storeio" = "xauto"; then
770 squid_opt_enable_storeio=yes
771 AC_MSG_CHECKING([for available StoreIO modules])
772 SQUID_LOOK_FOR_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
773 AC_MSG_RESULT([$squid_storeio_module_candidates])
774 fi
775
776 SQUID_CLEANUP_MODULES_LIST([squid_storeio_module_candidates])
777 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
778 AC_MSG_NOTICE([Store modules built: $squid_storeio_module_candidates])
779
780 for fs in $squid_storeio_module_candidates none; do
781 case "$fs" in
782 diskd)
783 if test "x$squid_disk_module_candidates_Blocking" != "xyes" -a \
784 "$squid_disk_module_candidates_DiskDaemon" != "yes" ; then
785 AC_MSG_ERROR([Storage diskd module requires DiskIO module: Blocking or DiskDaemon])
786 fi
787 ;;
788 aufs)
789 if test "x$squid_disk_module_candidates_Blocking" != "xyes" -a \
790 "$squid_disk_module_candidates_DiskThreads" != "yes" ; then
791 AC_MSG_ERROR([Storage module aufs requires DiskIO module: Blocking or DiskThreads])
792 fi
793 ;;
794 rock)
795 if test "x$squid_disk_module_candidates_IpcIo" != "xyes" -a \
796 "x$squid_disk_module_candidates_Blocking" != "xyes"; then
797 AC_MSG_ERROR([Storage module Rock requires IpcIo or Blocking DiskIO module])
798 fi
799 squid_do_build_rock=true
800 ;;
801 ufs)
802 squid_do_build_ufs=true
803 ;;
804 esac
805 done
806
807 AM_CONDITIONAL(HAVE_FS_UFS,[test "x$squid_do_build_ufs" = "xtrue" ])
808 AM_CONDITIONAL(HAVE_FS_ROCK,[test "x$squid_do_build_rock" = "xtrue" ])
809 dnl hack: need to define those even if not used in the build system to
810 dnl make sure that global FS objects are linked to the squid binary.
811 AH_TEMPLATE(HAVE_FS_UFS, "Define to 1 if ufs filesystem module is build")
812 AH_TEMPLATE(HAVE_FS_AUFS, "Define to 1 if aufs filesystem module is build")
813 AH_TEMPLATE(HAVE_FS_DISKD, "Define to 1 if diskd filesystem module is build")
814 AH_TEMPLATE(HAVE_FS_ROCK, "Define to 1 if rock filesystem module is build")
815
816
817 dnl got final squid_storeio_module_candidates, build library lists
818 dnl This list will not be needed when each fs library has its own Makefile
819 STORE_LIBS_TO_BUILD=
820 dnl File system libraries to link executables with.
821 dnl These are the same as STORE_LIBS_TO_BUILD, but with a path
822 STORE_LIBS_TO_ADD=
823 for fs in $squid_storeio_module_candidates; do
824 STORE_LIBS_TO_BUILD="$STORE_LIBS_TO_BUILD lib${fs}.la"
825 STORE_LIBS_TO_ADD="$STORE_LIBS_TO_ADD fs/lib${fs}.la"
826 SQUID_TOUPPER_VAR_CONTENTS([fs])
827 AC_DEFINE_UNQUOTED(HAVE_FS_${fs}, 1)
828 done
829
830 AC_SUBST(STORE_LIBS_TO_BUILD)
831 AC_SUBST(STORE_LIBS_TO_ADD)
832 AC_SUBST(STORE_TESTS)
833
834
835 dnl At lest one removal policy is always needed.
836 dnl 'lru' removal policy is currently hard-coded by name for tests
837 dnl so we must set it as default.
838 REPL_POLICIES="lru"
839 AC_ARG_ENABLE(removal-policies,
840 AS_HELP_STRING([--enable-removal-policies="list of policies"],
841 [Build support for the list of removal policies.
842 The default is only to build the "lru" module.
843 See src/repl for a list of available modules, or
844 Programmers Guide section 9.9 for details on how
845 to build your custom policy]), [
846 case $enableval in
847 yes)
848 SQUID_LOOK_FOR_MODULES([$srcdir/src/repl],[REPL_POLICIES])
849 ;;
850 no)
851 ;;
852 *)
853 REPL_POLICIES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
854 ;;
855 esac
856 ])
857 if test "x$REPL_POLICIES" != "x" ; then
858 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/repl],[REPL_POLICIES])
859 AC_MSG_NOTICE([Removal policies to build: $REPL_POLICIES])
860 REPL_OBJS="repl/lib`echo $REPL_POLICIES|sed -e 's% %.a repl/lib%g'`.a"
861 REPL_LIBS="`echo $REPL_OBJS|sed -e 's%repl/%%g'`"
862 fi
863 AC_SUBST(REPL_POLICIES)
864 AC_SUBST(REPL_OBJS)
865 AC_SUBST(REPL_LIBS)
866
867 AM_CONDITIONAL(ENABLE_PINGER, false)
868 AC_ARG_ENABLE(icmp,
869 AS_HELP_STRING([--enable-icmp],[Enable ICMP pinging and Network Measurement]),
870 [ if test "x$enableval" = "xyes" ; then
871 AC_MSG_NOTICE([ICMP enabled])
872 AC_DEFINE(USE_ICMP,1,[Define to use Squid ICMP and Network Measurement features (highly recommended!)])
873 AM_CONDITIONAL(ENABLE_PINGER, true)
874 fi
875 ])
876
877 AM_CONDITIONAL(ENABLE_DELAY_POOLS, false)
878 AC_ARG_ENABLE(delay-pools,
879 AS_HELP_STRING([--enable-delay-pools],[Enable delay pools to limit bandwidth usage]),
880 [ if test "x$enableval" = "xyes" ; then
881 AC_MSG_NOTICE([Delay pools enabled])
882 AC_DEFINE([USE_DELAY_POOLS],1,[Traffic management via "delay pools".])
883 AM_CONDITIONAL(ENABLE_DELAY_POOLS, true)
884 fi
885 ])
886
887 dnl disable generic/common adaptation support by default
888 squid_opt_use_adaptation=no
889
890 squid_opt_use_esi=yes
891 AH_TEMPLATE([USE_SQUID_ESI],
892 [Define to enable the ESI processor and Surrogate header support])
893 AC_ARG_ENABLE(esi,
894 AS_HELP_STRING([--enable-esi],
895 [Enable ESI for accelerators. Benefits from expat or libxml2.
896 Enabling ESI will cause squid reverse proxies to be capable
897 of the Edge Acceleration Specification (www.esi.org).]),
898 [squid_opt_use_esi=$enableval], [squid_opt_use_esi=no])
899 HAVE_LIBEXPAT=0
900 EXPATLIB=
901 HAVE_LIBXML2=0
902 XMLLIB=
903 if test "x$squid_opt_use_esi" = "xyes" ; then
904 AC_MSG_NOTICE([Enabling ESI processor and Surrogate header support.])
905 AC_DEFINE(USE_SQUID_ESI,1,
906 [Compile the ESI processor and Surrogate header support])
907 else
908 AC_MSG_NOTICE([Disabling ESI processor])
909 fi
910
911 # ESI support libraries: expat
912 AC_ARG_WITH(expat, AS_HELP_STRING([--without-expat],[Do not use expat for ESI. Default: auto-detect]))
913 if test "x$squid_opt_use_esi" = "xyes" -a "x$with_expat" != "xno" ; then
914 AC_CHECK_LIB([expat], [main], [EXPATLIB="-lexpat"; HAVE_LIBEXPAT=1])
915 AC_CHECK_HEADERS([expat.h])
916 AC_DEFINE_UNQUOTED(HAVE_LIBEXPAT, $HAVE_LIBEXPAT, [Define to 1 if you have the expat library])
917 if test "x$with_expat" = "xyes" -a "x$HAVE_LIBEXPAT" != "x1" ; then
918 AC_MSG_ERROR([Required library expat is not able to be found.])
919 fi
920 fi
921
922 AC_ARG_WITH(libxml2, AS_HELP_STRING([--without-libxml2],[Do not use libxml2 for ESI. Default: auto-detect]))
923 if test "x$squid_opt_use_esi" = "xyes" -a "x$with_libxml2" != "xno" ; then
924 AC_CHECK_LIB([xml2], [main], [XMLLIB="-lxml2"; HAVE_LIBXML2=1])
925 dnl Find the main header and include path...
926 AC_CACHE_CHECK([location of libxml2 include files], [ac_cv_libxml2_include], [
927 AC_CHECK_HEADERS([libxml/parser.h], [], [
928 AC_MSG_NOTICE([Testing in /usr/include/libxml2])
929 SAVED_CPPFLAGS="$CPPFLAGS"
930 CPPFLAGS="-I/usr/include/libxml2 $CPPFLAGS"
931 unset ac_cv_header_libxml_parser_h
932 AC_CHECK_HEADERS([libxml/parser.h], [ac_cv_libxml2_include="-I/usr/include/libxml2"], [
933 AC_MSG_NOTICE([Testing in /usr/local/include/libxml2])
934 CPPFLAGS="-I/usr/local/include/libxml2 $SAVED_CPPFLAGS"
935 unset ac_cv_header_libxml_parser_h
936 AC_CHECK_HEADERS([libxml/parser.h], [ac_cv_libxml2_include="-I/usr/local/include/libxml2"], [
937 AC_MSG_NOTICE([Failed to find libxml2 header file libxml/parser.h])
938 ])
939 ])
940 CPPFLAGS="$SAVED_CPPFLAGS"
941 ])
942 ])
943 if test "x$ac_cv_libxml2_include" != "x"; then
944 SQUID_CXXFLAGS="$ac_cv_libxml2_include $SQUID_CXXFLAGS"
945 CPPFLAGS="$ac_cv_libxml2_include $CPPFLAGS"
946 fi
947 dnl Now that we know where to look find the headers...
948 AC_CHECK_HEADERS(libxml/parser.h libxml/HTMLparser.h libxml/HTMLtree.h)
949 AC_DEFINE_UNQUOTED(HAVE_LIBXML2, $HAVE_LIBXML2, [Define to 1 if you have the libxml2 library])
950 if test "x$with_libxml2" = "xyes" -a "$HAVE_LIBXML2" != "1" ; then
951 AC_MSG_ERROR([Required library libxml2 is not able to be found.])
952 fi
953 fi
954
955 AM_CONDITIONAL(USE_ESI, test "x$squid_opt_use_esi" = "xyes")
956 AM_CONDITIONAL(HAVE_LIBEXPAT, test "$HAVE_LIBEXPAT" = 1)
957 AC_SUBST(EXPATLIB)
958 AM_CONDITIONAL(HAVE_LIBXML2, test "$HAVE_LIBXML2" = 1)
959 AC_SUBST(XMLLIB)
960
961 # icap argument handling
962 AC_ARG_ENABLE(icap-client,
963 AS_HELP_STRING([--disable-icap-client],[Disable the ICAP client.]),[
964 SQUID_YESNO([$enableval],[Unrecognized argument to --disable-icap-client: $enableval])
965 ])
966 SQUID_DEFINE_BOOL(ICAP_CLIENT,${enable_icap_client:=yes}, [Enable ICAP client features in Squid])
967 AM_CONDITIONAL(USE_ICAP_CLIENT, [test "x$enable_icap_client" != "xno" ])
968 if test "x$enable_icap_client" != "xno" ; then
969 ICAP_LIBS="icap/libicap.la"
970 squid_opt_use_adaptation=yes
971 else
972 ICAP_LIBS=""
973 fi
974 AC_SUBST(ICAP_LIBS)
975
976 squid_opt_use_ecap=1
977 AC_MSG_CHECKING(whether to support eCAP)
978 AC_ARG_ENABLE(ecap,
979 AS_HELP_STRING([--enable-ecap],[support loadable content adaptation modules]), [
980 case "${enableval}" in
981 yes|no) squid_opt_use_ecap=$enableval ;;
982 *) AC_MSG_ERROR(bad value ${enableval} for --enable-ecap) ;;
983 esac
984 AC_MSG_RESULT([$squid_opt_use_ecap, explicitly])
985 ], [
986 squid_opt_use_ecap=no;
987 AC_MSG_RESULT([$squid_opt_use_ecap, implicitly])
988 ]
989 )
990
991 dnl Necessary if the first PKG_CHECK_MODULES call is conditional
992 PKG_PROG_PKG_CONFIG
993
994 dnl Perform configuration consistency checks for eCAP
995 if test "x$squid_opt_use_ecap" != "xno";
996 then
997 dnl eCAP support requires loadable modules, which are enabled by default
998 if test "x$enable_loadable_modules" != "xyes"
999 then
1000 AC_MSG_ERROR([eCAP support requires loadable modules. Please do not use --disable-loadable-modules with --enable-ecap.])
1001 fi
1002
1003 if test -n "$PKG_CONFIG"; then
1004 dnl eCAP support requires libecap.
1005 dnl This Squid supports libecap v1.0.x.
1006 dnl Use EXT_ prefix to distinguish external libecap (that we check for
1007 dnl here) from our own convenience ecap library in Makefiles.
1008 PKG_CHECK_MODULES([EXT_LIBECAP],[libecap >= 1.0 libecap < 1.1])
1009 else
1010 AC_MSG_NOTICE([eCAP support requires pkg-config to verify the correct library version. Trouble may follow.])
1011 fi
1012 fi
1013
1014 AM_CONDITIONAL(USE_ECAP, test "x$squid_opt_use_ecap" = "xyes")
1015 if test "x$squid_opt_use_ecap" = "xyes";
1016 then
1017 AC_DEFINE(USE_ECAP,1,[Enable eCAP support])
1018 ECAP_LIBS="ecap/libsquid-ecap.la"
1019 squid_opt_use_adaptation=yes
1020 else
1021 AC_DEFINE(USE_ECAP,0,[Disable eCAP support])
1022 ECAP_LIBS=""
1023 fi
1024 dnl convenience library
1025 AC_SUBST(ECAP_LIBS)
1026
1027
1028 dnl enable adaptation if requested by specific adaptation mechanisms
1029 AM_CONDITIONAL(USE_ADAPTATION, test "x$squid_opt_use_adaptation" = "xyes")
1030 if test "x$squid_opt_use_adaptation" = "xyes"
1031 then
1032 AC_DEFINE(USE_ADAPTATION,1,[common adaptation support])
1033 ADAPTATION_LIBS="adaptation/libadaptation.la"
1034 else
1035 AC_DEFINE(USE_ADAPTATION,0,[common adaptation support])
1036 ADAPTATION_LIBS=""
1037 fi
1038 AC_SUBST(ADAPTATION_LIBS)
1039
1040 test "x$squid_host_os" = "xmingw" && enable_wccp=no
1041 AC_ARG_ENABLE(wccp,
1042 AS_HELP_STRING([--disable-wccp],[Disable Web Cache Coordination Protocol]), [
1043 SQUID_YESNO([$enableval],[unrecognized argument to --disable-wccp: $enableval])
1044 ])
1045 SQUID_DEFINE_BOOL(USE_WCCP, ${enable_wccp:=yes}, [Define to enable WCCP])
1046 AC_MSG_NOTICE([Web Cache Coordination Protocol enabled: $enable_wccp])
1047
1048 test "x$squid_host_os" = "xmingw" && enable_wccpv2=no
1049 AC_ARG_ENABLE(wccpv2,
1050 AS_HELP_STRING([--disable-wccpv2],
1051 [Disable Web Cache Coordination V2 Protocol]), [
1052 SQUID_YESNO([$enableval],
1053 [unrecognized argument to --disable-wccpv2: $enableval])
1054 ])
1055 SQUID_DEFINE_BOOL(USE_WCCPv2,${enable_wccpv2:=yes},
1056 [Define to enable WCCP V2])
1057 AC_MSG_NOTICE([Web Cache Coordination V2 Protocol enabled: $enable_wccpv2])
1058
1059 AC_ARG_ENABLE(kill-parent-hack,
1060 AS_HELP_STRING([--enable-kill-parent-hack],[Kill parent on shutdown]), [
1061 SQUID_YESNO([$enableval],
1062 [unrecognized argument to --enable-kill-parent-hack: $enableval])
1063 ])
1064 SQUID_DEFINE_BOOL(KILL_PARENT_OPT,${enable_kill_parent_hack:=no},
1065 [A dangerous feature which causes Squid to kill its parent
1066 process (presumably the RunCache script) upon receipt
1067 of SIGTERM or SIGINT. Deprecated, Use with caution.])
1068 AC_MSG_NOTICE([Kill parent on shutdown hack enabled: $enable_kill_parent_hack])
1069
1070 AC_ARG_ENABLE(snmp,
1071 AS_HELP_STRING([--disable-snmp],[Disable SNMP monitoring support]), [
1072 SQUID_YESNO([$enableval],
1073 [unrecognized argument to --disable-snmp: $enableval])
1074 ])
1075 SQUID_DEFINE_BOOL(SQUID_SNMP,${enable_snmp:=yes},
1076 [Define to enable SNMP monitoring of Squid])
1077 AM_CONDITIONAL(ENABLE_SNMP, [test "x$enable_snmp" = "xyes"])
1078 if test "x$enable_snmp" = "xyes"; then
1079 SNMPLIB='../lib/snmplib/libsnmplib.la'
1080 fi
1081 AC_MSG_NOTICE([SNMP support enabled: $enable_snmp])
1082 AC_SUBST(SNMPLIB)
1083
1084 AC_ARG_ENABLE(cachemgr-hostname,
1085 AS_HELP_STRING([--enable-cachemgr-hostname=hostname],
1086 [Make cachemgr.cgi default to this host.
1087 If unspecified, uses the name of the build-host]), [
1088 case $enableval in
1089 yes)
1090 AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()],
1091 [If you are upset that the cachemgr.cgi form comes up with the hostname field blank, then define this to getfullhostname()])
1092 AC_MSG_NOTICE([Cachemgr default hostname == host where cachemgr runs])
1093 ;;
1094 no)
1095 : # Nothing to do..
1096 ;;
1097 *)
1098 AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
1099 AC_MSG_NOTICE([Cachemgr default hostname set to ${enableval}])
1100 ;;
1101 esac
1102 ])
1103
1104 AC_ARG_ENABLE(eui,
1105 AS_HELP_STRING([--disable-eui],
1106 [Disable use of ARP / MAC/ EUI (ether address)]), [
1107 SQUID_YESNO([$enableval],[--disable-eui expects no arguments])
1108 ])
1109 if test "x${enable_eui:=yes}" = "xyes" ; then
1110 case "$squid_host_os" in
1111 linux|solaris|freebsd|openbsd|netbsd|cygwin)
1112 ${TRUE}
1113 ;;
1114 mingw)
1115 EUILIB="-liphlpapi"
1116 ;;
1117 *)
1118 AC_MSG_WARN([EUI support probably will not work on host $host.])
1119 ;;
1120 esac
1121 # iphlpapi.h check delayed after winsock2.h
1122 AC_CHECK_HEADERS( \
1123 windows.h \
1124 sys/sockio.h \
1125 sys/param.h,
1126 [], [], [[
1127 #if HAVE_WINDOWS_H
1128 include <windows.h>
1129 #endif
1130 ]]
1131 )
1132 AC_CHECK_HEADERS( \
1133 net/if_arp.h \
1134 net/route.h,
1135 [], [], [[
1136 #include <sys/types.h>
1137 #include <sys/socket.h>
1138 ]])
1139
1140 # OpenBSD, FreeBSD and NetBSD requires sys/param.h to be included before sysctl.h and net/if_dl.h
1141 AC_CHECK_HEADERS( \
1142 net/if_dl.h \
1143 sys/sysctl.h,
1144 [], [], [[
1145 #if HAVE_SYS_PARAM_H
1146 #include <sys/param.h>
1147 #endif
1148 ]])
1149 fi
1150 AC_SUBST(EUILIB)
1151 AC_MSG_NOTICE([EUI (MAC address) controls enabled: $enable_eui])
1152 SQUID_DEFINE_BOOL(USE_SQUID_EUI,$enable_eui,
1153 [Define this to include code which lets you use ethernet addresses. This code uses API initially defined in 4.4-BSD.])
1154 AM_CONDITIONAL(USE_SQUID_EUI, [test "x$enable_eui" = "xyes" ])
1155
1156
1157 AC_ARG_ENABLE(htcp,
1158 AS_HELP_STRING([--disable-htcp],[Disable HTCP protocol support]), [
1159 SQUID_YESNO([$enableval],
1160 [unrecognized argument to --disable-htcp: $enableval])
1161 ])
1162 SQUID_DEFINE_BOOL(USE_HTCP,${enable_htcp:=yes},
1163 [Define this to include code for the Hypertext Cache Protocol (HTCP)])
1164 AM_CONDITIONAL(ENABLE_HTCP, [test "x$enable_htcp" = "xyes"])
1165 AC_MSG_NOTICE([HTCP support enabled: $enable_htcp])
1166
1167 # Cryptograhic libraries
1168 AC_ARG_WITH(nettle,
1169 AS_HELP_STRING([--without-nettle],[Compile without the Nettle crypto library.]),[
1170 case "$with_nettle" in
1171 yes|no)
1172 : # Nothing special to do here
1173 ;;
1174 *)
1175 if test ! -d "$withval" ; then
1176 AC_MSG_ERROR([--with-nettle path does not point to a directory])
1177 fi
1178 NETTLELIBDIR="-L$with_nettle/lib"
1179 CPPFLAGS="-I$with_nettle/include $CPPFLAGS"
1180 with_nettle=yes
1181 esac
1182 ])
1183 if test "x$with_nettle" != "xno" ; then
1184 AC_CHECK_LIB(nettle, nettle_md5_init,[
1185 NETTLELIB="$NETTLELIBDIR -lnettle"
1186 AC_CHECK_HEADERS(nettle/md5.h)
1187 ],[with_nettle=no])
1188 if test "x$with_nettle" != "xno" ; then
1189 # Base64 uses the nettle 3.0 API
1190 # which matters on 64-bit systems
1191 AC_CHECK_HEADERS(nettle/base64.h)
1192 AC_MSG_CHECKING([for Nettle 3.0 API compatibility])
1193 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1194 # include <cstddef>
1195 # include <cstdint>
1196 # include <nettle/base64.h>
1197 ]],[[
1198 uint8_t inData[10]; inData[0] = '\0';
1199 size_t srcLen = 0;
1200 struct base64_decode_ctx ctx;
1201 base64_decode_init(&ctx);
1202 uint8_t outData[10];
1203 size_t dstLen = 0;
1204 if (!base64_decode_update(&ctx, &dstLen, outData, srcLen, inData) ||
1205 !base64_decode_final(&ctx)) {
1206 return 1;
1207 }
1208 ]])],[AC_MSG_RESULT(yes)
1209 AC_DEFINE(HAVE_NETTLE30_BASE64,1,[set to 1 if Nettle 3.0 API will link])
1210 ],[AC_MSG_RESULT(no)])
1211 fi
1212 fi
1213 AC_MSG_NOTICE([Using Nettle cryptographic library: ${with_nettle:=yes}])
1214 AC_SUBST(NETTLELIB)
1215
1216 dnl Check for libcrypt
1217 CRYPTLIB=
1218 dnl Some of our helpers use crypt(3) which may be in libc, or in
1219 dnl libcrypt (eg FreeBSD)
1220 AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
1221 dnl Solaris10 provides MD5 natively through libmd5
1222 AC_CHECK_LIB(md5, MD5Init, [CRYPTLIB="$CRYPTLIB -lmd5"])
1223 AC_SUBST(CRYPTLIB)
1224
1225 SSLLIB=""
1226
1227 dnl User may want to disable GnuTLS
1228 AC_ARG_WITH(gnutls,
1229 AS_HELP_STRING([--without-gnutls],
1230 [Do not use GnuTLS for SSL. Default: auto-detect]), [
1231 case "$with_gnutls" in
1232 yes|no)
1233 : # Nothing special to do here
1234 ;;
1235 *)
1236 if test ! -d "$withval" ; then
1237 AC_MSG_ERROR([--with-gnutls path does not point to a directory])
1238 fi
1239 LIBGNUTLS_PATH="-L$with_gnutls/lib"
1240 CPPFLAGS="-I$with_gnutls/include $CPPFLAGS"
1241 esac
1242 ])
1243 AH_TEMPLATE(USE_GNUTLS,[GnuTLS support is available])
1244 if test "x$with_gnutls" != "xno"; then
1245 AC_CHECK_HEADERS(gnutls/gnutls.h gnutls/x509.h)
1246
1247 # User may have provided a custom location for GnuTLS. Otherwise...
1248 SQUID_STATE_SAVE(squid_gnutls_state)
1249 LIBS="$LIBS $LIBGNUTLS_PATH"
1250
1251 # auto-detect using pkg-config
1252 PKG_CHECK_MODULES([LIBGNUTLS],[gnutls >= 3.1.5],,[
1253 ## find the package without pkg-config
1254 ## check that the library is actually new enough.
1255 ## by testing for a 3.1.5+ function which we use
1256 AC_CHECK_LIB(gnutls,gnutls_certificate_verify_peers3,[LIBGNUTLS_LIBS="-lgnutls"])
1257 ])
1258
1259 SQUID_STATE_ROLLBACK(squid_gnutls_state) #de-pollute LIBS
1260
1261 if test "x$with_gnutls" = "xyes" -a "x$LIBGNUTLS_LIBS" = "x"; then
1262 AC_MSG_ERROR([Required GnuTLS library not found])
1263 fi
1264 if test "x$LIBGNUTLS_LIBS" != "x" ; then
1265 CXXFLAGS="$LIBGNUTLS_CFLAGS $CXXFLAGS"
1266 SSLLIB="$LIBGNUTLS_PATH $LIBGNUTLS_LIBS $SSLLIB"
1267 AC_DEFINE(USE_GNUTLS,1,[GnuTLS support is available])
1268 else
1269 with_gnutls=no
1270 fi
1271 fi
1272 AC_MSG_NOTICE([GnuTLS library support: ${with_gnutls:=auto} ${LIBGNUTLS_PATH} ${LIBGNUTLS_LIBS}])
1273
1274 dnl User may specify OpenSSL is needed from a non-standard location
1275 AC_ARG_WITH(openssl,
1276 AS_HELP_STRING([--with-openssl=PATH],
1277 [Compile with the OpenSSL libraries. The path to
1278 the OpenSSL development libraries and headers
1279 installation can be specified if outside of the
1280 system standard directories]), [
1281 case "$with_openssl" in
1282 yes|no)
1283 : # Nothing special to do here
1284 ;;
1285 *)
1286 if test ! -d "$withval" ; then
1287 AC_MSG_ERROR([--with-openssl path does not point to a directory])
1288 fi
1289 LIBOPENSSL_PATH="-L$with_openssl/lib"
1290 CPPFLAGS="-I$with_openssl/include $CPPFLAGS"
1291 with_openssl=yes
1292 esac
1293 ])
1294 AH_TEMPLATE(USE_OPENSSL,[OpenSSL support is available])
1295 ## OpenSSL is default disable due to licensing issues on some OS
1296 if test "x$with_openssl" = "xyes"; then
1297 AC_CHECK_HEADERS( \
1298 openssl/bio.h \
1299 openssl/err.h \
1300 openssl/md5.h \
1301 openssl/opensslv.h \
1302 openssl/ssl.h \
1303 openssl/x509v3.h \
1304 openssl/engine.h \
1305 openssl/txt_db.h \
1306 )
1307
1308 # User may have provided a custom location for OpenSSL. Otherwise...
1309 SQUID_STATE_SAVE(squid_openssl_state)
1310 LIBS="$LIBS $LIBOPENSSL_PATH"
1311
1312 # auto-detect using pkg-config
1313 PKG_CHECK_MODULES([LIBOPENSSL],[openssl],,[
1314 ## For some OS pkg-config is broken or unavailable.
1315 ## Detect libraries the hard way.
1316
1317 # Windows MinGW has some special libraries ...
1318 if test "x$squid_host_os" = "xmingw" ; then
1319 LIBOPENSSL_LIBS='-lssleay32 -leay32 -lgdi32 $LIBOPENSSL_LIBS'
1320 AC_MSG_NOTICE([Windows OpenSSL library support: yes -lssleay32 -leay32 -lgdi32])
1321 fi
1322
1323 AC_CHECK_LIB(crypto,[CRYPTO_new_ex_data],[LIBOPENSSL_LIBS="-lcrypto $LIBOPENSSL_LIBS"],[
1324 AC_MSG_ERROR([library 'crypto' is required for OpenSSL])
1325 ])
1326 AC_CHECK_LIB(ssl,[SSL_library_init],[LIBOPENSSL_LIBS="-lssl $LIBOPENSSL_LIBS"],[
1327 AC_MSG_ERROR([library 'ssl' is required for OpenSSL])
1328 ])
1329 ])
1330
1331 # This is a workaround for RedHat 9 brain damage..
1332 if test -d /usr/kerberos/include -a -f /usr/include/openssl/kssl.h; then
1333 AC_MSG_NOTICE([OpenSSL depends on Kerberos])
1334 LIBOPENSSL_LIBS="-L/usr/kerberos/lib $LIBOPENSSL_LIBS"
1335 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
1336 fi
1337 SQUID_STATE_ROLLBACK(squid_openssl_state) #de-pollute LIBS
1338
1339 if test "x$LIBOPENSSL_LIBS" != "x"; then
1340 CXXFLAGS="$LIBOPENSSL_CFLAGS $CXXFLAGS"
1341 SSLLIB="$LIBOPENSSL_PATH $LIBOPENSSL_LIBS $SSLLIB"
1342 AC_DEFINE(USE_OPENSSL,1,[OpenSSL support is available])
1343
1344 # check for other specific broken implementations
1345 SQUID_CHECK_OPENSSL_GETCERTIFICATE_WORKS
1346 SQUID_CHECK_OPENSSL_CONST_SSL_METHOD
1347 SQUID_CHECK_OPENSSL_TXTDB
1348 SQUID_CHECK_OPENSSL_HELLO_OVERWRITE_HACK
1349 fi
1350 if test "x$SSLLIB" = "x"; then
1351 AC_MSG_ERROR([Required OpenSSL library not found])
1352 fi
1353 fi
1354 AC_MSG_NOTICE([OpenSSL library support: ${with_openssl:=no} ${LIBOPENSSL_PATH} ${LIBOPENSSL_LIBS}])
1355 AM_CONDITIONAL(ENABLE_SSL,[ test "x$with_openssl" = "xyes" ])
1356 AC_SUBST(SSLLIB)
1357
1358 dnl User may specify MIT Kerberos is needed from a non-standard location
1359 AC_ARG_WITH(mit-krb5,
1360 AS_HELP_STRING([--without-mit-krb5],
1361 [Compile without MIT Kerberos support.]), [
1362 case "$with_mit_krb5" in
1363 yes|no)
1364 : # Nothing special to do here
1365 ;;
1366 *)
1367 if test ! -d "$withval" ; then
1368 AC_MSG_ERROR([--with-mit-krb5 path does not point to a directory])
1369 fi
1370 if test -d "$with_mit_krb5/lib64" ; then
1371 LIB_KRB5_PATH="-L$with_mit_krb5/lib64 -L$with_mit_krb5/lib"
1372 else
1373 LIB_KRB5_PATH="-L$with_mit_krb5/lib"
1374 fi
1375 CXXFLAGS="-I$with_mit_krb5/include $CXXFLAGS"
1376 krb5confpath="$with_mit_krb5/bin"
1377 with_mit_krb5=yes
1378 esac
1379 ])
1380 AH_TEMPLATE(USE_APPLE_KRB5,[Apple Kerberos support is available])
1381 AH_TEMPLATE(USE_MIT_KRB5,[MIT Kerberos support is available])
1382 AH_TEMPLATE(USE_SOLARIS_KRB5,[Solaris Kerberos support is available])
1383
1384 dnl User may specify Heimdal Kerberos is needed from a non-standard location
1385 AC_ARG_WITH(heimdal-krb5,
1386 AS_HELP_STRING([--without-heimdal-krb5],
1387 [Compile without Heimdal Kerberos support.]), [
1388 case "$with_heimdal_krb5" in
1389 yes|no)
1390 : # Nothing special to do here
1391 ;;
1392 *)
1393 if test ! -d "$withval" ; then
1394 AC_MSG_ERROR([--with-heimdal-krb5 path does not point to a directory])
1395 fi
1396 if test -d "$with_heimdal_krb5/lib64" ; then
1397 LIB_KRB5_PATH="-L$with_heimdal_krb5/lib64 -L$with_heimdal_krb5/lib"
1398 else
1399 LIB_KRB5_PATH="-L$with_heimdal_krb5/lib"
1400 fi
1401 CXXFLAGS="-I$with_heimdal_krb5/include $CXXFLAGS"
1402 krb5confpath="$with_heimdal_krb5/bin"
1403 with_heimdal_krb5=yes
1404 esac
1405 ])
1406 AH_TEMPLATE(USE_HEIMDAL_KRB5,[Heimdal Kerberos support is available])
1407
1408
1409
1410 dnl User may specify GNU gss is needed from a non-standard location
1411 AC_ARG_WITH(gnugss,
1412 AS_HELP_STRING([--without-gnugss],
1413 [Compile without the GNU gss libraries.]), [
1414 case "$with_gnugss" in
1415 yes|no)
1416 : # Nothing special to do here
1417 ;;
1418 *)
1419 if test ! -d "$withval" ; then
1420 AC_MSG_ERROR([--with-gnugss path does not point to a directory])
1421 fi
1422 if test ! -d "$with_gnugss/lib64" ; then
1423 LIB_KRB5_PATH="-L$with_gnugss/lib64 -L$with_gnugss/lib"
1424 else
1425 LIB_KRB5_PATH="-L$with_gnugss/lib"
1426 fi
1427 CXXFLAGS="-I$with_gnugss/include $CXXFLAGS"
1428 krb5confpath=
1429 with_gnugss=yes
1430 esac
1431 ])
1432 AH_TEMPLATE(USE_GNUGSS,[GNU gss support is available])
1433
1434 # determine krb5 conflicts
1435 ac_with_krb5_count=0
1436 if test "x$with_mit_krb5" = "xyes"; then
1437 ac_with_krb5_count=`expr $ac_with_krb5_count + 1`
1438 fi
1439 if test "x$with_heimdal_krb5" = "xyes"; then
1440 ac_with_krb5_count=`expr $ac_with_krb5_count + 1`
1441 fi
1442 if test "x$with_gnugss" = "xyes"; then
1443 ac_with_krb5_count=`expr $ac_with_krb5_count + 1`
1444 fi
1445
1446 if test $ac_with_krb5_count -gt 1 ; then
1447 AC_MSG_ERROR([Please choose only one Kerberos library.])
1448 elif test $ac_with_krb5_count -eq 0 ; then
1449 # find installed libs via pkg-config or krb5-config
1450 PKG_CHECK_EXISTS(gssapi-krb5 krb5, [with_mit_krb5=yes])
1451 PKG_CHECK_EXISTS(heimdal-gssapi, [with_heimdal_krb5=yes])
1452 PKG_CHECK_EXISTS(gss, [with_gnugss=yes])
1453 if test "x$with_mit_krb5" = "xyes"; then
1454 ac_with_krb5_count=`expr $ac_with_krb5_count + 1`
1455 fi
1456 if test "x$with_heimdal_krb5" = "xyes"; then
1457 ac_with_krb5_count=`expr $ac_with_krb5_count + 1`
1458 fi
1459 if test "x$with_gnugss" = "xyes"; then
1460 ac_with_krb5_count=`expr $ac_with_krb5_count + 1`
1461 fi
1462 if test $ac_with_krb5_count -gt 1 ; then
1463 AC_MSG_ERROR([pkg-config found multiple Kerberos library. Please select one with --with-<kerberos package>])
1464 elif test $ac_with_krb5_count -eq 0 -a "$cross_compiling" = "no"; then
1465 # Look for krb5-config (unless cross-compiling)
1466 AC_PATH_PROG(krb5_config,krb5-config,no)
1467 if test "x$ac_cv_path_krb5_config" != "xno" ; then
1468 krb5confpath="`dirname $ac_cv_path_krb5_config`"
1469 ac_heimdal="`$ac_cv_path_krb5_config --version 2>/dev/null | grep -c -i heimdal`"
1470 ac_solaris="`$ac_cv_path_krb5_config --version 2>/dev/null | grep -c -i solaris`"
1471 ac_apple="`$ac_cv_path_krb5_config --vendor 2>/dev/null | grep -c -i apple`"
1472 if test $ac_heimdal -gt 0 ; then
1473 with_heimdal_krb5=yes
1474 ac_with_krb5_count=1
1475 fi
1476 if test $ac_solaris -gt 0 ; then
1477 with_solaris_krb5=yes
1478 ac_with_krb5_count=1
1479 fi
1480 if test $ac_apple -gt 0 ; then
1481 with_apple_krb5=yes
1482 ac_with_krb5_count=1
1483 fi
1484 if test $ac_heimdal -eq 0 && test $ac_solaris -eq 0 && test $ac_apple -eq 0; then
1485 with_mit_krb5=yes
1486 ac_with_krb5_count=1
1487 fi
1488 else
1489 AC_MSG_WARN([Could not find krb5-config in path])
1490 fi
1491 fi
1492 fi
1493
1494 if test "x$with_mit_krb5" = "xyes" || test "x$with_apple_krb5" = "xyes" ; then
1495 SQUID_STATE_SAVE([squid_krb5_save])
1496 LIBS="$LIBS $LIB_KRB5_PATH"
1497
1498 # auto-detect using pkg-config
1499 PKG_CHECK_MODULES([LIB_KRB5],[gssapi-krb5 krb5],,[
1500 # look for krb5-config (unless cross-compiling)
1501 if test "$cross_compiling" = "no"; then
1502 if test "x$krb5confpath" = "x" ; then
1503 AC_PATH_PROG(krb5_config,krb5-config,no)
1504 if test "x$ac_cv_path_krb5_config" != "xno" ; then
1505 ac_krb5_config="$ac_cv_path_krb5_config"
1506 fi
1507 else
1508 ac_krb5_config="$krb5confpath/krb5-config"
1509 fi
1510 fi
1511 if test "x$ac_krb5_config" != "x" && test -x "$ac_krb5_config"; then
1512 # Get libs, etc
1513 AC_MSG_NOTICE([Use krb5-config to get CXXFLAGS and LIBS])
1514 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags krb5 2>/dev/null`"
1515 LIB_KRB5_LIBS="`$ac_krb5_config --libs krb5 2>/dev/null`"
1516 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags gssapi 2>/dev/null` $LIB_KRB5_CFLAGS"
1517 LIB_KRB5_LIBS="`$ac_krb5_config --libs gssapi 2>/dev/null` $LIB_KRB5_LIBS"
1518 else
1519 ## For some OS pkg-config is broken or unavailable.
1520 ## Detect libraries the hard way.
1521
1522 SQUID_STATE_SAVE([squid_mit_save])
1523 AC_MSG_NOTICE([Try to find Kerberos libraries in given path])
1524 AC_CHECK_LIB(com_err, [main], [LIB_KRB5_LIBS="-lcom_err $LIB_KRB5_LIBS"],[
1525 AC_MSG_ERROR([library 'com_err' is required for MIT Kerberos])
1526 ])
1527 LIBS=$LIB_KRB5_LIBS
1528 AC_CHECK_LIB(k5crypto, [main], [LIB_KRB5_LIBS="-lk5crypto $LIB_KRB5_LIBS"],[
1529 AC_MSG_ERROR([library 'k5crypto' is required for MIT Kerberos])
1530 ])
1531 LIBS=$LIB_KRB5_LIBS
1532 AC_CHECK_LIB(krb5, [main], [LIB_KRB5_LIBS="-lkrb5 $LIB_KRB5_LIBS"],[
1533 AC_MSG_ERROR([library 'krb5' is required for MIT Kerberos])
1534 ])
1535 LIBS=$LIB_KRB5_LIBS
1536 AC_CHECK_LIB(gssapi_krb5, [main], [LIB_KRB5_LIBS="-lgssapi_krb5 $LIB_KRB5_LIBS"],[
1537 AC_MSG_ERROR([library 'gssapi_krb5' is required for MIT Kerberos])
1538 ])
1539 SQUID_STATE_ROLLBACK([squid_mit_save])
1540 fi
1541
1542 ])
1543
1544 if test "x$LIB_KRB5_LIBS" != "x"; then
1545 if test "x$with_apple_krb5" = "xyes" ; then
1546 AC_DEFINE(USE_APPLE_KRB5,1,[Apple Kerberos support is available])
1547 KRB5_FLAVOUR="Apple"
1548 else
1549 AC_DEFINE(USE_MIT_KRB5,1,[MIT Kerberos support is available])
1550 KRB5_FLAVOUR="MIT"
1551 fi
1552 KRB5LIBS="$LIB_KRB5_PATH $LIB_KRB5_LIBS $KRB5LIBS"
1553 KRB5INCS="$LIB_KRB5_CFLAGS"
1554
1555 # check for other specific broken implementations
1556 CXXFLAGS="$CXXFLAGS $KRB5INCS"
1557 LIBS="$LIBS $KRB5LIBS"
1558
1559 AC_MSG_NOTICE([Try to find Kerberos headers in given path])
1560 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h)
1561 AC_CHECK_HEADERS(gssapi/gssapi_generic.h)
1562 AC_CHECK_HEADERS(krb5.h com_err.h et/com_err.h)
1563 AC_CHECK_HEADERS(profile.h)
1564
1565 SQUID_CHECK_KRB5_FUNCS
1566
1567 fi
1568 if test "x$KRB5LIBS" = "x"; then
1569 AC_MSG_ERROR([Required Kerberos library not found])
1570 ac_with_krb5_count=0
1571 fi
1572
1573 SQUID_STATE_ROLLBACK([squid_krb5_save])
1574 fi
1575
1576 if test "x$with_solaris_krb5" = "xyes"; then
1577 SQUID_STATE_SAVE([squid_krb5_save])
1578 LIBS="$LIBS $LIB_KRB5_PATH"
1579
1580 # no pkg-config for solaris native Kerberos
1581 # look for krb5-config (unless cross-compiling)
1582 if test "$cross_compiling" = "no"; then
1583 if test "x$krb5confpath" = "x" ; then
1584 AC_PATH_PROG(krb5_config,krb5-config,no)
1585 if test "x$ac_cv_path_krb5_config" != "xno" ; then
1586 ac_krb5_config="$ac_cv_path_krb5_config"
1587 fi
1588 else
1589 ac_krb5_config="$krb5confpath/krb5-config"
1590 fi
1591 fi
1592 if test "x$ac_krb5_config" != "x" && test -x "$ac_krb5_config"; then
1593 # Get libs, etc
1594 AC_MSG_NOTICE([Use krb5-config to get CXXFLAGS and LIBS])
1595 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags krb5 2>/dev/null`"
1596 LIB_KRB5_LIBS="`$ac_krb5_config --libs krb5 2>/dev/null`"
1597 # Solaris 10 Update 11 patches the krb5-config tool to produce stderr messages on stdout.
1598 SOLARIS_BROKEN_KRB5CONFIG_GSSAPI="`$ac_krb5_config --libs gssapi 2>/dev/null | grep "krb5-config"`"
1599 if test "x$SOLARIS_BROKEN_KRB5CONFIG_GSSAPI" = "x"; then
1600 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags gssapi 2>/dev/null` $LIB_KRB5_CFLAGS"
1601 LIB_KRB5_LIBS="`$ac_krb5_config --libs gssapi 2>/dev/null` $LIB_KRB5_LIBS"
1602 fi
1603 else
1604 ## For some OS pkg-config is broken or unavailable.
1605 ## Detect libraries the hard way.
1606
1607 CXXFLAGS="-I/usr/include/kerberosv5 $CXXFLAGS"
1608
1609 SQUID_STATE_SAVE([squid_solaris_save])
1610 AC_MSG_NOTICE([Try to find Kerberos libraries in given path])
1611 AC_CHECK_LIB(krb5, [main], [LIB_KRB5_LIBS="-lkrb5 $LIB_KRB5_LIBS"],[
1612 AC_MSG_ERROR([library 'krb5' is required for Solaris Kerberos])
1613 ])
1614 LIBS=$LIB_KRB5_LIBS
1615 AC_CHECK_LIB(gss, [main], [LIB_KRB5_LIBS="-lgss $LIB_KRB5_LIBS"],[
1616 AC_MSG_ERROR([library 'gss' is required for Solaris Kerberos])
1617 ])
1618 SQUID_STATE_ROLLBACK([squid_solaris_save])
1619 fi
1620
1621 if test "x$LIB_KRB5_LIBS" != "x"; then
1622 KRB5LIBS="$LIB_KRB5_PATH $LIB_KRB5_LIBS $KRB5LIBS"
1623 KRB5INCS="$LIB_KRB5_CFLAGS"
1624 AC_DEFINE(USE_SOLARIS_KRB5,1,[Solaris Kerberos support is available])
1625 KRB5_FLAVOUR="Solaris"
1626
1627 # check for other specific broken implementations
1628 CXXFLAGS="$CXXFLAGS $KRB5INCS"
1629 LIBS="$LIBS $KRB5LIBS"
1630
1631 AC_MSG_NOTICE([Try to find Kerberos headers in given path])
1632 AC_CHECK_HEADERS(gssapi/gssapi.h gssapi/gssapi_ext.h)
1633 AC_CHECK_HEADERS(krb5.h com_err.h)
1634
1635 SQUID_CHECK_KRB5_SOLARIS_BROKEN_KRB5_H
1636 if test "x$squid_cv_broken_krb5_h" = "xyes"; then
1637 AC_DEFINE(HAVE_BROKEN_SOLARIS_KRB5_H, 1, [Define to 1 if Solaris krb5.h is broken for C++])
1638 AC_MSG_WARN([You have a broken Solaris <krb5.h> system include.])
1639 AC_MSG_WARN([Please see http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6837512])
1640 AC_MSG_WARN([If you need Kerberos support you will have to patch])
1641 AC_MSG_WARN([your system. See contrib/solaris/solaris-krb5-include.patch])
1642 fi
1643
1644 SQUID_CHECK_KRB5_FUNCS
1645
1646 fi
1647 if test "x$KRB5LIBS" = "x"; then
1648 AC_MSG_ERROR([Required Kerberos library not found])
1649 ac_with_krb5_count=0
1650 fi
1651
1652 SQUID_STATE_ROLLBACK([squid_krb5_save])
1653 fi
1654
1655 if test "x$with_heimdal_krb5" = "xyes"; then
1656 SQUID_STATE_SAVE([squid_krb5_save])
1657 LIBS="$LIBS $LIB_KRB5_PATH"
1658
1659 # auto-detect using pkg-config
1660 PKG_CHECK_MODULES([LIB_KRB5],[heimdal-gssapi],,[
1661 # look for krb5-config (unless cross-compiling)
1662 if test "$cross_compiling" = "no"; then
1663 if test "x$krb5confpath" = "x" ; then
1664 AC_PATH_PROG(krb5_config,krb5-config,no)
1665 if test "x$ac_cv_path_krb5_config" != "xno" ; then
1666 ac_krb5_config="$ac_cv_path_krb5_config"
1667 fi
1668 else
1669 ac_krb5_config="$krb5confpath/krb5-config"
1670 fi
1671 fi
1672 if test "x$ac_krb5_config" != "x" && test -x "$ac_krb5_config"; then
1673 # Get libs, etc
1674 AC_MSG_NOTICE([Use krb5-config to get CXXFLAGS and LIBS])
1675 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags krb5 2>/dev/null`"
1676 LIB_KRB5_LIBS="`$ac_krb5_config --libs krb5 2>/dev/null`"
1677 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags gssapi 2>/dev/null` $LIB_KRB5_CFLAGS"
1678 LIB_KRB5_LIBS="`$ac_krb5_config --libs gssapi 2>/dev/null` $LIB_KRB5_LIBS"
1679 else
1680 ## For some OS pkg-config is broken or unavailable.
1681 ## Detect libraries the hard way.
1682 SQUID_STATE_SAVE([squid_heimdal_save])
1683
1684 AC_MSG_NOTICE([Try to find Kerberos libraries in given path])
1685 AC_CHECK_LIB(resolv, [main], [LIB_KRB5_LIBS="-lresolv $LIB_KRB5_LIBS"],[
1686 AC_MSG_ERROR([library 'resolv' is required for Heimdal Kerberos])
1687 ])
1688 LIBS=$LIB_KRB5_LIBS
1689 AC_CHECK_LIB(crypt, [main], [LIB_KRB5_LIBS="-lcrypt $LIB_KRB5_LIBS"],[
1690 AC_MSG_ERROR([library 'crypt' is required for Heimdal Kerberos])
1691 ])
1692 LIBS=$LIB_KRB5_LIBS
1693 AC_CHECK_LIB(roken, [main], [LIB_KRB5_LIBS="-lroken $LIB_KRB5_LIBS"],[
1694 AC_MSG_ERROR([library 'roken' is required for Heimdal Kerberos])
1695 ])
1696 LIBS=$LIB_KRB5_LIBS
1697 AC_CHECK_LIB(heimbase, [main], [LIB_KRB5_LIBS="-lheimbase $LIB_KRB5_LIBS"],[
1698 AC_MSG_WARN([library 'heimbase' may be required for Heimdal Kerberos])
1699 ])
1700 LIBS=$LIB_KRB5_LIBS
1701 AC_CHECK_LIB(wind, [main], [LIB_KRB5_LIBS="-lwind $LIB_KRB5_LIBS"],[
1702 AC_MSG_WARN([library 'wind' may be required for Heimdal Kerberos])
1703 ])
1704 LIBS=$LIB_KRB5_LIBS
1705 AC_CHECK_LIB(crypto, [main], [LIB_KRB5_LIBS="-lcrypto $LIB_KRB5_LIBS"],[
1706 AC_MSG_ERROR([library 'crypto' is required for Heimdal Kerberos])
1707 ])
1708 LIBS=$LIB_KRB5_LIBS
1709 AC_CHECK_LIB(com_err, [main], [LIB_KRB5_LIBS="-lcom_err $LIB_KRB5_LIBS"],[
1710 AC_MSG_ERROR([library 'com_err' is required for Heimdal Kerberos])
1711 ])
1712 LIBS=$LIB_KRB5_LIBS
1713 AC_CHECK_LIB(hx509, [main], [LIB_KRB5_LIBS="-lhx509 $LIB_KRB5_LIBS"],[
1714 AC_MSG_WARN([library 'hx509' may be required for Heimdal Kerberos])
1715 ])
1716 LIBS=$LIB_KRB5_LIBS
1717 AC_CHECK_LIB(asn1, [main], [LIB_KRB5_LIBS="-lasn1 $LIB_KRB5_LIBS"],[
1718 AC_MSG_ERROR([library 'asn1' is required for Heimdal Kerberos])
1719 ])
1720 LIBS=$LIB_KRB5_LIBS
1721 AC_CHECK_LIB(krb5, [main], [LIB_KRB5_LIBS="-lkrb5 $LIB_KRB5_LIBS"],[
1722 AC_MSG_ERROR([library 'krb5' is required for Heimdal Kerberos])
1723 ])
1724 LIBS=$LIB_KRB5_LIBS
1725 AC_CHECK_LIB(heimntlm, [main], [LIB_KRB5_LIBS="-lheimntlm $LIB_KRB5_LIBS"],[
1726 AC_MSG_WARN([library 'heimntlm' may be required for Heimdal Kerberos])
1727 ])
1728 LIBS=$LIB_KRB5_LIBS
1729 AC_CHECK_LIB(gssapi, [main], [LIB_KRB5_LIBS="-lgssapi $LIB_KRB5_LIBS"],[
1730 AC_MSG_ERROR([library 'gssapi' is required for Heimdal Kerberos])
1731 ])
1732 SQUID_STATE_ROLLBACK([squid_heimdal_save])
1733 fi
1734
1735 ])
1736 if test "x$LIB_KRB5_LIBS" != "x"; then
1737 KRB5LIBS="$LIB_KRB5_PATH $LIB_KRB5_LIBS $KRB5LIBS"
1738 KRB5INCS="$LIB_KRB5_CFLAGS"
1739 AC_DEFINE(USE_HEIMDAL_KRB5,1,[Heimdal Kerberos support is available])
1740 KRB5_FLAVOUR="Heimdal"
1741
1742 # check for other specific broken implementations
1743 CXXFLAGS="$CXXFLAGS $KRB5INCS"
1744 LIBS="$LIBS $KRB5LIBS"
1745
1746 AC_MSG_NOTICE([Try to find Kerberos headers in given path])
1747 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h)
1748 AC_CHECK_HEADERS(krb5.h com_err.h et/com_err.h)
1749
1750 SQUID_CHECK_KRB5_HEIMDAL_BROKEN_KRB5_H
1751 if test "x$squid_cv_broken_heimdal_krb5_h" = "xyes"; then
1752 AC_DEFINE(HAVE_BROKEN_HEIMDAL_KRB5_H, 1, [Define to 1 if Heimdal krb5.h is broken for C++])
1753 fi
1754
1755 SQUID_CHECK_KRB5_FUNCS
1756
1757 fi
1758 if test "x$KRB5LIBS" = "x"; then
1759 AC_MSG_ERROR([Required Kerberos library not found])
1760 ac_with_krb5_count=0
1761 fi
1762
1763 SQUID_STATE_ROLLBACK([squid_krb5_save])
1764 fi
1765
1766 if test "x$with_gnugss" = "xyes"; then
1767 SQUID_STATE_SAVE([squid_krb5_save])
1768 LIBS="$LIBS $LIB_KRB5_PATH"
1769
1770 # auto-detect using pkg-config
1771 PKG_CHECK_MODULES([LIB_KRB5],[gss],,[
1772 ## For some OS pkg-config is broken or unavailable.
1773 ## Detect libraries the hard way.
1774
1775 AC_MSG_NOTICE([Try to find Kerberos libraries in given path])
1776 AC_CHECK_LIB(gss, [main], [LIB_KRB5_LIBS="-lgss $LIB_KRB5_LIBS"],[
1777 AC_MSG_ERROR([library 'com_err' is required for GNU Kerberos])
1778 ])
1779
1780 ])
1781
1782 if test "x$LIB_KRB5_LIBS" != "x"; then
1783 KRB5LIBS="$LIB_KRB5_PATH $LIB_KRB5_LIBS $KRB5LIBS"
1784 KRB5INCS="$LIB_KRB5_CFLAGS"
1785 AC_DEFINE(USE_GNUGSS,1,[GNU Kerberos support is available])
1786 KRB5_FLAVOUR="GNU GSS"
1787
1788 # check for other specific broken implementations
1789 CXXFLAGS="$CXXFLAGS $KRB5INCS"
1790 LIBS="$LIBS $KRB5LIBS"
1791
1792 AC_MSG_NOTICE([Try to find Kerbeors headers in given path])
1793 AC_CHECK_HEADERS(gss.h)
1794
1795 SQUID_CHECK_WORKING_GSSAPI
1796 SQUID_DEFINE_BOOL(HAVE_GSSAPI,$squid_cv_working_gssapi,[GSSAPI support])
1797
1798 SQUID_CHECK_SPNEGO_SUPPORT
1799 SQUID_DEFINE_BOOL(HAVE_SPNEGO,$squid_cv_have_spnego,[SPNEGO support])
1800
1801 SQUID_CHECK_WORKING_KRB5
1802 SQUID_DEFINE_BOOL(HAVE_KRB5,$squid_cv_working_krb5,[KRB5 support])
1803
1804 fi
1805 if test "x$KRB5LIBS" = "x"; then
1806 AC_MSG_ERROR([Required Kerberos library not found])
1807 ac_with_krb5_count=0
1808 fi
1809
1810 SQUID_STATE_ROLLBACK([squid_krb5_save])
1811 fi
1812 if test $ac_with_krb5_count -gt 0 ; then
1813 with_krb5=yes
1814 fi
1815 AC_MSG_NOTICE([$KRB5_FLAVOUR Kerberos library support: ${with_krb5:=no} ${LIB_KRB5_PATH} ${LIB_KRB5_LIBS}])
1816 AC_SUBST(KRB5INCS)
1817 AC_SUBST(KRB5LIBS)
1818 AM_CONDITIONAL(HAVE_SPNEGO, test x"$squid_cv_have_spnego" = x"yes" )
1819
1820 dnl On MinGW OpenLDAP is not available, so LDAP helpers can be linked
1821 dnl only with Windows LDAP libraries using -lwldap32
1822 case "$squid_host_os" in
1823 mingw)
1824 LDAPLIB="-lwldap32"
1825 LBERLIB=""
1826 ;;
1827 *)
1828 AC_CHECK_LIB(ldap, ldap_init, [LDAPLIB="-lldap"])
1829 dnl LDAP helpers need to know if -llber is needed or not
1830 AC_CHECK_LIB(lber, ber_init, [LBERLIB="-llber"])
1831 dnl if no ldap lib found check for mozilla version
1832 if test "x$ac_cv_lib_ldap_ldap_init" != x""yes; then
1833 oLIBS=$LIBS
1834 LIBS="$LIBPTHREADS"
1835 AC_CHECK_LIB(ldap60, ldap_init, [LDAPLIB="-lldap60"])
1836 LIBS="$LDAPLIB $LIBPTHREADS"
1837 AC_CHECK_LIB(prldap60, prldap_init, [LDAPLIB="-lprldap60 $LDAPLIB"])
1838 LIBS="$LDAPLIB $LIBPTHREADS"
1839 AC_CHECK_LIB(ssldap60, ldapssl_init, [LDAPLIB="-lssldap60 $LDAPLIB"])
1840 LIBS=$oLIBS
1841 fi
1842
1843 AC_CHECK_HEADERS(ldap.h lber.h)
1844 AC_CHECK_HEADERS(mozldap/ldap.h)
1845
1846 dnl
1847 dnl Check for LDAP_OPT_DEBUG_LEVEL
1848 dnl
1849 AC_MSG_CHECKING([for LDAP_OPT_DEBUG_LEVEL])
1850 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1851 # include <ldap.h>
1852 ]],[[
1853 int i=LDAP_OPT_DEBUG_LEVEL
1854 ]])],
1855 [ AC_MSG_RESULT(yes) ],
1856 [ AC_MSG_RESULT(no) ])
1857
1858 dnl
1859 dnl Check for working ldap
1860 dnl
1861 oLIBS=$LIBS
1862 LIBS="$LDAPLIB $LBERLIB $LIBPTHREADS"
1863 AC_MSG_CHECKING([for working ldap])
1864 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1865 # define LDAP_DEPRECATED 1
1866 # if HAVE_LDAP_H
1867 # include <ldap.h>
1868 # elif HAVE_MOZLDAP_LDAP_H
1869 # include <mozldap/ldap.h>
1870 # endif
1871 int
1872 main(void)
1873 {
1874 char host[]="";
1875 int port;
1876
1877 ldap_init((const char *)&host, port);
1878
1879 return 0;
1880 }
1881 ]])],
1882 [ AC_DEFINE(HAVE_LDAP, 1, [LDAP support])
1883 AC_MSG_RESULT(yes) ],
1884 [ AC_MSG_RESULT(no) ],
1885 [ AC_MSG_RESULT(cross-compiler cant tell) ])
1886 LIBS=$oLIBS
1887
1888 dnl
1889 dnl Check for ldap vendor
1890 dnl
1891 AC_MSG_CHECKING([for OpenLDAP])
1892 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1893 # if HAVE_LDAP_H
1894 # include <ldap.h>
1895 # endif
1896 # include <string.h>
1897 int
1898 main(void)
1899 {
1900 return strcmp(LDAP_VENDOR_NAME,"OpenLDAP");
1901 }
1902 ]])],
1903 [ AC_DEFINE(HAVE_OPENLDAP, 1, [OpenLDAP support])
1904 AC_MSG_RESULT(yes) ],
1905 [ AC_MSG_RESULT(no) ],
1906 [ AC_MSG_RESULT(cross-compiler cant tell) ])
1907
1908 AC_MSG_CHECKING([for Sun LDAP SDK])
1909 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1910 # if HAVE_LDAP_H
1911 # include <ldap.h>
1912 # endif
1913 # include <string.h>
1914 int
1915 main(void)
1916 {
1917 return strcmp(LDAP_VENDOR_NAME,"Sun Microsystems Inc.");
1918 }
1919 ]])],
1920 [ AC_DEFINE(HAVE_SUN_LDAP_SDK, 1, [Sun LDAP SDK support])
1921 AC_MSG_RESULT(yes) ],
1922 [ AC_MSG_RESULT(no) ],
1923 [ AC_MSG_RESULT(cross-compiler cant tell) ])
1924
1925 AC_MSG_CHECKING([for Mozilla LDAP SDK])
1926 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1927 # if HAVE_LDAP_H
1928 # include <ldap.h>
1929 # elif HAVE_MOZLDAP_LDAP_H
1930 # include <mozldap/ldap.h>
1931 # endif
1932 # include <string.h>
1933 int
1934 main(void)
1935 {
1936 return strcmp(LDAP_VENDOR_NAME,"mozilla.org");
1937 }
1938 ]])],
1939 [ AC_DEFINE(HAVE_MOZILLA_LDAP_SDK, 1, [Mozilla LDAP SDK support])
1940 AC_MSG_RESULT(yes) ],
1941 [ AC_MSG_RESULT(no)],
1942 [ AC_MSG_RESULT(cross-compiler cant tell) ])
1943
1944 dnl
1945 dnl Check for LDAP_REBINDPROC_CALLBACK
1946 dnl
1947 AC_MSG_CHECKING([for LDAP_REBINDPROC_CALLBACK])
1948 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1949 # if HAVE_LDAP_H
1950 # include <ldap.h>
1951 # elif HAVE_MOZLDAP_LDAP_H
1952 # include <mozldap/ldap.h>
1953 # endif
1954 ]],[[
1955 LDAP_REBINDPROC_CALLBACK ldap_rebind;
1956 ]])],
1957 [ AC_DEFINE(HAVE_LDAP_REBINDPROC_CALLBACK,1,[Define to 1 if you have LDAP_REBINDPROC_CALLBACK])
1958 AC_MSG_RESULT(yes) ],
1959 [ AC_MSG_RESULT(no) ])
1960
1961 dnl
1962 dnl Check for LDAP_REBIND_PROC
1963 dnl
1964 AC_MSG_CHECKING([for LDAP_REBIND_PROC])
1965 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1966 # if HAVE_LDAP_H
1967 # include <ldap.h>
1968 # elif HAVE_MOZLDAP_LDAP_H
1969 # include <mozldap/ldap.h>
1970 # endif
1971 ]],[[
1972 LDAP_REBIND_PROC ldap_rebind;
1973 ]])],
1974 [ AC_DEFINE(HAVE_LDAP_REBIND_PROC,1,[Define to 1 if you have LDAP_REBIND_PROC])
1975 AC_MSG_RESULT(yes) ],
1976 [ AC_MSG_RESULT(no) ])
1977
1978 dnl
1979 dnl Check for LDAP_REBIND_FUNCTION
1980 dnl
1981 AC_MSG_CHECKING([for LDAP_REBIND_FUNCTION])
1982 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1983 # define LDAP_REFERRALS
1984 # if HAVE_LDAP_H
1985 # include <ldap.h>
1986 # elif HAVE_MOZLDAP_LDAP_H
1987 # include <mozldap/ldap.h>
1988 # endif
1989 ]],[[
1990 LDAP_REBIND_FUNCTION ldap_rebind;
1991 ]])],
1992 [ AC_DEFINE(HAVE_LDAP_REBIND_FUNCTION,1,[Define to 1 if you have LDAP_REBIND_FUNCTION])
1993 AC_MSG_RESULT(yes) ],
1994 [ AC_MSG_RESULT(no) ])
1995
1996 dnl
1997 dnl Check for LDAP_SCOPE_DEFAULT
1998 dnl
1999 AC_MSG_CHECKING([for LDAP_SCOPE_DEFAULT])
2000 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2001 # if HAVE_LDAP_H
2002 # include <ldap.h>
2003 # elif HAVE_MOZLDAP_LDAP_H
2004 # include <mozldap/ldap.h>
2005 # endif
2006 ]],[[
2007 int i=LDAP_SCOPE_DEFAULT;
2008 ]])],
2009 [ AC_DEFINE(HAVE_LDAP_SCOPE_DEFAULT,1,[Define to 1 if you have LDAP_SCOPE_DEFAULT])
2010 AC_MSG_RESULT(yes) ],
2011 [ AC_MSG_RESULT(no) ])
2012
2013 dnl
2014 dnl Check for ldap_url_desc.lud_scheme
2015 dnl
2016 AC_CHECK_MEMBER(struct ldap_url_desc.lud_scheme,
2017 AC_DEFINE(HAVE_LDAP_URL_LUD_SCHEME,1,
2018 [Define to 1 if you have LDAPURLDesc.lud_scheme]),,[#include <ldap.h>])
2019
2020 dnl
2021 dnl Check for ldapssl_client_init
2022 dnl
2023 AC_CHECK_LIB(ldap,ldapssl_client_init,
2024 AC_DEFINE(HAVE_LDAPSSL_CLIENT_INIT,1,[Define to 1 if you have ldapssl_client_init]),)
2025
2026 dnl
2027 dnl Check for ldap_url_desc2str
2028 dnl
2029 AC_CHECK_LIB(ldap,ldap_url_desc2str,
2030 AC_DEFINE(HAVE_LDAP_URL_DESC2STR,1,[Define to 1 if you have ldap_url_desc2str]),)
2031
2032 dnl
2033 dnl Check for ldap_url_parse
2034 dnl
2035 AC_CHECK_LIB(ldap,ldap_url_parse,
2036 AC_DEFINE(HAVE_LDAP_URL_PARSE,1,[Define to 1 if you have ldap_url_parse]),)
2037
2038 dnl
2039 dnl Check for ldap_start_tls_s
2040 dnl
2041 AC_CHECK_LIB(ldap,ldap_start_tls_s,
2042 AC_DEFINE(HAVE_LDAP_START_TLS_S,1,[Define to 1 if you have ldap_start_tls_s]),)
2043 ;;
2044 esac
2045
2046 AC_SUBST(LDAPLIB)
2047 AC_SUBST(LBERLIB)
2048
2049 AC_ARG_ENABLE(forw-via-db,
2050 AS_HELP_STRING([--enable-forw-via-db],[Enable Forw/Via database]), [
2051 SQUID_YESNO([$enableval],[unrecognized argument to --enable-forw-via-db: $enableval])
2052 ])
2053 SQUID_DEFINE_BOOL(USE_FORW_VIA_DB,${enable_forw_via_db:=no},
2054 [Enable Forw/Via database])
2055 AC_MSG_NOTICE([Forw/Via database enabled: $enable_forw_via_db])
2056
2057 AC_ARG_ENABLE(cache-digests,
2058 AS_HELP_STRING([--enable-cache-digests],
2059 [Use Cache Digests. See http://wiki.squid-cache.org/SquidFaq/CacheDigests]),
2060 [
2061 SQUID_YESNO($enableval,
2062 [unrecognized argument to --enable-cache-digests: $enableval])
2063 ])
2064 SQUID_DEFINE_BOOL(USE_CACHE_DIGESTS,${enable_cache_digests:=no},
2065 [Use Cache Digests for locating objects in neighbor caches.])
2066 AC_MSG_NOTICE([Cache Digests enabled: $enable_cache_digests])
2067
2068
2069 ################################
2070 # check for netio plugin stuff #
2071 ################################
2072 dnl order of these options handling is relevant in case the user
2073 dnl supplies more than one --enable option. Options handled later
2074 dnl override those handled earlier for io loop method manual override
2075 AC_ARG_ENABLE(select,
2076 AS_HELP_STRING([--disable-select],[Disable select(2) support.]),
2077 [
2078 SQUID_YESNO($enableval,[--disable-select takes no extra argument])
2079 if test "x$enableval" = "xyes"; then
2080 if test "x$squid_host_os" = "xmingw"; then
2081 squid_opt_io_loop_engine="select_win32"
2082 else
2083 squid_opt_io_loop_engine="select"
2084 fi
2085 fi
2086 ])
2087 AC_MSG_NOTICE([enabling select syscall for net I/O: ${enable_select:=auto}])
2088
2089 AC_ARG_ENABLE(poll,
2090 AS_HELP_STRING([--disable-poll],[Disable poll(2) support.]),
2091 [
2092 SQUID_YESNO($enableval,[--disable-poll takes no extra argument])
2093 test "x$enableval" = "xyes" && squid_opt_io_loop_engine="poll"
2094 ])
2095 AC_MSG_NOTICE([enabling poll syscall for net I/O: ${enable_poll:=auto}])
2096
2097 AC_ARG_ENABLE(kqueue,
2098 AS_HELP_STRING([--disable-kqueue],
2099 [Disable kqueue(2) support.]), [
2100 SQUID_YESNO($enableval,[--enable-kqueue takes no extra argument])
2101 ])
2102 if test "x${enable_kqueue:=auto}" != "xno" ; then
2103 AC_CHECK_HEADERS([sys/event.h],[],[
2104 if test "x${enable_kqueue}" = "xyes" ; then
2105 AC_MSG_ERROR([kqueue support requires sys/event.h header file.])
2106 fi
2107 ])
2108 AC_CHECK_FUNCS(kqueue,[],[
2109 if test "x${enable_kqueue}" = "xyes" ; then
2110 AC_MSG_ERROR([kqueue support missing in libc library.])
2111 fi
2112 ])
2113 if test "x$ac_cv_func_kqueue" = "xyes" -a "x$ac_cv_header_sys_event_h" = "xyes" ; then
2114 squid_opt_io_loop_engine="kqueue"
2115 else
2116 enable_kqueue="no"
2117 fi
2118 fi
2119 AC_MSG_NOTICE([enabling kqueue for net I/O: ${enable_kqueue:=auto}])
2120
2121 dnl Enable epoll()
2122 AC_ARG_ENABLE(epoll,
2123 AS_HELP_STRING([--disable-epoll],[Disable Linux epoll(2) support.]),
2124 [
2125 SQUID_YESNO($enableval,[--disable-epoll takes no extra argument])
2126 test "x$enableval" = "xyes" && squid_opt_io_loop_engine="epoll"
2127 ])
2128 AC_MSG_NOTICE([enabling epoll syscall for net I/O: ${enable_epoll:=auto}])
2129
2130 # auto-detect and verify epoll header and library present and working
2131 # logic mapping and loop method selection are performed later
2132 if test "x$enable_epoll" != "xno" ; then
2133
2134 # check if libs are needed to support epoll
2135 # note: this code block seems quite generic. Could it be extracted
2136 # into a squid specific configure function?
2137 SQUID_STATE_SAVE(squid_epoll_state)
2138 AC_SEARCH_LIBS(epoll_ctl,[epoll])
2139 if test "x$ac_cv_search_epoll_ctl" = "xno" ; then
2140 enable_epoll=no #disable. Needed code not found
2141 elif test "x$ac_cv_search_epoll_ctl" = "xnone required" ; then
2142 EPOLL_LIBS=""
2143 else
2144 EPOLL_LIBS=$ac_cv_search_epoll_ctl
2145 fi
2146 AC_SUBST(EPOLL_LIBS)
2147 SQUID_STATE_ROLLBACK(squid_epoll_state) #de-pollute LIBS
2148
2149 # epoll requires sys/epoll.h
2150 AC_CHECK_HEADERS([sys/epoll.h])
2151
2152 dnl Verify that epoll really works
2153 if test "x$ac_cv_search_epoll_ctl" != 'xno' ; then
2154 SQUID_CHECK_EPOLL
2155 fi
2156
2157 if test "x$enable_epoll" = "xyes" -a "x$squid_cv_epoll_works" = "xno" ; then
2158 AC_MSG_ERROR([Epoll does not work. Force-enabling it is not going to help.])
2159 fi
2160 fi
2161
2162 dnl Enable /dev/poll
2163 AC_ARG_ENABLE(devpoll,
2164 AS_HELP_STRING([--disable-devpoll],[Disable Solaris /dev/poll support.]),
2165 [
2166 SQUID_YESNO($enableval,[--disable-devpoll takes no extra argument])
2167 test "x$enableval" = "xyes" && squid_opt_io_loop_engine="devpoll"
2168 ])
2169 AC_MSG_NOTICE([enabling /dev/poll for net I/O: ${enable_devpoll:=auto}])
2170
2171 ## auto-detect and verify devpoll header and library present and working
2172 if test "x$enable_devpoll" != "xno"; then
2173
2174 # /dev/poll requires ioctl() and write()
2175 AC_CHECK_FUNCS(ioctl)
2176 AC_CHECK_FUNCS(write)
2177
2178 # /dev/poll requires sys/devpoll.h
2179 AC_CHECK_HEADERS([sys/devpoll.h],,[
2180 if test "x$enable_devpoll" = "xyes"; then
2181 AC_MSG_ERROR([--enable-devpoll specified but /dev/poll headers not found])
2182 fi
2183 enable_devpoll=no])
2184
2185 # Verify that /dev/poll really works
2186 if test "x$enable_devpoll" != 'xno' ; then
2187 SQUID_CHECK_DEVPOLL
2188 fi
2189
2190 if test "x$enable_devpoll" = "xyes" -a "x$squid_cv_devpoll_works" = "xno" ; then
2191 AC_MSG_ERROR([/dev/poll does not work. Force-enabling it is not going to help.])
2192 fi
2193 fi
2194
2195
2196 AC_ARG_ENABLE(http-violations,
2197 AS_HELP_STRING([--disable-http-violations],
2198 [This allows you to remove code which is known to
2199 violate the HTTP protocol specification.]), [
2200 SQUID_YESNO([$enableval],
2201 [unrecognized argument to --disable-http-violations: $enableval])
2202 ])
2203 SQUID_DEFINE_BOOL(USE_HTTP_VIOLATIONS, ${enable_http_violations:=yes},
2204 [Define to enable code which volates the HTTP standard specification])
2205 AC_MSG_NOTICE([HTTP violations support enabled: $enable_http_violations])
2206
2207 # IPFW Transparent Proxy
2208 AC_ARG_ENABLE(ipfw-transparent,
2209 AS_HELP_STRING([--enable-ipfw-transparent],
2210 [Enable Transparent Proxy support for systems
2211 using FreeBSD IPFW-style firewalling.]), [
2212 SQUID_YESNO([$enableval],
2213 [unrecognized argument to --enable-ipfw-transparent: $enableval])
2214 ])
2215 SQUID_DEFINE_BOOL(IPFW_TRANSPARENT,${enable_ipfw_transparent:=no},
2216 [Enable support for Transparent Proxy on systems using FreeBSD IPFW-style firewalling.])
2217 AC_MSG_NOTICE([FreeBSD IPFW-based transparent proxying enabled: $enable_ipfw_transparent])
2218
2219 # IP-Filter Transparent Proxy
2220 AC_ARG_ENABLE(ipf-transparent,
2221 AS_HELP_STRING([--enable-ipf-transparent],
2222 [Enable Transparent Proxy support using IPFilter-style firewalling]), [
2223 SQUID_YESNO([$enableval],
2224 [unrecognized argument to --enable-ipf-transparent: $enableval])
2225 ])
2226 #will be AC_DEFINEd later, after checking for appropriate infrastructure
2227 #IPF currently broken. Default-disabled for now.
2228 AC_MSG_NOTICE([IPF-based transparent proxying requested: ${enable_ipf_transparent:=no}])
2229
2230 dnl Enable PF Transparent Proxy
2231 AC_ARG_ENABLE(pf-transparent,
2232 AS_HELP_STRING([--enable-pf-transparent],
2233 [Enable Transparent Proxy support for systems using PF network address redirection.]), [
2234 SQUID_YESNO([$enableval],
2235 [unrecognized argument to --enable-pf-transparent: $enableval])
2236 ])
2237 #will be AC_DEFINEd later, after checking for appropriate infrastructure
2238 AC_MSG_NOTICE([PF-based transparent proxying requested: ${enable_pf_transparent:=no}])
2239
2240 dnl Enable /dev/pf support for older PF Transparent Proxy systems (OpenBSD 4.x and older)
2241 AC_ARG_WITH(nat-devpf,
2242 AS_HELP_STRING([--with-nat-devpf],
2243 [Enable /dev/pf support for NAT on older OpenBSD and FreeBSD kernels.]), [
2244 SQUID_YESNO([$enableval],
2245 [unrecognized argument to --with-nat-devpf: $enableval])
2246 ])
2247 #will be AC_DEFINEd later, after checking for appropriate infrastructure
2248 AC_MSG_NOTICE([NAT lookups via /dev/pf: ${with_nat_devpf:=no}])
2249
2250 # Linux Netfilter Transparent Proxy
2251 AC_ARG_ENABLE(linux-netfilter,
2252 AS_HELP_STRING([--enable-linux-netfilter],
2253 [Enable Transparent Proxy support for Linux (Netfilter)]), [
2254 SQUID_YESNO([$enableval],
2255 [unrecognized argument to --enable-linux-netfilter: $enableval])
2256 ])
2257 AC_MSG_NOTICE([Linux Netfilter support requested: ${enable_linux_netfilter:=auto}])
2258 #will be AC_DEFINEd later, after checking for appropriate infrastructure
2259
2260
2261 dnl Look for libnetfilter_conntrack options (needed for QOS netfilter marking)
2262 dnl squid_opt_netfilterconntrack is set only when option is explicity specified
2263 AC_ARG_WITH(netfilter-conntrack,
2264 AS_HELP_STRING([--without-netfilter-conntrack],
2265 [Do not use Netfilter conntrack libraries for packet marking.
2266 A path to alternative library location may be specified by
2267 using --with-netfilter-conntrack=PATH. Default: auto-detect.]), [
2268 case "$with_netfilter_conntrack" in
2269 yes|no)
2270 squid_opt_netfilterconntrack=$with_netfilter_conntrack
2271 ;;
2272 *)
2273 if test ! -d "$withval" ; then
2274 AC_MSG_ERROR([--without-netfilter-conntrack path does not point to a directory])
2275 fi
2276 squid_opt_netfilterconntrackpath=$withval
2277 LDFLAGS="-L$squid_opt_netfilterconntrackpath/lib $LDFLAGS"
2278 CPPFLAGS="-I$squid_opt_netfilterconntrackpath/include $CPPFLAGS"
2279 with_netfilter_conntrack=yes
2280 squid_opt_netfilterconntrack=yes
2281 esac
2282 ])
2283 AC_MSG_NOTICE([Linux Netfilter Conntrack support requested: ${with_netfilter_conntrack:=auto}])
2284 if test "x$with_netfilter_conntrack" != "xno"; then
2285 AC_SEARCH_LIBS([nfct_query], [netfilter_conntrack],,[
2286 if test x"$with_netfilter_conntrack" = "xyes"; then
2287 AC_MSG_ERROR([--with-netfilter-conntrack specified but libnetfilter-conntrack library not found])
2288 fi
2289 with_netfilter_conntrack=no])
2290 AC_CHECK_HEADERS([libnetfilter_conntrack/libnetfilter_conntrack.h \
2291 libnetfilter_conntrack/libnetfilter_conntrack_tcp.h],,[
2292 if test x"$with_netfilter_conntrack" = "xyes"; then
2293 AC_MSG_ERROR([--with-netfilter-conntrack specified but libnetfilter-conntrack headers not found])
2294 fi
2295 with_netfilter_conntrack=no])
2296 # If nothing is broken; enable the libraries usage.
2297 if test "x$with_netfilter_conntrack" != "xno"; then
2298 with_netfilter_conntrack=yes
2299 fi
2300 fi
2301
2302
2303 dnl Enable Large file support
2304 buildmodel=""
2305 squid_opt_enable_large_files=no
2306
2307 AC_ARG_WITH(large-files,
2308 AS_HELP_STRING([--with-large-files],[Enable support for large files (logs etc).]), [
2309 if test "x$withval" = "xyes"; then
2310 squid_opt_enable_large_files=yes
2311 fi
2312 ])
2313
2314 dnl UNIX Build environment
2315 dnl AS_HELP_STRING is not suited here because it cannot to specify newlines
2316 AC_ARG_WITH(build-environment,
2317 AS_HELP_STRING([--with-build-environment=model],
2318 [The build environment to use. Normally one of
2319 POSIX_V6_ILP32_OFF32 (32 bits),
2320 POSIX_V6_ILP32_OFFBIG (32 bits with large file support),
2321 POSIX_V6_LP64_OFF64 (64 bits),
2322 POSIX_V6_LPBIG_OFFBIG (large pointers and files),
2323 XBS5_ILP32_OFF32 i(legacy, 32 bits),
2324 XBS5_ILP32_OFFBIG (legacy, 32 bits with large file support),
2325 XBS5_LP64_OFF64 (legacy, 64 bits),
2326 XBS5_LPBIG_OFFBIG (legacy, large pointers and files)
2327 or default (The default for your OS)]), [
2328 case "$withval" in
2329 yes|no)
2330 AC_MSG_FAILURE([--with-build-environment expects a build environment string as used by getconf])
2331 ;;
2332 *)
2333 buildmodel="$withval"
2334 ;;
2335 esac
2336 ])
2337
2338 #hack. Let's early-detect sizeof(long)
2339 AC_CHECK_SIZEOF(long)
2340
2341 if test "x$squid_opt_enable_large_files" = "xyes" -a "x$buildmodel" = "x"; then
2342 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
2343 if test "`getconf _$model 2>/dev/null || true`" = 1 || test "`getconf $model 2>/dev/null || true`" ; then
2344 buildmodel=$model
2345 break
2346 fi
2347 done
2348 if test "x$buildmodel" = "x"; then
2349 AC_MSG_WARN([No suitable build environment found for large files. Trying to use _FILE_OFFSET_BITS=64])
2350 fi
2351 fi
2352 if test "x$buildmodel" = "xdefault" -o "x$buildmodel" = "x"; then
2353 # define _FILE_OFFSET_BITS if requested and needed
2354 if test "x$squid_opt_enable_large_files" = "xyes" -a $ac_cv_sizeof_long -le 4 ; then
2355 AC_MSG_NOTICE([Enabling -D_FILE_OFFSET_BITS=64])
2356 CFLAGS="-D_FILE_OFFSET_BITS=64 $CFLAGS"
2357 CXXFLAGS="-D_FILE_OFFSET_BITS=64 $CXXFLAGS"
2358 fi
2359 else
2360 AC_MSG_NOTICE([Using $buildmodel build environment])
2361 if test "`getconf _$buildmodel 2>/dev/null || true`" = 1 || test "`getconf $buildmodel 2>/dev/null || true`" ; then
2362 : # All fine
2363 else
2364 AC_MSG_ERROR(Build environment $buildmodel not known to getconf.)
2365 fi
2366 CFLAGS="`getconf ${buildmodel}_CFLAGS` $CFLAGS"
2367 CXXFLAGS="`getconf ${buildmodel}_CFLAGS` $CXXFLAGS"
2368 LIBS="`getconf ${buildmodel}_LIBS` $LIBS"
2369 LDFLAGS="`getconf ${buildmodel}_LDFLAGS` $LDFLAGS"
2370 if test "x$squid_host_os" = "xsolaris" ; then
2371
2372 # On Solaris getconf returns for CFLAGS -xarch=generic64, -Xa and -Usun options, and
2373 # for LDFLAGS -xarch=generic64, but:
2374 # "-Xa" is supported only by Sun cc, so we need to remove it when using gcc
2375 # For gcc "-xarch=generic64" must be replaced with "-m64"
2376 # The 'sun' define is needed by ipfilter includes, so we must remove "-Usun"
2377 if test "x$GCC" = "xyes"; then
2378 AC_MSG_NOTICE([Removing -Xa for gcc/g++ on $host])
2379 CFLAGS="`echo $CFLAGS | sed -e 's/-Xa//'`"
2380 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Xa//'`"
2381 AC_MSG_NOTICE([Replacing -xarch=generic64 with -m64 for gcc/g++ on $host])
2382 CFLAGS="`echo $CFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
2383 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
2384 LDFLAGS="`echo $LDFLAGS | sed -e 's/-xarch=generic64//'`"
2385 fi
2386 AC_MSG_NOTICE([Removing -Usun on $host])
2387 CFLAGS="`echo $CFLAGS | sed -e 's/-Usun//'`"
2388 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Usun//'`"
2389 fi
2390 fi
2391
2392 dnl Enable Leak Finding Functions
2393 AC_ARG_ENABLE(leakfinder,
2394 AS_HELP_STRING([--enable-leakfinder],
2395 [Enable Leak Finding code. Enabling this alone does nothing;
2396 you also have to modify the source code to use the leak
2397 finding functions. Probably Useful for hackers only.]), [
2398 SQUID_YESNO([$enableval],
2399 [unrecognized argument to --enable-leakfinder: $enableval])
2400 ])
2401 AC_MSG_NOTICE([Leak Finder enabled: ${enable_leakfinder:=no}])
2402 SQUID_DEFINE_BOOL(USE_LEAKFINDER,$enable_leakfinder,
2403 [Enable code for assisting in finding memory leaks. Not for the faint of heart])
2404 AM_CONDITIONAL(MAKE_LEAKFINDER, [test "x$enable_leakfinder" = "xyes"])
2405
2406
2407 AC_ARG_ENABLE(follow-x-forwarded-for,
2408 AS_HELP_STRING([--enable-follow-x-forwarded-for],
2409 [Enable support for following the X-Forwarded-For
2410 HTTP header to try to find the IP address of the
2411 original or indirect client when a request has
2412 been forwarded through other proxies.]), [
2413 SQUID_YESNO([$enableval],
2414 [unrecognized argument to --enable-follow-x-forwarded-for: $enableval])
2415 ])
2416 AC_MSG_NOTICE([Support for X-Forwarded-For enabled: ${enable_follow_x_forwarded_for:=yes}])
2417 SQUID_DEFINE_BOOL(FOLLOW_X_FORWARDED_FOR,$enable_follow_x_forwarded_for,
2418 [Enable following X-Forwarded-For headers])
2419
2420 AC_ARG_ENABLE(ident-lookups,
2421 AS_HELP_STRING([--disable-ident-lookups],
2422 [Remove code that supports performing Ident (RFC 931) lookups.]), [
2423 SQUID_YESNO([$enableval],[unrecognized argument to --disable-ident-lookups: $enableval])
2424 ])
2425 AC_MSG_NOTICE([Support for Ident lookups enabled: ${enable_ident_lookups:=yes}])
2426 SQUID_DEFINE_BOOL(USE_IDENT,$enable_ident_lookups,[Support for Ident (RFC 931) lookups])
2427
2428 AM_CONDITIONAL(USE_SSL_CRTD, false)
2429 AC_ARG_ENABLE(ssl-crtd,
2430 AC_HELP_STRING([--enable-ssl-crtd],
2431 [Prevent Squid from directly generation of SSL private key and
2432 certificate request and instead enables the ssl_crtd processes.]), [
2433 SQUID_YESNO([$enableval],
2434 [unrecogized argument to --enable-ssl-crtd: $enableval])
2435 ])
2436
2437 if test "x$enable_ssl_crtd" = "xyes" -a "x$with_openssl" = "xno" ; then
2438 AC_MSG_ERROR([You need to enable ssl gatewaying support to use ssl_crtd feature. Try to use --with-openssl. ])
2439 fi
2440 SQUID_DEFINE_BOOL(USE_SSL_CRTD, ${enable_ssl_crtd:=no},[Use ssl_crtd daemon])
2441 AM_CONDITIONAL(USE_SSL_CRTD, [test "x$enable_ssl_crtd" = "xyes"])
2442
2443 dnl Select Default hosts file location
2444 AC_ARG_ENABLE(default-hostsfile,
2445 AS_HELP_STRING([--enable-default-hostsfile=path],
2446 [Select default location for hosts file.
2447 See hosts_file directive in squid.conf for details]), [
2448 if test "x$enableval" != "xnone" -a "x$enableval" != "xno" ; then
2449 if test \! -f "$enableval"; then
2450 AC_MSG_WARN([Unable to find file $enableval. I hope you know what you are doing.])
2451 fi
2452 squid_opt_default_hosts=$enableval
2453 else
2454 squid_opt_default_hosts="none"
2455 fi
2456 ])
2457 AC_MSG_NOTICE([Default hosts file set to: ${squid_opt_default_hosts:=/etc/hosts}])
2458 DEFAULT_HOSTS=$squid_opt_default_hosts
2459 AC_SUBST(DEFAULT_HOSTS)
2460
2461 # Select auth schemes modules to build
2462 AC_ARG_ENABLE(auth,
2463 AS_HELP_STRING([--enable-auth],
2464 [Build global support for authentication. The list of schemes
2465 and helpers to be enabled is defined elsewhere]), [
2466 SQUID_YESNO([$enableval],
2467 [unrecognized argument to --enable-auth: $enableval])
2468 ])
2469 AC_MSG_NOTICE([Authentication support enabled: ${enable_auth:=yes}])
2470 SQUID_DEFINE_BOOL(USE_AUTH,$enable_auth,[Enable support for authentication])
2471 AM_CONDITIONAL(ENABLE_AUTH, test "x$enable_auth" != "xno")
2472 AUTH_MODULES=""
2473
2474 AC_ARG_ENABLE(auth-basic,
2475 AS_HELP_STRING([--enable-auth-basic="list of helpers"],
2476 [Enable the basic authentication scheme, and build the specified helpers.
2477 Not providing an explicit list of helpers will attempt build of
2478 all possible helpers. Default is to do so.
2479 To disable the basic authentication scheme, use --disable-auth-basic.
2480 To enable but build no helpers, specify "none".
2481 To see available helpers, see the helpers/basic_auth directory. ]),[
2482 #nothing to do really
2483 ])
2484 m4_include([helpers/basic_auth/modules.m4])
2485
2486 AC_ARG_ENABLE(auth-digest,
2487 AS_HELP_STRING([--enable-auth-digest="list of helpers"],
2488 [Enable the Digest authentication scheme, and build the specified helpers.
2489 Not providing an explicit list of helpers will attempt build of
2490 all possible helpers. Default is to do so.
2491 To disable the Digest authentication scheme, use --disable-auth-digest.
2492 To enable but build no helpers, specify "none".
2493 To see available helpers, see the helpers/digest_auth directory. ]),[
2494 #nothing to do, really
2495 ])
2496 m4_include([helpers/digest_auth/modules.m4])
2497
2498 AC_ARG_ENABLE(auth-negotiate,
2499 AS_HELP_STRING([--enable-auth-negotiate="list of helpers"],
2500 [Enable the Negotiate authentication scheme, and build the specified
2501 helpers.
2502 Not providing an explicit list of helpers will attempt build of
2503 all possible helpers. Default is to do so.
2504 To disable the Negotiate authentication scheme,
2505 use --disable-auth-negotiate.
2506 To enable but build no helpers, specify "none".
2507 To see available helpers, see the helpers/negotiate_auth directory. ]),[
2508 #nothing to do, really
2509 ])
2510 m4_include([helpers/negotiate_auth/modules.m4])
2511
2512 AC_ARG_ENABLE(auth-ntlm,
2513 AS_HELP_STRING([--enable-auth-ntlm="list of helpers"],
2514 [Enable the NTLM authentication scheme, and build the specified helpers.
2515 Not providing an explicit list of helpers will attempt build of
2516 all possible helpers. Default is to do so.
2517 To disable the NTLM authentication scheme, use --disable-auth-ntlm.
2518 To enable but build no helpers, specify "none".
2519 To see available helpers, see the helpers/ntlm_auth directory. ]),[
2520 ])
2521 m4_include([helpers/ntlm_auth/modules.m4])
2522
2523 dnl Authentication libraries to build
2524 dnl This list will not be needed when each auth library has its own Makefile
2525 dnl this is to be placed AFTER each auth module's handler
2526 AUTH_LIBS_TO_BUILD=
2527 for module in $AUTH_MODULES; do
2528 AUTH_LIBS_TO_BUILD="$AUTH_LIBS_TO_BUILD ${module}/lib${module}.la"
2529 done
2530 AC_SUBST(AUTH_MODULES)
2531 AC_SUBST(AUTH_LIBS_TO_BUILD)
2532
2533 dnl Select logging daemon helpers to build
2534 AC_ARG_ENABLE(log-daemon-helpers,
2535 AS_HELP_STRING([--enable-log-daemon-helpers="list of helpers"],
2536 [This option selects which logging daemon helpers to
2537 build and install as part of the normal build process
2538 For a list of available helpers see the helpers/log_daemon
2539 directory.]),[
2540 #nothing to do, really
2541 ])
2542 m4_include([helpers/log_daemon/modules.m4])
2543
2544 AC_ARG_ENABLE(external-acl-helpers,
2545 AS_HELP_STRING([--enable-external-acl-helpers="list of helpers"],
2546 [Enable external_acl helpers support and thelpers themselves.
2547 Default is to build all buildable helpers and enable support.
2548 To disable support, use --disable-external-acl-helpers.
2549 To build no helpers, specify "none".
2550 To see available helpers, see the helpers/external_acl
2551 directory]), [
2552 #nothing to do, really
2553 ])
2554 m4_include([helpers/external_acl/modules.m4])
2555
2556 dnl Select url_rewrite helpers to build
2557 AC_ARG_ENABLE(url-rewrite-helpers,
2558 AS_HELP_STRING([--enable-url-rewrite-helpers="list of helpers"],
2559 [This option selects which url_rewrite helpers to
2560 build and install as part of the normal build
2561 process. The default is to attempt the build of all possible
2562 helpers. Use --disable-url-rewrite-helpers to build none.
2563 For a list of available helpers see the
2564 helpers/url_rewrite directory.]),[
2565 ])
2566 m4_include([helpers/url_rewrite/modules.m4])
2567
2568 dnl Select storeid_rewrite helpers to build
2569 AC_ARG_ENABLE(storeid-rewrite-helpers,
2570 AS_HELP_STRING([--enable-storeid-rewrite-helpers="list of helpers"],
2571 [This option selects which Store-ID rewrite helpers to
2572 build and install as part of the normal build
2573 process. The default is to attempt the build of all possible
2574 helpers. Use --disable-storeid-rewrite-helpers to build none.
2575 For a list of available helpers see the
2576 helpers/storeid_rewrite directory.]),[
2577 ])
2578 m4_include([helpers/storeid_rewrite/modules.m4])
2579
2580 AC_ARG_WITH(valgrind-debug,
2581 AS_HELP_STRING([--with-valgrind-debug],
2582 [Include debug instrumentation for use with valgrind]),
2583 [
2584 SQUID_YESNO([$withval],
2585 [unrecognized argument to --with-valgrind-debug: $withval])
2586 if test "x$withval" != "xno" ; then
2587 AC_CHECK_HEADERS(valgrind/memcheck.h,[],[
2588 AC_MSG_ERROR([Valgrind support requested, needed headers not found.])
2589 ])
2590 fi
2591 ])
2592 SQUID_DEFINE_BOOL(WITH_VALGRIND,${with_valgrind_debug:=no},
2593 [Valgrind memory debugger support])
2594 AC_MSG_NOTICE([Valgrind debug support enabled: $with_valgrind_debug])
2595
2596 dnl Disable "memPools" code
2597 #AC_ARG_ENABLE(chunkedmempools,
2598 # AS_HELP_STRING([--enable-chunkedmempools],
2599 # [Enable experimental chunked memPools. Note that this option
2600 # simply sets the default behaviour. Specific classes can override this
2601 # at runtime, and only lib/MemPool.c needs to be altered
2602 # to change the squid-wide default for all classes.]), [
2603 #SQUID_YESNO([$enableval],
2604 # [--enable-chunkedmempools option takes no arguments])
2605 #])
2606 SQUID_DEFINE_BOOL(USE_CHUNKEDMEMPOOLS,${enable_chunkedmempools:=no},
2607 [Enable chunked Memory Pools support (experimental)])
2608 #AC_MSG_NOTICE([Chunked MemPools enabled: $enable_chunkedmempools])
2609
2610 dnl Enable WIN32 Service compile mode
2611 AC_ARG_ENABLE(win32-service,
2612 AS_HELP_STRING([--enable-win32-service],
2613 [Compile Squid as a WIN32 Service.
2614 Works only on MS-Windows platforms]), [
2615 SQUID_YESNO([$enableval],
2616 [unrecognized argument to --enable-win32-service: $enableval])
2617 ])
2618 SQUID_DEFINE_BOOL(USE_WIN32_SERVICE,${enable_win32_service:=no},
2619 [Enable code supporting MS Windows service mode])
2620 AC_MSG_NOTICE([MS Windows service mode enabled: $enable_win32_service])
2621
2622
2623 # Disable "unlinkd" code
2624 AC_ARG_ENABLE(unlinkd,
2625 AS_HELP_STRING([--disable-unlinkd],[Do not use unlinkd]), [
2626 SQUID_YESNO([$enableval],
2627 [unrecognized argument to --disable-unlinkd: $enableval])
2628 ])
2629 SQUID_DEFINE_BOOL(USE_UNLINKD,${enable_unlinkd:=yes},
2630 [Enable useage of unlinkd])
2631 AM_CONDITIONAL(ENABLE_UNLINKD,test "x$enable_unlinkd" = "xyes")
2632 AC_MSG_NOTICE([unlinkd enabled: $enable_unlinkd])
2633
2634 # Enable backtraces on fatal errors
2635 AC_ARG_ENABLE(stacktraces,
2636 AS_HELP_STRING([--enable-stacktraces],
2637 [Enable automatic call backtrace on fatal errors]), [
2638 SQUID_YESNO([$enableval],
2639 [unrecognized argument to --enable-stacktraces: $enableval])
2640 ])
2641 SQUID_DEFINE_BOOL(PRINT_STACK_TRACE,${enable_stacktraces:=no},
2642 [Print stack traces on fatal errors])
2643 AC_MSG_NOTICE([Automatically print stack trace on fatal errors: $enable_stacktraces])
2644
2645
2646 # CPU Profiling options handling
2647 AC_ARG_ENABLE(cpu-profiling,
2648 AS_HELP_STRING([--enable-cpu-profiling],
2649 [Enable instrumentation to try and understand how CPU power
2650 is spent by squid, by enabling specific probes in selected
2651 functions.
2652 New probes can only be added by modifying the source code.
2653 It is meant to help developers in optimizing performance
2654 of Squid internal functions.
2655 If you are not developer you should not enable this,
2656 as it slows squid down somewhat.
2657 See lib/Profiler.c for more details.]), [
2658 SQUID_YESNO([$enableval],
2659 [unrecognized argument to --enable-cpu-profiling: $enableval])
2660 ])
2661 # Default OFF. This is a debug feature. Only check and enable if forced ON.
2662 if test "x$enable_cpu_profiling" = "xyes"; then
2663 SQUID_CHECK_FUNCTIONAL_CPU_PROFILER
2664 if test "x$squid_cv_cpu_profiler_works" = "xno"; then
2665 AC_MSG_ERROR([CPU profiling will not be functional in this build.])
2666 fi
2667 fi
2668 SQUID_DEFINE_BOOL(USE_XPROF_STATS,${enable_cpu_profiling:=no},
2669 [Define to enable CPU profiling within Squid])
2670 AM_CONDITIONAL(ENABLE_XPROF_STATS,
2671 test "x$enable_cpu_profiling" = "xyes")
2672 AC_MSG_NOTICE([CPU profiling enabled: $enable_cpu_profiling])
2673
2674 # Enable X-Accelerator-Vary for Vary support within an accelerator setup
2675 AC_ARG_ENABLE(x-accelerator-vary,
2676 AS_HELP_STRING([--enable-x-accelerator-vary],
2677 [Enable support for the X-Accelerator-Vary
2678 HTTP header. Can be used to indicate
2679 variance within an accelerator setup.
2680 Typically used together with other code
2681 that adds custom HTTP headers to the requests.]), [
2682 SQUID_YESNO([$enableval],
2683 [unrecognized argument to --enable-x-accelerator-vary: $enableval])
2684 ])
2685 SQUID_DEFINE_BOOL(X_ACCELERATOR_VARY,${enable_x_accelerator_vary:=no},
2686 [Enable support for the X-Accelerator-Vary HTTP header])
2687 AC_MSG_NOTICE([X-Accelerator-Vary support enabled: $enable_x_accelerator_vary])
2688
2689
2690 if $CPPUNITCONFIG --help >/dev/null; then
2691 squid_cv_cppunit_version="`$CPPUNITCONFIG --version`"
2692 AC_MSG_NOTICE([using system installed cppunit version $squid_cv_cppunit_version])
2693 unset squid_cv_cppunit_version
2694 SQUID_CPPUNIT_LIBS="`$CPPUNITCONFIG --libs`"
2695 SQUID_CPPUNIT_LA=''
2696 SQUID_CPPUNIT_INC="`$CPPUNITCONFIG --cflags`"
2697 else
2698 AC_MSG_WARN([cppunit does not appear to be installed. squid does not require this, but code testing with 'make check' will fail.])
2699 SQUID_CPPUNIT_LA=''
2700 SQUID_CPPUNIT_LIBS=''
2701 SQUID_CPPUNIT_INC=''
2702 fi
2703
2704 AC_ARG_WITH(cppunit-basedir,
2705 AS_HELP_STRING([--with-cppunit-basedir=PATH],
2706 [Path where the cppunit headers are libraries can be found ]), [
2707 if test -f "$withval/include/cppunit/TestCase.h"; then
2708 AC_MSG_NOTICE([Using cppunit includes from $withval])
2709 SQUID_CPPUNIT_INC="-I${withval}/include"
2710 else
2711 AC_MSG_ERROR(Cannot find cppunit at $withval)
2712 fi
2713 if test -f "$withval/lib/libcppunit.la"; then
2714 AC_MSG_NOTICE([Using cppunit lib from $withval])
2715 SQUID_CPPUNIT_LA="${withval}/lib/libcppunit.la"
2716 SQUID_CPPUNIT_LIBS='$(SQUID_CPPUNIT_LA)'
2717 else
2718 AC_MSG_ERROR(Cannot find cppunit at $withval)
2719 fi
2720 ])
2721 SQUID_STATE_SAVE(squid_cppunit_state)
2722 CXXFLAGS="$CXXFLAGS $SQUID_CPPUNIT_INC"
2723 AC_CHECK_HEADERS(cppunit/extensions/HelperMacros.h)
2724 SQUID_STATE_ROLLBACK(squid_cppunit_state)
2725 AC_SUBST(SQUID_CPPUNIT_LIBS)
2726 AC_SUBST(SQUID_CPPUNIT_LA)
2727 AC_SUBST(SQUID_CPPUNIT_INC)
2728
2729 # Force some compilers to use ANSI features
2730 #
2731 case "$host" in
2732 *-hp-hpux*)
2733 if test "x$ac_cv_prog_CC" = "xcc" ; then
2734 AC_MSG_NOTICE([adding '-Ae' to cc args for $host])
2735 CC="cc -Ae";
2736 ac_cv_prog_CC="$CC"
2737 fi
2738 ;;
2739 esac
2740
2741
2742 dnl automake handles this AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
2743
2744 case "$host" in
2745 *hpux*)
2746 AC_MSG_NOTICE([Disabling ranlib for HP-UX...])
2747 RANLIB=":"
2748 ;;
2749 esac
2750
2751 dnl Check for headers
2752 AC_HEADER_DIRENT
2753 AC_HEADER_STDC
2754
2755 AC_CHECK_HEADERS( \
2756 arpa/inet.h \
2757 arpa/nameser.h \
2758 assert.h \
2759 bstring.h \
2760 crypt.h \
2761 ctype.h \
2762 direct.h \
2763 errno.h \
2764 execinfo.h \
2765 fcntl.h \
2766 fnmatch.h \
2767 getopt.h \
2768 glob.h \
2769 gnumalloc.h \
2770 grp.h \
2771 ipl.h \
2772 lber.h \
2773 ldap.h \
2774 libc.h \
2775 limits.h \
2776 linux/posix_types.h \
2777 linux/types.h \
2778 malloc.h \
2779 math.h \
2780 memory.h \
2781 mount.h \
2782 netdb.h \
2783 netinet/in.h \
2784 netinet/in_systm.h \
2785 netinet/tcp.h \
2786 paths.h \
2787 poll.h \
2788 pwd.h \
2789 regex.h \
2790 sched.h \
2791 siginfo.h \
2792 signal.h \
2793 stdarg.h \
2794 stddef.h \
2795 stdio.h \
2796 stdlib.h \
2797 string.h \
2798 strings.h \
2799 sys/bitypes.h \
2800 sys/file.h \
2801 sys/ioctl.h \
2802 sys/ipc.cc \
2803 sys/param.h \
2804 sys/prctl.h \
2805 sys/md5.h \
2806 sys/mman.h \
2807 sys/msg.h \
2808 sys/resource.h \
2809 sys/select.h \
2810 sys/shm.h \
2811 sys/socket.h \
2812 sys/stat.h \
2813 syscall.h \
2814 sys/syscall.h \
2815 sys/time.h \
2816 sys/types.h \
2817 sys/uio.h \
2818 sys/un.h \
2819 sys/vfs.h \
2820 sys/wait.h \
2821 syslog.h \
2822 time.h \
2823 unistd.h \
2824 utime.h \
2825 varargs.h \
2826 byteswap.h \
2827 glib.h \
2828 stdint.h \
2829 inttypes.h \
2830 db.h \
2831 db_185.h \
2832 wchar.h
2833 )
2834
2835 AC_CHECK_HEADERS( \
2836 linux/netfilter_ipv4.h \
2837 linux/netfilter_ipv6/ip6_tables.h \
2838 ,,,
2839 SQUID_DEFAULT_INCLUDES
2840 #if HAVE_LIMITS_H
2841 #include <limits.h>
2842 #endif
2843 /* Netfilter ip(6)tables v1.4.0 has broken headers */
2844 #if HAVE_NETINET_IN_H
2845 #include <netinet/in.h>
2846 #endif
2847 )
2848
2849 dnl *BSD dont include the dependencies for all their net/ and netinet/ files
2850 dnl We must include a few basic type headers for them to work.
2851 AC_CHECK_HEADERS( \
2852 net/if.h \
2853 netinet/if_ether.h\
2854 netinet/icmp6.h \
2855 netinet/in.h \
2856 netinet/ip.h \
2857 netinet/ip6.h \
2858 netinet/ip_icmp.h \
2859 netinet/ipl.h \
2860 net/pf/pfvar.h \
2861 net/pfvar.h \
2862 sys/mount.h\
2863 resolv.h \
2864 ,,,
2865 SQUID_BSDNET_INCLUDES)
2866
2867 AC_C_CONST
2868 AC_C_BIGENDIAN
2869
2870 AC_STRUCT_TM
2871 AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
2872 #if TM_IN_SYS_TIME
2873 #if HAVE_SYS_TIME_H
2874 #include <sys/time.h>
2875 #endif
2876 #elif HAVE_TIME_H
2877 #include <time.h>
2878 #endif
2879 ])
2880
2881 dnl Override rusage() detect on MinGW because is emulated in source code
2882 case "$squid_host_os" in
2883 mingw)
2884 AC_DEFINE(HAVE_STRUCT_RUSAGE)
2885 ac_cv_func_getrusage='yes'
2886 AC_MSG_NOTICE([Using own rusage on Windows.])
2887 ;;
2888 *)
2889 AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
2890 #if HAVE_SYS_TIME_H
2891 #include <sys/time.h>
2892 #endif
2893 #if HAVE_SYS_RESOURCE_H
2894 #include <sys/resource.h>
2895 #endif])
2896 ;;
2897 esac
2898
2899 AC_CHECK_MEMBERS([struct iphdr.ip_hl],,,[
2900 #if HAVE_SYS_TYPES_H
2901 #include <sys/types.h>
2902 #endif
2903 #include <netinet/in.h>
2904 #include <netinet/in_systm.h>
2905 #include <netinet/ip.h>
2906 #if defined (__linux__) || defined (__CYGWIN__)
2907 #define ip_hl ihl
2908 #endif
2909 #ifndef __linux__
2910 #ifndef __CYGWIN__
2911 #define iphdr ip
2912 #endif
2913 #endif])
2914
2915 dnl Check for typedefs
2916 AC_CHECK_SIZEOF(void *)
2917
2918 # check for a bunch of types
2919 AC_TYPE_INT8_T
2920 AC_TYPE_UINT8_T
2921 AC_TYPE_INT16_T
2922 AC_TYPE_UINT16_T
2923 AC_TYPE_INT32_T
2924 AC_TYPE_UINT32_T
2925 AC_TYPE_INT64_T
2926 AC_TYPE_UINT64_T
2927 AC_TYPE_PID_T
2928 AC_TYPE_SIZE_T
2929 AC_TYPE_SSIZE_T
2930 AC_TYPE_OFF_T
2931 AC_TYPE_UID_T
2932 AC_CHECK_TYPE([bool])
2933 #need the defines for PRId64
2934 AC_CHECK_SIZEOF(int64_t)
2935 AC_CHECK_SIZEOF(long)
2936 #need the defines for PRIuSIZE
2937 AC_CHECK_SIZEOF(size_t)
2938 #need the define for overflow checks
2939 AC_CHECK_SIZEOF(off_t)
2940 AC_CHECK_SIZEOF(size_t)
2941
2942 dnl Some C++11 types we try to use
2943 AX_CXX_TYPE_NULLPTR
2944 AX_CXX_TYPE_UNIQUE_PTR
2945 AX_CXX_TYPE_UNIFORM_DISTRIBUTIONS
2946
2947 dnl On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
2948 dnl that is incompatible with the updated Solaris header files.
2949 dnl For this reason, we must check if pad128_t and upad128_t are defined.
2950 AC_CHECK_TYPE(pad128_t,
2951 AC_DEFINE(HAVE_PAD128_T,1,[pad128_t is defined in system headers]),
2952 ,SQUID_DEFAULT_INCLUDES)
2953
2954 AC_CHECK_TYPE(upad128_t,
2955 AC_DEFINE(HAVE_UPAD128_T,1,[upad128_t is defined in system headers]),
2956 ,SQUID_DEFAULT_INCLUDES)
2957
2958 AC_CHECK_TYPE(mode_t, AC_DEFINE(HAVE_MODE_T,1,[mode_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2959 AC_CHECK_TYPE(fd_mask, AC_DEFINE(HAVE_FD_MASK,1,[fd_mask is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2960
2961 AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the system headers]),,[
2962 #include <sys/types.h>
2963 #include <sys/socket.h>
2964 #if STDC_HEADERS
2965 #include <stdlib.h>
2966 #include <stddef.h>
2967 #endif])
2968
2969 AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,
2970 [mtyp_t is defined by the system headers]),,[#include <sys/types.h>
2971 #include <sys/ipc.h>
2972 #include <sys/msg.h>])
2973
2974 # check for compiler support of %zu printf macro
2975 AH_TEMPLATE(PRIuSIZE,[Compiler supports %zu printf macro])
2976 AC_MSG_CHECKING([for compiler %zu support])
2977 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2978 #include <stdio.h>
2979 ]],[[size_t n=1;printf("%zu",n);]])],[
2980 AC_DEFINE(PRIuSIZE,"zu")
2981 AC_MSG_RESULT(yes)
2982 ],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
2983
2984
2985 dnl Check for special functions
2986 AC_FUNC_ALLOCA
2987
2988
2989 dnl Check for libcap header (assume its not broken unless
2990 AC_ARG_WITH(libcap, AS_HELP_STRING([--without-libcap],
2991 [disable usage of Linux capabilities library to control privileges]), [
2992 SQUID_YESNO([$withval],[unrecognized argument to --without-libcap: $withval])
2993 ],[with_libcap=auto])
2994
2995 if test "x$with_libcap" != "xno"; then
2996 # cap_clear_flag is the most recent libcap function we require
2997 AC_CHECK_HEADERS(sys/capability.h)
2998 AC_CHECK_LIB(cap, cap_clear_flag)
2999 SQUID_CHECK_FUNCTIONAL_LIBCAP2
3000
3001 # if it can't be supported..
3002 if test "x$ac_cv_header_sys_capability_h" = "xno" -o \
3003 "x$ac_cv_lib_cap_cap_clear_flag" = "xno"; then
3004 # and it was forced on: error
3005 if test "x$with_libcap" = "xyes" ; then
3006 AC_MSG_ERROR([libcap forced enabled but not available or not usable, requires libcap-2.09 or later])
3007 else
3008 # with_libcap is "auto"; it can't be supported. Disable.
3009 with_libcap=no
3010 fi
3011 else
3012 # header and lib are ok, we support
3013 with_libcap=yes
3014 fi
3015
3016 fi
3017
3018 SQUID_DEFINE_BOOL(USE_LIBCAP,$with_libcap,
3019 [use libcap to set capabilities required for TPROXY])
3020 AC_MSG_NOTICE([libcap support enabled: $with_libcap])
3021 SQUID_DEFINE_BOOL(LIBCAP_BROKEN,${squid_cv_sys_capability_works:=no},
3022 [libcap2 headers are broken and clashing with glibc])
3023 AC_MSG_NOTICE([libcap2 headers are ok: $squid_cv_sys_capability_works])
3024
3025
3026 dnl Check for needed libraries
3027 AC_SEARCH_LIBS([gethostbyname],[nsl resolv bind])
3028 AC_SEARCH_LIBS([res_init],[resolv])
3029 AC_SEARCH_LIBS([__res_search],[resolv])
3030 AC_SEARCH_LIBS([bind],[socket])
3031 AC_SEARCH_LIBS([opcom_stack_trace],[opcom_stack])
3032 AC_SEARCH_LIBS([strlcpy], [bsd])
3033 AC_SEARCH_LIBS([yp_match], [nsl nss_nis nss_nisplus])
3034 dnl Check for Winsock only on MinGW, on Cygwin we must use emulated BSD socket API
3035 if test "x$squid_host_os" = "xmingw" ; then
3036 SQUID_CHECK_WINSOCK_LIB
3037 AC_CHECK_HEADERS( \
3038 windows.h \
3039 ws2tcpip.h \
3040 iphlpapi.h ,,,[
3041 #if HAVE_WINSOCK2_H
3042 #include <winsock2.h>
3043 #endif
3044 #if HAVE_WINDOWS_H
3045 #include <windows.h>
3046 #endif
3047 #if HAVE_WS2TCPIP_H
3048 #include <ws2tcpip.h>
3049 #endif
3050 ])
3051 fi
3052
3053 # check that we have unix sockets
3054 SQUID_CHECK_UNIX_SOCKET
3055 SQUID_DEFINE_BOOL(HAVE_UNIXSOCKET,$squid_cv_unixsocket,[System supports unix sockets])
3056
3057 AC_CHECK_LIB(gnumalloc, malloc)
3058 if test "x$ac_cv_lib_gnumalloc_malloc" = "xyes"; then
3059 AC_MSG_NOTICE([Disabling extended malloc functions when using bundled gnumalloc])
3060 ac_cv_func_mallocblksize=no
3061 ac_cv_func_mallopt=no
3062 else
3063 case "$squid_host_os" in
3064 solaris)
3065 AC_MSG_NOTICE([skipping libmalloc check for $host])
3066 ;;
3067 freebsd)
3068 AC_MSG_NOTICE([skipping libmalloc check for $host])
3069 ;;
3070 *)
3071 #used later. FIXME
3072 AC_CHECK_LIB(malloc, main)
3073 ;;
3074 esac
3075 fi
3076
3077 case "$squid_host_os" in
3078 mingw)
3079 AC_MSG_NOTICE([Use MSVCRT for math functions.])
3080 ;;
3081 *)
3082 dnl rint() and log() are only used in old C code for now.
3083 AC_LANG_PUSH([C])
3084 AC_SEARCH_LIBS([rint],[m])
3085 AC_SEARCH_LIBS([log],[m])
3086 AC_LANG_POP([C])
3087 ;;
3088 esac
3089
3090 dnl --with-maxfd present for compatibility with Squid-2.
3091 dnl undocumented in ./configure --help to encourage using the Squid-3 directive
3092 AC_ARG_WITH(maxfd,,
3093 [
3094 case ${withval} in
3095 [[0-9]]*)
3096 squid_filedescriptors_num=$withval
3097 AC_MSG_NOTICE([forcing default of $squid_filedescriptors_num filedescriptors (user-forced)])
3098 ;;
3099 *)
3100 AC_MSG_ERROR(--with-maxfd expects a numeric argument)
3101 ;;
3102 esac
3103 ])
3104
3105 AC_ARG_WITH(filedescriptors,
3106 AS_HELP_STRING([--with-filedescriptors=NUMBER],
3107 [Force squid to support NUMBER filedescriptors]),
3108 [
3109 case ${withval} in
3110 [[0-9]]*)
3111 squid_filedescriptors_num=$withval
3112 AC_MSG_NOTICE([forcing default of $squid_filedescriptors_num filedescriptors (user-forced)])
3113 ;;
3114 *)
3115 AC_MSG_ERROR(--with-filedescriptors expects a numeric argument)
3116 ;;
3117 esac
3118 ])
3119
3120 SQUID_CHECK_DEFAULT_FD_SETSIZE
3121 SQUID_CHECK_MAXFD
3122 if test "x$squid_filedescriptors_num" != "x"; then
3123 AC_MSG_NOTICE([Default number of fieldescriptors: $squid_filedescriptors_num])
3124 fi
3125 if test "$squid_filedescriptors_num" -lt 512 ; then
3126 AC_MSG_WARN([$squid_filedescriptors_num may not be enough filedescriptors if your])
3127 AC_MSG_WARN([cache will be very busy. Please see the FAQ page])
3128 AC_MSG_WARN([http://wiki.squid-cache.org/SquidFaq/TroubleShooting])
3129 AC_MSG_WARN([on how to increase your filedescriptor limit])
3130 fi
3131 AC_DEFINE_UNQUOTED(SQUID_MAXFD, $squid_filedescriptors_num,[Maximum number of open filedescriptors])
3132
3133
3134 dnl Enable IPv6 support
3135 AC_MSG_CHECKING([whether to enable IPv6])
3136 AC_ARG_ENABLE(ipv6,
3137 AS_HELP_STRING([--disable-ipv6],[Disable IPv6 support. The default is to probe system capabilities on startup.]), [
3138 SQUID_YESNO([$enableval],[unrecognized argument to --disable-ipv6: $enableval])
3139 ])
3140 AC_MSG_RESULT(${enable_ipv6:=yes})
3141 SQUID_DEFINE_BOOL(USE_IPV6,$enable_ipv6,[Enable support for IPv6 ])
3142
3143 if test "x$enable_ipv6" = "xyes" ; then
3144 SQUID_CHECK_SIN6_LEN_IN_SAI
3145 fi
3146 SQUID_CHECK_SS_LEN_IN_SOCKADDR_STORAGE
3147 SQUID_CHECK_SIN_LEN_IN_SOCKADDR_IN
3148
3149
3150 dnl Check for libdl, used by auth_modules/PAM
3151 if test "x$with_dl" = "xyes"; then
3152 AC_CHECK_LIB(dl, dlopen)
3153 fi
3154
3155 dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
3156 dnl Robert Side <rside@aiinc.bc.ca>
3157 dnl Mon, 18 Jan 1999 17:48:00 GMT
3158 case "$host" in
3159 *-pc-sco3.2*)
3160 AC_CHECK_LIB(intl, strftime)
3161 ;;
3162 esac
3163
3164 dnl Check for libdb
3165 dnl this is not fully functional if db.h is for a differend db version
3166 DBLIB=
3167
3168 dnl check that dbopen is actually defined in the header
3169 dnl FIXME: in case of failure undef db-related includes etc.
3170 AC_CHECK_DECL(dbopen,,,[
3171 #if HAVE_SYS_TYPES_H
3172 #include <sys/types.h>
3173 #endif
3174 #if HAVE_LIMITS_H
3175 #include <limits.h>
3176 #endif
3177 #if HAVE_DB_185_H
3178 #include <db_185.h>
3179 #elif HAVE_DB_H
3180 #include <db.h>
3181 #endif])
3182
3183 dnl 1.85
3184 SQUID_CHECK_DBOPEN_NEEDS_LIBDB
3185 if test "x$ac_cv_dbopen_libdb" = "xyes"; then
3186 LIB_DB="-ldb"
3187 fi
3188 AC_SUBST(LIB_DB)
3189
3190 dnl System-specific library modifications
3191 dnl
3192 case "$host" in
3193 i386-*-solaris2.*)
3194 if test "x$GCC" = "xyes"; then
3195 AC_MSG_NOTICE([Removing -O for gcc on $host])
3196 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
3197 fi
3198 ;;
3199
3200 *-sgi-irix*)
3201 AC_MSG_NOTICE([Removing -lsocket for IRIX...])
3202 LIBS=`echo $LIBS | sed -e s/-lsocket//`
3203 AC_MSG_NOTICE([Removing -lnsl for IRIX...])
3204 LIBS=`echo $LIBS | sed -e s/-lnsl//`
3205 ac_cv_lib_nsl_main=no
3206 AC_MSG_NOTICE([Removing -lbsd for IRIX...])
3207 LIBS=`echo $LIBS | sed -e s/-lbsd//`
3208 ;;
3209 dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
3210 dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
3211 dnl Please change your configure script. AIX doesn't need -lbsd.
3212 *-ibm-aix*)
3213 AC_MSG_NOTICE([Removing -lbsd for AIX...])
3214 LIBS=`echo $LIBS | sed -e s/-lbsd//`
3215
3216 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_rtti],[-rtti],[[
3217 #include <assert.h>
3218 #ifndef NULL
3219 #define NULL 0
3220 #endif
3221 class Foo{
3222 public:virtual ~Foo(){}
3223 };
3224 class Bar:public Foo{
3225 public:Bar():Foo(){}
3226 };
3227 ]],[[
3228 Foo * myFoo=new Bar();
3229 Bar * myBar=dynamic_cast<Bar *>(myFoo);
3230 assert(myBar != NULL);
3231 ]])
3232 if test "$ac_cv_require_rtti" = "yes"; then
3233 SQUID_CFLAGS="-rtti $SQUID_CFLAGS"
3234 SQUID_CXXFLAGS="-rtti $SQUID_CXXFLAGS"
3235 fi
3236
3237 AC_LANG_PUSH([C])
3238 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_qcpluscmt],[-qcpluscmt],[[]],[[//c++ cmt]])
3239 AC_LANG_POP([C])
3240 if test "$ac_cv_require_qcpluscmt" = "yes"; then
3241 SQUID_CFLAGS="-qcpluscmt $SQUID_CFLAGS"
3242 fi
3243 ;;
3244
3245 *m88k*)
3246 SQUID_CFLAGS="$SQUID_CFLAGS -D_SQUID_MOTOROLA_"
3247 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_SQUID_MOTOROLA_"
3248 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1,
3249 [If gettimeofday is known to take only one argument])
3250 ;;
3251 [*-*-solaris2.[0-4]])
3252 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
3253 ;;
3254 [*-sony-newsos[56]*])
3255 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
3256 ;;
3257 esac
3258
3259 # Remove optimization for GCC 2.95.[123]
3260 # gcc -O[2] on *BSD and Linux (x86) causes pointers to magically become NULL
3261 if test "x$GCC" = "xyes"; then
3262 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
3263 case "$GCCVER" in
3264 [2.95.[123]])
3265 AC_MSG_NOTICE([Removing -O for gcc on $host with GCC $GCCVER])
3266 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
3267 ;;
3268 esac
3269 fi
3270
3271 dnl This has to be before AC_CHECK_FUNCS
3272 # Disable poll() on certain platforms. Override by setting ac_cv_func_poll
3273 # when running configure.
3274 if test "x$ac_cv_func_poll" = "x" ; then
3275 case "$host" in
3276 [*-hp-hpux*.*])
3277 # Duane Wessels
3278 AC_MSG_NOTICE([disabling poll for $host...])
3279 ac_cv_func_poll='no'
3280 ;;
3281 [*-linux-*])
3282 # Henrik Nordstrom (hno@squid-cache.org) 19980817
3283 # poll is problematic on Linux. We disable it
3284 # by default until Linux gets it right.
3285 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
3286 if test $rev -lt 002002; then
3287 AC_MSG_NOTICE([disabling poll for $host < 2.2...])
3288 ac_cv_func_poll='no'
3289 fi
3290 ;;
3291 [powerpc-ibm-aix4.1.*])
3292 # Mike Laster (mlaster@metavillage.com) 19981021
3293 AC_MSG_NOTICE([disabling poll for $host...])
3294 ac_cv_func_poll='no'
3295 ;;
3296 [*-pc-sco3.2*])
3297 # Robert Side <rside@aiinc.bc.ca>
3298 # Mon, 18 Jan 1999 17:48:00 GMT
3299 AC_MSG_NOTICE([disabling poll for $host...])
3300 ac_cv_func_poll='no'
3301 ;;
3302 esac
3303 fi
3304
3305 dnl Check for library functions
3306 AC_CHECK_FUNCS(\
3307 backtrace_symbols_fd \
3308 bcopy \
3309 eui64_aton \
3310 fchmod \
3311 getdtablesize \
3312 getpagesize \
3313 getpass \
3314 getrlimit \
3315 getrusage \
3316 getspnam \
3317 gettimeofday \
3318 glob \
3319 mallocblksize \
3320 mallopt \
3321 memcpy \
3322 memmove \
3323 memrchr \
3324 memset \
3325 mkstemp \
3326 mktime \
3327 mstats \
3328 poll \
3329 prctl \
3330 pthread_attr_setschedparam \
3331 pthread_attr_setscope \
3332 pthread_setschedparam \
3333 pthread_sigmask \
3334 putenv \
3335 regcomp \
3336 regexec \
3337 regfree \
3338 res_init \
3339 __res_init \
3340 rint \
3341 sched_getaffinity \
3342 sched_setaffinity \
3343 select \
3344 seteuid \
3345 setgroups \
3346 setpgrp \
3347 setsid \
3348 sigaction \
3349 snprintf \
3350 socketpair \
3351 sysconf \
3352 syslog \
3353 timegm \
3354 vsnprintf \
3355 )
3356 dnl ... and some we provide local replacements for
3357 AC_REPLACE_FUNCS(\
3358 initgroups \
3359 psignal \
3360 strerror \
3361 strtoll \
3362 tempnam \
3363 )
3364
3365 AC_CHECK_DECLS([getaddrinfo,getnameinfo,inet_ntop,inet_pton,InetNtopA,InetPtonA],,,[
3366 /*
3367 * BSD requires sys/types.h, sys/socket.h, netinet/in.h, netdb.h, arpa/inet.h
3368 * Linux requires sys/types.h, sys/socket.h, arpa/inet.h
3369 * Windows requires sys/socket.h, winsock2.h, ws2tcpip.h
3370 */
3371 #if HAVE_SYS_TYPES_H
3372 #include <sys/types.h>
3373 #endif
3374 #if HAVE_NETINET_IN_H
3375 #include <netinet/in.h>
3376 #endif
3377 #if HAVE_SYS_SOCKET_H
3378 #include <sys/socket.h>
3379 #endif
3380 #if HAVE_NETDB_H
3381 #include <netdb.h>
3382 #endif
3383 #if HAVE_ARPA_INET_H
3384 #include <arpa/inet.h>
3385 #endif
3386 #if HAVE_WINSOCK2_H
3387 #include <winsock2.h>
3388 #endif
3389 #if HAVE_WS2TCPIP_H
3390 #include <ws2tcpip.h>
3391 #endif
3392 ])
3393
3394 # Magic which checks whether we are forcing a type of comm loop we
3395 # are actually going to (ab)use.
3396 # Mostly ripped from squid-commloops, thanks to adrian and benno
3397
3398 if test "x$squid_opt_io_loop_engine" != "x"; then
3399 AC_MSG_NOTICE([choosing user-specified net I/O API $squid_opt_io_loop_engine])
3400 elif test "x$enable_epoll" != "xno" -a "x$squid_cv_epoll_works" = "xyes" ; then
3401 squid_opt_io_loop_engine="epoll"
3402 elif test "x$enable_kqueue" != "xno" ; then
3403 squid_opt_io_loop_engine="kqueue"
3404 elif test "x$enable_devpoll" != "xno" ; then
3405 squid_opt_io_loop_engine="devpoll"
3406 elif test "x$enable_poll" != "xno" -a "x$ac_cv_func_poll" = "xyes" ; then
3407 squid_opt_io_loop_engine="poll"
3408 elif test "x$enable_select" != "xno" -a "x$ac_cv_func_select" = "xyes"; then
3409 squid_opt_io_loop_engine="select"
3410 elif test "x$enable_select" != "xno" -a "x$squid_host_os" = "xmingw"; then
3411 squid_opt_io_loop_engine="select_win32"
3412 else
3413 AC_MSG_WARN([Eep! Cannot find epoll, kqueue, /dev/poll, poll or select!])
3414 AC_MSG_WARN([Will try select and hope for the best.])
3415 squid_opt_io_loop_engine="select"
3416 fi
3417
3418 AC_MSG_NOTICE([Using ${squid_opt_io_loop_engine} for the IO loop.])
3419
3420 AM_CONDITIONAL([USE_POLL], [test $squid_opt_io_loop_engine = poll])
3421 AM_CONDITIONAL([USE_EPOLL], [test $squid_opt_io_loop_engine = epoll])
3422 AM_CONDITIONAL([USE_SELECT], [test $squid_opt_io_loop_engine = select])
3423 AM_CONDITIONAL([USE_SELECT_WIN32], [test $squid_opt_io_loop_engine = select_win32])
3424 AM_CONDITIONAL([USE_KQUEUE], [test $squid_opt_io_loop_engine = kqueue])
3425 AM_CONDITIONAL([USE_DEVPOLL], [test $squid_opt_io_loop_engine = devpoll])
3426
3427 case $squid_opt_io_loop_engine in
3428 epoll) AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop]) ;;
3429 devpoll) AC_DEFINE(USE_DEVPOLL,1,[Use /dev/poll for the IO loop]) ;;
3430 poll) AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop]) ;;
3431 kqueue) AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop]) ;;
3432 select_win32) AC_DEFINE(USE_SELECT_WIN32,1,[Use Winsock select() for the IO loop]) ;;
3433 select) AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop]) ;;
3434 esac
3435
3436 if test "x$ac_cv_func_sched_getaffinity" = "xyes" -a "x$ac_cv_func_sched_setaffinity" = "xyes" ; then
3437 AC_DEFINE(HAVE_CPU_AFFINITY,1,[Support setting CPU affinity for workers])
3438 fi
3439
3440 SQUID_CHECK_SETRESUID_WORKS
3441 if test "x$squid_cv_resuid_works" = "xyes" ; then
3442 AC_DEFINE(HAVE_SETRESUID,1,[Yay! Another Linux brokenness. Knowing that setresuid() exists is not enough, because RedHat 5.0 declares setresuid() but does not implement it.])
3443 fi
3444
3445 AC_CHECK_HEADERS(mswsock.h)
3446 AC_MSG_CHECKING([for constant CMSG_SPACE])
3447 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3448 #if HAVE_SYS_SOCKET_H
3449 #include <sys/socket.h>
3450 #endif
3451 #if HAVE_MSWSOCK_H
3452 #include <mswsock.h>
3453 #endif
3454
3455 int a[CMSG_SPACE(int)];
3456 ]])], [
3457 AC_MSG_RESULT(yes)
3458 AC_DEFINE(HAVE_CONSTANT_CMSG_SPACE, 1, [Define to 1 if CMSG_SPACE is constant])
3459 ], [
3460 AC_MSG_RESULT(no)
3461 ])
3462
3463 AC_CHECK_TYPE(struct cmsghdr,AC_DEFINE(HAVE_CMSGHDR,1,[The system provides struct cmsghdr]),,[
3464 #if HAVE_SYS_SOCKET_H
3465 #include <sys/socket.h>
3466 #endif
3467 #if HAVE_MSWSOCK_H
3468 #include <mswsock.h>
3469 #endif
3470 #if HAVE_WINSOCK2_H
3471 #include <winsock2.h>
3472 #endif
3473 ])
3474
3475 AC_CHECK_TYPE(struct iovec,AC_DEFINE(HAVE_IOVEC,1,[The system provides struct iovec]),,[
3476 #if HAVE_SYS_SOCKET_H
3477 #include <sys/socket.h>
3478 #endif
3479 #if HAVE_WINSOCK2_H
3480 #include <winsock2.h>
3481 #endif
3482 #if HAVE_SYS_UIO_H
3483 #include <sys/uio.h>
3484 #endif
3485 ])
3486
3487 AC_CHECK_TYPE(struct msghdr,AC_DEFINE(HAVE_MSGHDR,1,[The system provides struct msghdr]),,[
3488 #if HAVE_SYS_SOCKET_H
3489 #include <sys/socket.h>
3490 #endif
3491 #if HAVE_MSWSOCK_H
3492 #include <mswsock.h>
3493 #endif
3494 #if HAVE_WINSOCK2_H
3495 #include <winsock2.h>
3496 #endif
3497 ])
3498
3499 AC_CHECK_TYPE(struct sockaddr_un,AC_DEFINE(HAVE_SOCKADDR_UN,1,[The system provides sockaddr_un]),,[
3500 #if HAVE_SYS_UN_H
3501 #include <sys/un.h>
3502 #endif
3503 #if HAVE_SYS_SOCKET_H
3504 #include <sys/socket.h>
3505 #endif
3506 #if HAVE_WINSOCK2_H
3507 #include <winsock2.h>
3508 #endif
3509 ])
3510
3511 SQUID_CHECK_FUNC_STRNSTR
3512 SQUID_CHECK_FUNC_VACOPY
3513 SQUID_CHECK_FUNC___VACOPY
3514
3515 dnl IP-Filter support requires ipf header files. These aren't
3516 dnl installed by default, so we need to check for them
3517 if test "x$enable_ipf_transparent" != "xno" ; then
3518 SQUID_CHECK_BROKEN_SOLARIS_IPFILTER
3519 AC_MSG_CHECKING(for availability of IP-Filter header files)
3520 # hold on to your hats...
3521 if test "x$ac_cv_header_ip_compat_h" = "xyes" -o \
3522 "x$ac_cv_header_ip_fil_compat_h" = "xyes" -o \
3523 "x$ac_cv_header_netinet_ip_compat_h" = "xyes" -o \
3524 "x$ac_cv_header_netinet_ip_fil_compat_h" = "xyes" ; then
3525 have_ipfilter_compat_header="yes"
3526 fi
3527 if test "x$have_ipfilter_compat_header" = "xyes" -a \
3528 "x$ac_cv_header_ip_fil_h" = "xyes" -a \
3529 "x$ac_cv_header_ip_nat_h" = "xyes" ; then
3530 enable_ipf_transparent="yes"
3531 elif test "x$have_ipfilter_compat_header" = "xyes" -a \
3532 "x$ac_cv_header_netinet_ip_fil_h" = "xyes" -a \
3533 "x$ac_cv_header_netinet_ip_nat_h" = "xyes" ; then
3534 enable_ipf_transparent="yes"
3535 else
3536 enable_ipf_transparent="no"
3537 fi
3538 AC_MSG_RESULT($IPF_TRANSPARENT)
3539
3540 ## On Solaris Ipfilter includes expect that SOLARIS2 is defined with the
3541 ## Solaris minor version (8, 9, 10, ...)
3542 if test "x$enable_ipf_transparent" = "xyes" -a "x$squid_host_os" = "xsolaris" ; then
3543 solrev=`uname -r | sh -c 'IFS=. read j n x; echo $n'`
3544 CFLAGS="-DSOLARIS2=$solrev $CFLAGS"
3545 CXXFLAGS="-DSOLARIS2=$solrev $CXXFLAGS"
3546 fi
3547
3548 fi
3549 AC_MSG_NOTICE([IPF-based transparent proxying enabled: $enable_ipf_transparent])
3550 SQUID_DEFINE_BOOL(IPF_TRANSPARENT,$enable_ipf_transparent,
3551 [Enable support for IPF-style transparent proxying])
3552
3553 dnl PF /dev/pf support requires a header file.
3554 if test "x$with_nat_devpf" != "xno" ; then
3555 if test "x$ac_cv_header_net_pfvar_h" = "xyes" -o \
3556 "x$ac_cv_header_net_pf_pfvar_h" = "xyes"; then
3557 if test "x$with_nat_devpf" = "xauto" ; then
3558 with_nat_devpf="no"
3559 fi
3560 else
3561 if test "x$with_nat_devpf" = "xyes" ; then
3562 AC_MSG_ERROR([PF /dev/pf based NAT requested but needed header not found])
3563 fi
3564 with_nat_devpf="no"
3565 fi
3566 fi
3567 SQUID_DEFINE_BOOL(PF_TRANSPARENT,${enable_pf_transparent:=no},
3568 [Enable support for PF-style transparent proxying])
3569 SQUID_DEFINE_BOOL(USE_NAT_DEVPF,${with_nat_devpf:=no},
3570 [Enable support for /dev/pf NAT lookups])
3571
3572 if test "x$enable_linux_netfilter" != "xno" ; then
3573 if test "x$ac_cv_header_linux_netfilter_ipv4_h" = "xyes"; then
3574 if test "x$enable_linux_netfilter" = "xauto" ; then
3575 enable_linux_netfilter=yes
3576 fi
3577 else
3578 if test "x$enable_linux_netfilter" = "xauto" ; then
3579 enable_linux_netfilter=no
3580 else
3581 AC_MSG_ERROR([Linux Netfilter support requested but needed headers not found])
3582 fi
3583 fi
3584 fi
3585 SQUID_DEFINE_BOOL(LINUX_NETFILTER,$enable_linux_netfilter,
3586 [Enable support for Transparent Proxy on Linux via Netfilter])
3587
3588 dnl Netfilter TPROXY depends on libcap but the NAT parts can still work.
3589 AC_MSG_NOTICE([Support for Netfilter-based interception proxy requested: $enable_linux_netfilter])
3590 if test "x$enable_linux_netfilter" = "xyes" -a "x$with_libcap" != "xyes" ; then
3591 AC_MSG_WARN([Missing needed capabilities (libcap 2.09+) for TPROXY])
3592 AC_MSG_WARN([Linux Transparent Proxy (version 4+) support WILL NOT be enabled])
3593 AC_MSG_WARN([Reduced support to NAT Interception Proxy])
3594 # AC_DEFINEd later
3595 fi
3596
3597 if test "x$squid_opt_netfilterconntrack" = "xyes" -a "x$with_libcap" != "xyes" ; then
3598 AC_MSG_ERROR([Linux netfilter conntrack requires libcap support (libcap 2.09+)])
3599 fi
3600 if test "x$with_netfilter_conntrack" = "xyes" -a "x$with_libcap" != "xyes" ; then
3601 AC_MSG_WARN([Missing needed capabilities (libcap 2.09+) for netfilter mark support])
3602 AC_MSG_WARN([Linux netfilter marking support WILL NOT be enabled])
3603 with_netfilter_conntrack=no
3604 fi
3605 AC_MSG_NOTICE([Linux Netfilter Conntrack support enabled: ${with_netfilter_conntrack} ${squid_opt_netfilterconntrackpath}])
3606
3607
3608 AC_ARG_ENABLE(zph-qos,
3609 AS_HELP_STRING([--enable-zph-qos],[Enable ZPH QOS support]), [
3610 SQUID_YESNO([$enableval],
3611 [unrecognized argument to --enable-zph-qos: $enableval])
3612 ])
3613 SQUID_DEFINE_BOOL(USE_QOS_TOS,${enable_zph_qos:=yes},
3614 [Enable Zero Penalty Hit QOS. When set, Squid will alter the
3615 TOS field of HIT responses to help policing network traffic])
3616 AC_MSG_NOTICE([ZPH QOS enabled: $enable_zph_qos])
3617 if test x"$enable_zph_qos" = "xyes" ; then
3618 AC_MSG_NOTICE([QOS netfilter mark preservation enabled: $with_netfilter_conntrack])
3619 SQUID_DEFINE_BOOL(USE_LIBNETFILTERCONNTRACK,${with_netfilter_conntrack:=no},
3620 [Enable support for QOS netfilter mark preservation])
3621 fi
3622
3623
3624 AC_CHECK_LIB(regex, regexec, [REGEXLIB="-lregex"],[REGEXLIB=''])
3625 AC_ARG_ENABLE(gnuregex,
3626 AS_HELP_STRING([--enable-gnuregex],
3627 [Compile GNUregex. Unless you have reason to use
3628 this option, you should not enable it.
3629 This library file is usually only required on Windows and
3630 very old Unix boxes which do not have their own regex
3631 library built in.]), [
3632 SQUID_YESNO([$enableval],[unrecognized argument to --enable-gnuregex: $enableval])
3633 ])
3634 # force-enable on old solaris and nextstep
3635 if test "x${enable_gnuregex:=auto}" = "xauto" ; then
3636 case "$host" in
3637 *-sun-solaris2.[[0-4]])
3638 enable_gnuregex="yes"
3639 ;;
3640 *-next-nextstep*)
3641 enable_gnuregex="yes"
3642 ;;
3643 esac
3644 fi
3645
3646 # try detecting if it is needed
3647 if test "x$enable_gnuregex" = "xauto" ; then
3648 SQUID_CHECK_REGEX_WORKS
3649 if test "x$squid_cv_regex_works" = "xyes" ; then
3650 enable_gnuregex=no
3651 else
3652 enable_gnuregex=yes
3653 fi
3654 fi
3655 AC_MSG_CHECKING(if GNUregex needs to be compiled)
3656 AC_MSG_RESULT($enable_gnuregex)
3657 if test "x$enable_gnuregex" = "xyes"; then
3658 # for some reason (force-enable, test..) gnuregex was found as needed. Override any system lib
3659 REGEXLIB=""
3660 fi
3661 #if no reason was found to enable gnuregex, disable it
3662 if test "x$enable_gnuregex" = "xauto" ; then
3663 enable_gnuregex=no
3664 fi
3665 SQUID_DEFINE_BOOL(USE_GNUREGEX,$enable_gnuregex,[Define if we should use GNU regex])
3666 AC_SUBST(REGEXLIB)
3667
3668 SQUID_DETECT_UDP_SND_BUFSIZE
3669 SQUID_DETECT_UDP_RECV_BUFSIZE
3670 SQUID_DETECT_TCP_SND_BUFSIZE
3671 SQUID_DETECT_TCP_RECV_BUFSIZE
3672
3673 SQUID_CHECK_RECV_ARG_TYPE
3674 SQUID_CHECK_NEED_SYS_ERRLIST
3675 SQUID_CHECK_MAXPATHLEN
3676
3677 SQUID_CHECK_LIBRESOLV_DNS_TTL_HACK
3678 SQUID_CHECK_RESOLVER_FIELDS
3679
3680 AC_CHECK_HEADERS(sys/statvfs.h)
3681 if test "x$ac_cv_header_sys_statvfs_h" = "xyes" ; then
3682 SQUID_CHECK_WORKING_STATVFS
3683 fi
3684 if test "x$ac_cv_func_statvfs" != "xyes" ; then
3685 AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/vfs.h sys/statfs.h)
3686 AC_CHECK_FUNCS(statfs)
3687 SQUID_CHECK_F_FRSIZE_IN_STATFS
3688 fi
3689
3690 dnl Squid will not usually attempt to translate templates when building
3691 AC_ARG_ENABLE(translation,
3692 AS_HELP_STRING([--enable-translation],[Generate the localized error page templates and manuals.
3693 Which can also be downloaded from http://www.squid-cache.org/Versions/langpack/.]), [
3694 SQUID_YESNO([$enableval],
3695 [unrecognized argument to --enable-translation: $enableval])
3696 ])
3697 if test "x${enable_translation:=no}" = "xyes" ; then
3698 AX_WITH_PROG([PO2HTML],[po2html])
3699 AX_WITH_PROG([PO2TEXT],[po2txt])
3700 else
3701 PO2HTML="off"
3702 PO2TEXT="off"
3703 fi
3704 AC_SUBST(PO2HTML)
3705 AC_SUBST(PO2TEXT)
3706
3707 dnl Squid now has limited locale handling ...
3708 dnl on error pages
3709 AC_ARG_ENABLE(auto-locale,
3710 AS_HELP_STRING([--disable-auto-locale],[This prevents Squid providing localized error pages based on the
3711 clients request headers.
3712 When disabled Squid requires explicit language configuration.]), [
3713 SQUID_YESNO([$enableval],
3714 [unrecognized argument to --disable-auto-locale: $enableval])
3715 ])
3716 AC_MSG_NOTICE([Multi-Language support enabled: ${enable_auto_locale:=yes}])
3717 SQUID_DEFINE_BOOL(USE_ERR_LOCALES,$enable_auto_locale,
3718 [Use multi-language support on error pages])
3719
3720
3721 dnl Need the debugging version of malloc if available
3722 XTRA_OBJS=''
3723 if test "x$ac_cv_lib_malloc_main" = "xyes" ; then
3724 if test -r /usr/lib/debug/malloc.o ; then
3725 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
3726 fi
3727 if test -r /usr/lib/debug/mallocmap.o ; then
3728 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
3729 fi
3730 fi
3731 AC_SUBST(XTRA_OBJS)
3732
3733 if test "x$XTRA_LIBS" = "x"; then
3734 XTRA_LIBS="$LIBS"
3735 dnl minor cleanup
3736 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
3737 LIBS=''
3738 fi
3739 AC_SUBST(XTRA_LIBS)
3740
3741 AC_SUBST(SQUID_CFLAGS)
3742 AC_SUBST(SQUID_CXXFLAGS)
3743
3744 AC_ARG_VAR([BUILDCXXFLAGS],[C++ compiler flags for building compile-time tools. e.g. cf_gen])
3745 if test "x$BUILDCXXFLAGS" = "x"; then
3746 # if we are NOT cross-compiling, use the default build flags for cf_gen and friends
3747 # otherwise rely on the user-provided value
3748 if test "x$squid_cv_check_marchnative" = "xyes"; then
3749 # always valid for the Build compiler.
3750 BUILDCXXFLAGS="-march=native"
3751 fi
3752 BUILDCXXFLAGS="$BUILDCXXFLAGS $CXXFLAGS"
3753 fi
3754 AC_SUBST(BUILDCXXFLAGS)
3755
3756 AC_MSG_NOTICE([BUILD LIBRARIES: $LIBS])
3757 AC_MSG_NOTICE([BUILD EXTRA LIBRARIES: $XTRA_LIBS])
3758 AC_MSG_NOTICE([BUILD OBJECTS: $OBJS])
3759 AC_MSG_NOTICE([BUILD EXTRA OBJECTS: $XTRA_OBJS])
3760 AC_MSG_NOTICE([BUILD C FLAGS: $CFLAGS])
3761 AC_MSG_NOTICE([BUILD EXTRA C FLAGS: $SQUID_CFLAGS])
3762 AC_MSG_NOTICE([BUILD C++ FLAGS: $CXXFLAGS])
3763 AC_MSG_NOTICE([BUILD EXTRA C++ FLAGS: $SQUID_CXXFLAGS])
3764 AC_MSG_NOTICE([BUILD Tools C++ FLAGS: $BUILDCXXFLAGS])
3765
3766 dnl Clean up after OSF/1 core dump bug
3767 rm -f core
3768
3769 AC_CONFIG_FILES([
3770 Makefile
3771 compat/Makefile
3772 contrib/Makefile
3773 doc/Makefile
3774 doc/manuals/Makefile
3775 errors/Makefile
3776 helpers/Makefile
3777 helpers/basic_auth/Makefile
3778 helpers/basic_auth/DB/Makefile
3779 helpers/basic_auth/fake/Makefile
3780 helpers/basic_auth/getpwnam/Makefile
3781 helpers/basic_auth/LDAP/Makefile
3782 helpers/basic_auth/NCSA/Makefile
3783 helpers/basic_auth/NIS/Makefile
3784 helpers/basic_auth/PAM/Makefile
3785 helpers/basic_auth/POP3/Makefile
3786 helpers/basic_auth/RADIUS/Makefile
3787 helpers/basic_auth/SASL/Makefile
3788 helpers/basic_auth/SMB/Makefile
3789 helpers/basic_auth/SMB_LM/Makefile
3790 helpers/basic_auth/SSPI/Makefile
3791 helpers/digest_auth/Makefile
3792 helpers/digest_auth/eDirectory/Makefile
3793 helpers/digest_auth/file/Makefile
3794 helpers/digest_auth/LDAP/Makefile
3795 helpers/external_acl/Makefile
3796 helpers/external_acl/AD_group/Makefile
3797 helpers/external_acl/delayer/Makefile
3798 helpers/external_acl/eDirectory_userip/Makefile
3799 helpers/external_acl/file_userip/Makefile
3800 helpers/external_acl/kerberos_ldap_group/Makefile
3801 helpers/external_acl/LDAP_group/Makefile
3802 helpers/external_acl/LM_group/Makefile
3803 helpers/external_acl/session/Makefile
3804 helpers/external_acl/SQL_session/Makefile
3805 helpers/external_acl/unix_group/Makefile
3806 helpers/external_acl/wbinfo_group/Makefile
3807 helpers/external_acl/time_quota/Makefile
3808 helpers/log_daemon/Makefile
3809 helpers/log_daemon/DB/Makefile
3810 helpers/log_daemon/file/Makefile
3811 helpers/negotiate_auth/Makefile
3812 helpers/negotiate_auth/kerberos/Makefile
3813 helpers/negotiate_auth/SSPI/Makefile
3814 helpers/negotiate_auth/wrapper/Makefile
3815 helpers/ntlm_auth/Makefile
3816 helpers/ntlm_auth/fake/Makefile
3817 helpers/ntlm_auth/smb_lm/Makefile
3818 helpers/ntlm_auth/SSPI/Makefile
3819 helpers/ssl/Makefile
3820 helpers/storeid_rewrite/Makefile
3821 helpers/storeid_rewrite/file/Makefile
3822 helpers/url_rewrite/Makefile
3823 helpers/url_rewrite/fake/Makefile
3824 helpers/url_rewrite/LFS/Makefile
3825 icons/Makefile
3826 lib/Makefile
3827 lib/libTrie/Makefile
3828 lib/libTrie/test/Makefile
3829 lib/ntlmauth/Makefile
3830 lib/profiler/Makefile
3831 lib/rfcnb/Makefile
3832 lib/smblib/Makefile
3833 lib/snmplib/Makefile
3834 scripts/Makefile
3835 src/Makefile
3836 src/acl/Makefile
3837 src/adaptation/Makefile
3838 src/adaptation/icap/Makefile
3839 src/adaptation/ecap/Makefile
3840 src/anyp/Makefile
3841 src/auth/Makefile
3842 src/auth/basic/Makefile
3843 src/auth/digest/Makefile
3844 src/auth/negotiate/Makefile
3845 src/auth/ntlm/Makefile
3846 src/base/Makefile
3847 src/clients/Makefile
3848 src/comm/Makefile
3849 src/dns/Makefile
3850 src/esi/Makefile
3851 src/eui/Makefile
3852 src/format/Makefile
3853 src/fs/Makefile
3854 src/ftp/Makefile
3855 src/helper/Makefile
3856 src/http/Makefile
3857 src/http/one/Makefile
3858 src/icmp/Makefile
3859 src/ident/Makefile
3860 src/ip/Makefile
3861 src/ipc/Makefile
3862 src/log/Makefile
3863 src/mem/Makefile
3864 src/mgr/Makefile
3865 src/parser/Makefile
3866 src/repl/Makefile
3867 src/security/Makefile
3868 src/servers/Makefile
3869 src/snmp/Makefile
3870 src/ssl/Makefile
3871 test-suite/Makefile
3872 tools/Makefile
3873 tools/helper-mux/Makefile
3874 tools/purge/Makefile
3875 tools/squidclient/Makefile
3876 tools/systemd/Makefile
3877 tools/sysvinit/Makefile
3878 ])
3879
3880 # must configure libltdl subdir unconditionally for "make distcheck" to work
3881 #AC_CONFIG_SUBDIRS(libltdl)
3882
3883 AC_OUTPUT