OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2013 Apple Inc. | 2 * Copyright (C) 2004, 2005, 2006, 2013 Apple Inc. |
3 * Copyright (C) 2009 Google Inc. All rights reserved. | 3 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 4 * Copyright (C) 2007-2009 Torch Mobile, Inc. |
| 5 * Copyright (C) 2010, 2011 Research In Motion Limited. All rights reserved. |
4 * | 6 * |
5 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
9 * | 11 * |
10 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Library General Public License for more details. | 15 * Library General Public License for more details. |
14 * | 16 * |
15 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
16 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
19 * | 21 * |
20 */ | 22 */ |
21 | 23 |
22 #include <wtf/Platform.h> | 24 /* Include compiler specific macros */ |
| 25 #include "wtf/Compiler.h" |
| 26 |
| 27 /* ==== Platform adaptation macros: these describe properties of the target envi
ronment. ==== */ |
| 28 |
| 29 /* HAVE() - specific system features (headers, functions or similar) that are pr
esent or not */ |
| 30 #define HAVE(WTF_FEATURE) (defined HAVE_##WTF_FEATURE && HAVE_##WTF_FEATURE) |
| 31 /* OS() - underlying operating system; only to be used for mandated low-level se
rvices like |
| 32 virtual memory, not to choose a GUI toolkit */ |
| 33 #define OS(WTF_FEATURE) (defined WTF_OS_##WTF_FEATURE && WTF_OS_##WTF_FEATURE) |
| 34 |
| 35 /* ==== Policy decision macros: these define policy choices for a particular por
t. ==== */ |
| 36 |
| 37 /* USE() - use a particular third-party library or optional OS service */ |
| 38 #define USE(WTF_FEATURE) (defined WTF_USE_##WTF_FEATURE && WTF_USE_##WTF_FEATUR
E) |
| 39 /* ENABLE() - turn on a specific feature of WebKit */ |
| 40 #define ENABLE(WTF_FEATURE) (defined ENABLE_##WTF_FEATURE && ENABLE_##WTF_FEATU
RE) |
| 41 |
| 42 /* ==== OS() - underlying operating system; only to be used for mandated low-lev
el services like |
| 43 virtual memory, not to choose a GUI toolkit ==== */ |
| 44 |
| 45 /* OS(ANDROID) - Android */ |
| 46 #ifdef ANDROID |
| 47 #define WTF_OS_ANDROID 1 |
| 48 #endif |
| 49 |
| 50 /* OS(DARWIN) - Any Darwin-based OS, including Mac OS X and iPhone OS */ |
| 51 #ifdef __APPLE__ |
| 52 #define WTF_OS_DARWIN 1 |
| 53 #endif |
| 54 |
| 55 /* OS(FREEBSD) - FreeBSD */ |
| 56 #if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__
) |
| 57 #define WTF_OS_FREEBSD 1 |
| 58 #endif |
| 59 |
| 60 /* OS(HURD) - GNU/Hurd */ |
| 61 #ifdef __GNU__ |
| 62 #define WTF_OS_HURD 1 |
| 63 #endif |
| 64 |
| 65 /* OS(LINUX) - Linux */ |
| 66 #ifdef __linux__ |
| 67 #define WTF_OS_LINUX 1 |
| 68 #endif |
| 69 |
| 70 /* OS(NETBSD) - NetBSD */ |
| 71 #if defined(__NetBSD__) |
| 72 #define WTF_OS_NETBSD 1 |
| 73 #endif |
| 74 |
| 75 /* OS(OPENBSD) - OpenBSD */ |
| 76 #ifdef __OpenBSD__ |
| 77 #define WTF_OS_OPENBSD 1 |
| 78 #endif |
| 79 |
| 80 /* OS(SOLARIS) - Solaris */ |
| 81 #if defined(sun) || defined(__sun) |
| 82 #define WTF_OS_SOLARIS 1 |
| 83 #endif |
| 84 |
| 85 /* OS(WINDOWS) - Any version of Windows */ |
| 86 #if defined(WIN32) || defined(_WIN32) |
| 87 #define WTF_OS_WINDOWS 1 |
| 88 #endif |
| 89 |
| 90 /* OS(UNIX) - Any Unix-like system */ |
| 91 #if OS(ANDROID) \ |
| 92 || OS(DARWIN) \ |
| 93 || OS(FREEBSD) \ |
| 94 || OS(HURD) \ |
| 95 || OS(LINUX) \ |
| 96 || OS(NETBSD) \ |
| 97 || OS(OPENBSD) \ |
| 98 || OS(SOLARIS) \ |
| 99 || defined(unix) \ |
| 100 || defined(__unix) \ |
| 101 || defined(__unix__) |
| 102 #define WTF_OS_UNIX 1 |
| 103 #endif |
| 104 |
| 105 /* Operating environments */ |
| 106 |
| 107 #if OS(ANDROID) |
| 108 #define WTF_USE_LOW_QUALITY_IMAGE_INTERPOLATION 1 |
| 109 #define WTF_USE_LOW_QUALITY_IMAGE_NO_JPEG_DITHERING 1 |
| 110 #define WTF_USE_LOW_QUALITY_IMAGE_NO_JPEG_FANCY_UPSAMPLING 1 |
| 111 #else |
| 112 #define WTF_USE_ICCJPEG 1 |
| 113 #define WTF_USE_QCMSLIB 1 |
| 114 #endif |
| 115 |
| 116 #if OS(DARWIN) |
| 117 #define WTF_USE_CF 1 |
| 118 |
| 119 /* We can't override the global operator new and delete on OS(DARWIN) because |
| 120 * some object are allocated by WebKit and deallocated by the embedder. */ |
| 121 #else /* !OS(DARWIN) */ |
| 122 /* On non-OS(DARWIN), the "system malloc" is actually TCMalloc anyway, so there'
s |
| 123 * no need to use WebKit's copy of TCMalloc. */ |
| 124 #define WTF_USE_SYSTEM_MALLOC 1 |
| 125 #endif /* OS(DARWIN) */ |
| 126 |
| 127 #if !defined(HAVE_ACCESSIBILITY) |
| 128 #define HAVE_ACCESSIBILITY 1 |
| 129 #endif /* !defined(HAVE_ACCESSIBILITY) */ |
| 130 |
| 131 #if OS(UNIX) |
| 132 #define HAVE_MMAP 1 |
| 133 #define HAVE_SIGNAL_H 1 |
| 134 #define HAVE_SYS_TIME_H 1 |
| 135 #define WTF_USE_PTHREADS 1 |
| 136 #endif /* OS(UNIX) */ |
| 137 |
| 138 #if !defined(HAVE_VASPRINTF) |
| 139 #if !COMPILER(MSVC) |
| 140 #define HAVE_VASPRINTF 1 |
| 141 #endif |
| 142 #endif |
| 143 |
| 144 #if !OS(WINDOWS) && !OS(SOLARIS) && !OS(ANDROID) |
| 145 #define HAVE_TM_GMTOFF 1 |
| 146 #define HAVE_TM_ZONE 1 |
| 147 #define HAVE_TIMEGM 1 |
| 148 #endif |
| 149 |
| 150 #if OS(DARWIN) |
| 151 #define HAVE_DISPATCH_H 1 |
| 152 #define HAVE_PTHREAD_SETNAME_NP 1 |
| 153 #endif /* OS(DARWIN) */ |
23 | 154 |
24 #if OS(WINDOWS) | 155 #if OS(WINDOWS) |
25 | 156 |
26 // If we don't define these, they get defined in windef.h. | 157 // If we don't define these, they get defined in windef.h. |
27 // We want to use std::min and std::max. | 158 // We want to use std::min and std::max. |
28 #ifndef max | 159 #ifndef max |
29 #define max max | 160 #define max max |
30 #endif | 161 #endif |
31 #ifndef min | 162 #ifndef min |
32 #define min min | 163 #define min min |
33 #endif | 164 #endif |
34 | 165 |
35 #endif /* OS(WINDOWS) */ | 166 #endif /* OS(WINDOWS) */ |
36 | 167 |
37 #ifdef __cplusplus | 168 #ifdef __cplusplus |
38 | 169 |
39 // These undefs match up with defines in WebCorePrefixMac.h for Mac OS X. | 170 // These undefs match up with defines in WebCorePrefixMac.h for Mac OS X. |
40 // Helps us catch if anyone uses new or delete by accident in code and doesn't i
nclude "config.h". | 171 // Helps us catch if anyone uses new or delete by accident in code and doesn't i
nclude "config.h". |
41 #undef new | 172 #undef new |
42 #undef delete | 173 #undef delete |
43 #include <wtf/FastMalloc.h> | 174 #include "wtf/FastMalloc.h" |
44 | 175 |
45 #include <ciso646> | 176 #include <ciso646> |
46 | 177 |
47 #endif | 178 #endif |
48 | 179 |
49 #if COMPILER(MSVC) | 180 #if COMPILER(MSVC) |
50 #define SKIP_STATIC_CONSTRUCTORS_ON_MSVC 1 | 181 #define SKIP_STATIC_CONSTRUCTORS_ON_MSVC 1 |
51 #else | 182 #else |
52 #define SKIP_STATIC_CONSTRUCTORS_ON_GCC 1 | 183 #define SKIP_STATIC_CONSTRUCTORS_ON_GCC 1 |
53 #endif | 184 #endif |
54 | 185 |
55 #ifndef __STDC_FORMAT_MACROS | 186 #ifndef __STDC_FORMAT_MACROS |
56 #define __STDC_FORMAT_MACROS 1 | 187 #define __STDC_FORMAT_MACROS 1 |
57 #endif | 188 #endif |
OLD | NEW |