]>
git.ipfire.org Git - thirdparty/squid.git/blob - include/config.h
2 * $Id: config.h,v 1.27 2008/01/07 15:47:08 hno Exp $
4 * AUTHOR: Duane Wessels
6 * SQUID Web Proxy Cache http://www.squid-cache.org/
7 * ----------------------------------------------------------
9 * Squid is the result of efforts by numerous individuals from
10 * the Internet community; see the CONTRIBUTORS file for full
11 * details. Many organizations have provided support for Squid's
12 * development; see the SPONSORS file for full details. Squid is
13 * Copyrighted (C) 2001 by the Regents of the University of
14 * California; see the COPYRIGHT file for full details. Squid
15 * incorporates software developed and/or copyrighted by other
16 * sources; see the CREDITS file for full details.
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
34 #ifndef SQUID_CONFIG_H
35 #define SQUID_CONFIG_H
37 #include "autoconf.h" /* For GNU autoconf variables */
40 /* To keep API definitions clear */
42 #define SQUIDCEXTERN extern "C"
44 #define SQUIDCEXTERN extern
47 /****************************************************************************
48 *--------------------------------------------------------------------------*
49 * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...*
50 *--------------------------------------------------------------------------*
51 ****************************************************************************/
53 #ifdef USE_POSIX_REGEX
55 #define USE_RE_SYNTAX REG_EXTENDED /* default Syntax */
59 /* define the _SQUID_TYPE_ based on a guess of the OS */
60 #if defined(__sun__) || defined(__sun) /* SUN */
62 #if defined(__SVR4) /* SOLARIS */
63 #define _SQUID_SOLARIS_
68 #elif defined(__hpux) /* HP-UX - SysV-like? */
72 #elif defined(__osf__) /* OSF/1 */
75 #elif defined(__ultrix) /* Ultrix */
76 #define _SQUID_ULTRIX_
78 #elif defined(_AIX) /* AIX */
81 #elif defined(__linux__) /* Linux */
84 #define _SQUID_LINUX_THREADS_
87 #elif defined(__FreeBSD__) /* FreeBSD */
88 #define _SQUID_FREEBSD_
89 #if USE_ASYNC_IO && defined(LINUXTHREADS)
90 #define _SQUID_LINUX_THREADS_
93 #elif defined(__sgi__) || defined(sgi) || defined(__sgi) /* SGI */
95 #if !defined(_SVR4_SOURCE)
96 #define _SVR4_SOURCE /* for tempnam(3) */
100 #endif /* USE_ASYNC_IO */
102 #elif defined(__NeXT__)
105 #elif defined(__bsdi__)
106 #define _SQUID_BSDI_ /* BSD/OS */
108 #elif defined(__NetBSD__)
109 #define _SQUID_NETBSD_
111 #elif defined(__OpenBSD__)
112 #define _SQUID_OPENBSD_
114 #elif defined(__CYGWIN32__) || defined(__CYGWIN__)
115 #define _SQUID_CYGWIN_
116 #define _SQUID_WIN32_
118 #elif defined(WIN32) || defined(WINNT) || defined(__WIN32__) || defined(__WIN32)
119 #define _SQUID_MSWIN_
120 #define _SQUID_WIN32_
121 #include "squid_mswin.h"
123 #elif defined(__APPLE__)
124 #define _SQUID_APPLE_
126 #elif defined(sony_news) && defined(__svr4)
127 #define _SQUID_NEWSOS6_
129 #elif defined(__EMX__) || defined(OS2) || defined(__OS2__)
132 * FIXME: the os2 port of bash seems to have problems checking
133 * the return codes of programs in if statements. These options
134 * need to be overridden.
138 /* FD_SETSIZE must be redefined before including sys/types.h */
141 * On some systems, FD_SETSIZE is set to something lower than the
142 * actual number of files which can be opened. IRIX is one case,
143 * NetBSD is another. So here we increase FD_SETSIZE to our
144 * configure-discovered maximum *before* any system includes.
146 #define CHANGE_FD_SETSIZE 1
149 * Cannot increase FD_SETSIZE on Linux, but we can increase __FD_SETSIZE
150 * with glibc 2.2 (or later? remains to be seen). We do this by including
151 * bits/types.h which defines __FD_SETSIZE first, then we redefine
152 * __FD_SETSIZE. Ofcourse a user program may NEVER include bits/whatever.h
153 * directly, so this is a dirty hack!
155 #if defined(_SQUID_LINUX_)
156 #undef CHANGE_FD_SETSIZE
157 #define CHANGE_FD_SETSIZE 0
158 #include <features.h>
159 #if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
160 #if SQUID_MAXFD > DEFAULT_FD_SETSIZE
161 #include <bits/types.h>
163 #define __FD_SETSIZE SQUID_MAXFD
169 * Cannot increase FD_SETSIZE on FreeBSD before 2.2.0, causes select(2)
171 * --Marian Durkovic <marian@svf.stuba.sk>
172 * --Peter Wemm <peter@spinner.DIALix.COM>
174 #if defined(_SQUID_FREEBSD_)
175 #include <osreldate.h>
176 #if __FreeBSD_version < 220000
177 #undef CHANGE_FD_SETSIZE
178 #define CHANGE_FD_SETSIZE 0
183 * Trying to redefine CHANGE_FD_SETSIZE causes a slew of warnings
184 * on Mac OS X Server.
186 #if defined(_SQUID_APPLE_)
187 #undef CHANGE_FD_SETSIZE
188 #define CHANGE_FD_SETSIZE 0
191 /* Increase FD_SETSIZE if SQUID_MAXFD is bigger */
192 #if CHANGE_FD_SETSIZE && SQUID_MAXFD > DEFAULT_FD_SETSIZE
193 #define FD_SETSIZE SQUID_MAXFD
196 /* Typedefs for missing entries on a system */
198 #include "squid_types.h"
202 #if HAVE_CHAR && SIZEOF_CHAR == 1
205 #error NO 8 bit signed type available
210 #ifndef HAVE_U_INT8_T
212 typedef uint8_t u_int8_t
;
214 typedef unsigned char u_int8_t
;
220 #if HAVE_SHORT && SIZEOF_SHORT == 2
221 typedef short int16_t;
222 #elif HAVE_INT && SIZEOF_INT == 2
225 #error NO 16 bit signed type available
230 #ifndef HAVE_U_INT16_T
232 typedef uint16_t u_int16_t
;
234 typedef unsigned int16_t u_int16_t
;
240 #if HAVE_INT && SIZEOF_INT == 4
242 #elif HAVE_LONG && SIZEOF_LONG == 4
243 typedef long int32_t;
245 #error NO 32 bit signed type available
250 #ifndef HAVE_U_INT32_T
252 typedef uint32_t u_int32_t
;
254 typedef unsigned int32_t u_int32_t
;
261 typedef __int64
int64_t;
262 #elif HAVE_LONG && SIZEOF_LONG == 8
263 typedef long int64_t;
264 #elif HAVE_LONG_LONG && SIZEOF_LONG_LONG == 8
265 typedef long long int64_t;
267 #error NO 64 bit signed type available
272 #ifndef HAVE_U_INT64_T
274 typedef uint64_t u_int64_t
;
276 typedef unsigned int64_t u_int64_t
;
286 typedef unsigned int size_t;
298 typedef unsigned short mode_t
;
302 typedef unsigned long fd_mask
;
305 #ifndef HAVE_SOCKLEN_T
306 typedef int socklen_t
;
314 * On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
315 * that is incompatible with the updated Solaris header files.
317 #if defined(_SQUID_SOLARIS_) && (defined(i386) || defined(__i386))
318 #ifndef HAVE_PAD128_T
324 #ifndef HAVE_UPAD128_T
333 * Don't allow inclusion of malloc.h on FreeBSD, Next and OpenBSD
335 #if defined(HAVE_MALLOC_H) && (defined(_SQUID_FREEBSD_) || defined(_SQUID_NEXT_) || defined(_SQUID_OPENBSD_))
340 * res_init() is just a macro re-definition of __res_init on Linux (Debian/Ubuntu)
342 #if !defined(HAVE_RES_INIT) && defined(HAVE___RES_INIT) && !defined(res_init)
343 #define res_init __res_init
344 #define HAVE_RES_INIT HAVE___RES_INIT
347 #if !defined(CACHEMGR_HOSTNAME)
348 #define CACHEMGR_HOSTNAME ""
350 #define CACHEMGR_HOSTNAME_DEFINED 1
353 #if SQUID_DETECT_UDP_SO_SNDBUF > 16384
354 #define SQUID_UDP_SO_SNDBUF 16384
356 #define SQUID_UDP_SO_SNDBUF SQUID_DETECT_UDP_SO_SNDBUF
359 #if SQUID_DETECT_UDP_SO_RCVBUF > 16384
360 #define SQUID_UDP_SO_RCVBUF 16384
362 #define SQUID_UDP_SO_RCVBUF SQUID_DETECT_UDP_SO_RCVBUF
366 #define xmemcpy(d,s,n) memcpy((d),(s),(n))
368 #define xmemcpy(d,s,n) bcopy((s),(d),(n))
370 #define xmemcpy(d,s,n) memmove((d),(s),(n))
374 #define xmemmove(d,s,n) memmove((d),(s),(n))
376 #define xmemmove(d,s,n) bcopy((s),(d),(n))
379 #define xisspace(x) isspace((unsigned char)x)
380 #define xtoupper(x) toupper((unsigned char)x)
381 #define xtolower(x) tolower((unsigned char)x)
382 #define xisdigit(x) isdigit((unsigned char)x)
383 #define xisascii(x) isascii((unsigned char)x)
384 #define xislower(x) islower((unsigned char)x)
385 #define xisalpha(x) isalpha((unsigned char)x)
386 #define xisprint(x) isprint((unsigned char)x)
387 #define xisalnum(x) isalnum((unsigned char)x)
388 #define xiscntrl(x) iscntrl((unsigned char)x)
389 #define xispunct(x) ispunct((unsigned char)x)
390 #define xisupper(x) isupper((unsigned char)x)
391 #define xisxdigit(x) isxdigit((unsigned char)x)
392 #define xisgraph(x) isgraph((unsigned char)x)
395 #define squid_random random
396 #define squid_srandom srandom
398 #define squid_random lrand48
399 #define squid_srandom srand48
401 #define squid_random rand
402 #define squid_srandom srand
405 /* gcc doesn't recognize the Windows native 64 bit formatting tags causing
406 * the compile fail, so we must disable the check on native Windows.
409 #if __GNUC__ && !defined(_SQUID_MSWIN_)
410 #define PRINTF_FORMAT_ARG1 __attribute__ ((format (printf, 1, 2)))
411 #define PRINTF_FORMAT_ARG2 __attribute__ ((format (printf, 2, 3)))
412 #define PRINTF_FORMAT_ARG3 __attribute__ ((format (printf, 3, 4)))
414 #define PRINTF_FORMAT_ARG1
415 #define PRINTF_FORMAT_ARG2
416 #define PRINTF_FORMAT_ARG3
420 * Determine if this is a leak check build or standard
423 #define LEAK_CHECK_MODE 1
425 #define LEAK_CHECK_MODE 1
427 #define LEAK_CHECK_MODE 1
431 * valgrind debug support
434 #include <valgrind/memcheck.h>
435 #undef VALGRIND_MAKE_NOACCESS
436 #undef VALGRIND_MAKE_WRITABLE
437 #undef VALGRIND_MAKE_READABLE
438 /* A little glue for older valgrind version prior to 3.2.0 */
439 #ifndef VALGRIND_MAKE_MEM_NOACCESS
440 #define VALGRIND_MAKE_MEM_NOACCESS VALGRIND_MAKE_NOACCESS
441 #define VALGRIND_MAKE_MEM_UNDEFINED VALGRIND_MAKE_WRITABLE
442 #define VALGRIND_MAKE_MEM_DEFINED VALGRIND_MAKE_READABLE
443 #define VALGRIND_CHECK_MEM_IS_ADDRESSABLE VALGRIND_CHECK_WRITABLE
446 #define VALGRIND_MAKE_MEM_NOACCESS(a,b) (0)
447 #define VALGRIND_MAKE_MEM_UNDEFINED(a,b) (0)
448 #define VALGRIND_MAKE_MEM_DEFINED(a,b) (0)
449 #define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,b) (0)
450 #define VALGRIND_CHECK_MEM_IS_DEFINED(a,b) (0)
451 #define VALGRIND_MALLOCLIKE_BLOCK(a,b,c,d)
452 #define VALGRIND_FREELIKE_BLOCK(a,b)
453 #define RUNNING_ON_VALGRIND 0
454 #endif /* WITH_VALGRIND */
458 * strnstr() is needed. The OS may not provide a working copy.
462 #endif /* SQUID_CONFIG_H */