]> git.ipfire.org Git - thirdparty/squid.git/blame - configure.in
Configurable proxy-auth realm string (Bob Franklin)
[thirdparty/squid.git] / configure.in
CommitLineData
090089c4 1dnl
2877b8a9 2dnl Configuration input file for Squid
090089c4 3dnl
983061ed 4dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9)
090089c4 5dnl
95e36d02 6dnl $Id: configure.in,v 1.136 1998/07/31 00:15:24 wessels Exp $
090089c4 7dnl
8dnl
090089c4 9dnl
a26bdc75 10AC_INIT(src/main.c)
090089c4 11AC_CONFIG_HEADER(include/autoconf.h)
95e36d02 12AC_REVISION($Revision: 1.136 $)dnl
2877b8a9 13AC_PREFIX_DEFAULT(/usr/local/squid)
71b12d7c 14AC_CONFIG_AUX_DIR(cfgaux)
090089c4 15
88d50a22 16AC_CANONICAL_HOST
17
26675bf4 18CRYPTLIB=''
00fa2c12 19REGEXLIB='' # -lregex
20LIBREGEX='' # libregex.a
090089c4 21
983061ed 22dnl use directory structure of cached as default (hack)
23if test "$libexecdir" = '${exec_prefix}/libexec'; then
24 libexecdir='${bindir}'
25 localstatedir='${prefix}'
26
27fi
28
df087e68 29dnl use .exe suffix for executables on cygwin32 platform
30case "$host_os" in
31cygwin32)
32 exec_suffix=".exe"
33 cgi_suffix=".exe"
34 ;;
35*)
36 exec_suffix=""
37 cgi_suffix=".cgi"
38 ;;
39esac
40AC_SUBST(exec_suffix)
41AC_SUBST(cgi_suffix)
42
a26bdc75 43if test -z "$CACHE_HTTP_PORT"; then
44 CACHE_HTTP_PORT="3128"
45fi
46if test -z "$CACHE_ICP_PORT"; then
47 CACHE_ICP_PORT="3130"
48fi
a26bdc75 49
090089c4 50dnl Subsitutions
a26bdc75 51AC_SUBST(CACHE_HTTP_PORT)
52AC_SUBST(CACHE_ICP_PORT)
090089c4 53
30a4f2a8 54AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host")
55
56dnl Set default LDFLAGS
57if test -z "$LDFLAGS"; then
58 LDFLAGS="-g"
59fi
60
38fea766 61PRESET_CFLAGS="$CFLAGS"
30a4f2a8 62
090089c4 63dnl Check for GNU cc
64AC_PROG_CC
65
6ad85e8a 66dnl Gerben Wierda <Gerben_Wierda@RnA.nl>
67case "$host" in
68 mab-next-nextstep3)
69 CC="$CC -arch m68k -arch i486 -arch hppa -arch sparc"
70 ;;
71esac
72
30a4f2a8 73dnl Set Default CFLAGS
74if test -z "$PRESET_CFLAGS"; then
75 if test "$GCC" = "yes"; then
76 case "$host" in
97b12a5b 77 *-sun-sunos*)
30a4f2a8 78 # sunos has too many warnings for this to be useful
79 # motorola too
80 ;;
97b12a5b 81 *m88k*)
82 # Motorola cc/ld does not like -02 but is ok on -O
83 CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]/-O/'`
84 ;;
30a4f2a8 85 *)
86 CFLAGS="$CFLAGS -Wall"
87 ;;
88 esac
89 fi
30a4f2a8 90fi
91
92dnl Set LDFLAGS
93if test -z "$PRESET_LDFLAGS"; then
94 if test "$GCC" = "yes"; then
95 case "$host" in
96 *)
97 # nothing
98 ;;
99 esac
100 fi
101fi
2060fa9a 102
e5f4e1b0 103dnl Enable optional modules
104AC_ARG_ENABLE(dlmalloc,
94d48591 105[ --enable-dlmalloc[=LIB] Compile & use the malloc package by Doug Lea],
e5f4e1b0 106[
94d48591 107 if test "x$ac_cv_enabled_dlmalloc" = "xyes"; then
108 # Ok. dlmalloc was enabled before, but state may be changed.
e5f4e1b0 109 # we have to test these again
110 unset ac_cv_func_mallinfo
111 unset ac_cv_func_mallocblksize
112 unset ac_cv_func_free
113 unset ac_cv_func_realloc
114 unset ac_cv_func_memalign
115 unset ac_cv_func_valloc
116 unset ac_cv_func_pvalloc
117 unset ac_cv_func_calloc
118 unset ac_cv_func_cfree
119 unset ac_cv_func_malloc_trim
120 unset ac_cv_func_malloc_usable_size
121 unset ac_cv_func_malloc_stats
122 unset ac_cv_func_mallinfo
123 unset ac_cv_func_mallopt
124 unset ac_cv_lib_gnumalloc
125 unset ac_cv_lib_malloc
126 unset ac_cv_enabled_dlmalloc
127 fi
94d48591 128 case "$enableval" in
129 'yes')
130 LIBDLMALLOC="libdlmalloc.a"
131 LIB_MALLOC="-L../lib -ldlmalloc"
132 ac_cv_func_mallinfo="yes"
133 ac_cv_func_mallocblksize="no"
134 ac_cv_func_free="yes"
135 ac_cv_func_realloc="yes"
136 ac_cv_func_memalign="yes"
137 ac_cv_func_valloc="yes"
138 ac_cv_func_pvalloc="yes"
139 ac_cv_func_calloc="yes"
140 ac_cv_func_cfree="yes"
141 ac_cv_func_malloc_trim="yes"
142 ac_cv_func_malloc_usable_size="yes"
143 ac_cv_func_malloc_stats="yes"
144 ac_cv_func_mallinfo="yes"
145 ac_cv_func_mallopt="yes"
146 ac_cv_lib_gnumalloc="no"
147 ac_cv_lib_malloc="no"
148 ac_cv_enabled_dlmalloc="yes"
149 echo "dlmalloc build enabled"
150 ;;
151 'no')
152 # Disabled explicitly.
153 echo "dlmalloc disabled."
154 ;;
155 *)
156 # Use already installed dlmalloc library.
157 LIB_MALLOC="${enableval}"
158 ac_cv_func_mallinfo="yes"
159 ac_cv_func_mallocblksize="no"
160 ac_cv_func_free="yes"
161 ac_cv_func_realloc="yes"
162 ac_cv_func_memalign="yes"
163 ac_cv_func_valloc="yes"
164 ac_cv_func_pvalloc="yes"
165 ac_cv_func_calloc="yes"
166 ac_cv_func_cfree="yes"
167 ac_cv_func_malloc_trim="yes"
168 ac_cv_func_malloc_usable_size="yes"
169 ac_cv_func_malloc_stats="yes"
170 ac_cv_func_mallinfo="yes"
171 ac_cv_func_mallopt="yes"
172 ac_cv_lib_gnumalloc="no"
173 ac_cv_lib_malloc="no"
174 ac_cv_enabled_dlmalloc="yes"
175 echo "Use installed dlmalloc."
176 ;;
177 esac
e5f4e1b0 178 ],[
179 if test "x$ac_cv_enabled_dlmalloc" = "xyes"; then
180 # Ok. dlmalloc was enabled before, but now disabled.
181 # we have to test these again
182 unset ac_cv_func_mallinfo
183 unset ac_cv_func_mallocblksize
184 unset ac_cv_func_free
185 unset ac_cv_func_realloc
186 unset ac_cv_func_memalign
187 unset ac_cv_func_valloc
188 unset ac_cv_func_pvalloc
189 unset ac_cv_func_calloc
190 unset ac_cv_func_cfree
191 unset ac_cv_func_malloc_trim
192 unset ac_cv_func_malloc_usable_size
193 unset ac_cv_func_malloc_stats
194 unset ac_cv_func_mallinfo
195 unset ac_cv_func_mallopt
196 unset ac_cv_lib_gnumalloc
197 unset ac_cv_lib_malloc
198 unset ac_cv_enabled_dlmalloc
199 fi
200 ])
201AC_SUBST(LIBDLMALLOC)
202AC_SUBST(LIB_MALLOC)
203
204AC_ARG_ENABLE(gnuregex,
205[ --enable-gnuregex Compile GNUregex],
206[USE_GNUREGEX=$enableval])
207
933cc58d 208AC_ARG_ENABLE(splaytree,
3a29b1d4 209[ --enable-splaytree Use SPLAY trees to store ACL lists],
210[ if test "$enableval" = "yes" ; then
211 echo "ACL lists using SPLAY trees"
212 AC_DEFINE(USE_SPLAY_TREE)
213 fi
214])
215
e5f4e1b0 216AC_ARG_ENABLE(xmalloc_debug,
217[ --enable-xmalloc-debug Do some simple malloc debugging],
218[ if test "$enableval" = "yes" ; then
219 echo "Malloc debugging enabled"
220 AC_DEFINE(XMALLOC_DEBUG)
221 fi
222])
223
027acbaf 224AC_ARG_ENABLE(xmalloc_debug_trace,
225[ --enable-xmalloc-debug-trace
e5f4e1b0 226 Detailed trace of memory allocations],
227[ if test "$enableval" = "yes" ; then
027acbaf 228 echo "Malloc debug trace enabled"
229 AC_DEFINE(XMALLOC_TRACE)
230 AC_DEFINE(XMALLOC_DEBUG)
e5f4e1b0 231 fi
232])
233
234AC_ARG_ENABLE(xmalloc_statistics,
235[ --enable-xmalloc-statistics
236 Show malloc statistics in status page],
237[ if test "$enableval" = "yes" ; then
238 echo "Malloc statistics enabled"
239 AC_DEFINE(XMALLOC_STATISTICS)
240 fi
241])
242
323fe0d4 243AC_ARG_ENABLE(carp,
244[ --enable-carp Enable CARP support],
245[ if test "$enableval" = "yes" ; then
246 echo "CARP support enabled"
247 AC_DEFINE(USE_CARP)
248 fi
249])
250
e5f4e1b0 251AC_ARG_ENABLE(async_io,
252[ --enable-async-io Do ASYNC disk I/O using threads],
253[ if test "$enableval" = "yes" ; then
254 echo "Async I/O enabled"
255 AC_DEFINE(USE_ASYNC_IO)
256 ASYNC_OBJS='$(ASYNC_OBJS)'
9fc0b4b8 257 SQUID_PTHREAD_LIB='$(PTHREADLIB)'
258 CFLAGS="$CFLAGS -D_REENTRANT"
e5f4e1b0 259 fi
260])
261AC_SUBST(ASYNC_OBJS)
262AC_SUBST(SQUID_PTHREAD_LIB)
263
264AC_ARG_ENABLE(icmp,
265[ --enable-icmp Enable ICMP pinging],
266[ if test "$enableval" = "yes" ; then
267 echo "ICMP enabled"
268 AC_DEFINE(USE_ICMP)
269 fi
270])
271
95e36d02 272AC_ARG_ENABLE(delay_pools,
273[ --enable-delay-pools Enable delay pools to limit bandwith usage],
e5f4e1b0 274[ if test "$enableval" = "yes" ; then
95e36d02 275 echo "Delay pools enabled"
276 DELAY_OBJS='$(DELAY_OBJS)'
277 AC_DEFINE(DELAY_POOLS)
e5f4e1b0 278 fi
279])
95e36d02 280AC_SUBST(DELAY_OBJS)
e5f4e1b0 281
36a97e19 282AC_ARG_ENABLE(mem-gen-trace,
283[ --enable-mem-gen-trace Do trace of memory stuff],
284[ if test "$enableval" = "yes" ; then
285 echo "Memory trace (to file) enabled"
286 AC_DEFINE(MEM_GEN_TRACE)
287 fi
288])
289
e5f4e1b0 290AC_ARG_ENABLE(useragent_log,
291[ --enable-useragent-log Enable logging of User-Agent header],
292[ if test "$enableval" = "yes" ; then
293 echo "User-Agent logging enabled"
294 AC_DEFINE(USE_USERAGENT_LOG)
295 fi
296])
297
9fc0b4b8 298AC_ARG_ENABLE(kill_parent_hack,
299[ --enable-kill-parent-hack
300 Kill parent on shutdown],
e5f4e1b0 301[ if test "$enableval" = "yes" ; then
302 echo "Kill parent on shutdown"
303 AC_DEFINE(KILL_PARENT_OPT)
304 fi
305])
306
307AC_ARG_ENABLE(snmp,
308[ --enable-snmp Enable SNMP monitoring],
309[ if test "$enableval" = "yes" ; then
310 echo "SNMP monitoring enabled"
311 AC_DEFINE(SQUID_SNMP)
312 SNMPLIB='-L../snmplib -lsnmp'
313 SNMP_OBJS='$(SNMP_OBJS)'
314 makesnmplib=snmplib
315 fi
316])
317AC_SUBST(SNMPLIB)
318AC_SUBST(SNMP_OBJS)
319AC_SUBST(makesnmplib)
320
321AC_ARG_ENABLE(time_hack,
322[ --enable-time-hack Update internal timestamp only once per second],
323[ if test "$enableval" = "yes" ; then
324 echo "Update internal timestamp only once per second"
325 AC_DEFINE(ALARM_UPDATES_TIME)
326 fi
327])
328
329AC_ARG_ENABLE(cachemgr_hostname,
330[ --enable-cachemgr-hostname[=hostname]
331 Make cachemgr.cgi default to this host],
332[ case $enableval in
333 yes)
334 AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()])
335 echo "Cachemgr default hostname == host where cachemgr runs"
336 ;;
337 no)
338 : # Nothing to do..
339 ;;
340 *)
341 AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
342 echo "Cachemgr default hostname set to ${enableval}"
343 ;;
344 esac
345])
346
347AC_ARG_ENABLE(arp_acl,
348[ --enable-arp-acl Enable use of ARP ACL lists (ether address)],
349[ if test "$enableval" = "yes" ; then
350 echo "ARP ACL lists enabled (ether address)"
933cc58d 351 case "$host" in
352 i386-*-freebsd*)
353 ;;
a931a29b 354 *-pc-linux-*)
355 ;;
933cc58d 356 *)
a931a29b 357 echo "WARNING: ARP ACL support is designed for FreeBSD and Linux;"
358 echo " it probably wont work on your $host system"
933cc58d 359 sleep 10
360 ;;
361 esac
e5f4e1b0 362 AC_DEFINE(USE_ARP_ACL)
363 fi
364])
365
74075210 366AC_ARG_ENABLE(htcp,
02749868 367[ --enable-htpc Enable HTCP protocol],
b4b8b6da 368[ if test "$enableval" = "yes" ; then
369 echo "HTCP enabled"
370 HTCP_OBJS='$(HTCP_OBJS)'
371 AC_DEFINE(USE_HTCP)
372 fi
74075210 373])
b4b8b6da 374AC_SUBST(HTCP_OBJS)
74075210 375
02749868 376AC_ARG_ENABLE(forw-via-db,
377[ --enable-forw-via-db Enable Forw/Via database],
378[ if test "$enableval" = "yes" ; then
379 echo "FORW-VIA enabled"
380 AC_DEFINE(FORW_VIA_DB)
381 fi
382])
383
6cfa8966 384AC_ARG_ENABLE(cache-digests,
22df58ea 385[ --enable-cache-digests Use Cache Digests
043e3d78 386 see http://squid.nlanr.net/Squid/FAQ/FAQ-16.html],
484f2ebc 387[ if test "$enableval" = "yes" ; then
6cfa8966 388 echo "USE_CACHE_DIGESTS enabled"
389 AC_DEFINE(USE_CACHE_DIGESTS)
484f2ebc 390 fi
391])
392
933cc58d 393dnl Select Error language
394AC_ARG_ENABLE(err-language,
395[ --enable-err-language=lang
396 Select language for Error pages (see errors dir) ],
397[
398 if test -d errors/$enableval; then
399 ERR_LANGUAGE=$enableval
400 else
401 echo "ERROR! Unknown language $enableval, see errors/"
402 exit 1
403 fi
93a8bb45 404],[ERR_LANGUAGE="English"])
933cc58d 405AC_SUBST(ERR_LANGUAGE)
406
fd9aaa3e 407# Force some compilers to use ANSI features
408#
409case "$host" in
410 alpha-dec-osf*)
411 if test "$ac_cv_prog_CC" = "cc" ; then
412 echo "adding '-std1' to cc args for $host"
413 CC="cc -std1";
414 ac_cv_prog_CC="$CC"
415 fi
416 ;;
417esac
418
090089c4 419dnl Check for programs
420AC_PROG_CPP
421AC_PROG_INSTALL
422AC_PROG_RANLIB
423AC_PROG_LN_S
81280a96 424AC_PATH_PROG(SH, sh, /bin/sh)
d9f67e6f 425AC_PATH_PROG(FALSE, false, /usr/bin/false)
426AC_PATH_PROG(TRUE, true, /usr/bin/true)
427AC_PATH_PROG(RM, rm, $FALSE)
428AC_PATH_PROG(MV, mv, $FALSE)
429AC_PATH_PROG(MKDIR, mkdir, $FALSE)
090089c4 430AC_PATH_PROG(LN, ln, cp)
983061ed 431AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
d9f67e6f 432AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
6ad85e8a 433AC_PATH_PROG(AR, ar, $FALSE)
434
435case "$host" in
436 *-hp-hpux*)
437 echo "Disabling 'ranlib' for HP-UX..."
438 RANLIB=":"
439 ;;
440esac
441
442dnl set $(AR)
443AR_R="$AR r"
444case "$host" in
445 *-next-nextstep3)
446 AR="libtool -o"
447 ;;
448esac
449AC_SUBST(AR_R)
090089c4 450
451dnl Check for headers
452AC_HEADER_DIRENT
453AC_HEADER_STDC
db40ae20 454
455AC_CHECK_HEADERS( \
456 alloca.h \
457 arpa/inet.h \
30a4f2a8 458 arpa/nameser.h \
9441aa34 459 assert.h \
db40ae20 460 bstring.h \
461 config.h \
462 crypt.h \
30a4f2a8 463 ctype.h \
464 errno.h \
db40ae20 465 fcntl.h \
9c1d8929 466 getopt.h \
88738790 467 gnumalloc.h \
30a4f2a8 468 grp.h \
469 libc.h \
6ad85e8a 470 limits.h \
30a4f2a8 471 malloc.h \
e0bddc45 472 math.h \
db40ae20 473 memory.h \
30a4f2a8 474 netdb.h \
db40ae20 475 netinet/in.h \
30a4f2a8 476 netinet/tcp.h \
dcfe6390 477 poll.h \
30a4f2a8 478 pwd.h \
479 regex.h \
480 resolv.h \
481 signal.h \
482 stdarg.h \
483 stddef.h \
484 stdio.h \
db40ae20 485 stdlib.h \
486 string.h \
487 strings.h \
488 sys/file.h \
30a4f2a8 489 sys/param.h \
490 sys/resource.h \
db40ae20 491 sys/select.h\
30a4f2a8 492 sys/socket.h \
493 sys/stat.h \
494 sys/syscall.h \
db40ae20 495 sys/time.h \
496 sys/types.h \
30a4f2a8 497 sys/un.h \
498 sys/wait.h \
db40ae20 499 syslog.h \
30a4f2a8 500 time.h \
501 unistd.h \
502 varargs.h \
db40ae20 503)
504
aee0606f 505AC_C_CONST
d57288d2 506AC_C_BIGENDIAN
aee0606f 507
5c51415d 508AC_CACHE_CHECK(if ANSI prototypes work,ac_cv_have_ansi_prototypes, [
509 AC_TRY_COMPILE([int foo(char *); int foo (char *bar) {return 1;}],
510 [foo("bar")],
511 ac_cv_have_ansi_prototypes="yes",
512 ac_cv_have_ansi_prototypes="no")
513])
514if test $ac_cv_have_ansi_prototypes = "yes" ; then
515 AC_DEFINE(HAVE_ANSI_PROTOTYPES)
516fi
20a50bb9 517
5c51415d 518AC_CACHE_CHECK(for tm->tm_gmtoff,ac_cv_have_tm_gmoff, [
519 AC_TRY_COMPILE([#include <time.h>
46c883ed 520#include <sys/time.h>],
5c51415d 521 [struct tm foo;
522 foo.tm_gmtoff = 0;],
523 ac_cv_have_tm_gmoff="yes",
524 ac_cv_have_tm_gmoff="no")
525])
526if test $ac_cv_have_tm_gmoff = "yes" ; then
527 AC_DEFINE(HAVE_TM_GMTOFF)
528fi
46c883ed 529
5c51415d 530AC_CACHE_CHECK(for extended mallinfo,ac_cv_have_ext_mallinfo, [
531 AC_TRY_COMPILE([#include <sys/types.h>
46c883ed 532#include <malloc.h>],
5c51415d 533 [struct mallinfo foo;
534 foo.mxfast = 0;],
535 ac_cv_have_ext_mallinfo="yes",
536 ac_cv_have_ext_mallinfo="no")
537])
538if test $ac_cv_have_ext_mallinfo = "yes" ; then
539 AC_DEFINE(HAVE_EXT_MALLINFO)
540fi
090089c4 541
b54a6789 542AC_CACHE_CHECK(for struct rusage,ac_cv_have_struct_rusage, [
543 AC_TRY_COMPILE([
8ff51bba 544#if HAVE_SYS_TIME_H
545#include <sys/time.h>
546#endif
b54a6789 547#if HAVE_SYS_RESOURCE_H
548#include <sys/resource.h>
549#endif],
550 [struct rusage R;],
551 ac_cv_have_struct_rusage="yes",
552 ac_cv_have_struct_rusage="no")
553])
554if test $ac_cv_have_struct_rusage = "yes" ; then
555 AC_DEFINE(HAVE_STRUCT_RUSAGE)
556fi
557
5c51415d 558AC_CACHE_CHECK(for ip->ip_hl, ac_cv_have_ip_hl, [
559 AC_TRY_COMPILE([#include <sys/types.h>
a025a745 560#include <netinet/in.h>
561#include <netinet/in_systm.h>
6ad85e8a 562#include <netinet/ip.h>
563#ifdef __linux__
564#define ip_hl ihl
565#endif
566#ifndef __linux__
567#define iphdr ip
568#endif],
5c51415d 569 [struct iphdr ip;
570 ip.ip_hl= 0;],
571 ac_cv_have_ip_hl="yes",
572 ac_cv_have_ip_hl="no")
573])
574if test $ac_cv_have_ip_hl = "yes" ; then
575 AC_DEFINE(HAVE_IP_HL)
576fi
a025a745 577
090089c4 578dnl Check for typedefs
579AC_CHECK_SIZEOF(int)
580AC_CHECK_SIZEOF(long)
581
256cf05b 582dnl Check for special functions
583AC_FUNC_ALLOCA
090089c4 584
3f6fcd8a 585AC_CHECK_TYPE(pid_t, int)
0897af2d 586AC_CHECK_TYPE(size_t, unsigned int)
587AC_CHECK_TYPE(ssize_t, int)
3f6fcd8a 588AC_CHECK_TYPE(off_t, int)
95cf2361 589AC_CHECK_TYPE(mode_t, u_short)
3f6fcd8a 590
090089c4 591dnl Check for needed libraries
30a4f2a8 592AC_CHECK_LIB(nsl, main)
6716b242 593AC_CHECK_LIB(socket, main)
94d48591 594
595if test "x$ac_cv_enabled_dlmalloc" = "xyes" ; then
596 echo "skipping libmalloc check (--enable-dlmalloc specified)"
5c51415d 597else
94d48591 598 AC_CHECK_LIB(gnumalloc, main)
599 if test "$ac_cv_lib_gnumalloc_main" = "yes"; then
600 echo "Disabling extended malloc functions when using gnumalloc"
601 ac_cv_func_mallinfo=no
602 ac_cv_func_mallocblksize=no
603 ac_cv_func_mallopt=no
604 else
605 case "$host" in
606 *-sun-solaris*)
607 echo "skipping libmalloc check for $host"
608 ;;
609 i386-*-freebsd*)
610 echo "skipping libmalloc check for $host"
611 ;;
612 *)
613
614 AC_CHECK_LIB(malloc, main)
615 ;;
616 esac
617 fi
8a15e65e 618fi
94d48591 619
6716b242 620AC_CHECK_LIB(bsd, main)
be79ade0 621AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"])
78743365 622case "$host" in
623 i386-*-freebsd*)
624 echo "skipping libresolv checks for $host"
625 ;;
626 *)
627 AC_CHECK_LIB(resolv, inet_aton, AC_CHECK_LIB(44bsd, inet_aton))
628 AC_CHECK_LIB(resolv, main)
629 ;;
630esac
e0bddc45 631AC_CHECK_LIB(m, main)
090089c4 632
633dnl Check for libcrypt
b8de7ebe 634dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
0f5a16f8 635AC_CHECK_LIB(crypt, crypt)
636if test $ac_cv_lib_crypt_crypt = "yes"; then
637 CRYPTLIB="-lcrypt"
638fi
be79ade0 639AC_SUBST(CRYPTLIB)
77f675ad 640
e5f4e1b0 641dnl Check for pthreads
642dnl We use pthreads when doing ASYNC I/O
0f5a16f8 643AC_CHECK_LIB(pthread, main)
644if test $ac_cv_lib_pthread_main = "yes"; then
645 PTHREADLIB="-lpthread"
646fi
71f8abc8 647AC_SUBST(PTHREADLIB)
648
77f675ad 649dnl System-specific library modifications
650dnl
651case "$host" in
88738790 652 i386-*-solaris2.*)
7149a49f 653 if test "$GCC" = "yes"; then
654 echo "Removing -O for gcc on $host"
80e92d6d 655 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
7149a49f 656 fi
657 ;;
77f675ad 658 *-sgi-irix*)
659 echo "Removing -lsocket for IRIX..."
6716b242 660 LIBS=`echo $LIBS | sed -e s/-lsocket//`
77f675ad 661 echo "Removing -lnsl for IRIX..."
6716b242 662 LIBS=`echo $LIBS | sed -e s/-lnsl//`
b44c0fb4 663 echo "Removing -lbsd for IRIX..."
664 LIBS=`echo $LIBS | sed -e s/-lbsd//`
77f675ad 665 ;;
4ba0bd0e 666dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
667dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
668dnl Please change your configure script. AIX doesn't need -lbsd.
669 *-ibm-aix*)
670 echo "Removing -lbsd for AIX..."
671 LIBS=`echo $LIBS | sed -e s/-lbsd//`
672 ;;
30a4f2a8 673 *m88k*)
674 CFLAGS="$CFLAGS -D_SQUID_MOTOROLA_"
7149a49f 675 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
676 ;;
580ce039 677 [*-*-solaris2.[0-4]])
7149a49f 678 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
30a4f2a8 679 ;;
77f675ad 680esac
090089c4 681
176d10ee 682# Recommended by Balint Nagy Endre <bne@CareNet.hu>
683case "$host" in
684 *-univel-sysv4.2MP)
685 if test `uname -v` = "2.03"; then
686 echo "disabling mallinfo for $host"
687 ac_cv_func_mallinfo=no
688 fi
689 ;;
690esac
691
692
6716b242 693dnl Check for library functions
694AC_CHECK_FUNCS(\
30a4f2a8 695 bcopy \
df087e68 696 crypt \
4ac29a5b 697 fchmod \
6716b242 698 getdtablesize \
8505e57b 699 getpagesize \
30a4f2a8 700 getrusage \
9c1d8929 701 getspnam \
30a4f2a8 702 lrand48 \
6716b242 703 mallinfo \
0f5efab0 704 mallocblksize \
6716b242 705 mallopt \
2ae6b9b0 706 memcpy \
30a4f2a8 707 memmove \
dac27377 708 memset \
1812b6c7 709 mktime \
88738790 710 mstats \
b1e77ec1 711 random \
6716b242 712 regcomp \
713 regexec \
714 regfree \
30a4f2a8 715 res_init \
4915be3b 716 rint \
234967c9 717 seteuid \
30a4f2a8 718 setpgrp \
6716b242 719 setrlimit \
30a4f2a8 720 setsid \
721 sigaction \
11430c03 722 snprintf \
30a4f2a8 723 srand48 \
b1e77ec1 724 srandom \
6716b242 725 sysconf \
726 syslog \
0a3efad5 727 tempnam \
234967c9 728 timegm \
28da5e0d 729 vsnprintf \
6716b242 730)
731
a03233e7 732case "$host" in
733 [alpha-dec-osf3.*])
734 # John Kay (jkay@nlanr.net) 19970818
bbaf3d23 735 echo "skipping poll() check for $host..."
736 ac_cv_func_poll='no'
737 ;;
738 [*-hp-hpux*.*])
739 # Duane Wessels
740 echo "skipping poll() check for $host..."
741 ac_cv_func_poll='no'
742 ;;
743 *)
7e9bec27 744 AC_CHECK_FUNCS(poll)
a03233e7 745 ;;
746esac
747
60939927 748dnl Yay! Another Linux brokenness. Its not good enough
749dnl to know that setresuid() exists, because RedHat 5.0 declares
750dnl setresuid() but doesn't implement it.
751dnl
752AC_CACHE_CHECK(if setresuid is implemented, ac_cv_func_setresuid,
5c51415d 753 AC_TRY_RUN([
60939927 754#include <stdlib.h>
5c51415d 755 int main() {
756 if(setresuid(-1,-1,-1)) {
757 perror("setresuid:");
758 exit(1);
60939927 759 }
760 exit(0);
5c51415d 761 }
762 ],ac_cv_func_setresuid="yes",ac_cv_func_setresuid="no")
60939927 763)
5c51415d 764if test "$ac_cv_func_setresuid" = "yes" ; then
765 AC_DEFINE(HAVE_SETRESUID)
766fi
60939927 767
91bc414e 768if test -z "$USE_GNUREGEX" ; then
769 case "$host" in
770 *-sun-solaris2.[[0-4]])
771 USE_GNUREGEX="yes"
772 ;;
773 *-next-nextstep*)
774 USE_GNUREGEX="yes"
775 ;;
776 esac
777fi
7a081912 778AC_MSG_CHECKING(if GNUregex needs to be compiled)
91bc414e 779if test -z "$USE_GNUREGEX"; then
55878dfd 780if test "$ac_cv_func_regcomp" = "no" || test "$USE_GNUREGEX" = "yes" ; then
74946a0f 781 USE_GNUREGEX="yes"
00fa2c12 782else
0cccc031 783 AC_TRY_COMPILE([#include <sys/types.h>
784#include <regex.h>],[regex_t t; regcomp(&t,"",0);],
91bc414e 785 USE_GNUREGEX="no",
786 USE_GNUREGEX="yes")
787fi
00fa2c12 788fi
74946a0f 789AC_MSG_RESULT($USE_GNUREGEX)
790if test "$USE_GNUREGEX" = "yes"; then
26675bf4 791 REGEXLIB="-lregex"
7a081912 792 LIBREGEX="libregex.a"
74946a0f 793 AC_DEFINE(USE_GNUREGEX)
7a081912 794fi
26675bf4 795AC_SUBST(REGEXLIB)
00fa2c12 796AC_SUBST(LIBREGEX)
7a081912 797
3f6fcd8a 798AC_REPLACE_FUNCS(\
799 tempnam \
4d38fc7e 800 strerror \
3f6fcd8a 801)
802
5c51415d 803dnl Not cached since people are likely to tune this
e924600d 804AC_MSG_CHECKING(Default FD_SETSIZE value)
805AC_TRY_RUN([
806#if HAVE_STDIO_H
807#include <stdio.h>
808#endif
809#if HAVE_UNISTD_H
810#include <unistd.h>
811#endif
812#if HAVE_SYS_TIME_H
813#include <sys/time.h>
814#endif
815#if HAVE_SYS_SELECT_H
816#include <sys/select.h>
817#endif
818#if HAVE_SYS_TYPES_H
819#include <sys/types.h>
820#endif
821main() {
822 fprintf (fopen("conftestval", "w"), "%d\n", FD_SETSIZE);
823 exit(0);
824}
825],
826DEFAULT_FD_SETSIZE=`cat conftestval`,
827DEFAULT_FD_SETSIZE=256,
828DEFAULT_FD_SETSIZE=256)
829AC_MSG_RESULT($DEFAULT_FD_SETSIZE)
830AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE)
831
5c51415d 832dnl Not cached since people are likely to tune this
234967c9 833AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
834AC_TRY_RUN([
8cca06da 835#include <stdio.h>
234967c9 836#include <unistd.h>
30a4f2a8 837#include <sys/time.h> /* needed on FreeBSD */
234967c9 838#include <sys/param.h>
839#include <sys/resource.h>
840main() {
841 int i,j;
df087e68 842#if __CYGWIN32__
843 /* getrlimit and sysconf returns bogous values on cygwin32.
844 * Number of fds is virtually unlimited in cygwin (sys/param.h)
845 */
846 i = NOFILE;
847#else
234967c9 848#if HAVE_SETRLIMIT
849 struct rlimit rl;
850#if defined(RLIMIT_NOFILE)
851 if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
852 perror("getrlimit: RLIMIT_NOFILE");
853 } else {
854 rl.rlim_cur = rl.rlim_max; /* set it to the max */
855 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
856 perror("setrlimit: RLIMIT_NOFILE");
857 }
858 }
859#elif defined(RLIMIT_OFILE)
860 if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
861 perror("getrlimit: RLIMIT_OFILE");
862 } else {
863 rl.rlim_cur = rl.rlim_max; /* set it to the max */
864 if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
865 perror("setrlimit: RLIMIT_OFILE");
866 }
867 }
868#endif /* RLIMIT_NOFILE */
869#endif /* HAVE_SETRLIMIT */
870#if HAVE_SYSCONF && defined(_SC_OPEN_MAX)
871 i = sysconf(_SC_OPEN_MAX);
3f6fcd8a 872#elif HAVE_GETDTABLESIZE && !defined(__linux__)
234967c9 873 i = getdtablesize();
874#elif defined(OPEN_MAX)
875 i = OPEN_MAX;
876#elif defined(NOFILE)
877 i = NOFILE;
878#elif defined(_NFILE)
879 i = _NFILE;
880#else
881 while((j=open("/dev/null", 0)) > 0) i=j;
0a5b9b32 882 close(i); close(i-1);
883 i++;
234967c9 884#endif
df087e68 885#endif /* __CYGWIN32__ */
234967c9 886 fprintf (fopen("conftestval", "w"), "%d\n", i);
887 exit(0);
888}
889],
431d84c5 890SQUID_MAXFD=`cat conftestval`,
891SQUID_MAXFD=256,
892SQUID_MAXFD=256)
893AC_MSG_RESULT($SQUID_MAXFD)
894AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD)
b9cc811d 895if test "$SQUID_MAXFD" -lt 512 ; then
80ab193b 896 echo "WARNING: $SQUID_MAXFD may not be enough filedescriptors if your"
897 echo " cache will be very busy. Please see the FAQ page"
043e3d78 898 echo " http://squid.nlanr.net/Squid/FAQ/FAQ-11.html#filedescriptors"
e692ff35 899 echo " on how to increase your filedescriptor limit"
933cc58d 900 sleep 10
80ab193b 901fi
234967c9 902
5c51415d 903dnl Not cached since people are likely to tune this
30a4f2a8 904AC_MSG_CHECKING(Default UDP send buffer size)
905AC_TRY_RUN([
8cca06da 906#include <stdlib.h>
907#include <stdio.h>
30a4f2a8 908#include <sys/types.h>
909#include <sys/socket.h>
910#include <netinet/in.h>
911main ()
912{
913 int fd,val=0,len=sizeof(int);
914 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
915 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
916 if (val<=0) exit(1);
917 fprintf (fopen("conftestval", "w"), "%d\n", val);
918 exit(0);
919}
920],
921SQUID_UDP_SO_SNDBUF=`cat conftestval`,
1c481e00 922SQUID_UDP_SO_SNDBUF=16384,
923SQUID_UDP_SO_SNDBUF=16384)
30a4f2a8 924AC_MSG_RESULT($SQUID_UDP_SO_SNDBUF)
925AC_DEFINE_UNQUOTED(SQUID_UDP_SO_SNDBUF, $SQUID_UDP_SO_SNDBUF)
926
5c51415d 927dnl Not cached since people are likely to tune this
30a4f2a8 928AC_MSG_CHECKING(Default UDP receive buffer size)
929AC_TRY_RUN([
8cca06da 930#include <stdlib.h>
931#include <stdio.h>
30a4f2a8 932#include <sys/types.h>
933#include <sys/socket.h>
934#include <netinet/in.h>
935main ()
936{
937 int fd,val=0,len=sizeof(int);
938 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
939 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
940 if (val <= 0) exit(1);
941 fprintf (fopen("conftestval", "w"), "%d\n", val);
942 exit(0);
943}
944],
945SQUID_UDP_SO_RCVBUF=`cat conftestval`,
1c481e00 946SQUID_UDP_SO_RCVBUF=16384,
947SQUID_UDP_SO_RCVBUF=16384)
30a4f2a8 948AC_MSG_RESULT($SQUID_UDP_SO_RCVBUF)
949AC_DEFINE_UNQUOTED(SQUID_UDP_SO_RCVBUF, $SQUID_UDP_SO_RCVBUF)
950
5c51415d 951dnl Not cached since people are likely to tune this
30a4f2a8 952AC_MSG_CHECKING(Default TCP send buffer size)
953AC_TRY_RUN([
8cca06da 954#include <stdlib.h>
955#include <stdio.h>
30a4f2a8 956#include <sys/types.h>
957#include <sys/socket.h>
958#include <netinet/in.h>
959main ()
960{
961 int fd,val=0,len=sizeof(int);
962 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
963 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
964 if (val <= 0) exit(1);
965 fprintf (fopen("conftestval", "w"), "%d\n", val);
966 exit(0);
967}
968],
969SQUID_TCP_SO_SNDBUF=`cat conftestval`,
1c481e00 970SQUID_TCP_SO_SNDBUF=16384,
971SQUID_TCP_SO_SNDBUF=16384)
30a4f2a8 972AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF)
973AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF)
974
5c51415d 975dnl Not cached since people are likely to tune this
30a4f2a8 976AC_MSG_CHECKING(Default TCP receive buffer size)
977AC_TRY_RUN([
8cca06da 978#include <stdlib.h>
979#include <stdio.h>
30a4f2a8 980#include <sys/types.h>
981#include <sys/socket.h>
982#include <netinet/in.h>
983main ()
984{
985 int fd,val=0,len=sizeof(int);
986 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
987 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
988 if (val <= 0) exit(1);
989 fprintf (fopen("conftestval", "w"), "%d\n", val);
990 exit(0);
991}
992],
993SQUID_TCP_SO_RCVBUF=`cat conftestval`,
1c481e00 994SQUID_TCP_SO_RCVBUF=16384,
995SQUID_TCP_SO_RCVBUF=16384)
30a4f2a8 996AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF)
997AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF)
998
5c51415d 999AC_CACHE_CHECK(if sys_errlist is already defined, ac_cv_needs_sys_errlist,
1000 AC_TRY_COMPILE([#include <stdio.h>],[char *s = sys_errlist[0];],
1001 ac_cv_needs_sys_errlist="no",
1002 ac_cv_needs_sys_errlist="yes")
1003)
1004if test "$ac_cv_needs_sys_errlist" = "yes" ; then
1005 AC_DEFINE(NEED_SYS_ERRLIST)
1006fi
30a4f2a8 1007
5c51415d 1008dnl Not cached since people are likely to change this
6bf65235 1009AC_MSG_CHECKING(for libresolv _dns_ttl_ hack)
1010AC_TRY_LINK(extern int _dns_ttl_;,return _dns_ttl_;,
1011[AC_MSG_RESULT(yes)
1012AC_DEFINE(LIBRESOLV_DNS_TTL_HACK)],
1013AC_MSG_RESULT(no))
1014
090089c4 1015dnl Need the debugging version of malloc if available
1016XTRA_OBJS=''
6509a1a0 1017if test "$ac_cv_lib_malloc_main" = "yes" ; then
090089c4 1018 if test -r /usr/lib/debug/malloc.o ; then
1019 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
1020 fi
1021 if test -r /usr/lib/debug/mallocmap.o ; then
1022 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
1023 fi
1024fi
2bbd722b 1025
090089c4 1026AC_SUBST(XTRA_OBJS)
1027
38fea766 1028if test -z "$XTRA_LIBS"; then
1029 XTRA_LIBS="$LIBS"
0f5a16f8 1030 dnl -lcrypt is set in CRYPTLIB
1031 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/-lcrypt//"`
1032 dnl -lpthread is set in PTHREADLIB
1033 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/-lpthread//"`
1034 dnl minor cleanup
1035 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
38fea766 1036 LIBS=''
1037fi
090089c4 1038AC_SUBST(XTRA_LIBS)
1039
090089c4 1040dnl Clean up after OSF/1 core dump bug
1041rm -f core
1042
1043AC_OUTPUT(\
0992a350 1044 ./makefile \
090089c4 1045 ./lib/Makefile \
a26bdc75 1046 ./include/config.h \
090089c4 1047 ./scripts/Makefile \
1048 ./scripts/RunCache \
1049 ./scripts/RunAccel \
a26bdc75 1050 ./src/Makefile \
e550e8b6 1051 ./contrib/Makefile \
2bbd722b 1052 ./snmplib/Makefile \
81280a96 1053 ./icons/Makefile \
d4fb069d 1054 ./errors/Makefile \
090089c4 1055)