]> git.ipfire.org Git - thirdparty/squid.git/blame - include/config.h
Correct debugs output on GetDenyInfo
[thirdparty/squid.git] / include / config.h
CommitLineData
4d683a65 1/*
68d4f9d3 2 * $Id: config.h,v 1.27 2008/01/07 15:47:08 hno Exp $
4d683a65 3 *
4 * AUTHOR: Duane Wessels
5 *
6 * SQUID Web Proxy Cache http://www.squid-cache.org/
7 * ----------------------------------------------------------
8 *
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.
17 *
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.
c5dd4956 22 *
4d683a65 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.
c5dd4956 27 *
4d683a65 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.
c5dd4956 31 *
4d683a65 32 */
33
b5638623 34#ifndef SQUID_CONFIG_H
35#define SQUID_CONFIG_H
4d683a65 36
392bbafe 37#include "autoconf.h" /* For GNU autoconf variables */
4d683a65 38#include "version.h"
39
e6ccf245 40/* To keep API definitions clear */
41#ifdef __cplusplus
42#define SQUIDCEXTERN extern "C"
43#else
44#define SQUIDCEXTERN extern
45#endif
46
4d683a65 47/****************************************************************************
48 *--------------------------------------------------------------------------*
49 * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...*
50 *--------------------------------------------------------------------------*
51 ****************************************************************************/
52
53#ifdef USE_POSIX_REGEX
54#ifndef USE_RE_SYNTAX
55#define USE_RE_SYNTAX REG_EXTENDED /* default Syntax */
56#endif
57#endif
58
59/* define the _SQUID_TYPE_ based on a guess of the OS */
392bbafe 60#if defined(__sun__) || defined(__sun) /* SUN */
4d683a65 61#define _SQUID_SUN_
392bbafe 62#if defined(__SVR4) /* SOLARIS */
4d683a65 63#define _SQUID_SOLARIS_
392bbafe 64#else /* SUNOS */
4d683a65 65#define _SQUID_SUNOS_
66#endif
67
392bbafe 68#elif defined(__hpux) /* HP-UX - SysV-like? */
4d683a65 69#define _SQUID_HPUX_
70#define _SQUID_SYSV_
71
392bbafe 72#elif defined(__osf__) /* OSF/1 */
4d683a65 73#define _SQUID_OSF_
74
392bbafe 75#elif defined(__ultrix) /* Ultrix */
4d683a65 76#define _SQUID_ULTRIX_
77
392bbafe 78#elif defined(_AIX) /* AIX */
4d683a65 79#define _SQUID_AIX_
80
392bbafe 81#elif defined(__linux__) /* Linux */
4d683a65 82#define _SQUID_LINUX_
83#if USE_ASYNC_IO
84#define _SQUID_LINUX_THREADS_
85#endif
86
392bbafe 87#elif defined(__FreeBSD__) /* FreeBSD */
4d683a65 88#define _SQUID_FREEBSD_
89#if USE_ASYNC_IO && defined(LINUXTHREADS)
90#define _SQUID_LINUX_THREADS_
91#endif
92
392bbafe 93#elif defined(__sgi__) || defined(sgi) || defined(__sgi) /* SGI */
4d683a65 94#define _SQUID_SGI_
95#if !defined(_SVR4_SOURCE)
96#define _SVR4_SOURCE /* for tempnam(3) */
97#endif
98#if USE_ASYNC_IO
99#define _ABI_SOURCE
100#endif /* USE_ASYNC_IO */
101
102#elif defined(__NeXT__)
103#define _SQUID_NEXT_
104
105#elif defined(__bsdi__)
392bbafe 106#define _SQUID_BSDI_ /* BSD/OS */
4d683a65 107
108#elif defined(__NetBSD__)
109#define _SQUID_NETBSD_
110
482aa790 111#elif defined(__OpenBSD__)
112#define _SQUID_OPENBSD_
113
2e38af5d
AJ
114#elif defined(__DragonFly__)
115#define _SQUID_DRAGONFLY_
116
392bbafe 117#elif defined(__CYGWIN32__) || defined(__CYGWIN__)
4d683a65 118#define _SQUID_CYGWIN_
ec4daaa5 119#define _SQUID_WIN32_
4d683a65 120
121#elif defined(WIN32) || defined(WINNT) || defined(__WIN32__) || defined(__WIN32)
122#define _SQUID_MSWIN_
ec4daaa5 123#define _SQUID_WIN32_
021ab202 124#include "squid_mswin.h"
4d683a65 125
126#elif defined(__APPLE__)
127#define _SQUID_APPLE_
128
129#elif defined(sony_news) && defined(__svr4)
130#define _SQUID_NEWSOS6_
131
132#elif defined(__EMX__) || defined(OS2) || defined(__OS2__)
133#define _SQUID_OS2_
134/*
c5dd4956
AJ
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.
138*/
4d683a65 139#endif
6a9f6389 140
88d8a2a3 141/* FD_SETSIZE must be redefined before including sys/types.h */
142
143/*
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.
148 */
149#define CHANGE_FD_SETSIZE 1
150
151/*
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!
157 */
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>
165#undef __FD_SETSIZE
166#define __FD_SETSIZE SQUID_MAXFD
167#endif
168#endif
169#endif
170
171/*
172 * Cannot increase FD_SETSIZE on FreeBSD before 2.2.0, causes select(2)
173 * to return EINVAL.
174 * --Marian Durkovic <marian@svf.stuba.sk>
175 * --Peter Wemm <peter@spinner.DIALix.COM>
176 */
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
182#endif
183#endif
184
185/*
186 * Trying to redefine CHANGE_FD_SETSIZE causes a slew of warnings
187 * on Mac OS X Server.
188 */
189#if defined(_SQUID_APPLE_)
190#undef CHANGE_FD_SETSIZE
191#define CHANGE_FD_SETSIZE 0
192#endif
193
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
197#endif
198
6a9f6389 199/* Typedefs for missing entries on a system */
200
201#include "squid_types.h"
202
0409a509 203/* int8_t */
204#ifndef HAVE_INT8_T
205#if HAVE_CHAR && SIZEOF_CHAR == 1
206typedef char int8_t;
207#else
208#error NO 8 bit signed type available
209#endif
210#endif
211
212/* u_int8_t */
213#ifndef HAVE_U_INT8_T
214#if HAVE_UINT8_T
215typedef uint8_t u_int8_t;
216#else
217typedef unsigned char u_int8_t;
218#endif
219#endif
220
6a9f6389 221/* int16_t */
222#ifndef HAVE_INT16_T
223#if HAVE_SHORT && SIZEOF_SHORT == 2
224typedef short int16_t;
225#elif HAVE_INT && SIZEOF_INT == 2
226typedef int int16_t;
227#else
228#error NO 16 bit signed type available
229#endif
230#endif
231
232/* u_int16_t */
233#ifndef HAVE_U_INT16_T
234#if HAVE_UINT16_T
235typedef uint16_t u_int16_t;
236#else
237typedef unsigned int16_t u_int16_t;
238#endif
239#endif
240
241/* int32_t */
242#ifndef HAVE_INT32_T
243#if HAVE_INT && SIZEOF_INT == 4
244typedef int int32_t;
245#elif HAVE_LONG && SIZEOF_LONG == 4
246typedef long int32_t;
247#else
248#error NO 32 bit signed type available
249#endif
250#endif
251
252/* u_int32_t */
253#ifndef HAVE_U_INT32_T
254#if HAVE_UINT32_T
255typedef uint32_t u_int32_t;
256#else
257typedef unsigned int32_t u_int32_t;
258#endif
259#endif
260
261/* int64_t */
262#ifndef HAVE_INT64_T
263#if HAVE___INT64
264typedef __int64 int64_t;
265#elif HAVE_LONG && SIZEOF_LONG == 8
266typedef long int64_t;
267#elif HAVE_LONG_LONG && SIZEOF_LONG_LONG == 8
268typedef long long int64_t;
269#else
270#error NO 64 bit signed type available
271#endif
272#endif
273
274/* u_int64_t */
275#ifndef HAVE_U_INT64_T
276#if HAVE_UINT64_T
277typedef uint64_t u_int64_t;
278#else
279typedef unsigned int64_t u_int64_t;
4d683a65 280#endif
281#endif
282
6a9f6389 283
284#ifndef HAVE_PID_T
285typedef int pid_t;
286#endif
287
288#ifndef HAVE_SIZE_T
289typedef unsigned int size_t;
290#endif
291
292#ifndef HAVE_SSIZE_T
293typedef int ssize_t;
294#endif
295
296#ifndef HAVE_OFF_T
297typedef int off_t;
298#endif
299
300#ifndef HAVE_MODE_T
301typedef unsigned short mode_t;
302#endif
303
304#ifndef HAVE_FD_MASK
305typedef unsigned long fd_mask;
306#endif
307
308#ifndef HAVE_SOCKLEN_T
309typedef int socklen_t;
310#endif
311
312#ifndef HAVE_MTYP_T
313typedef long mtyp_t;
314#endif
315
b73f343e 316/*
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.
319 */
320#if defined(_SQUID_SOLARIS_) && (defined(i386) || defined(__i386))
588e71df 321#ifndef HAVE_PAD128_T
b73f343e 322typedef union {
c5dd4956
AJ
323 long double _q;
324 int32_t _l[4];
b73f343e 325} pad128_t;
326#endif
588e71df 327#ifndef HAVE_UPAD128_T
b73f343e 328typedef union {
c5dd4956
AJ
329 long double _q;
330 uint32_t _l[4];
b73f343e 331} upad128_t;
332#endif
333#endif
334
c5dd4956
AJ
335/*
336 * Don't allow inclusion of malloc.h on FreeBSD, Next and OpenBSD
482aa790 337 */
2e38af5d 338#if defined(HAVE_MALLOC_H) && (defined(_SQUID_FREEBSD_) || defined(_SQUID_NEXT_) || defined(_SQUID_OPENBSD_) || defined(_SQUID_DRAGONFLY_))
482aa790 339#undef HAVE_MALLOC_H
340#endif
341
af76ec93 342/*
343 * res_init() is just a macro re-definition of __res_init on Linux (Debian/Ubuntu)
344 */
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
348#endif
349
4d683a65 350#if !defined(CACHEMGR_HOSTNAME)
351#define CACHEMGR_HOSTNAME ""
42ad37af 352#else
353#define CACHEMGR_HOSTNAME_DEFINED 1
4d683a65 354#endif
355
6a9f6389 356#if SQUID_DETECT_UDP_SO_SNDBUF > 16384
4d683a65 357#define SQUID_UDP_SO_SNDBUF 16384
6a9f6389 358#else
359#define SQUID_UDP_SO_SNDBUF SQUID_DETECT_UDP_SO_SNDBUF
4d683a65 360#endif
361
6a9f6389 362#if SQUID_DETECT_UDP_SO_RCVBUF > 16384
4d683a65 363#define SQUID_UDP_SO_RCVBUF 16384
6a9f6389 364#else
365#define SQUID_UDP_SO_RCVBUF SQUID_DETECT_UDP_SO_RCVBUF
4d683a65 366#endif
367
368#ifdef HAVE_MEMCPY
369#define xmemcpy(d,s,n) memcpy((d),(s),(n))
370#elif HAVE_BCOPY
371#define xmemcpy(d,s,n) bcopy((s),(d),(n))
372#elif HAVE_MEMMOVE
373#define xmemcpy(d,s,n) memmove((d),(s),(n))
374#endif
375
376#ifdef HAVE_MEMMOVE
377#define xmemmove(d,s,n) memmove((d),(s),(n))
378#elif HAVE_BCOPY
379#define xmemmove(d,s,n) bcopy((s),(d),(n))
380#endif
381
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)
ec451a0f 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)
ba53f4b8 395#define xisgraph(x) isgraph((unsigned char)x)
4d683a65 396
397#if HAVE_RANDOM
398#define squid_random random
399#define squid_srandom srandom
400#elif HAVE_LRAND48
401#define squid_random lrand48
402#define squid_srandom srand48
403#else
404#define squid_random rand
405#define squid_srandom srand
406#endif
407
798f959e 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.
c5dd4956 410 */
798f959e 411
412#if __GNUC__ && !defined(_SQUID_MSWIN_)
68361fc4 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)))
392bbafe 416#else
68361fc4 417#define PRINTF_FORMAT_ARG1
418#define PRINTF_FORMAT_ARG2
419#define PRINTF_FORMAT_ARG3
392bbafe 420#endif
421
b4bab919 422/*
423 * Determine if this is a leak check build or standard
424 */
425#if PURIFY
426#define LEAK_CHECK_MODE 1
427#elif WITH_VALGRIND
428#define LEAK_CHECK_MODE 1
429#elif XMALLOC_TRACE
430#define LEAK_CHECK_MODE 1
431#endif
432
433/*
434 * valgrind debug support
435 */
436#if WITH_VALGRIND
437#include <valgrind/memcheck.h>
68d4f9d3 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
447#endif
b4bab919 448#else
68d4f9d3 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)
b4bab919 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 */
458
cee08cbc
AJ
459
460/*
461 * strnstr() is needed. The OS may not provide a working copy.
462 */
463#include "strnstr.h"
464
b5638623 465#endif /* SQUID_CONFIG_H */