]>
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(__DragonFly__)
115 #define _SQUID_DRAGONFLY_
117 #elif defined(__CYGWIN32__) || defined(__CYGWIN__)
118 #define _SQUID_CYGWIN_
119 #define _SQUID_WIN32_
121 #elif defined(WIN32) || defined(WINNT) || defined(__WIN32__) || defined(__WIN32)
122 #define _SQUID_MSWIN_
123 #define _SQUID_WIN32_
124 #include "squid_mswin.h"
126 #elif defined(__APPLE__)
127 #define _SQUID_APPLE_
129 #elif defined(sony_news) && defined(__svr4)
130 #define _SQUID_NEWSOS6_
132 #elif defined(__EMX__) || defined(OS2) || defined(__OS2__)
135 * FIXME: the os2 port of bash seems to have problems checking
136 * the return codes of programs in if statements. These options
137 * need to be overridden.
141 /* FD_SETSIZE must be redefined before including sys/types.h */
144 * On some systems, FD_SETSIZE is set to something lower than the
145 * actual number of files which can be opened. IRIX is one case,
146 * NetBSD is another. So here we increase FD_SETSIZE to our
147 * configure-discovered maximum *before* any system includes.
149 #define CHANGE_FD_SETSIZE 1
152 * Cannot increase FD_SETSIZE on Linux, but we can increase __FD_SETSIZE
153 * with glibc 2.2 (or later? remains to be seen). We do this by including
154 * bits/types.h which defines __FD_SETSIZE first, then we redefine
155 * __FD_SETSIZE. Ofcourse a user program may NEVER include bits/whatever.h
156 * directly, so this is a dirty hack!
158 #if defined(_SQUID_LINUX_)
159 #undef CHANGE_FD_SETSIZE
160 #define CHANGE_FD_SETSIZE 0
161 #include <features.h>
162 #if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
163 #if SQUID_MAXFD > DEFAULT_FD_SETSIZE
164 #include <bits/types.h>
166 #define __FD_SETSIZE SQUID_MAXFD
172 * Cannot increase FD_SETSIZE on FreeBSD before 2.2.0, causes select(2)
174 * --Marian Durkovic <marian@svf.stuba.sk>
175 * --Peter Wemm <peter@spinner.DIALix.COM>
177 #if defined(_SQUID_FREEBSD_)
178 #include <osreldate.h>
179 #if __FreeBSD_version < 220000
180 #undef CHANGE_FD_SETSIZE
181 #define CHANGE_FD_SETSIZE 0
186 * Trying to redefine CHANGE_FD_SETSIZE causes a slew of warnings
187 * on Mac OS X Server.
189 #if defined(_SQUID_APPLE_)
190 #undef CHANGE_FD_SETSIZE
191 #define CHANGE_FD_SETSIZE 0
194 /* Increase FD_SETSIZE if SQUID_MAXFD is bigger */
195 #if CHANGE_FD_SETSIZE && SQUID_MAXFD > DEFAULT_FD_SETSIZE
196 #define FD_SETSIZE SQUID_MAXFD
199 /* Typedefs for missing entries on a system */
201 #include "squid_types.h"
205 #if HAVE_CHAR && SIZEOF_CHAR == 1
208 #error NO 8 bit signed type available
213 #ifndef HAVE_U_INT8_T
215 typedef uint8_t u_int8_t
;
217 typedef unsigned char u_int8_t
;
223 #if HAVE_SHORT && SIZEOF_SHORT == 2
224 typedef short int16_t;
225 #elif HAVE_INT && SIZEOF_INT == 2
228 #error NO 16 bit signed type available
233 #ifndef HAVE_U_INT16_T
235 typedef uint16_t u_int16_t
;
237 typedef unsigned int16_t u_int16_t
;
243 #if HAVE_INT && SIZEOF_INT == 4
245 #elif HAVE_LONG && SIZEOF_LONG == 4
246 typedef long int32_t;
248 #error NO 32 bit signed type available
253 #ifndef HAVE_U_INT32_T
255 typedef uint32_t u_int32_t
;
257 typedef unsigned int32_t u_int32_t
;
264 typedef __int64
int64_t;
265 #elif HAVE_LONG && SIZEOF_LONG == 8
266 typedef long int64_t;
267 #elif HAVE_LONG_LONG && SIZEOF_LONG_LONG == 8
268 typedef long long int64_t;
270 #error NO 64 bit signed type available
275 #ifndef HAVE_U_INT64_T
277 typedef uint64_t u_int64_t
;
279 typedef unsigned int64_t u_int64_t
;
289 typedef unsigned int size_t;
301 typedef unsigned short mode_t
;
305 typedef unsigned long fd_mask
;
308 #ifndef HAVE_SOCKLEN_T
309 typedef int socklen_t
;
317 * On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
318 * that is incompatible with the updated Solaris header files.
320 #if defined(_SQUID_SOLARIS_) && (defined(i386) || defined(__i386))
321 #ifndef HAVE_PAD128_T
327 #ifndef HAVE_UPAD128_T
336 * Don't allow inclusion of malloc.h on FreeBSD, Next and OpenBSD
338 #if defined(HAVE_MALLOC_H) && (defined(_SQUID_FREEBSD_) || defined(_SQUID_NEXT_) || defined(_SQUID_OPENBSD_) || defined(_SQUID_DRAGONFLY_))
343 * res_init() is just a macro re-definition of __res_init on Linux (Debian/Ubuntu)
345 #if !defined(HAVE_RES_INIT) && defined(HAVE___RES_INIT) && !defined(res_init)
346 #define res_init __res_init
347 #define HAVE_RES_INIT HAVE___RES_INIT
350 #if !defined(CACHEMGR_HOSTNAME)
351 #define CACHEMGR_HOSTNAME ""
353 #define CACHEMGR_HOSTNAME_DEFINED 1
356 #if SQUID_DETECT_UDP_SO_SNDBUF > 16384
357 #define SQUID_UDP_SO_SNDBUF 16384
359 #define SQUID_UDP_SO_SNDBUF SQUID_DETECT_UDP_SO_SNDBUF
362 #if SQUID_DETECT_UDP_SO_RCVBUF > 16384
363 #define SQUID_UDP_SO_RCVBUF 16384
365 #define SQUID_UDP_SO_RCVBUF SQUID_DETECT_UDP_SO_RCVBUF
369 #define xmemcpy(d,s,n) memcpy((d),(s),(n))
371 #define xmemcpy(d,s,n) bcopy((s),(d),(n))
373 #define xmemcpy(d,s,n) memmove((d),(s),(n))
377 #define xmemmove(d,s,n) memmove((d),(s),(n))
379 #define xmemmove(d,s,n) bcopy((s),(d),(n))
382 #define xisspace(x) isspace((unsigned char)x)
383 #define xtoupper(x) toupper((unsigned char)x)
384 #define xtolower(x) tolower((unsigned char)x)
385 #define xisdigit(x) isdigit((unsigned char)x)
386 #define xisascii(x) isascii((unsigned char)x)
387 #define xislower(x) islower((unsigned char)x)
388 #define xisalpha(x) isalpha((unsigned char)x)
389 #define xisprint(x) isprint((unsigned char)x)
390 #define xisalnum(x) isalnum((unsigned char)x)
391 #define xiscntrl(x) iscntrl((unsigned char)x)
392 #define xispunct(x) ispunct((unsigned char)x)
393 #define xisupper(x) isupper((unsigned char)x)
394 #define xisxdigit(x) isxdigit((unsigned char)x)
395 #define xisgraph(x) isgraph((unsigned char)x)
398 #define squid_random random
399 #define squid_srandom srandom
401 #define squid_random lrand48
402 #define squid_srandom srand48
404 #define squid_random rand
405 #define squid_srandom srand
408 /* gcc doesn't recognize the Windows native 64 bit formatting tags causing
409 * the compile fail, so we must disable the check on native Windows.
412 #if __GNUC__ && !defined(_SQUID_MSWIN_)
413 #define PRINTF_FORMAT_ARG1 __attribute__ ((format (printf, 1, 2)))
414 #define PRINTF_FORMAT_ARG2 __attribute__ ((format (printf, 2, 3)))
415 #define PRINTF_FORMAT_ARG3 __attribute__ ((format (printf, 3, 4)))
417 #define PRINTF_FORMAT_ARG1
418 #define PRINTF_FORMAT_ARG2
419 #define PRINTF_FORMAT_ARG3
423 * Determine if this is a leak check build or standard
426 #define LEAK_CHECK_MODE 1
428 #define LEAK_CHECK_MODE 1
430 #define LEAK_CHECK_MODE 1
434 * valgrind debug support
437 #include <valgrind/memcheck.h>
438 #undef VALGRIND_MAKE_NOACCESS
439 #undef VALGRIND_MAKE_WRITABLE
440 #undef VALGRIND_MAKE_READABLE
441 /* A little glue for older valgrind version prior to 3.2.0 */
442 #ifndef VALGRIND_MAKE_MEM_NOACCESS
443 #define VALGRIND_MAKE_MEM_NOACCESS VALGRIND_MAKE_NOACCESS
444 #define VALGRIND_MAKE_MEM_UNDEFINED VALGRIND_MAKE_WRITABLE
445 #define VALGRIND_MAKE_MEM_DEFINED VALGRIND_MAKE_READABLE
446 #define VALGRIND_CHECK_MEM_IS_ADDRESSABLE VALGRIND_CHECK_WRITABLE
449 #define VALGRIND_MAKE_MEM_NOACCESS(a,b) (0)
450 #define VALGRIND_MAKE_MEM_UNDEFINED(a,b) (0)
451 #define VALGRIND_MAKE_MEM_DEFINED(a,b) (0)
452 #define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,b) (0)
453 #define VALGRIND_CHECK_MEM_IS_DEFINED(a,b) (0)
454 #define VALGRIND_MALLOCLIKE_BLOCK(a,b,c,d)
455 #define VALGRIND_FREELIKE_BLOCK(a,b)
456 #define RUNNING_ON_VALGRIND 0
457 #endif /* WITH_VALGRIND */
461 * strnstr() is needed. The OS may not provide a working copy.
465 #endif /* SQUID_CONFIG_H */