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