]> git.ipfire.org Git - thirdparty/squid.git/blame - configure.in
updating to squid-1.0.1
[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
983061ed 6dnl $Id: configure.in,v 1.20 1996/05/03 22:56:16 wessels Exp $
090089c4 7dnl
8dnl
090089c4 9dnl
a26bdc75 10AC_INIT(src/main.c)
090089c4 11AC_CONFIG_HEADER(include/autoconf.h)
983061ed 12AC_REVISION($Revision: 1.20 $)dnl
2877b8a9 13AC_PREFIX_DEFAULT(/usr/local/squid)
da22ac20 14AC_CONFIG_AUX_DIR(aux)
090089c4 15
88d50a22 16AC_CANONICAL_HOST
17
090089c4 18XTRA_CFLAGS=''
090089c4 19CRYPT_LIB=''
20
983061ed 21dnl use directory structure of cached as default (hack)
22if test "$libexecdir" = '${exec_prefix}/libexec'; then
23 libexecdir='${bindir}'
24 localstatedir='${prefix}'
25
26fi
27
a26bdc75 28if test -z "$CACHE_HTTP_PORT"; then
29 CACHE_HTTP_PORT="3128"
30fi
31if test -z "$CACHE_ICP_PORT"; then
32 CACHE_ICP_PORT="3130"
33fi
34if test -z "$CACHE_FTP_PORT"; then
35 CACHE_FTP_PORT="3132"
36fi
37
090089c4 38dnl Subsitutions
090089c4 39AC_SUBST(XTRA_CFLAGS)
a26bdc75 40AC_SUBST(CACHE_HTTP_PORT)
41AC_SUBST(CACHE_ICP_PORT)
42AC_SUBST(CACHE_FTP_PORT)
090089c4 43
44dnl Check for GNU cc
45AC_PROG_CC
46
47dnl Warn if not using GNU cc
48XXXCC=`echo $CC | awk '{print $1}'`
a0846d9c 49if test "`basename $XXXCC`" != "gcc"; then
090089c4 50 echo '**************************************************************';
51 echo '**************************************************************';
52 echo '**';
2877b8a9 53 echo '** WARNING: Squid is only guaranteed to compile with GNU cc.';
090089c4 54 echo "** Currently, you're using $CC";
55 echo '** ';
090089c4 56 echo '**************************************************************';
57 echo '**************************************************************';
58 sleep 5
59fi
60
2060fa9a 61
090089c4 62dnl Check for programs
63AC_PROG_CPP
64AC_PROG_INSTALL
65AC_PROG_RANLIB
66AC_PROG_LN_S
67AC_PATH_PROG(RM, rm, /bin/false)
68AC_PATH_PROG(MV, mv, /bin/false)
69AC_PATH_PROG(MKDIR, mkdir, /bin/false)
70AC_PATH_PROG(LN, ln, cp)
983061ed 71AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
090089c4 72
090089c4 73
74dnl Check for headers
75AC_HEADER_DIRENT
76AC_HEADER_STDC
db40ae20 77
2060fa9a 78
db40ae20 79AC_CHECK_HEADERS( \
80 alloca.h \
81 arpa/inet.h \
82 bstring.h \
83 config.h \
84 crypt.h \
85 fcntl.h \
86 memory.h \
87 netinet/in.h \
88 stdlib.h \
89 string.h \
90 strings.h \
91 sys/file.h \
92 sys/select.h\
93 sys/time.h \
94 sys/types.h \
234967c9 95 sys/syscall.h \
db40ae20 96 unistd.h \
97 regex.h \
98 syslog.h \
99)
100
46c883ed 101AC_MSG_CHECKING(for tm->tm_gmtoff)
102AC_TRY_COMPILE([#include <time.h>
103#include <sys/time.h>],
104[struct tm foo;
105foo.tm_gmtoff = 0;],
106[AC_DEFINE(HAVE_TM_GMTOFF)
107AC_MSG_RESULT(yes)],
108AC_MSG_RESULT(no))
109
110AC_MSG_CHECKING(for extended mallinfo)
111AC_TRY_COMPILE([#include <sys/types.h>
112#include <malloc.h>],
113[struct mallinfo foo;
114foo.mxfast = 0;],
115[AC_DEFINE(HAVE_EXT_MALLINFO)
116AC_MSG_RESULT(yes)],
117AC_MSG_RESULT(no))
090089c4 118
234967c9 119AC_MSG_CHECKING(if signal handlers need to be reset)
120AC_TRY_RUN([void handle(s) int s; { return; }
121main(){signal(15,handle);kill(getpid(),15);kill(getpid(),15);exit(0);}],
122AC_MSG_RESULT(no),
123[AC_DEFINE(RESET_SIGNAL_HANDLER)
124AC_MSG_RESULT(yes)],
125dnl default
126[AC_DEFINE(RESET_SIGNAL_HANDLER)
127AC_MSG_RESULT(yes)],)
128
090089c4 129dnl Check for typedefs
130AC_CHECK_SIZEOF(int)
131AC_CHECK_SIZEOF(long)
132
256cf05b 133dnl Check for special functions
134AC_FUNC_ALLOCA
090089c4 135
090089c4 136dnl Check for needed libraries
6716b242 137AC_CHECK_LIB(socket, main)
138AC_CHECK_LIB(malloc, main, [HAVE_LIBMALLOC="yes"; LIBS="$LIBS -lmalloc"])
139AC_CHECK_LIB(nsl, main)
140AC_CHECK_LIB(resolv, main)
141AC_CHECK_LIB(bsd, main)
090089c4 142
143dnl We found a version of libresolv on SunOS 4.x which requires -l44bsd
144dnl We have to first check to see if -l44bsd is present and has the
145dnl function inet_aton
77f675ad 146AC_CHECK_LIB(44bsd, inet_aton, [HAVE_LIB44BSD="yes"])
6716b242 147AC_CHECK_LIB(resolv, inet_aton, [if test "$HAVE_LIB44BSD" = "yes"; then LIBS="$LIBS -l44bsd"; fi])
090089c4 148
149dnl Check for libcrypt
b8de7ebe 150dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
090089c4 151AC_CHECK_LIB(crypt, crypt, [CRYPT_LIB="-lcrypt"])
77f675ad 152AC_SUBST(CRYPT_LIB)
153
154dnl System-specific library modifications
155dnl
156case "$host" in
157 *-sun-solaris*)
158 echo "Removing -lmalloc for Solaris..."
6716b242 159 LIBS=`echo $LIBS | sed -e s/-lmalloc//`
77f675ad 160 HAVE_LIBMALLOC="no"
161 ;;
162 *-sgi-irix*)
163 echo "Removing -lsocket for IRIX..."
6716b242 164 LIBS=`echo $LIBS | sed -e s/-lsocket//`
77f675ad 165 echo "Removing -lnsl for IRIX..."
6716b242 166 LIBS=`echo $LIBS | sed -e s/-lnsl//`
77f675ad 167 ;;
168esac
090089c4 169
6716b242 170dnl Check for library functions
171AC_CHECK_FUNCS(\
172 getdtablesize \
173 mallinfo \
174 mallopt \
175 regcomp \
176 regexec \
177 regfree \
234967c9 178 seteuid \
179 setresuid \
6716b242 180 setrlimit \
181 strdup \
182 strerror \
183 sysconf \
184 syslog \
234967c9 185 timegm \
6716b242 186)
187
234967c9 188AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
189AC_TRY_RUN([
190#include <unistd.h>
191#include <sys/param.h>
192#include <sys/resource.h>
193main() {
194 int i,j;
195#if HAVE_SETRLIMIT
196 struct rlimit rl;
197#if defined(RLIMIT_NOFILE)
198 if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
199 perror("getrlimit: RLIMIT_NOFILE");
200 } else {
201 rl.rlim_cur = rl.rlim_max; /* set it to the max */
202 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
203 perror("setrlimit: RLIMIT_NOFILE");
204 }
205 }
206#elif defined(RLIMIT_OFILE)
207 if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
208 perror("getrlimit: RLIMIT_OFILE");
209 } else {
210 rl.rlim_cur = rl.rlim_max; /* set it to the max */
211 if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
212 perror("setrlimit: RLIMIT_OFILE");
213 }
214 }
215#endif /* RLIMIT_NOFILE */
216#endif /* HAVE_SETRLIMIT */
217#if HAVE_SYSCONF && defined(_SC_OPEN_MAX)
218 i = sysconf(_SC_OPEN_MAX);
219#elif HAVE_GETDTABLESIZE
220 i = getdtablesize();
221#elif defined(OPEN_MAX)
222 i = OPEN_MAX;
223#elif defined(NOFILE)
224 i = NOFILE;
225#elif defined(_NFILE)
226 i = _NFILE;
227#else
228 while((j=open("/dev/null", 0)) > 0) i=j;
229#endif
230 fprintf (fopen("conftestval", "w"), "%d\n", i);
231 exit(0);
232}
233],
234SQUID_FD_SETSIZE=`cat conftestval`,
235SQUID_FD_SETSIZE=256,
236SQUID_FD_SETSIZE=256)
237AC_MSG_RESULT($SQUID_FD_SETSIZE)
238AC_DEFINE_UNQUOTED(SQUID_FD_SETSIZE, $SQUID_FD_SETSIZE)
239
090089c4 240dnl Need the debugging version of malloc if available
241XTRA_OBJS=''
77f675ad 242if test "$HAVE_LIBMALLOC" = "yes" ; then
090089c4 243 if test -r /usr/lib/debug/malloc.o ; then
244 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
245 fi
246 if test -r /usr/lib/debug/mallocmap.o ; then
247 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
248 fi
249fi
250AC_SUBST(XTRA_OBJS)
251
6716b242 252XTRA_LIBS="$LIBS"
253LIBS=''
090089c4 254AC_SUBST(XTRA_LIBS)
255
13b46529 256dnl Set STD_CFLAGS
257if test -z "$STD_CFLAGS"; then
d7ce09df 258 STD_CFLAGS="-g"
a0846d9c 259 XXXCC=`echo $CC | awk '{print $1}'`
260 if test "`basename $XXXCC`" = "gcc"; then
268d1df2 261 case "$host" in
262 *-sun-sunos*)
263 # sunos has too many warnings for this to be useful
264 ;;
265 *)
266 STD_CFLAGS="$STD_CFLAGS -Wall"
267 ;;
268 esac
a0846d9c 269 fi
270fi
13b46529 271AC_SUBST(STD_CFLAGS)
a0846d9c 272
13b46529 273dnl Set STD_LDFLAGS
274if test -z "$STD_LDFLAGS"; then
d7ce09df 275 STD_LDFLAGS="-g"
090089c4 276fi
13b46529 277AC_SUBST(STD_LDFLAGS)
090089c4 278
77f675ad 279dnl Last minute system specific modifications
090089c4 280dnl
77f675ad 281case "$host" in
282 *-sgi-irix*)
283 echo "Adding ANSI compile flags for IRIX..."
284 XXXCC=`echo $CC | awk '{print $1}'`
285 if test "`basename $XXXCC`" = "gcc"; then
286 [XTRA_CFLAGS="$XTRA_CFLAGS -ansi"]
287 else
288 [XTRA_CFLAGS="$XTRA_CFLAGS -D__STRICT_ANSI__"]
289 fi
290 ;;
291 *-hp-hpux*)
292 echo "Disabling 'ranlib' for HP-UX..."
293 RANLIB=":"
294 ;;
295esac
090089c4 296
297
298dnl Clean up after OSF/1 core dump bug
299rm -f core
300
301AC_OUTPUT(\
0992a350 302 ./makefile \
090089c4 303 ./lib/Makefile \
a26bdc75 304 ./include/config.h \
090089c4 305 ./scripts/Makefile \
306 ./scripts/RunCache \
307 ./scripts/RunAccel \
a26bdc75 308 ./src/Makefile \
983061ed 309 ./src/squid.conf.pre \
090089c4 310)