configure.in
上传用户:liugui
上传日期:2007-01-04
资源大小:822k
文件大小:33k
- dnl
- dnl Configuration input file for Squid
- dnl
- dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9)
- dnl
- dnl $Id: configure.in,v 1.167.2.4 1999/02/14 08:25:35 wessels Exp $
- dnl
- dnl
- dnl
- AC_INIT(src/main.c)
- AC_CONFIG_HEADER(include/autoconf.h)
- AC_REVISION($Revision: 1.167.2.4 $)dnl
- AC_PREFIX_DEFAULT(/usr/local/squid)
- AC_CONFIG_AUX_DIR(cfgaux)
- AC_CANONICAL_HOST
- CRYPTLIB=''
- REGEXLIB='' # -lregex
- LIBREGEX='' # libregex.a
- dnl use directory structure of cached as default (hack)
- if test "$libexecdir" = '${exec_prefix}/libexec'; then
- libexecdir='${bindir}'
- localstatedir='${prefix}'
- fi
- dnl use .exe suffix for executables on cygwin32 platform
- case "$host_os" in
- cygwin32|os2)
- exec_suffix=".exe"
- cgi_suffix=".exe"
- ;;
- *)
- exec_suffix=""
- cgi_suffix=".cgi"
- ;;
- esac
- AC_SUBST(exec_suffix)
- AC_SUBST(cgi_suffix)
- if test -z "$CACHE_HTTP_PORT"; then
- CACHE_HTTP_PORT="3128"
- fi
- if test -z "$CACHE_ICP_PORT"; then
- CACHE_ICP_PORT="3130"
- fi
- dnl Subsitutions
- AC_SUBST(CACHE_HTTP_PORT)
- AC_SUBST(CACHE_ICP_PORT)
- AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host")
- dnl Set default LDFLAGS
- if test -z "$LDFLAGS"; then
- LDFLAGS="-g"
- fi
- PRESET_CFLAGS="$CFLAGS"
- dnl Check for GNU cc
- AC_PROG_CC
- dnl Gerben Wierda <Gerben_Wierda@RnA.nl>
- case "$host" in
- mab-next-nextstep3)
- CC="$CC -arch m68k -arch i486 -arch hppa -arch sparc"
- ;;
- esac
- dnl Set Default CFLAGS
- if test -z "$PRESET_CFLAGS"; then
- if test "$GCC" = "yes"; then
- case "$host" in
- *-sun-sunos*)
- # sunos has too many warnings for this to be useful
- # motorola too
- ;;
- *m88k*)
- # Motorola cc/ld does not like -02 but is ok on -O
- CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]/-O/'`
- ;;
- *)
- CFLAGS="$CFLAGS -Wall"
- ;;
- esac
- else
- case "$host" in
- *mips-sgi-irix6.4*)
- # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
- CFLAGS="$CFLAGS -n32 -mips4 -O3 -OPT:Olimit=0:space=OFF
- -woff 1009,1014,1048,1110,1116,1185,1188,1204,1230,1233
- -Wl,-woff,85,-woff,84,-woff,134
- -nostdinc -I/usr/include -D_BSD_SIGNALS"
- ;;
- alpha-dec-osf4.*)
- # Mogul says DEC compilers take both -g and -O2
- CFLAGS=`echo $CFLAGS | sed -e 's/-g/-g3/'`
- CFLAGS="$CFLAGS -O2"
- ;;
- *)
- ;;
- esac
- fi
- fi
- dnl Set LDFLAGS
- if test -z "$PRESET_LDFLAGS"; then
- if test "$GCC" = "yes"; then
- case "$host" in
- *)
- # nothing
- ;;
- esac
- else
- case "$host" in
- *mips-sgi-irix6.4*)
- # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
- LDFLAGS="-n32 -mips4 -nostdlib -L/usr/lib32"
- ;;
- esac
- fi
- fi
- dnl Enable optional modules
- AC_ARG_ENABLE(dlmalloc,
- [ --enable-dlmalloc[=LIB] Compile & use the malloc package by Doug Lea],
- [
- if test "x$ac_cv_enabled_dlmalloc" = "xyes"; then
- # Ok. dlmalloc was enabled before, but state may be changed.
- # we have to test these again
- unset ac_cv_func_mallinfo
- unset ac_cv_func_mallocblksize
- unset ac_cv_func_free
- unset ac_cv_func_realloc
- unset ac_cv_func_memalign
- unset ac_cv_func_valloc
- unset ac_cv_func_pvalloc
- unset ac_cv_func_calloc
- unset ac_cv_func_cfree
- unset ac_cv_func_malloc_trim
- unset ac_cv_func_malloc_usable_size
- unset ac_cv_func_malloc_stats
- unset ac_cv_func_mallinfo
- unset ac_cv_func_mallopt
- unset ac_cv_lib_gnumalloc
- unset ac_cv_header_gnumalloc_h
- unset ac_cv_lib_malloc
- unset ac_cv_enabled_dlmalloc
- fi
- case "$enableval" in
- 'yes')
- LIBDLMALLOC="libdlmalloc.a"
- LIB_MALLOC="-L../lib -ldlmalloc"
- ac_cv_func_mallinfo="yes"
- ac_cv_func_mallocblksize="no"
- ac_cv_func_free="yes"
- ac_cv_func_realloc="yes"
- ac_cv_func_memalign="yes"
- ac_cv_func_valloc="yes"
- ac_cv_func_pvalloc="yes"
- ac_cv_func_calloc="yes"
- ac_cv_func_cfree="yes"
- ac_cv_func_malloc_trim="yes"
- ac_cv_func_malloc_usable_size="yes"
- ac_cv_func_malloc_stats="yes"
- ac_cv_func_mallinfo="yes"
- ac_cv_func_mallopt="yes"
- ac_cv_lib_gnumalloc="no"
- ac_cv_header_gnumalloc_h="no"
- ac_cv_lib_malloc="no"
- ac_cv_enabled_dlmalloc="yes"
- echo "dlmalloc build enabled"
- ;;
- 'no')
- # Disabled explicitly.
- echo "dlmalloc disabled."
- ;;
- *)
- # Use already installed dlmalloc library.
- LIB_MALLOC="${enableval}"
- ac_cv_func_mallinfo="yes"
- ac_cv_func_mallocblksize="no"
- ac_cv_func_free="yes"
- ac_cv_func_realloc="yes"
- ac_cv_func_memalign="yes"
- ac_cv_func_valloc="yes"
- ac_cv_func_pvalloc="yes"
- ac_cv_func_calloc="yes"
- ac_cv_func_cfree="yes"
- ac_cv_func_malloc_trim="yes"
- ac_cv_func_malloc_usable_size="yes"
- ac_cv_func_malloc_stats="yes"
- ac_cv_func_mallinfo="yes"
- ac_cv_func_mallopt="yes"
- ac_cv_lib_gnumalloc="no"
- ac_cv_header_gnumalloc_h="no"
- ac_cv_lib_malloc="no"
- ac_cv_enabled_dlmalloc="yes"
- echo "Use installed dlmalloc."
- ;;
- esac
- ],[
- if test "x$ac_cv_enabled_dlmalloc" = "xyes"; then
- # Ok. dlmalloc was enabled before, but now disabled.
- # we have to test these again
- unset ac_cv_func_mallinfo
- unset ac_cv_func_mallocblksize
- unset ac_cv_func_free
- unset ac_cv_func_realloc
- unset ac_cv_func_memalign
- unset ac_cv_func_valloc
- unset ac_cv_func_pvalloc
- unset ac_cv_func_calloc
- unset ac_cv_func_cfree
- unset ac_cv_func_malloc_trim
- unset ac_cv_func_malloc_usable_size
- unset ac_cv_func_malloc_stats
- unset ac_cv_func_mallinfo
- unset ac_cv_func_mallopt
- unset ac_cv_lib_gnumalloc
- unset ac_cv_header_gnumalloc_h
- unset ac_cv_lib_malloc
- unset ac_cv_enabled_dlmalloc
- fi
- ])
- AC_SUBST(LIBDLMALLOC)
- AC_SUBST(LIB_MALLOC)
- AC_ARG_ENABLE(gnuregex,
- [ --enable-gnuregex Compile GNUregex],
- [USE_GNUREGEX=$enableval])
- AC_ARG_ENABLE(xmalloc_debug,
- [ --enable-xmalloc-debug Do some simple malloc debugging],
- [ if test "$enableval" = "yes" ; then
- echo "Malloc debugging enabled"
- AC_DEFINE(XMALLOC_DEBUG)
- fi
- ])
- AC_ARG_ENABLE(xmalloc_debug_trace,
- [ --enable-xmalloc-debug-trace
- Detailed trace of memory allocations],
- [ if test "$enableval" = "yes" ; then
- echo "Malloc debug trace enabled"
- AC_DEFINE(XMALLOC_TRACE)
- AC_DEFINE(XMALLOC_DEBUG)
- fi
- ])
- AC_ARG_ENABLE(xmalloc_statistics,
- [ --enable-xmalloc-statistics
- Show malloc statistics in status page],
- [ if test "$enableval" = "yes" ; then
- echo "Malloc statistics enabled"
- AC_DEFINE(XMALLOC_STATISTICS)
- fi
- ])
- AC_ARG_ENABLE(carp,
- [ --enable-carp Enable CARP support],
- [ if test "$enableval" = "yes" ; then
- echo "CARP support enabled"
- AC_DEFINE(USE_CARP)
- fi
- ])
- AC_ARG_ENABLE(async_io,
- [ --enable-async-io Do ASYNC disk I/O using threads],
- [ if test "$enableval" = "yes" ; then
- echo "Async I/O enabled"
- async_io=yes
- AC_DEFINE(USE_ASYNC_IO)
- ASYNC_OBJS='$(ASYNC_OBJS)'
- SQUID_PTHREAD_LIB='$(PTHREADLIB)'
- CFLAGS="$CFLAGS -D_REENTRANT"
- case "$host" in
- i386-unknown-freebsd*)
- if test "$GCC" = "yes" ; then
- if test -z "$PRESET_LDFLAGS"; then
- LDFLAGS="$LDFLAGS -pthread"
- fi
- fi
- ;;
- esac
- fi
- ])
- AC_SUBST(ASYNC_OBJS)
- AC_SUBST(SQUID_PTHREAD_LIB)
- AC_ARG_ENABLE(icmp,
- [ --enable-icmp Enable ICMP pinging],
- [ if test "$enableval" = "yes" ; then
- echo "ICMP enabled"
- AC_DEFINE(USE_ICMP)
- fi
- ])
- AC_ARG_ENABLE(delay_pools,
- [ --enable-delay-pools Enable delay pools to limit bandwith usage],
- [ if test "$enableval" = "yes" ; then
- echo "Delay pools enabled"
- DELAY_OBJS='$(DELAY_OBJS)'
- AC_DEFINE(DELAY_POOLS)
- fi
- ])
- AC_SUBST(DELAY_OBJS)
- AC_ARG_ENABLE(mem-gen-trace,
- [ --enable-mem-gen-trace Do trace of memory stuff],
- [ if test "$enableval" = "yes" ; then
- echo "Memory trace (to file) enabled"
- AC_DEFINE(MEM_GEN_TRACE)
- fi
- ])
- AC_ARG_ENABLE(useragent_log,
- [ --enable-useragent-log Enable logging of User-Agent header],
- [ if test "$enableval" = "yes" ; then
- echo "User-Agent logging enabled"
- AC_DEFINE(USE_USERAGENT_LOG)
- fi
- ])
- AC_ARG_ENABLE(kill_parent_hack,
- [ --enable-kill-parent-hack
- Kill parent on shutdown],
- [ if test "$enableval" = "yes" ; then
- echo "Kill parent on shutdown"
- AC_DEFINE(KILL_PARENT_OPT)
- fi
- ])
- AC_ARG_ENABLE(snmp,
- [ --enable-snmp Enable SNMP monitoring],
- [ if test "$enableval" = "yes" ; then
- echo "SNMP monitoring enabled"
- AC_DEFINE(SQUID_SNMP)
- SNMPLIB='-L../snmplib -lsnmp'
- SNMP_OBJS='$(SNMP_OBJS)'
- SNMP_MAKEFILE=./snmplib/Makefile
- makesnmplib=snmplib
- fi
- ])
- AC_SUBST(SNMPLIB)
- AC_SUBST(SNMP_OBJS)
- AC_SUBST(makesnmplib)
- AC_ARG_ENABLE(time_hack,
- [ --enable-time-hack Update internal timestamp only once per second],
- [ if test "$enableval" = "yes" ; then
- echo "Update internal timestamp only once per second"
- AC_DEFINE(ALARM_UPDATES_TIME)
- fi
- ])
- AC_ARG_ENABLE(cachemgr_hostname,
- [ --enable-cachemgr-hostname[=hostname]
- Make cachemgr.cgi default to this host],
- [ case $enableval in
- yes)
- AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()])
- echo "Cachemgr default hostname == host where cachemgr runs"
- ;;
- no)
- : # Nothing to do..
- ;;
- *)
- AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
- echo "Cachemgr default hostname set to ${enableval}"
- ;;
- esac
- ])
- AC_ARG_ENABLE(arp_acl,
- [ --enable-arp-acl Enable use of ARP ACL lists (ether address)],
- [ if test "$enableval" = "yes" ; then
- echo "ARP ACL lists enabled (ether address)"
- case "$host" in
- *-pc-linux-*)
- ;;
- *)
- echo "WARNING: ARP ACL support is only currently supported on Linux"
- echo " ethernet interfaces, probably won't work on $host."
- sleep 10
- ;;
- esac
- AC_DEFINE(USE_ARP_ACL)
- fi
- ])
- AC_ARG_ENABLE(htcp,
- [ --enable-htcp Enable HTCP protocol],
- [ if test "$enableval" = "yes" ; then
- echo "HTCP enabled"
- HTCP_OBJS='$(HTCP_OBJS)'
- AC_DEFINE(USE_HTCP)
- fi
- ])
- AC_SUBST(HTCP_OBJS)
- AC_ARG_ENABLE(forw-via-db,
- [ --enable-forw-via-db Enable Forw/Via database],
- [ if test "$enableval" = "yes" ; then
- echo "FORW-VIA enabled"
- AC_DEFINE(FORW_VIA_DB)
- fi
- ])
- AC_ARG_ENABLE(cache-digests,
- [ --enable-cache-digests Use Cache Digests
- see http://squid.nlanr.net/Squid/FAQ/FAQ-16.html],
- [ if test "$enableval" = "yes" ; then
- echo "USE_CACHE_DIGESTS enabled"
- AC_DEFINE(USE_CACHE_DIGESTS)
- fi
- ])
- dnl Select Error language
- AC_ARG_ENABLE(err-language,
- [ --enable-err-language=lang
- Select language for Error pages (see errors dir) ],
- [
- if test -d errors/$enableval; then
- ERR_LANGUAGE=$enableval
- else
- echo "ERROR! Unknown language $enableval, see errors/"
- exit 1
- fi
- ],[ERR_LANGUAGE="English"])
- AC_SUBST(ERR_LANGUAGE)
- dnl Enable poll()
- AC_ARG_ENABLE(poll,
- [ --enable-poll Enable poll() instead of select(). Normally poll
- is preferred over select, but configure knows poll
- is broken on some platforms. If you think you are
- smarter than the configure script, you may enable
- poll with this option.
- --disable-poll Disable the use of poll().],
- [
- case "$enableval" in
- yes)
- echo "Forcing poll() to be enabled"
- ac_cv_func_poll='yes'
- ;;
- no)
- echo "Forcing poll() to be disabled"
- ac_cv_func_poll='no'
- ;;
- esac
- ])
- dnl Disable HTTP violations
- AC_ARG_ENABLE(http-violations,
- [ --disable-http-violations
- This allows you to remove code which is known to
- violate the HTTP protocol specification.],
- [ if test "$enableval" = "no" ; then
- echo "Disabling HTTP Violations"
- AC_DEFINE(HTTP_VIOLATIONS, 0)
- else
- AC_DEFINE(HTTP_VIOLATIONS, 1)
- fi
- ])
- dnl Enable IP-Filter Transparent Proxy
- AC_ARG_ENABLE(ipf-transparent,
- [ --enable-ipf-transparent
- Enable Transparent Proxy support for systems
- using IP-Filter network address redirection.],
- [ if test "$enableval" = "yes" ; then
- echo "IP-Filter Transparent Proxy enabled"
- AC_DEFINE(IPF_TRANSPARENT)
- IPF_TRANSPARENT="yes"
- fi
- ])
- dnl Enable Leak Finding Functions
- AC_ARG_ENABLE(leakfinder,
- [ --enable-leakfinder
- Enable Leak Finding code. Enabling this alone
- does nothing; you also have to modify the source
- code to use the leak finding functions. Probably
- Useful for hackers only.],
- [ if test "$enableval" = "yes" ; then
- echo "Leak-Finding enabled"
- AC_DEFINE(USE_LEAKFINDER)
- LEAKFINDER_OBJS='$(LEAKFINDER_OBJS)'
- USE_LEAKFINDER="yes"
- fi
- ])
- AC_SUBST(LEAKFINDER_OBJS)
- dnl Disable HTTP violations
- AC_ARG_ENABLE(ident-lookups,
- [ --disable-ident-lookups
- This allows you to remove code that performs
- Ident (RFC 931) lookups.],
- [ if test "$enableval" = "no" ; then
- echo "Disabling Ident Lookups"
- AC_DEFINE(USE_IDENT, 0)
- else
- AC_DEFINE(USE_IDENT, 1)
- fi
- ])
- # Force some compilers to use ANSI features
- #
- case "$host" in
- alpha-dec-osf*)
- if test "$ac_cv_prog_CC" = "cc" ; then
- echo "adding '-std1' to cc args for $host"
- CC="cc -std1";
- ac_cv_prog_CC="$CC"
- fi
- ;;
- *-hp-hpux*)
- if test "$ac_cv_prog_CC" = "cc" ; then
- echo "adding '-Ae' to cc args for $host"
- CC="cc -Ae";
- ac_cv_prog_CC="$CC"
- fi
- ;;
- esac
- dnl Check for programs
- AC_PROG_CPP
- AC_PROG_INSTALL
- AC_PROG_RANLIB
- AC_PROG_LN_S
- AC_PATH_PROG(SH, sh, /bin/sh)
- AC_PATH_PROG(FALSE, false, /usr/bin/false)
- AC_PATH_PROG(TRUE, true, /usr/bin/true)
- AC_PATH_PROG(RM, rm, $FALSE)
- AC_PATH_PROG(MV, mv, $FALSE)
- AC_PATH_PROG(MKDIR, mkdir, $FALSE)
- AC_PATH_PROG(LN, ln, cp)
- AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
- AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
- AC_PATH_PROG(AR, ar, $FALSE)
- case "$host" in
- *-hp-hpux*)
- echo "Disabling 'ranlib' for HP-UX..."
- RANLIB=":"
- ;;
- esac
- dnl set $(AR)
- AR_R="$AR r"
- case "$host" in
- *-next-nextstep3)
- AR="libtool -o"
- ;;
- esac
- AC_SUBST(AR_R)
- dnl Check for headers
- AC_HEADER_DIRENT
- AC_HEADER_STDC
- AC_CHECK_HEADERS(
- arpa/inet.h
- arpa/nameser.h
- assert.h
- bstring.h
- config.h
- crypt.h
- ctype.h
- errno.h
- fcntl.h
- getopt.h
- gnumalloc.h
- grp.h
- ip_compat.h
- ip_fil.h
- ip_nat.h
- libc.h
- limits.h
- malloc.h
- math.h
- memory.h
- mount.h
- net/if.h
- netdb.h
- netinet/in.h
- netinet/tcp.h
- poll.h
- pwd.h
- regex.h
- resolv.h
- sched.h
- signal.h
- stdarg.h
- stddef.h
- stdio.h
- stdlib.h
- string.h
- strings.h
- sys/file.h
- sys/ioctl.h
- sys/param.h
- sys/resource.h
- sys/select.h
- sys/socket.h
- sys/stat.h
- sys/statvfs.h
- sys/syscall.h
- sys/time.h
- sys/types.h
- sys/un.h
- sys/vfs.h
- sys/wait.h
- syslog.h
- time.h
- unistd.h
- varargs.h
- )
- AC_C_CONST
- AC_C_BIGENDIAN
- AC_CACHE_CHECK(if ANSI prototypes work,ac_cv_have_ansi_prototypes, [
- AC_TRY_COMPILE([int foo(char *); int foo (char *bar) {return 1;}],
- [foo("bar")],
- ac_cv_have_ansi_prototypes="yes",
- ac_cv_have_ansi_prototypes="no")
- ])
- if test $ac_cv_have_ansi_prototypes = "yes" ; then
- AC_DEFINE(HAVE_ANSI_PROTOTYPES)
- fi
- AC_CACHE_CHECK(for tm->tm_gmtoff,ac_cv_have_tm_gmoff, [
- AC_TRY_COMPILE([#include <time.h>
- #include <sys/time.h>],
- [struct tm foo;
- foo.tm_gmtoff = 0;],
- ac_cv_have_tm_gmoff="yes",
- ac_cv_have_tm_gmoff="no")
- ])
- if test $ac_cv_have_tm_gmoff = "yes" ; then
- AC_DEFINE(HAVE_TM_GMTOFF)
- fi
- AC_CACHE_CHECK(for extended mallinfo,ac_cv_have_ext_mallinfo, [
- AC_TRY_COMPILE([#include <sys/types.h>
- #include <malloc.h>],
- [struct mallinfo foo;
- foo.mxfast = 0;],
- ac_cv_have_ext_mallinfo="yes",
- ac_cv_have_ext_mallinfo="no")
- ])
- if test $ac_cv_have_ext_mallinfo = "yes" ; then
- AC_DEFINE(HAVE_EXT_MALLINFO)
- fi
- AC_CACHE_CHECK(for struct rusage,ac_cv_have_struct_rusage, [
- AC_TRY_COMPILE([
- #if HAVE_SYS_TIME_H
- #include <sys/time.h>
- #endif
- #if HAVE_SYS_RESOURCE_H
- #include <sys/resource.h>
- #endif],
- [struct rusage R;],
- ac_cv_have_struct_rusage="yes",
- ac_cv_have_struct_rusage="no")
- ])
- if test $ac_cv_have_struct_rusage = "yes" ; then
- AC_DEFINE(HAVE_STRUCT_RUSAGE)
- fi
- AC_CACHE_CHECK(for ip->ip_hl, ac_cv_have_ip_hl, [
- AC_TRY_COMPILE([#include <sys/types.h>
- #include <netinet/in.h>
- #include <netinet/in_systm.h>
- #include <netinet/ip.h>
- #ifdef __linux__
- #define ip_hl ihl
- #endif
- #ifndef __linux__
- #define iphdr ip
- #endif],
- [struct iphdr ip;
- ip.ip_hl= 0;],
- ac_cv_have_ip_hl="yes",
- ac_cv_have_ip_hl="no")
- ])
- if test $ac_cv_have_ip_hl = "yes" ; then
- AC_DEFINE(HAVE_IP_HL)
- fi
- dnl Check for typedefs
- AC_CHECK_SIZEOF(int)
- AC_CHECK_SIZEOF(long)
- dnl Check for special functions
- AC_FUNC_ALLOCA
- AC_CHECK_TYPE(pid_t, int)
- AC_CHECK_TYPE(size_t, unsigned int)
- AC_CHECK_TYPE(ssize_t, int)
- AC_CHECK_TYPE(off_t, int)
- AC_CHECK_TYPE(mode_t, u_short)
- AC_CHECK_TYPE(fd_mask, int)
- dnl Check for type in sys/socket.h
- AC_CACHE_CHECK(for socklen_t, ac_cv_type_socklen_t, [
- AC_EGREP_CPP([socklen_t[^a-zA-Z_0-9]], [#include <sys/types.h>
- #include <sys/socket.h>
- #if STDC_HEADERS
- #include <stdlib.h>
- #include <stddef.h>
- #endif],
- ac_cv_type_socklen_t=yes,
- ac_cv_type_socklen_t=no)
- ])
- if test $ac_cv_type_socklen_t = no; then
- AC_DEFINE(socklen_t, int)
- fi
- dnl Check for needed libraries
- AC_CHECK_LIB(nsl, main)
- AC_CHECK_LIB(socket, main)
- if test "x$ac_cv_enabled_dlmalloc" = "xyes" ; then
- echo "skipping libmalloc check (--enable-dlmalloc specified)"
- else
- AC_CHECK_LIB(gnumalloc, main)
- if test "$ac_cv_lib_gnumalloc_main" = "yes"; then
- echo "Disabling extended malloc functions when using gnumalloc"
- ac_cv_func_mallinfo=no
- ac_cv_func_mallocblksize=no
- ac_cv_func_mallopt=no
- else
- case "$host" in
- *-sun-solaris*)
- echo "skipping libmalloc check for $host"
- ;;
- i386-*-freebsd*)
- echo "skipping libmalloc check for $host"
- ;;
- *)
-
- AC_CHECK_LIB(malloc, main)
- ;;
- esac
- fi
- fi
- AC_CHECK_LIB(bsd, main)
- AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"])
- AC_CHECK_LIB(bind, gethostbyname)
- if test $ac_cv_lib_bind_gethostbyname = "no" ; then
- case "$host" in
- i386-*-freebsd*)
- echo "skipping libresolv checks for $host"
- ;;
- *)
- AC_CHECK_LIB(resolv, inet_aton, AC_CHECK_LIB(44bsd, inet_aton))
- AC_CHECK_LIB(resolv, main)
- ;;
- esac
- fi
- AC_CHECK_LIB(m, main)
- dnl Check for libcrypt
- dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
- AC_CHECK_LIB(crypt, crypt)
- if test $ac_cv_lib_crypt_crypt = "yes"; then
- CRYPTLIB="-lcrypt"
- fi
- AC_SUBST(CRYPTLIB)
- dnl Check for pthreads
- dnl We use pthreads when doing ASYNC I/O
- AC_CHECK_LIB(pthread, main)
- if test $ac_cv_lib_pthread_main = "yes"; then
- PTHREADLIB="-lpthread"
- fi
- AC_SUBST(PTHREADLIB)
- dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
- dnl Robert Side <rside@aiinc.bc.ca>
- dnl Mon, 18 Jan 1999 17:48:00 GMT
- case "$host" in
- *-pc-sco3.2*)
- AC_CHECK_LIB(intl, strftime)
- ;;
- esac
- dnl System-specific library modifications
- dnl
- case "$host" in
- i386-*-solaris2.*)
- if test "$GCC" = "yes"; then
- echo "Removing -O for gcc on $host"
- CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
- fi
- ;;
- *-sgi-irix*)
- echo "Removing -lsocket for IRIX..."
- LIBS=`echo $LIBS | sed -e s/-lsocket//`
- echo "Removing -lnsl for IRIX..."
- LIBS=`echo $LIBS | sed -e s/-lnsl//`
- echo "Removing -lbsd for IRIX..."
- LIBS=`echo $LIBS | sed -e s/-lbsd//`
- ;;
- dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
- dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
- dnl Please change your configure script. AIX doesn't need -lbsd.
- *-ibm-aix*)
- echo "Removing -lbsd for AIX..."
- LIBS=`echo $LIBS | sed -e s/-lbsd//`
- dnl From: mlaster@metavillage.com (Mike Laster)
- dnl AIX 4.1.4.x does not have header files for snprintf/vsnprintf
- dnl So using the internal versions generates a load of warnings
- dnl during compile.
- echo "disabling snprintf/vsnprintf for $host"
- ac_cv_func_snprintf=no
- ac_cv_func_vsnprintf=no
- ;;
- *m88k*)
- CFLAGS="$CFLAGS -D_SQUID_MOTOROLA_"
- AC_DEFINE(GETTIMEOFDAY_NO_TZP)
- ;;
- [*-*-solaris2.[0-4]])
- AC_DEFINE(GETTIMEOFDAY_NO_TZP)
- ;;
- [*-sony-newsos[56]*])
- AC_DEFINE(GETTIMEOFDAY_NO_TZP)
- ;;
- esac
- # Recommended by Balint Nagy Endre <bne@CareNet.hu>
- case "$host" in
- *-univel-sysv4.2MP)
- if test `uname -v` = "2.03"; then
- echo "disabling mallinfo for $host"
- ac_cv_func_mallinfo=no
- fi
- ;;
- esac
- dnl This has to be before AC_CHECK_FUNCS
- # Disable poll() on certain platforms. Override by setting ac_cv_func_poll
- # when running configure.
- if test -z "$ac_cv_func_poll"; then
- case "$host" in
- [alpha-dec-osf3.*])
- # John Kay (jkay@nlanr.net) 19970818
- echo "disabling poll for $host..."
- ac_cv_func_poll='no'
- ;;
- [*-hp-hpux*.*])
- # Duane Wessels
- echo "disabling poll for $host..."
- ac_cv_func_poll='no'
- ;;
- [*-linux-*])
- # Henrik Nordstrom (hno@hem.passagen.se) 19980817
- # poll is problematic on Linux. We disable it
- # by default until Linux gets it right.
- echo "disabling poll for $host..."
- ac_cv_func_poll='no'
- ;;
- [powerpc-ibm-aix4.1.*])
- # Mike Laster (mlaster@metavillage.com) 19981021
- echo "disabling poll for $host..."
- ac_cv_func_poll='no'
- ;;
- [*-pc-sco3.2*])
- # Robert Side <rside@aiinc.bc.ca>
- # Mon, 18 Jan 1999 17:48:00 GMT
- echo "disabling poll for $host..."
- ac_cv_func_poll='no'
- ;;
- esac
- fi
- dnl Check for library functions
- AC_CHECK_FUNCS(
- bcopy
- crypt
- drand48
- fchmod
- getdtablesize
- getpagesize
- getrusage
- getspnam
- lrand48
- mallinfo
- mallocblksize
- mallopt
- memcpy
- memmove
- memset
- mktime
- mstats
- poll
- putenv
- random
- regcomp
- regexec
- regfree
- res_init
- rint
- seteuid
- setpgrp
- setrlimit
- setsid
- sigaction
- snprintf
- srand48
- srandom
- statvfs
- sysconf
- syslog
- tempnam
- timegm
- vsnprintf
- )
- if test "$async_io" = "yes" ; then
- AC_CHECK_FUNCS(
- pthread_attr_setscope
- pthread_setschedparam
- pthread_attr_setschedparam
- )
- fi
- dnl Yay! Another Linux brokenness. Its not good enough
- dnl to know that setresuid() exists, because RedHat 5.0 declares
- dnl setresuid() but doesn't implement it.
- dnl
- AC_CACHE_CHECK(if setresuid is implemented, ac_cv_func_setresuid,
- AC_TRY_RUN([
- #include <stdlib.h>
- int main() {
- if(setresuid(-1,-1,-1)) {
- perror("setresuid:");
- exit(1);
- }
- exit(0);
- }
- ],ac_cv_func_setresuid="yes",ac_cv_func_setresuid="no")
- )
- if test "$ac_cv_func_setresuid" = "yes" ; then
- AC_DEFINE(HAVE_SETRESUID)
- fi
- dnl IP-Filter support requires ipf header files. These aren't
- dnl installed by default, so we need to check for them
- if test "$IPF_TRANSPARENT" ; then
- AC_MSG_CHECKING(if IP-Filter header files are installed)
- if test "$ac_cv_header_ip_compat_h" = "no" ||
- test "$ac_cv_header_ip_fil_h" = "no" ||
- test "$ac_cv_header_ip_nat_h" = "no" ; then
- IPF_TRANSPARENT="no"
- AC_DEFINE(IPF_TRANSPARENT, 0)
- else
- IPF_TRANSPARENT="yes"
- AC_DEFINE(IPF_TRANSPARENT)
- fi
- AC_MSG_RESULT($IPF_TRANSPARENT)
- fi
- if test "$IPF_TRANSPARENT" = "no" ; then
- echo "WARNING: Cannot find necessary IP-Filter header files"
- echo " Transparent Proxy support WILL NOT be enabled"
- sleep 10
- fi
- if test -z "$USE_GNUREGEX" ; then
- case "$host" in
- *-sun-solaris2.[[0-4]])
- USE_GNUREGEX="yes"
- ;;
- *-next-nextstep*)
- USE_GNUREGEX="yes"
- ;;
- esac
- fi
- AC_MSG_CHECKING(if GNUregex needs to be compiled)
- if test -z "$USE_GNUREGEX"; then
- if test "$ac_cv_func_regcomp" = "no" || test "$USE_GNUREGEX" = "yes" ; then
- USE_GNUREGEX="yes"
- else
- AC_TRY_COMPILE([#include <sys/types.h>
- #include <regex.h>],[regex_t t; regcomp(&t,"",0);],
- USE_GNUREGEX="no",
- USE_GNUREGEX="yes")
- fi
- fi
- AC_MSG_RESULT($USE_GNUREGEX)
- if test "$USE_GNUREGEX" = "yes"; then
- REGEXLIB="-lregex"
- LIBREGEX="libregex.a"
- AC_DEFINE(USE_GNUREGEX)
- fi
- AC_SUBST(REGEXLIB)
- AC_SUBST(LIBREGEX)
- AC_REPLACE_FUNCS(
- drand48
- tempnam
- strerror
- )
- dnl Not cached since people are likely to tune this
- AC_MSG_CHECKING(Default FD_SETSIZE value)
- AC_TRY_RUN([
- #if HAVE_STDIO_H
- #include <stdio.h>
- #endif
- #if HAVE_UNISTD_H
- #include <unistd.h>
- #endif
- #if HAVE_SYS_TIME_H
- #include <sys/time.h>
- #endif
- #if HAVE_SYS_SELECT_H
- #include <sys/select.h>
- #endif
- #if HAVE_SYS_TYPES_H
- #include <sys/types.h>
- #endif
- main() {
- FILE *fp = fopen("conftestval", "w");
- fprintf (fp, "%dn", FD_SETSIZE);
- exit(0);
- }
- ],
- DEFAULT_FD_SETSIZE=`cat conftestval`,
- DEFAULT_FD_SETSIZE=256,
- DEFAULT_FD_SETSIZE=256)
- AC_MSG_RESULT($DEFAULT_FD_SETSIZE)
- AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE)
- dnl Not cached since people are likely to tune this
- AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
- AC_TRY_RUN([
- #include <stdio.h>
- #include <unistd.h>
- #include <sys/time.h> /* needed on FreeBSD */
- #include <sys/param.h>
- #include <sys/resource.h>
- main() {
- FILE *fp;
- int i,j;
- #if __CYGWIN32__
- /* getrlimit and sysconf returns bogous values on cygwin32.
- * Number of fds is virtually unlimited in cygwin (sys/param.h)
- */
- i = NOFILE;
- #else
- #if HAVE_SETRLIMIT
- struct rlimit rl;
- #if defined(RLIMIT_NOFILE)
- if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
- perror("getrlimit: RLIMIT_NOFILE");
- } else {
- rl.rlim_cur = rl.rlim_max; /* set it to the max */
- if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
- perror("setrlimit: RLIMIT_NOFILE");
- }
- }
- #elif defined(RLIMIT_OFILE)
- if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
- perror("getrlimit: RLIMIT_OFILE");
- } else {
- rl.rlim_cur = rl.rlim_max; /* set it to the max */
- if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
- perror("setrlimit: RLIMIT_OFILE");
- }
- }
- #endif /* RLIMIT_NOFILE */
- #endif /* HAVE_SETRLIMIT */
- #if HAVE_GETRLIMIT && defined(RLIMIT_NOFILE)
- if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
- perror("getrlimit: RLIMIT_NOFILE");
- }
- i = rl.rlim_cur;
- #elif HAVE_SYSCONF && defined(_SC_OPEN_MAX)
- i = sysconf(_SC_OPEN_MAX);
- #elif HAVE_GETDTABLESIZE && !defined(__linux__)
- i = getdtablesize();
- #elif defined(OPEN_MAX)
- i = OPEN_MAX;
- #elif defined(NOFILE)
- i = NOFILE;
- #elif defined(_NFILE)
- i = _NFILE;
- #else
- while((j=open("/dev/null", 0)) > 0) i=j;
- close(i); close(i-1);
- i++;
- #endif
- #endif /* __CYGWIN32__ */
- fp = fopen("conftestval", "w");
- fprintf (fp, "%dn", i);
- exit(0);
- }
- ],
- SQUID_MAXFD=`cat conftestval`,
- SQUID_MAXFD=256,
- SQUID_MAXFD=256)
- AC_MSG_RESULT($SQUID_MAXFD)
- AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD)
- if test "$SQUID_MAXFD" -lt 512 ; then
- echo "WARNING: $SQUID_MAXFD may not be enough filedescriptors if your"
- echo " cache will be very busy. Please see the FAQ page"
- echo " http://squid.nlanr.net/Squid/FAQ/FAQ-11.html#filedescriptors"
- echo " on how to increase your filedescriptor limit"
- sleep 10
- fi
- dnl Not cached since people are likely to tune this
- AC_MSG_CHECKING(Default UDP send buffer size)
- AC_TRY_RUN([
- #include <stdlib.h>
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- main ()
- {
- FILE *fp;
- int fd,val=0,len=sizeof(int);
- if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
- if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
- if (val<=0) exit(1);
- fp = fopen("conftestval", "w");
- fprintf (fp, "%dn", val);
- exit(0);
- }
- ],
- SQUID_UDP_SO_SNDBUF=`cat conftestval`,
- SQUID_UDP_SO_SNDBUF=16384,
- SQUID_UDP_SO_SNDBUF=16384)
- AC_MSG_RESULT($SQUID_UDP_SO_SNDBUF)
- AC_DEFINE_UNQUOTED(SQUID_UDP_SO_SNDBUF, $SQUID_UDP_SO_SNDBUF)
- dnl Not cached since people are likely to tune this
- AC_MSG_CHECKING(Default UDP receive buffer size)
- AC_TRY_RUN([
- #include <stdlib.h>
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- main ()
- {
- FILE *fp;
- int fd,val=0,len=sizeof(int);
- if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
- if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
- if (val <= 0) exit(1);
- fp = fopen("conftestval", "w");
- fprintf (fp, "%dn", val);
- exit(0);
- }
- ],
- SQUID_UDP_SO_RCVBUF=`cat conftestval`,
- SQUID_UDP_SO_RCVBUF=16384,
- SQUID_UDP_SO_RCVBUF=16384)
- AC_MSG_RESULT($SQUID_UDP_SO_RCVBUF)
- AC_DEFINE_UNQUOTED(SQUID_UDP_SO_RCVBUF, $SQUID_UDP_SO_RCVBUF)
- dnl Not cached since people are likely to tune this
- AC_MSG_CHECKING(Default TCP send buffer size)
- AC_TRY_RUN([
- #include <stdlib.h>
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- main ()
- {
- FILE *fp;
- int fd,val=0,len=sizeof(int);
- FILE *fp;
- if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
- if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
- if (val <= 0) exit(1);
- fp = fopen("conftestval", "w");
- fprintf (fp, "%dn", val);
- exit(0);
- }
- ],
- SQUID_TCP_SO_SNDBUF=`cat conftestval`,
- SQUID_TCP_SO_SNDBUF=16384,
- SQUID_TCP_SO_SNDBUF=16384)
- AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF)
- AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF)
- dnl Not cached since people are likely to tune this
- AC_MSG_CHECKING(Default TCP receive buffer size)
- AC_TRY_RUN([
- #include <stdlib.h>
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- main ()
- {
- FILE *fp;
- int fd,val=0,len=sizeof(int);
- FILE *fp;
- if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
- if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
- if (val <= 0) exit(1);
- fp = fopen("conftestval", "w");
- fprintf (fp, "%dn", val);
- exit(0);
- }
- ],
- SQUID_TCP_SO_RCVBUF=`cat conftestval`,
- SQUID_TCP_SO_RCVBUF=16384,
- SQUID_TCP_SO_RCVBUF=16384)
- AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF)
- AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF)
- AC_CACHE_CHECK(if sys_errlist is already defined, ac_cv_needs_sys_errlist,
- AC_TRY_COMPILE([#include <stdio.h>],[char *s = sys_errlist[0];],
- ac_cv_needs_sys_errlist="no",
- ac_cv_needs_sys_errlist="yes")
- )
- if test "$ac_cv_needs_sys_errlist" = "yes" ; then
- AC_DEFINE(NEED_SYS_ERRLIST)
- fi
- dnl Not cached since people are likely to change this
- AC_MSG_CHECKING(for libresolv _dns_ttl_ hack)
- AC_TRY_LINK(extern int _dns_ttl_;,return _dns_ttl_;,
- [AC_MSG_RESULT(yes)
- AC_DEFINE(LIBRESOLV_DNS_TTL_HACK)],
- AC_MSG_RESULT(no))
- AC_MSG_CHECKING(if inet_ntoa() actually works)
- AC_TRY_RUN([
- #include <stdlib.h>
- #include <stdio.h>
- #include <sys/types.h>
- #include <netinet/in.h>
- #include <arpa/inet.h>
- main ()
- {
- FILE *fp;
- struct in_addr in;
- in.s_addr = inet_addr("1.2.3.4");
- fp = fopen("conftestval", "w");
- fprintf (fp, "%sn", inet_ntoa(in));
- exit(0);
- }
- ],
- INET_NTOA_RESULT=`cat conftestval`,
- INET_NTOA_RESULT="broken",
- INET_NTOA_RESULT="broken")
- if test "$INET_NTOA_RESULT" = "1.2.3.4" ; then
- AC_MSG_RESULT("yes")
- else
- AC_MSG_RESULT("no")
- echo "Will use our own inet_ntoa()."
- LIBOBJS="$LIBOBJS inet_ntoa.o"
- # echo "WARNING: This looks bad, and probably prevents Squid from working."
- # echo " If you're on IRIX and using GCC 2.8, you probably need"
- # echo " to use the IRIX C compiler instead."
- # sleep 10
- fi
- if test "$ac_cv_func_statvfs" = "yes" ; then
- AC_MSG_CHECKING(for working statvfs() interface)
- AC_TRY_COMPILE([
- #include <stdlib.h>
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/statvfs.h>
- ],
- [
- struct statvfs sfs;
- sfs.f_blocks = sfs.f_bfree = sfs.f_frsize =
- sfs.f_files = sfs.f_ffree = 0;
- statvfs("/tmp", &sfs);
- ],
- ac_cv_func_statvfs=yes,
- ac_cv_func_statvfs=no)
- AC_MSG_RESULT($ac_cv_func_statvfs)
- fi
- AC_CACHE_CHECK(for _res.nsaddr_list, ac_cv_have_res_nsaddr_list,
- AC_TRY_COMPILE([
- #if HAVE_SYS_TYPES_H
- #include <sys/types.h>
- #endif
- #if HAVE_NETINET_IN_H
- #include <netinet/in.h>
- #endif
- #if HAVE_ARPA_INET_H
- #include <arpa/inet.h>
- #endif
- #if HAVE_ARPA_NAMESER_H
- #include <arpa/nameser.h>
- #endif
- #if HAVE_RESOLV_H
- #include <resolv.h>
- #endif
- ],
- [_res.nsaddr_list[[0]];],
- ac_cv_have_res_nsaddr_list="yes",
- ac_cv_have_res_nsaddr_list="no"))
- if test $ac_cv_have_res_nsaddr_list = "yes" ; then
- AC_DEFINE(HAVE_RES_NSADDR_LIST)
- fi
- if test $ac_cv_have_res_nsaddr_list = "no" ; then
- AC_CACHE_CHECK(for _res.ns_list, ac_cv_have_res_ns_list,
- AC_TRY_COMPILE([
- #if HAVE_SYS_TYPES_H
- #include <sys/types.h>
- #endif
- #if HAVE_NETINET_IN_H
- #include <netinet/in.h>
- #endif
- #if HAVE_ARPA_INET_H
- #include <arpa/inet.h>
- #endif
- #if HAVE_ARPA_NAMESER_H
- #include <arpa/nameser.h>
- #endif
- #if HAVE_RESOLV_H
- #include <resolv.h>
- #endif
- ],
- [_res.ns_list[[0]].addr;],
- ac_cv_have_res_ns_list="yes",
- ac_cv_have_res_ns_list="no"))
- if test $ac_cv_have_res_ns_list = "yes" ; then
- AC_DEFINE(HAVE_RES_NS_LIST)
- fi
- fi
- dnl Need the debugging version of malloc if available
- XTRA_OBJS=''
- if test "$ac_cv_lib_malloc_main" = "yes" ; then
- if test -r /usr/lib/debug/malloc.o ; then
- XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
- fi
- if test -r /usr/lib/debug/mallocmap.o ; then
- XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
- fi
- fi
- AC_SUBST(XTRA_OBJS)
- if test -z "$XTRA_LIBS"; then
- XTRA_LIBS="$LIBS"
- dnl -lcrypt is set in CRYPTLIB
- XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/-lcrypt//"`
- dnl -lpthread is set in PTHREADLIB
- XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/-lpthread//"`
- dnl minor cleanup
- XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
- LIBS=''
- fi
- AC_SUBST(XTRA_LIBS)
- dnl Clean up after OSF/1 core dump bug
- rm -f core
- AC_OUTPUT(
- ./makefile
- ./lib/Makefile
- ./include/config.h
- ./scripts/Makefile
- ./scripts/RunCache
- ./scripts/RunAccel
- ./src/Makefile
- ./contrib/Makefile
- $SNMP_MAKEFILE
- ./icons/Makefile
- ./errors/Makefile
- ./auth_modules/dummy
- ./auth_modules/NCSA/Makefile
- )