~clint-fewbar/ubuntu/precise/squid3/ignore-sighup-early

« back to all changes in this revision

Viewing changes to configure.in

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2010-05-04 11:15:49 UTC
  • mfrom: (1.3.1 upstream)
  • mto: (20.3.1 squeeze) (21.2.1 sid)
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: james.westby@ubuntu.com-20100504111549-1apjh2g5sndki4te
Tags: upstream-3.1.3
ImportĀ upstreamĀ versionĀ 3.1.3

Show diffs side-by-side

added added

removed removed

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