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