1 /* 2 * Copyright (C) 2004, 2005, 2006 Apple Inc. 3 * Copyright (C) 2009 Google Inc. All rights reserved. 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 15 * 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 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 * 20 */ 21 22 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H 23 #ifdef BUILDING_WITH_CMAKE 24 #include "cmakeconfig.h" 25 #else 26 #include "autotoolsconfig.h" 27 #endif 28 #endif 29 30 #include <wtf/Platform.h> 31 32 /* See note in wtf/Platform.h for more info on EXPORT_MACROS. */ 33 #if USE(EXPORT_MACROS) 34 35 #include <wtf/ExportMacros.h> 36 37 #if defined(BUILDING_JavaScriptCore) || defined(BUILDING_WTF) 38 #define WTF_EXPORT_PRIVATE WTF_EXPORT 39 #define JS_EXPORT_PRIVATE WTF_EXPORT 40 #else 41 #define WTF_EXPORT_PRIVATE WTF_IMPORT 42 #define JS_EXPORT_PRIVATE WTF_IMPORT 43 #endif 44 45 #define JS_EXPORTDATA JS_EXPORT_PRIVATE 46 #define JS_EXPORTCLASS JS_EXPORT_PRIVATE 47 48 #if defined(BUILDING_WebCore) || defined(BUILDING_WebKit) 49 #define WEBKIT_EXPORTDATA WTF_EXPORT 50 #else 51 #define WEBKIT_EXPORTDATA WTF_IMPORT 52 #endif 53 54 #else /* !USE(EXPORT_MACROS) */ 55 56 #if !PLATFORM(CHROMIUM) && OS(WINDOWS) && !defined(BUILDING_WX__) && !COMPILER(GCC) 57 #if defined(BUILDING_JavaScriptCore) || defined(BUILDING_WTF) 58 #define JS_EXPORTDATA __declspec(dllexport) 59 #else 60 #define JS_EXPORTDATA __declspec(dllimport) 61 #endif 62 #if defined(BUILDING_WebCore) || defined(BUILDING_WebKit) 63 #define WEBKIT_EXPORTDATA __declspec(dllexport) 64 #else 65 #define WEBKIT_EXPORTDATA __declspec(dllimport) 66 #endif 67 #define WTF_EXPORT_PRIVATE 68 #define JS_EXPORT_PRIVATE 69 #define JS_EXPORTCLASS JS_EXPORTDATA 70 #else 71 #define JS_EXPORTDATA 72 #define JS_EXPORTCLASS 73 #define WEBKIT_EXPORTDATA 74 #define WTF_EXPORT_PRIVATE 75 #define JS_EXPORT_PRIVATE 76 #endif 77 78 #endif /* USE(EXPORT_MACROS) */ 79 80 #ifdef __APPLE__ 81 #define HAVE_FUNC_USLEEP 1 82 #endif /* __APPLE__ */ 83 84 #if OS(WINDOWS) 85 86 #ifndef _WIN32_WINNT 87 #define _WIN32_WINNT 0x0500 88 #endif 89 90 #ifndef WINVER 91 #define WINVER 0x0500 92 #endif 93 94 // If we don't define these, they get defined in windef.h. 95 // We want to use std::min and std::max. 96 #ifndef max 97 #define max max 98 #endif 99 #ifndef min 100 #define min min 101 #endif 102 103 // CURL needs winsock, so don't prevent inclusion of it 104 #if !USE(CURL) 105 #ifndef _WINSOCKAPI_ 106 #define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h 107 #endif 108 #endif 109 110 #endif /* OS(WINDOWS) */ 111 112 #if PLATFORM(ANDROID) 113 // Android uses a single set of include directories when building WebKit and 114 // JavaScriptCore. Since WebCore/ is included before JavaScriptCore/, Android 115 // includes JavaScriptCore/config.h explicitly here to make sure it gets picked 116 // up. 117 #include <JavaScriptCore/config.h> 118 119 #define WEBCORE_NAVIGATOR_VENDOR "Google Inc." 120 // This must be defined before we include FastMalloc.h, below. 121 #define USE_SYSTEM_MALLOC 1 122 #define LOG_DISABLED 1 123 #include <wtf/Assertions.h> 124 // Central place to set which optional features Android uses. 125 #define ENABLE_CHANNEL_MESSAGING 1 126 #define ENABLE_DOM_STORAGE 1 127 #undef ENABLE_FTPDIR // Enabled by default in Platform.h 128 #define ENABLE_FTPDIR 0 129 #ifndef ENABLE_SVG 130 #define ENABLE_SVG 0 131 #endif 132 #define ENABLE_VIDEO 1 133 #define ENABLE_WORKERS 1 134 #define ENABLE_XBL 0 135 #define ENABLE_XHTMLMP 0 136 #define ENABLE_XPATH 0 137 #define ENABLE_XSLT 0 138 #define ENABLE_ARCHIVE 0 139 #define ENABLE_OFFLINE_WEB_APPLICATIONS 1 140 #undef ENABLE_GEOLOCATION // Disabled by default in Platform.h 141 #define ENABLE_GEOLOCATION 1 142 #undef ENABLE_INSPECTOR // Enabled by default in Platform.h 143 #define ENABLE_INSPECTOR 0 144 #define ENABLE_EVENT_SOURCE 0 145 #endif /* PLATFORM(ANDROID) */ 146 147 #ifdef __cplusplus 148 149 // These undefs match up with defines in WebCorePrefix.h for Mac OS X. 150 // Helps us catch if anyone uses new or delete by accident in code and doesn't include "config.h". 151 #undef new 152 #undef delete 153 #include <wtf/FastMalloc.h> 154 155 #endif 156 157 // On MSW, wx headers need to be included before windows.h is. 158 // The only way we can always ensure this is if we include wx here. 159 #if PLATFORM(WX) 160 #include <wx/defs.h> 161 #endif 162 163 // this breaks compilation of <QFontDatabase>, at least, so turn it off for now 164 // Also generates errors on wx on Windows, presumably because these functions 165 // are used from wx headers. On GTK+ for Mac many GTK+ files include <libintl.h> 166 // or <glib/gi18n-lib.h>, which in turn include <xlocale/_ctype.h> which uses 167 // isacii(). 168 #if !PLATFORM(QT) && !PLATFORM(WX) && !PLATFORM(CHROMIUM) && !(OS(DARWIN) && PLATFORM(GTK)) 169 #include <wtf/DisallowCType.h> 170 #endif 171 172 #if COMPILER(MSVC) 173 #define SKIP_STATIC_CONSTRUCTORS_ON_MSVC 1 174 #elif !COMPILER(WINSCW) 175 #define SKIP_STATIC_CONSTRUCTORS_ON_GCC 1 176 #endif 177 178 #if PLATFORM(WIN) 179 #if defined(WIN_CAIRO) 180 #undef WTF_USE_CG 181 #define WTF_USE_CAIRO 1 182 #define WTF_USE_CURL 1 183 #ifndef _WINSOCKAPI_ 184 #define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h 185 #endif 186 #elif !OS(WINCE) 187 #define WTF_USE_CG 1 188 #undef WTF_USE_CAIRO 189 #undef WTF_USE_CURL 190 #endif 191 #endif 192 193 #if PLATFORM(MAC) 194 // New theme 195 #define WTF_USE_NEW_THEME 1 196 #endif // PLATFORM(MAC) 197 198 #if OS(SYMBIAN) 199 #define USE_SYSTEM_MALLOC 1 200 #define ENABLE_PASSWORD_ECHO 1 201 #endif 202 203 #if OS(UNIX) || OS(WINDOWS) 204 #define WTF_USE_OS_RANDOMNESS 1 205 #endif 206 207 #if PLATFORM(CHROMIUM) 208 209 // Chromium uses this file instead of JavaScriptCore/config.h to compile 210 // JavaScriptCore/wtf (chromium doesn't compile the rest of JSC). Therefore, 211 // this define is required. 212 #define WTF_CHANGES 1 213 214 #define WTF_USE_GOOGLEURL 1 215 216 #if !defined(WTF_USE_V8) 217 #define WTF_USE_V8 1 218 #endif 219 220 #endif /* PLATFORM(CHROMIUM) */ 221 222 #if !defined(WTF_USE_V8) 223 #define WTF_USE_V8 0 224 #endif /* !defined(WTF_USE_V8) */ 225 226 /* Using V8 implies not using JSC and vice versa */ 227 #if !defined(WTF_USE_JSC) 228 #define WTF_USE_JSC !WTF_USE_V8 229 #endif 230 231 #if USE(CG) 232 #ifndef CGFLOAT_DEFINED 233 #ifdef __LP64__ 234 typedef double CGFloat; 235 #else 236 typedef float CGFloat; 237 #endif 238 #define CGFLOAT_DEFINED 1 239 #endif 240 #endif /* USE(CG) */ 241 242 243 #if PLATFORM(WIN) && USE(CG) 244 #define WTF_USE_SAFARI_THEME 1 245 #endif 246 247 // CoreAnimation is available to IOS, Mac and Windows if using CG 248 #if PLATFORM(MAC) || PLATFORM(IOS) || (PLATFORM(WIN) && USE(CG)) 249 #define WTF_USE_CA 1 250 #endif 251 252 #if PLATFORM(QT) && USE(V8) && defined(Q_WS_X11) 253 /* protect ourselves from evil X11 defines */ 254 #include <bridge/npruntime_internal.h> 255 #endif 256 257