]>
Commit | Line | Data |
---|---|---|
dde65f3f | 1 | #ifndef __CONFIG_H |
2 | #define __CONFIG_H | |
3 | ||
06db1f50 | 4 | #ifdef __APPLE__ |
5 | #include <AvailabilityMacros.h> | |
6 | #endif | |
7 | ||
32f99c51 | 8 | /* Define redis_fstat to fstat or fstat64() */ |
06db1f50 | 9 | #if defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_6) |
dde65f3f | 10 | #define redis_fstat fstat64 |
11 | #define redis_stat stat64 | |
12 | #else | |
13 | #define redis_fstat fstat | |
14 | #define redis_stat stat | |
15 | #endif | |
16 | ||
b1a8e3e8 | 17 | /* Test for proc filesystem */ |
eddb388e | 18 | #ifdef __linux__ |
19 | #define HAVE_PROCFS 1 | |
20 | #endif | |
21 | ||
b1a8e3e8 | 22 | /* Test for task_info() */ |
73db2acc | 23 | #if defined(__APPLE__) |
24 | #define HAVE_TASKINFO 1 | |
25 | #endif | |
26 | ||
b1a8e3e8 | 27 | /* Test for backtrace() */ |
ca2344f9 | 28 | #if defined(__APPLE__) || defined(__linux__) || defined(__sun) |
d76412d1 | 29 | #define HAVE_BACKTRACE 1 |
30 | #endif | |
31 | ||
b1a8e3e8 | 32 | /* Test for polling API */ |
266373b2 | 33 | #ifdef __linux__ |
34 | #define HAVE_EPOLL 1 | |
35 | #endif | |
36 | ||
37be2765 | 37 | #if (defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_6)) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined (__NetBSD__) |
f3053eb0 HM |
38 | #define HAVE_KQUEUE 1 |
39 | #endif | |
40 | ||
2aa1efb8 DP |
41 | #ifdef __sun |
42 | #include <sys/feature_tests.h> | |
43 | #ifdef _DTRACE_VERSION | |
44 | #define HAVE_EVPORT 1 | |
45 | #endif | |
46 | #endif | |
47 | ||
b1a8e3e8 | 48 | /* Define aof_fsync to fdatasync() in Linux and fsync() for all the rest */ |
10ce1276 | 49 | #ifdef __linux__ |
50 | #define aof_fsync fdatasync | |
51 | #else | |
52 | #define aof_fsync fsync | |
53 | #endif | |
54 | ||
13732168 | 55 | /* Define rdb_fsync_range to sync_file_range() on Linux, otherwise we use |
56 | * the plain fsync() call. */ | |
57 | #ifdef __linux__ | |
be407c01 | 58 | #include <linux/version.h> |
59 | #ifdef __GLIBC__ | |
60 | #if (LINUX_VERSION_CODE >= 0x020617 && GLIBC_VERSION_AT_LEAST(2, 6)) | |
61 | #define HAVE_SYNC_FILE_RANGE 1 | |
62 | #endif | |
63 | #else | |
64 | #if (LINUX_VERSION_CODE >= 0x020617) | |
65 | #define HAVE_SYNC_FILE_RANGE 1 | |
66 | #endif | |
67 | #endif | |
68 | #endif | |
69 | ||
70 | #ifdef HAVE_SYNC_FILE_RANGE | |
13732168 | 71 | #define rdb_fsync_range(fd,off,size) sync_file_range(fd,off,size,SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE) |
72 | #else | |
73 | #define rdb_fsync_range(fd,off,size) fsync(fd) | |
74 | #endif | |
75 | ||
b1a8e3e8 | 76 | /* Byte ordering detection */ |
77 | #include <sys/types.h> /* This will likely define BYTE_ORDER */ | |
78 | ||
79 | #ifndef BYTE_ORDER | |
80 | #if (BSD >= 199103) | |
81 | # include <machine/endian.h> | |
82 | #else | |
83 | #if defined(linux) || defined(__linux__) | |
84 | # include <endian.h> | |
85 | #else | |
86 | #define LITTLE_ENDIAN 1234 /* least-significant byte first (vax, pc) */ | |
87 | #define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */ | |
88 | #define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp)*/ | |
89 | ||
e74bec56 PN |
90 | #if defined(__i386__) || defined(__x86_64__) || defined(__amd64__) || \ |
91 | defined(vax) || defined(ns32000) || defined(sun386) || \ | |
92 | defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \ | |
93 | defined(__alpha__) || defined(__alpha) | |
94 | #define BYTE_ORDER LITTLE_ENDIAN | |
b1a8e3e8 | 95 | #endif |
96 | ||
97 | #if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \ | |
98 | defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \ | |
99 | defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || defined(DGUX) ||\ | |
100 | defined(apollo) || defined(__convex__) || defined(_CRAY) || \ | |
101 | defined(__hppa) || defined(__hp9000) || \ | |
102 | defined(__hp9000s300) || defined(__hp9000s700) || \ | |
103 | defined (BIT_ZERO_ON_LEFT) || defined(m68k) || defined(__sparc) | |
104 | #define BYTE_ORDER BIG_ENDIAN | |
105 | #endif | |
106 | #endif /* linux */ | |
107 | #endif /* BSD */ | |
108 | #endif /* BYTE_ORDER */ | |
109 | ||
110 | #if defined(__BYTE_ORDER) && !defined(BYTE_ORDER) | |
111 | #if (__BYTE_ORDER == __LITTLE_ENDIAN) | |
112 | #define BYTE_ORDER LITTLE_ENDIAN | |
113 | #else | |
114 | #define BYTE_ORDER BIG_ENDIAN | |
115 | #endif | |
116 | #endif | |
117 | ||
118 | #if !defined(BYTE_ORDER) || \ | |
48e46215 | 119 | (BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN) |
b1a8e3e8 | 120 | /* you must determine what the correct bit order is for |
121 | * your compiler - the next line is an intentional error | |
122 | * which will force your compiles to bomb until you fix | |
123 | * the above macros. | |
124 | */ | |
125 | #error "Undefined or invalid BYTE_ORDER" | |
126 | #endif | |
127 | ||
80ff1fc6 | 128 | #if (__i386 || __amd64) && __GNUC__ |
1d6628c0 JW |
129 | #define GNUC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) |
130 | #if GNUC_VERSION >= 40100 | |
131 | #define HAVE_ATOMIC | |
132 | #endif | |
80ff1fc6 PH |
133 | #endif |
134 | ||
135 | ||
dde65f3f | 136 | #endif |