]> git.ipfire.org Git - thirdparty/squid.git/blame - configure.in
From: Henrik Nordstrom <hno@hem.passagen.se>
[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
0f5a16f8 6dnl $Id: configure.in,v 1.127 1998/05/08 22:06:52 wessels Exp $
090089c4 7dnl
8dnl
090089c4 9dnl
a26bdc75 10AC_INIT(src/main.c)
090089c4 11AC_CONFIG_HEADER(include/autoconf.h)
0f5a16f8 12AC_REVISION($Revision: 1.127 $)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 ;;
315 *)
316 echo "WARNING: ARP ACL support is designed for FreeBSD and"
e692ff35 317 echo " probably wont work on your $host system"
933cc58d 318 sleep 10
319 ;;
320 esac
e5f4e1b0 321 AC_DEFINE(USE_ARP_ACL)
322 fi
323])
324
74075210 325AC_ARG_ENABLE(htcp,
02749868 326[ --enable-htpc Enable HTCP protocol],
b4b8b6da 327[ if test "$enableval" = "yes" ; then
328 echo "HTCP enabled"
329 HTCP_OBJS='$(HTCP_OBJS)'
330 AC_DEFINE(USE_HTCP)
331 fi
74075210 332])
b4b8b6da 333AC_SUBST(HTCP_OBJS)
74075210 334
02749868 335AC_ARG_ENABLE(forw-via-db,
336[ --enable-forw-via-db Enable Forw/Via database],
337[ if test "$enableval" = "yes" ; then
338 echo "FORW-VIA enabled"
339 AC_DEFINE(FORW_VIA_DB)
340 fi
341])
342
6cfa8966 343AC_ARG_ENABLE(cache-digests,
22df58ea 344[ --enable-cache-digests Use Cache Digests
345 see http://squid.nlanr.net/Squid/FAQ/FAQ-15.html],
484f2ebc 346[ if test "$enableval" = "yes" ; then
6cfa8966 347 echo "USE_CACHE_DIGESTS enabled"
348 AC_DEFINE(USE_CACHE_DIGESTS)
484f2ebc 349 fi
350])
351
933cc58d 352dnl Select Error language
353AC_ARG_ENABLE(err-language,
354[ --enable-err-language=lang
355 Select language for Error pages (see errors dir) ],
356[
357 if test -d errors/$enableval; then
358 ERR_LANGUAGE=$enableval
359 else
360 echo "ERROR! Unknown language $enableval, see errors/"
361 exit 1
362 fi
93a8bb45 363],[ERR_LANGUAGE="English"])
933cc58d 364AC_SUBST(ERR_LANGUAGE)
365
fd9aaa3e 366# Force some compilers to use ANSI features
367#
368case "$host" in
369 alpha-dec-osf*)
370 if test "$ac_cv_prog_CC" = "cc" ; then
371 echo "adding '-std1' to cc args for $host"
372 CC="cc -std1";
373 ac_cv_prog_CC="$CC"
374 fi
375 ;;
376esac
377
090089c4 378dnl Check for programs
379AC_PROG_CPP
380AC_PROG_INSTALL
381AC_PROG_RANLIB
382AC_PROG_LN_S
81280a96 383AC_PATH_PROG(SH, sh, /bin/sh)
d9f67e6f 384AC_PATH_PROG(FALSE, false, /usr/bin/false)
385AC_PATH_PROG(TRUE, true, /usr/bin/true)
386AC_PATH_PROG(RM, rm, $FALSE)
387AC_PATH_PROG(MV, mv, $FALSE)
388AC_PATH_PROG(MKDIR, mkdir, $FALSE)
090089c4 389AC_PATH_PROG(LN, ln, cp)
983061ed 390AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
d9f67e6f 391AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
6ad85e8a 392AC_PATH_PROG(AR, ar, $FALSE)
393
394case "$host" in
395 *-hp-hpux*)
396 echo "Disabling 'ranlib' for HP-UX..."
397 RANLIB=":"
398 ;;
399esac
400
401dnl set $(AR)
402AR_R="$AR r"
403case "$host" in
404 *-next-nextstep3)
405 AR="libtool -o"
406 ;;
407esac
408AC_SUBST(AR_R)
090089c4 409
410dnl Check for headers
411AC_HEADER_DIRENT
412AC_HEADER_STDC
db40ae20 413
414AC_CHECK_HEADERS( \
415 alloca.h \
416 arpa/inet.h \
30a4f2a8 417 arpa/nameser.h \
9441aa34 418 assert.h \
db40ae20 419 bstring.h \
420 config.h \
421 crypt.h \
30a4f2a8 422 ctype.h \
423 errno.h \
db40ae20 424 fcntl.h \
9c1d8929 425 getopt.h \
88738790 426 gnumalloc.h \
30a4f2a8 427 grp.h \
428 libc.h \
6ad85e8a 429 limits.h \
30a4f2a8 430 malloc.h \
e0bddc45 431 math.h \
db40ae20 432 memory.h \
30a4f2a8 433 netdb.h \
db40ae20 434 netinet/in.h \
30a4f2a8 435 netinet/tcp.h \
dcfe6390 436 poll.h \
30a4f2a8 437 pwd.h \
438 regex.h \
439 resolv.h \
440 signal.h \
441 stdarg.h \
442 stddef.h \
443 stdio.h \
db40ae20 444 stdlib.h \
445 string.h \
446 strings.h \
447 sys/file.h \
30a4f2a8 448 sys/param.h \
449 sys/resource.h \
db40ae20 450 sys/select.h\
30a4f2a8 451 sys/socket.h \
452 sys/stat.h \
453 sys/syscall.h \
db40ae20 454 sys/time.h \
455 sys/types.h \
30a4f2a8 456 sys/un.h \
457 sys/wait.h \
db40ae20 458 syslog.h \
30a4f2a8 459 time.h \
460 unistd.h \
461 varargs.h \
db40ae20 462)
463
aee0606f 464AC_C_CONST
d57288d2 465AC_C_BIGENDIAN
aee0606f 466
5c51415d 467AC_CACHE_CHECK(if ANSI prototypes work,ac_cv_have_ansi_prototypes, [
468 AC_TRY_COMPILE([int foo(char *); int foo (char *bar) {return 1;}],
469 [foo("bar")],
470 ac_cv_have_ansi_prototypes="yes",
471 ac_cv_have_ansi_prototypes="no")
472])
473if test $ac_cv_have_ansi_prototypes = "yes" ; then
474 AC_DEFINE(HAVE_ANSI_PROTOTYPES)
475fi
20a50bb9 476
5c51415d 477AC_CACHE_CHECK(for tm->tm_gmtoff,ac_cv_have_tm_gmoff, [
478 AC_TRY_COMPILE([#include <time.h>
46c883ed 479#include <sys/time.h>],
5c51415d 480 [struct tm foo;
481 foo.tm_gmtoff = 0;],
482 ac_cv_have_tm_gmoff="yes",
483 ac_cv_have_tm_gmoff="no")
484])
485if test $ac_cv_have_tm_gmoff = "yes" ; then
486 AC_DEFINE(HAVE_TM_GMTOFF)
487fi
46c883ed 488
5c51415d 489AC_CACHE_CHECK(for extended mallinfo,ac_cv_have_ext_mallinfo, [
490 AC_TRY_COMPILE([#include <sys/types.h>
46c883ed 491#include <malloc.h>],
5c51415d 492 [struct mallinfo foo;
493 foo.mxfast = 0;],
494 ac_cv_have_ext_mallinfo="yes",
495 ac_cv_have_ext_mallinfo="no")
496])
497if test $ac_cv_have_ext_mallinfo = "yes" ; then
498 AC_DEFINE(HAVE_EXT_MALLINFO)
499fi
090089c4 500
b54a6789 501AC_CACHE_CHECK(for struct rusage,ac_cv_have_struct_rusage, [
502 AC_TRY_COMPILE([
8ff51bba 503#if HAVE_SYS_TIME_H
504#include <sys/time.h>
505#endif
b54a6789 506#if HAVE_SYS_RESOURCE_H
507#include <sys/resource.h>
508#endif],
509 [struct rusage R;],
510 ac_cv_have_struct_rusage="yes",
511 ac_cv_have_struct_rusage="no")
512])
513if test $ac_cv_have_struct_rusage = "yes" ; then
514 AC_DEFINE(HAVE_STRUCT_RUSAGE)
515fi
516
5c51415d 517AC_CACHE_CHECK(for ip->ip_hl, ac_cv_have_ip_hl, [
518 AC_TRY_COMPILE([#include <sys/types.h>
a025a745 519#include <netinet/in.h>
520#include <netinet/in_systm.h>
6ad85e8a 521#include <netinet/ip.h>
522#ifdef __linux__
523#define ip_hl ihl
524#endif
525#ifndef __linux__
526#define iphdr ip
527#endif],
5c51415d 528 [struct iphdr ip;
529 ip.ip_hl= 0;],
530 ac_cv_have_ip_hl="yes",
531 ac_cv_have_ip_hl="no")
532])
533if test $ac_cv_have_ip_hl = "yes" ; then
534 AC_DEFINE(HAVE_IP_HL)
535fi
a025a745 536
090089c4 537dnl Check for typedefs
538AC_CHECK_SIZEOF(int)
539AC_CHECK_SIZEOF(long)
540
256cf05b 541dnl Check for special functions
542AC_FUNC_ALLOCA
090089c4 543
3f6fcd8a 544AC_CHECK_TYPE(pid_t, int)
0897af2d 545AC_CHECK_TYPE(size_t, unsigned int)
546AC_CHECK_TYPE(ssize_t, int)
3f6fcd8a 547AC_CHECK_TYPE(off_t, int)
95cf2361 548AC_CHECK_TYPE(mode_t, u_short)
3f6fcd8a 549
090089c4 550dnl Check for needed libraries
30a4f2a8 551AC_CHECK_LIB(nsl, main)
6716b242 552AC_CHECK_LIB(socket, main)
8a15e65e 553AC_CHECK_LIB(gnumalloc, main)
5c51415d 554if test "$ac_cv_lib_gnumalloc_main" = "yes"; then
555 echo "Disabling extended malloc functions when using gnumalloc"
556 ac_cv_func_mallinfo=no
557 ac_cv_func_mallocblksize=no
558 ac_cv_func_mallopt=no
559else
8a15e65e 560 case "$host" in
561 *-sun-solaris*)
562 echo "skipping libmalloc check for $host"
563 ;;
564 i386-*-freebsd*)
565 echo "skipping libmalloc check for $host"
566 ;;
567 *)
568 AC_CHECK_LIB(malloc, main)
569 ;;
570 esac
571fi
6716b242 572AC_CHECK_LIB(bsd, main)
be79ade0 573AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"])
78743365 574case "$host" in
575 i386-*-freebsd*)
576 echo "skipping libresolv checks for $host"
577 ;;
578 *)
579 AC_CHECK_LIB(resolv, inet_aton, AC_CHECK_LIB(44bsd, inet_aton))
580 AC_CHECK_LIB(resolv, main)
581 ;;
582esac
e0bddc45 583AC_CHECK_LIB(m, main)
090089c4 584
585dnl Check for libcrypt
b8de7ebe 586dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
0f5a16f8 587AC_CHECK_LIB(crypt, crypt)
588if test $ac_cv_lib_crypt_crypt = "yes"; then
589 CRYPTLIB="-lcrypt"
590fi
be79ade0 591AC_SUBST(CRYPTLIB)
77f675ad 592
e5f4e1b0 593dnl Check for pthreads
594dnl We use pthreads when doing ASYNC I/O
0f5a16f8 595AC_CHECK_LIB(pthread, main)
596if test $ac_cv_lib_pthread_main = "yes"; then
597 PTHREADLIB="-lpthread"
598fi
71f8abc8 599AC_SUBST(PTHREADLIB)
600
77f675ad 601dnl System-specific library modifications
602dnl
603case "$host" in
88738790 604 i386-*-solaris2.*)
7149a49f 605 if test "$GCC" = "yes"; then
606 echo "Removing -O for gcc on $host"
80e92d6d 607 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
7149a49f 608 fi
609 ;;
77f675ad 610 *-sgi-irix*)
611 echo "Removing -lsocket for IRIX..."
6716b242 612 LIBS=`echo $LIBS | sed -e s/-lsocket//`
77f675ad 613 echo "Removing -lnsl for IRIX..."
6716b242 614 LIBS=`echo $LIBS | sed -e s/-lnsl//`
b44c0fb4 615 echo "Removing -lbsd for IRIX..."
616 LIBS=`echo $LIBS | sed -e s/-lbsd//`
77f675ad 617 ;;
4ba0bd0e 618dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
619dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
620dnl Please change your configure script. AIX doesn't need -lbsd.
621 *-ibm-aix*)
622 echo "Removing -lbsd for AIX..."
623 LIBS=`echo $LIBS | sed -e s/-lbsd//`
624 ;;
30a4f2a8 625 *m88k*)
626 CFLAGS="$CFLAGS -D_SQUID_MOTOROLA_"
7149a49f 627 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
628 ;;
580ce039 629 [*-*-solaris2.[0-4]])
7149a49f 630 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
30a4f2a8 631 ;;
77f675ad 632esac
090089c4 633
176d10ee 634# Recommended by Balint Nagy Endre <bne@CareNet.hu>
635case "$host" in
636 *-univel-sysv4.2MP)
637 if test `uname -v` = "2.03"; then
638 echo "disabling mallinfo for $host"
639 ac_cv_func_mallinfo=no
640 fi
641 ;;
642esac
643
644
6716b242 645dnl Check for library functions
646AC_CHECK_FUNCS(\
30a4f2a8 647 bcopy \
df087e68 648 crypt \
4ac29a5b 649 fchmod \
6716b242 650 getdtablesize \
8505e57b 651 getpagesize \
30a4f2a8 652 getrusage \
9c1d8929 653 getspnam \
30a4f2a8 654 lrand48 \
6716b242 655 mallinfo \
0f5efab0 656 mallocblksize \
6716b242 657 mallopt \
2ae6b9b0 658 memcpy \
30a4f2a8 659 memmove \
1812b6c7 660 mktime \
88738790 661 mstats \
b1e77ec1 662 random \
6716b242 663 regcomp \
664 regexec \
665 regfree \
30a4f2a8 666 res_init \
234967c9 667 seteuid \
30a4f2a8 668 setpgrp \
6716b242 669 setrlimit \
30a4f2a8 670 setsid \
671 sigaction \
11430c03 672 snprintf \
30a4f2a8 673 srand48 \
b1e77ec1 674 srandom \
6716b242 675 sysconf \
676 syslog \
0a3efad5 677 tempnam \
234967c9 678 timegm \
28da5e0d 679 vsnprintf \
6716b242 680)
681
a03233e7 682case "$host" in
683 [alpha-dec-osf3.*])
684 # John Kay (jkay@nlanr.net) 19970818
bbaf3d23 685 echo "skipping poll() check for $host..."
686 ac_cv_func_poll='no'
687 ;;
688 [*-hp-hpux*.*])
689 # Duane Wessels
690 echo "skipping poll() check for $host..."
691 ac_cv_func_poll='no'
692 ;;
693 *)
694 AC_CHECK_FUNC(poll)
a03233e7 695 ;;
696esac
697
60939927 698dnl Yay! Another Linux brokenness. Its not good enough
699dnl to know that setresuid() exists, because RedHat 5.0 declares
700dnl setresuid() but doesn't implement it.
701dnl
702AC_CACHE_CHECK(if setresuid is implemented, ac_cv_func_setresuid,
5c51415d 703 AC_TRY_RUN([
60939927 704#include <stdlib.h>
5c51415d 705 int main() {
706 if(setresuid(-1,-1,-1)) {
707 perror("setresuid:");
708 exit(1);
60939927 709 }
710 exit(0);
5c51415d 711 }
712 ],ac_cv_func_setresuid="yes",ac_cv_func_setresuid="no")
60939927 713)
5c51415d 714if test "$ac_cv_func_setresuid" = "yes" ; then
715 AC_DEFINE(HAVE_SETRESUID)
716fi
60939927 717
91bc414e 718if test -z "$USE_GNUREGEX" ; then
719 case "$host" in
720 *-sun-solaris2.[[0-4]])
721 USE_GNUREGEX="yes"
722 ;;
723 *-next-nextstep*)
724 USE_GNUREGEX="yes"
725 ;;
726 esac
727fi
7a081912 728AC_MSG_CHECKING(if GNUregex needs to be compiled)
91bc414e 729if test -z "$USE_GNUREGEX"; then
55878dfd 730if test "$ac_cv_func_regcomp" = "no" || test "$USE_GNUREGEX" = "yes" ; then
74946a0f 731 USE_GNUREGEX="yes"
00fa2c12 732else
91bc414e 733 AC_TRY_COMPILE([#include <regex.h>],[regex_t t; regcomp(&t,"",0);],
734 USE_GNUREGEX="no",
735 USE_GNUREGEX="yes")
736fi
00fa2c12 737fi
74946a0f 738AC_MSG_RESULT($USE_GNUREGEX)
739if test "$USE_GNUREGEX" = "yes"; then
26675bf4 740 REGEXLIB="-lregex"
7a081912 741 LIBREGEX="libregex.a"
74946a0f 742 AC_DEFINE(USE_GNUREGEX)
7a081912 743fi
26675bf4 744AC_SUBST(REGEXLIB)
00fa2c12 745AC_SUBST(LIBREGEX)
7a081912 746
3f6fcd8a 747AC_REPLACE_FUNCS(\
748 tempnam \
4d38fc7e 749 strerror \
3f6fcd8a 750)
751
5c51415d 752dnl Not cached since people are likely to tune this
e924600d 753AC_MSG_CHECKING(Default FD_SETSIZE value)
754AC_TRY_RUN([
755#if HAVE_STDIO_H
756#include <stdio.h>
757#endif
758#if HAVE_UNISTD_H
759#include <unistd.h>
760#endif
761#if HAVE_SYS_TIME_H
762#include <sys/time.h>
763#endif
764#if HAVE_SYS_SELECT_H
765#include <sys/select.h>
766#endif
767#if HAVE_SYS_TYPES_H
768#include <sys/types.h>
769#endif
770main() {
771 fprintf (fopen("conftestval", "w"), "%d\n", FD_SETSIZE);
772 exit(0);
773}
774],
775DEFAULT_FD_SETSIZE=`cat conftestval`,
776DEFAULT_FD_SETSIZE=256,
777DEFAULT_FD_SETSIZE=256)
778AC_MSG_RESULT($DEFAULT_FD_SETSIZE)
779AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE)
780
5c51415d 781dnl Not cached since people are likely to tune this
234967c9 782AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
783AC_TRY_RUN([
8cca06da 784#include <stdio.h>
234967c9 785#include <unistd.h>
30a4f2a8 786#include <sys/time.h> /* needed on FreeBSD */
234967c9 787#include <sys/param.h>
788#include <sys/resource.h>
789main() {
790 int i,j;
df087e68 791#if __CYGWIN32__
792 /* getrlimit and sysconf returns bogous values on cygwin32.
793 * Number of fds is virtually unlimited in cygwin (sys/param.h)
794 */
795 i = NOFILE;
796#else
234967c9 797#if HAVE_SETRLIMIT
798 struct rlimit rl;
799#if defined(RLIMIT_NOFILE)
800 if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
801 perror("getrlimit: RLIMIT_NOFILE");
802 } else {
803 rl.rlim_cur = rl.rlim_max; /* set it to the max */
804 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
805 perror("setrlimit: RLIMIT_NOFILE");
806 }
807 }
808#elif defined(RLIMIT_OFILE)
809 if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
810 perror("getrlimit: RLIMIT_OFILE");
811 } else {
812 rl.rlim_cur = rl.rlim_max; /* set it to the max */
813 if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
814 perror("setrlimit: RLIMIT_OFILE");
815 }
816 }
817#endif /* RLIMIT_NOFILE */
818#endif /* HAVE_SETRLIMIT */
819#if HAVE_SYSCONF && defined(_SC_OPEN_MAX)
820 i = sysconf(_SC_OPEN_MAX);
3f6fcd8a 821#elif HAVE_GETDTABLESIZE && !defined(__linux__)
234967c9 822 i = getdtablesize();
823#elif defined(OPEN_MAX)
824 i = OPEN_MAX;
825#elif defined(NOFILE)
826 i = NOFILE;
827#elif defined(_NFILE)
828 i = _NFILE;
829#else
830 while((j=open("/dev/null", 0)) > 0) i=j;
0a5b9b32 831 close(i); close(i-1);
832 i++;
234967c9 833#endif
df087e68 834#endif /* __CYGWIN32__ */
234967c9 835 fprintf (fopen("conftestval", "w"), "%d\n", i);
836 exit(0);
837}
838],
431d84c5 839SQUID_MAXFD=`cat conftestval`,
840SQUID_MAXFD=256,
841SQUID_MAXFD=256)
842AC_MSG_RESULT($SQUID_MAXFD)
843AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD)
b9cc811d 844if test "$SQUID_MAXFD" -lt 512 ; then
80ab193b 845 echo "WARNING: $SQUID_MAXFD may not be enough filedescriptors if your"
846 echo " cache will be very busy. Please see the FAQ page"
847 echo " http://squid.nlanr.net/Squid/FAQ/FAQ-10.html#filedescriptors"
e692ff35 848 echo " on how to increase your filedescriptor limit"
933cc58d 849 sleep 10
80ab193b 850fi
234967c9 851
5c51415d 852dnl Not cached since people are likely to tune this
30a4f2a8 853AC_MSG_CHECKING(Default UDP send buffer size)
854AC_TRY_RUN([
8cca06da 855#include <stdlib.h>
856#include <stdio.h>
30a4f2a8 857#include <sys/types.h>
858#include <sys/socket.h>
859#include <netinet/in.h>
860main ()
861{
862 int fd,val=0,len=sizeof(int);
863 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
864 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
865 if (val<=0) exit(1);
866 fprintf (fopen("conftestval", "w"), "%d\n", val);
867 exit(0);
868}
869],
870SQUID_UDP_SO_SNDBUF=`cat conftestval`,
1c481e00 871SQUID_UDP_SO_SNDBUF=16384,
872SQUID_UDP_SO_SNDBUF=16384)
30a4f2a8 873AC_MSG_RESULT($SQUID_UDP_SO_SNDBUF)
874AC_DEFINE_UNQUOTED(SQUID_UDP_SO_SNDBUF, $SQUID_UDP_SO_SNDBUF)
875
5c51415d 876dnl Not cached since people are likely to tune this
30a4f2a8 877AC_MSG_CHECKING(Default UDP receive buffer size)
878AC_TRY_RUN([
8cca06da 879#include <stdlib.h>
880#include <stdio.h>
30a4f2a8 881#include <sys/types.h>
882#include <sys/socket.h>
883#include <netinet/in.h>
884main ()
885{
886 int fd,val=0,len=sizeof(int);
887 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
888 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
889 if (val <= 0) exit(1);
890 fprintf (fopen("conftestval", "w"), "%d\n", val);
891 exit(0);
892}
893],
894SQUID_UDP_SO_RCVBUF=`cat conftestval`,
1c481e00 895SQUID_UDP_SO_RCVBUF=16384,
896SQUID_UDP_SO_RCVBUF=16384)
30a4f2a8 897AC_MSG_RESULT($SQUID_UDP_SO_RCVBUF)
898AC_DEFINE_UNQUOTED(SQUID_UDP_SO_RCVBUF, $SQUID_UDP_SO_RCVBUF)
899
5c51415d 900dnl Not cached since people are likely to tune this
30a4f2a8 901AC_MSG_CHECKING(Default TCP send buffer size)
902AC_TRY_RUN([
8cca06da 903#include <stdlib.h>
904#include <stdio.h>
30a4f2a8 905#include <sys/types.h>
906#include <sys/socket.h>
907#include <netinet/in.h>
908main ()
909{
910 int fd,val=0,len=sizeof(int);
911 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
912 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
913 if (val <= 0) exit(1);
914 fprintf (fopen("conftestval", "w"), "%d\n", val);
915 exit(0);
916}
917],
918SQUID_TCP_SO_SNDBUF=`cat conftestval`,
1c481e00 919SQUID_TCP_SO_SNDBUF=16384,
920SQUID_TCP_SO_SNDBUF=16384)
30a4f2a8 921AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF)
922AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF)
923
5c51415d 924dnl Not cached since people are likely to tune this
30a4f2a8 925AC_MSG_CHECKING(Default TCP receive buffer size)
926AC_TRY_RUN([
8cca06da 927#include <stdlib.h>
928#include <stdio.h>
30a4f2a8 929#include <sys/types.h>
930#include <sys/socket.h>
931#include <netinet/in.h>
932main ()
933{
934 int fd,val=0,len=sizeof(int);
935 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
936 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
937 if (val <= 0) exit(1);
938 fprintf (fopen("conftestval", "w"), "%d\n", val);
939 exit(0);
940}
941],
942SQUID_TCP_SO_RCVBUF=`cat conftestval`,
1c481e00 943SQUID_TCP_SO_RCVBUF=16384,
944SQUID_TCP_SO_RCVBUF=16384)
30a4f2a8 945AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF)
946AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF)
947
5c51415d 948AC_CACHE_CHECK(if sys_errlist is already defined, ac_cv_needs_sys_errlist,
949 AC_TRY_COMPILE([#include <stdio.h>],[char *s = sys_errlist[0];],
950 ac_cv_needs_sys_errlist="no",
951 ac_cv_needs_sys_errlist="yes")
952)
953if test "$ac_cv_needs_sys_errlist" = "yes" ; then
954 AC_DEFINE(NEED_SYS_ERRLIST)
955fi
30a4f2a8 956
5c51415d 957dnl Not cached since people are likely to change this
6bf65235 958AC_MSG_CHECKING(for libresolv _dns_ttl_ hack)
959AC_TRY_LINK(extern int _dns_ttl_;,return _dns_ttl_;,
960[AC_MSG_RESULT(yes)
961AC_DEFINE(LIBRESOLV_DNS_TTL_HACK)],
962AC_MSG_RESULT(no))
963
090089c4 964dnl Need the debugging version of malloc if available
965XTRA_OBJS=''
6509a1a0 966if test "$ac_cv_lib_malloc_main" = "yes" ; then
090089c4 967 if test -r /usr/lib/debug/malloc.o ; then
968 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
969 fi
970 if test -r /usr/lib/debug/mallocmap.o ; then
971 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
972 fi
973fi
2bbd722b 974
090089c4 975AC_SUBST(XTRA_OBJS)
976
38fea766 977if test -z "$XTRA_LIBS"; then
978 XTRA_LIBS="$LIBS"
0f5a16f8 979 dnl -lcrypt is set in CRYPTLIB
980 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/-lcrypt//"`
981 dnl -lpthread is set in PTHREADLIB
982 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/-lpthread//"`
983 dnl minor cleanup
984 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
38fea766 985 LIBS=''
986fi
090089c4 987AC_SUBST(XTRA_LIBS)
988
090089c4 989dnl Clean up after OSF/1 core dump bug
990rm -f core
991
992AC_OUTPUT(\
0992a350 993 ./makefile \
090089c4 994 ./lib/Makefile \
a26bdc75 995 ./include/config.h \
090089c4 996 ./scripts/Makefile \
997 ./scripts/RunCache \
998 ./scripts/RunAccel \
a26bdc75 999 ./src/Makefile \
e550e8b6 1000 ./contrib/Makefile \
2bbd722b 1001 ./snmplib/Makefile \
81280a96 1002 ./icons/Makefile \
d4fb069d 1003 ./errors/Makefile \
090089c4 1004)