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