/*
- * $Id: config.h,v 1.13 2004/12/20 16:30:29 robertc Exp $
+ * $Id$
*
* AUTHOR: Duane Wessels
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
- *
+ *
*/
#ifndef SQUID_CONFIG_H
#define SQUID_CONFIG_H
#include "autoconf.h" /* For GNU autoconf variables */
+
+#if !defined(HAVE_SQUID)
+/* sub-packages define their own version details */
#include "version.h"
+#endif
+
/* To keep API definitions clear */
#ifdef __cplusplus
#define SQUIDCEXTERN extern "C"
#elif defined(__NetBSD__)
#define _SQUID_NETBSD_
+#elif defined(__OpenBSD__)
+#define _SQUID_OPENBSD_
+
+#elif defined(__DragonFly__)
+#define _SQUID_DRAGONFLY_
+
#elif defined(__CYGWIN32__) || defined(__CYGWIN__)
#define _SQUID_CYGWIN_
#define _SQUID_WIN32_
#elif defined(WIN32) || defined(WINNT) || defined(__WIN32__) || defined(__WIN32)
#define _SQUID_MSWIN_
#define _SQUID_WIN32_
+#include "squid_mswin.h"
#elif defined(__APPLE__)
#define _SQUID_APPLE_
#elif defined(__EMX__) || defined(OS2) || defined(__OS2__)
#define _SQUID_OS2_
/*
- * FIXME: the os2 port of bash seems to have problems checking
- * the return codes of programs in if statements. These options
- * need to be overridden.
- */
+* FIXME: the os2 port of bash seems to have problems checking
+* the return codes of programs in if statements. These options
+* need to be overridden.
+*/
#endif
/* FD_SETSIZE must be redefined before including sys/types.h */
#define FD_SETSIZE SQUID_MAXFD
#endif
-
-
/* Typedefs for missing entries on a system */
#include "squid_types.h"
+/* int8_t */
+#ifndef HAVE_INT8_T
+#if HAVE_CHAR && SIZEOF_CHAR == 1
+typedef char int8_t;
+#else
+#error NO 8 bit signed type available
+#endif
+#endif
+
+/* u_int8_t */
+#ifndef HAVE_U_INT8_T
+#if HAVE_UINT8_T
+typedef uint8_t u_int8_t;
+#else
+typedef unsigned char u_int8_t;
+#endif
+#endif
+
/* int16_t */
#ifndef HAVE_INT16_T
#if HAVE_SHORT && SIZEOF_SHORT == 2
* that is incompatible with the updated Solaris header files.
*/
#if defined(_SQUID_SOLARIS_) && (defined(i386) || defined(__i386))
-#ifndef pad128_t
+#ifndef HAVE_PAD128_T
typedef union {
- long double _q;
- int32_t _l[4];
+ long double _q;
+ int32_t _l[4];
} pad128_t;
#endif
-#ifndef upda128_t
+#ifndef HAVE_UPAD128_T
typedef union {
- long double _q;
- uint32_t _l[4];
+ long double _q;
+ uint32_t _l[4];
} upad128_t;
#endif
#endif
+/*
+ * Don't allow inclusion of malloc.h on FreeBSD, Next and OpenBSD
+ */
+#if defined(HAVE_MALLOC_H) && (defined(_SQUID_FREEBSD_) || defined(_SQUID_NEXT_) || defined(_SQUID_OPENBSD_) || defined(_SQUID_DRAGONFLY_))
+#undef HAVE_MALLOC_H
+#endif
+
+/*
+ * res_init() is just a macro re-definition of __res_init on Linux (Debian/Ubuntu)
+ */
+#if !defined(HAVE_RES_INIT) && defined(HAVE___RES_INIT) && !defined(res_init)
+#define res_init __res_init
+#define HAVE_RES_INIT HAVE___RES_INIT
+#endif
+
#if !defined(CACHEMGR_HOSTNAME)
#define CACHEMGR_HOSTNAME ""
+#else
+#define CACHEMGR_HOSTNAME_DEFINED 1
#endif
#if SQUID_DETECT_UDP_SO_SNDBUF > 16384
#define xispunct(x) ispunct((unsigned char)x)
#define xisupper(x) isupper((unsigned char)x)
#define xisxdigit(x) isxdigit((unsigned char)x)
+#define xisgraph(x) isgraph((unsigned char)x)
#if HAVE_RANDOM
#define squid_random random
#define squid_srandom srand
#endif
-#if __GNUC__
+/* gcc doesn't recognize the Windows native 64 bit formatting tags causing
+ * the compile fail, so we must disable the check on native Windows.
+ */
+
+#if __GNUC__ && !defined(_SQUID_MSWIN_)
#define PRINTF_FORMAT_ARG1 __attribute__ ((format (printf, 1, 2)))
#define PRINTF_FORMAT_ARG2 __attribute__ ((format (printf, 2, 3)))
#define PRINTF_FORMAT_ARG3 __attribute__ ((format (printf, 3, 4)))
#define PRINTF_FORMAT_ARG3
#endif
+/*
+ * Determine if this is a leak check build or standard
+ */
+#if PURIFY
+#define LEAK_CHECK_MODE 1
+#elif WITH_VALGRIND
+#define LEAK_CHECK_MODE 1
+#elif XMALLOC_TRACE
+#define LEAK_CHECK_MODE 1
+#endif
+
+/*
+ * valgrind debug support
+ */
+#if WITH_VALGRIND
+#include <valgrind/memcheck.h>
+/* A little glue for older valgrind version prior to 3.2.0 */
+#ifndef VALGRIND_MAKE_MEM_NOACCESS
+#define VALGRIND_MAKE_MEM_NOACCESS VALGRIND_MAKE_NOACCESS
+#define VALGRIND_MAKE_MEM_UNDEFINED VALGRIND_MAKE_WRITABLE
+#define VALGRIND_MAKE_MEM_DEFINED VALGRIND_MAKE_READABLE
+#define VALGRIND_CHECK_MEM_IS_ADDRESSABLE VALGRIND_CHECK_WRITABLE
+#else
+#undef VALGRIND_MAKE_NOACCESS
+#undef VALGRIND_MAKE_WRITABLE
+#undef VALGRIND_MAKE_READABLE
+#endif
+#else
+#define VALGRIND_MAKE_MEM_NOACCESS(a,b) (0)
+#define VALGRIND_MAKE_MEM_UNDEFINED(a,b) (0)
+#define VALGRIND_MAKE_MEM_DEFINED(a,b) (0)
+#define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,b) (0)
+#define VALGRIND_CHECK_MEM_IS_DEFINED(a,b) (0)
+#define VALGRIND_MALLOCLIKE_BLOCK(a,b,c,d)
+#define VALGRIND_FREELIKE_BLOCK(a,b)
+#define RUNNING_ON_VALGRIND 0
+#endif /* WITH_VALGRIND */
+
+
+/*
+ * strnstr() is needed. The OS may not provide a working copy.
+ */
+#include "strnstr.h"
+
#endif /* SQUID_CONFIG_H */