~ubuntu-branches/ubuntu/oneiric/squid3/oneiric-security

« back to all changes in this revision

Viewing changes to configure.ac

  • Committer: Bazaar Package Importer
  • Author(s): Mahyuddin Susanto
  • Date: 2011-02-15 18:46:13 UTC
  • mfrom: (21.2.4 sid)
  • Revision ID: james.westby@ubuntu.com-20110215184613-1u3dh5sz4i055flk
Tags: 3.1.10-1ubuntu1
* Merge from debian unstable. (LP: #719283)  Remaining changes:
  - debian/patches/18-fix-ftbfs-binutils-gold.dpatch: Add library linker into
    LIBS instead to LDFLAGS to fixing FTBFS binutils-gold.
* Drop Ubuntu configuration for ufw which landed in Debian and sync it: 
  - debian/squid3.ufw.profile.

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