]> git.saurik.com Git - redis.git/blame - src/config.h
minor change with no actual effects til the loading node config code is in place
[redis.git] / src / config.h
CommitLineData
dde65f3f 1#ifndef __CONFIG_H
2#define __CONFIG_H
3
06db1f50 4#ifdef __APPLE__
5#include <AvailabilityMacros.h>
6#endif
7
d94ac406
PN
8/* Use tcmalloc's malloc_size() when available.
9 * When tcmalloc is used, native OSX malloc_size() may never be used because
10 * this expects a different allocation scheme. Therefore, *exclusively* use
11 * either tcmalloc or OSX's malloc_size()! */
7cdc98b6
PN
12#if defined(USE_TCMALLOC)
13#include <google/tcmalloc.h>
14#if TC_VERSION_MAJOR >= 1 && TC_VERSION_MINOR >= 6
15#define HAVE_MALLOC_SIZE 1
16#define redis_malloc_size(p) tc_malloc_size(p)
17#endif
d94ac406 18#elif defined(__APPLE__)
dde65f3f 19#include <malloc/malloc.h>
d76412d1 20#define HAVE_MALLOC_SIZE 1
dde65f3f 21#define redis_malloc_size(p) malloc_size(p)
22#endif
23
b1a8e3e8 24/* Tefine redis_fstat to fstat or fstat64() */
06db1f50 25#if defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_6)
dde65f3f 26#define redis_fstat fstat64
27#define redis_stat stat64
28#else
29#define redis_fstat fstat
30#define redis_stat stat
31#endif
32
b1a8e3e8 33/* Test for proc filesystem */
eddb388e 34#ifdef __linux__
35#define HAVE_PROCFS 1
36#endif
37
b1a8e3e8 38/* Test for task_info() */
73db2acc 39#if defined(__APPLE__)
40#define HAVE_TASKINFO 1
41#endif
42
b1a8e3e8 43/* Test for backtrace() */
d76412d1 44#if defined(__APPLE__) || defined(__linux__)
45#define HAVE_BACKTRACE 1
46#endif
47
b1a8e3e8 48/* Test for polling API */
266373b2 49#ifdef __linux__
50#define HAVE_EPOLL 1
51#endif
52
37be2765 53#if (defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_6)) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined (__NetBSD__)
f3053eb0
HM
54#define HAVE_KQUEUE 1
55#endif
56
b1a8e3e8 57/* Define aof_fsync to fdatasync() in Linux and fsync() for all the rest */
10ce1276 58#ifdef __linux__
59#define aof_fsync fdatasync
60#else
61#define aof_fsync fsync
62#endif
63
b1a8e3e8 64/* Byte ordering detection */
65#include <sys/types.h> /* This will likely define BYTE_ORDER */
66
67#ifndef BYTE_ORDER
68#if (BSD >= 199103)
69# include <machine/endian.h>
70#else
71#if defined(linux) || defined(__linux__)
72# include <endian.h>
73#else
74#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax, pc) */
75#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */
76#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp)*/
77
78#if defined(vax) || defined(ns32000) || defined(sun386) || defined(__i386__) || \
79 defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \
80 defined(__alpha__) || defined(__alpha)
81#define BYTE_ORDER LITTLE_ENDIAN
82#endif
83
84#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \
85 defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \
86 defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || defined(DGUX) ||\
87 defined(apollo) || defined(__convex__) || defined(_CRAY) || \
88 defined(__hppa) || defined(__hp9000) || \
89 defined(__hp9000s300) || defined(__hp9000s700) || \
90 defined (BIT_ZERO_ON_LEFT) || defined(m68k) || defined(__sparc)
91#define BYTE_ORDER BIG_ENDIAN
92#endif
93#endif /* linux */
94#endif /* BSD */
95#endif /* BYTE_ORDER */
96
97#if defined(__BYTE_ORDER) && !defined(BYTE_ORDER)
98#if (__BYTE_ORDER == __LITTLE_ENDIAN)
99#define BYTE_ORDER LITTLE_ENDIAN
100#else
101#define BYTE_ORDER BIG_ENDIAN
102#endif
103#endif
104
105#if !defined(BYTE_ORDER) || \
48e46215 106 (BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN)
b1a8e3e8 107 /* you must determine what the correct bit order is for
108 * your compiler - the next line is an intentional error
109 * which will force your compiles to bomb until you fix
110 * the above macros.
111 */
112#error "Undefined or invalid BYTE_ORDER"
113#endif
114
dde65f3f 115#endif