~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: 2011-01-21 18:43:56 UTC
  • mfrom: (1.4.5 upstream)
  • mto: This revision was merged to the branch mainline in revision 26.
  • Revision ID: james.westby@ubuntu.com-20110121184356-4zn7gwuzws6lpnuc
Tags: 3.1.10-1
* New upstream release (Closes: #609881)
  - Removed patches integrated upstream
    + 16-CVE-2010-3072
    + 17-CVE-2010-2951
  - Fixes TCP DNS lookups failure on IPv6-disabled systems (Closes: #607379)
  - Fixes HTTPS not working if IPv6 is disabled (Closes: #594713)

* debian/rules
  - Enable ZPH feature (Closes: #597687)

* debian/squid3.ufw.profile
  - Added UFW profile, thanks to Alessio Treglia (Closes: #605088)

* debian/control
  - Added versioned dependency on squid-langpack

Show diffs side-by-side

added added

removed removed

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