1 /* 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2007-2009 Torch Mobile, Inc. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27 #ifndef WTF_Platform_h 28 #define WTF_Platform_h 29 30 /* ==== PLATFORM handles OS, operating environment, graphics API, and 31 CPU. This macro will be phased out in favor of platform adaptation 32 macros, policy decision macros, and top-level port definitions. ==== */ 33 #define PLATFORM(WTF_FEATURE) (defined WTF_PLATFORM_##WTF_FEATURE && WTF_PLATFORM_##WTF_FEATURE) 34 35 36 /* ==== Platform adaptation macros: these describe properties of the target environment. ==== */ 37 38 /* COMPILER() - the compiler being used to build the project */ 39 #define COMPILER(WTF_FEATURE) (defined WTF_COMPILER_##WTF_FEATURE && WTF_COMPILER_##WTF_FEATURE) 40 /* CPU() - the target CPU architecture */ 41 #define CPU(WTF_FEATURE) (defined WTF_CPU_##WTF_FEATURE && WTF_CPU_##WTF_FEATURE) 42 /* HAVE() - specific system features (headers, functions or similar) that are present or not */ 43 #define HAVE(WTF_FEATURE) (defined HAVE_##WTF_FEATURE && HAVE_##WTF_FEATURE) 44 /* OS() - underlying operating system; only to be used for mandated low-level services like 45 virtual memory, not to choose a GUI toolkit */ 46 #define OS(WTF_FEATURE) (defined WTF_OS_##WTF_FEATURE && WTF_OS_##WTF_FEATURE) 47 48 49 /* ==== Policy decision macros: these define policy choices for a particular port. ==== */ 50 51 /* USE() - use a particular third-party library or optional OS service */ 52 #define USE(WTF_FEATURE) (defined WTF_USE_##WTF_FEATURE && WTF_USE_##WTF_FEATURE) 53 /* ENABLE() - turn on a specific feature of WebKit */ 54 #define ENABLE(WTF_FEATURE) (defined ENABLE_##WTF_FEATURE && ENABLE_##WTF_FEATURE) 55 56 57 58 /* ==== COMPILER() - the compiler being used to build the project ==== */ 59 60 /* COMPILER(MSVC) Microsoft Visual C++ */ 61 /* COMPILER(MSVC7) Microsoft Visual C++ v7 or lower*/ 62 #if defined(_MSC_VER) 63 #define WTF_COMPILER_MSVC 1 64 #if _MSC_VER < 1400 65 #define WTF_COMPILER_MSVC7 1 66 #endif 67 #endif 68 69 /* COMPILER(RVCT) - ARM RealView Compilation Tools */ 70 #if defined(__CC_ARM) || defined(__ARMCC__) 71 #define WTF_COMPILER_RVCT 1 72 #endif 73 74 /* COMPILER(GCC) - GNU Compiler Collection */ 75 /* --gnu option of the RVCT compiler also defines __GNUC__ */ 76 #if defined(__GNUC__) && !COMPILER(RVCT) 77 #define WTF_COMPILER_GCC 1 78 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) 79 #endif 80 81 /* COMPILER(MINGW) - MinGW GCC */ 82 #if defined(MINGW) || defined(__MINGW32__) 83 #define WTF_COMPILER_MINGW 1 84 #endif 85 86 /* COMPILER(WINSCW) - CodeWarrior for Symbian emulator */ 87 #if defined(__WINSCW__) 88 #define WTF_COMPILER_WINSCW 1 89 #endif 90 91 92 93 /* ==== CPU() - the target CPU architecture ==== */ 94 95 /* This also defines CPU(BIG_ENDIAN) or CPU(MIDDLE_ENDIAN) or neither, as appropriate. */ 96 97 /* CPU(ALPHA) - DEC Alpha */ 98 #if defined(__alpha__) 99 #define WTF_CPU_ALPHA 1 100 #endif 101 102 /* CPU(IA64) - Itanium / IA-64 */ 103 #if defined(__ia64__) 104 #define WTF_CPU_IA64 1 105 #endif 106 107 /* CPU(PPC) - PowerPC 32-bit */ 108 #if defined(__ppc__) \ 109 || defined(__PPC__) \ 110 || defined(__powerpc__) \ 111 || defined(__powerpc) \ 112 || defined(__POWERPC__) \ 113 || defined(_M_PPC) \ 114 || defined(__PPC) 115 #define WTF_CPU_PPC 1 116 #define WTF_CPU_BIG_ENDIAN 1 117 #endif 118 119 /* CPU(PPC64) - PowerPC 64-bit */ 120 #if defined(__ppc64__) \ 121 || defined(__PPC64__) 122 #define WTF_CPU_PPC64 1 123 #define WTF_CPU_BIG_ENDIAN 1 124 #endif 125 126 /* CPU(SH4) - SuperH SH-4 */ 127 #if defined(__SH4__) 128 #define WTF_CPU_SH4 1 129 #endif 130 131 /* CPU(SPARC32) - SPARC 32-bit */ 132 #if defined(__sparc) && !defined(__arch64__) || defined(__sparcv8) 133 #define WTF_CPU_SPARC32 1 134 #define WTF_CPU_BIG_ENDIAN 1 135 #endif 136 137 /* CPU(SPARC64) - SPARC 64-bit */ 138 #if defined(__sparc__) && defined(__arch64__) || defined (__sparcv9) 139 #define WTF_CPU_SPARC64 1 140 #define WTF_CPU_BIG_ENDIAN 1 141 #endif 142 143 /* CPU(SPARC) - any SPARC, true for CPU(SPARC32) and CPU(SPARC64) */ 144 #if CPU(SPARC32) || CPU(SPARC64) 145 #define WTF_CPU_SPARC 146 #endif 147 148 /* CPU(X86) - i386 / x86 32-bit */ 149 #if defined(__i386__) \ 150 || defined(i386) \ 151 || defined(_M_IX86) \ 152 || defined(_X86_) \ 153 || defined(__THW_INTEL) 154 #define WTF_CPU_X86 1 155 #endif 156 157 /* CPU(X86_64) - AMD64 / Intel64 / x86_64 64-bit */ 158 #if defined(__x86_64__) \ 159 || defined(_M_X64) 160 #define WTF_CPU_X86_64 1 161 #endif 162 163 /* CPU(ARM) - ARM, any version*/ 164 #if defined(arm) \ 165 || defined(__arm__) 166 #define WTF_CPU_ARM 1 167 168 #if defined(__ARMEB__) 169 #define WTF_CPU_BIG_ENDIAN 1 170 171 #elif !defined(__ARM_EABI__) \ 172 && !defined(__EABI__) \ 173 && !defined(__VFP_FP__) \ 174 && !defined(ANDROID) 175 #define WTF_CPU_MIDDLE_ENDIAN 1 176 177 #endif 178 179 #define WTF_ARM_ARCH_AT_LEAST(N) (CPU(ARM) && WTF_ARM_ARCH_VERSION >= N) 180 181 /* Set WTF_ARM_ARCH_VERSION */ 182 #if defined(__ARM_ARCH_4__) \ 183 || defined(__ARM_ARCH_4T__) \ 184 || defined(__MARM_ARMV4__) \ 185 || defined(_ARMV4I_) 186 #define WTF_ARM_ARCH_VERSION 4 187 188 #elif defined(__ARM_ARCH_5__) \ 189 || defined(__ARM_ARCH_5T__) \ 190 || defined(__ARM_ARCH_5E__) \ 191 || defined(__ARM_ARCH_5TE__) \ 192 || defined(__ARM_ARCH_5TEJ__) \ 193 || defined(__MARM_ARMV5__) 194 #define WTF_ARM_ARCH_VERSION 5 195 196 #elif defined(__ARM_ARCH_6__) \ 197 || defined(__ARM_ARCH_6J__) \ 198 || defined(__ARM_ARCH_6K__) \ 199 || defined(__ARM_ARCH_6Z__) \ 200 || defined(__ARM_ARCH_6ZK__) \ 201 || defined(__ARM_ARCH_6T2__) \ 202 || defined(__ARMV6__) 203 #define WTF_ARM_ARCH_VERSION 6 204 205 #elif defined(__ARM_ARCH_7A__) \ 206 || defined(__ARM_ARCH_7R__) 207 #define WTF_ARM_ARCH_VERSION 7 208 209 /* RVCT sets _TARGET_ARCH_ARM */ 210 #elif defined(__TARGET_ARCH_ARM) 211 #define WTF_ARM_ARCH_VERSION __TARGET_ARCH_ARM 212 213 #else 214 #define WTF_ARM_ARCH_VERSION 0 215 216 #endif 217 218 /* Set WTF_THUMB_ARCH_VERSION */ 219 #if defined(__ARM_ARCH_4T__) 220 #define WTF_THUMB_ARCH_VERSION 1 221 222 #elif defined(__ARM_ARCH_5T__) \ 223 || defined(__ARM_ARCH_5TE__) \ 224 || defined(__ARM_ARCH_5TEJ__) 225 #define WTF_THUMB_ARCH_VERSION 2 226 227 #elif defined(__ARM_ARCH_6J__) \ 228 || defined(__ARM_ARCH_6K__) \ 229 || defined(__ARM_ARCH_6Z__) \ 230 || defined(__ARM_ARCH_6ZK__) \ 231 || defined(__ARM_ARCH_6M__) 232 #define WTF_THUMB_ARCH_VERSION 3 233 234 #elif defined(__ARM_ARCH_6T2__) \ 235 || defined(__ARM_ARCH_7__) \ 236 || defined(__ARM_ARCH_7A__) \ 237 || defined(__ARM_ARCH_7R__) \ 238 || defined(__ARM_ARCH_7M__) 239 #define WTF_THUMB_ARCH_VERSION 4 240 241 /* RVCT sets __TARGET_ARCH_THUMB */ 242 #elif defined(__TARGET_ARCH_THUMB) 243 #define WTF_THUMB_ARCH_VERSION __TARGET_ARCH_THUMB 244 245 #else 246 #define WTF_THUMB_ARCH_VERSION 0 247 #endif 248 249 250 /* CPU(ARMV5_OR_LOWER) - ARM instruction set v5 or earlier */ 251 /* On ARMv5 and below the natural alignment is required. 252 And there are some other differences for v5 or earlier. */ 253 #if !defined(ARMV5_OR_LOWER) && !WTF_ARM_ARCH_AT_LEAST(6) 254 #define WTF_CPU_ARMV5_OR_LOWER 1 255 #endif 256 257 258 /* CPU(ARM_TRADITIONAL) - Thumb2 is not available, only traditional ARM (v4 or greater) */ 259 /* CPU(ARM_THUMB2) - Thumb2 instruction set is available */ 260 /* Only one of these will be defined. */ 261 #if !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2) 262 # if defined(thumb2) || defined(__thumb2__) \ 263 || ((defined(__thumb) || defined(__thumb__)) && WTF_THUMB_ARCH_VERSION == 4) 264 # define WTF_CPU_ARM_TRADITIONAL 0 265 # define WTF_CPU_ARM_THUMB2 1 266 # elif WTF_ARM_ARCH_AT_LEAST(4) 267 # define WTF_CPU_ARM_TRADITIONAL 1 268 # define WTF_CPU_ARM_THUMB2 0 269 # else 270 # error "Not supported ARM architecture" 271 # endif 272 #elif CPU(ARM_TRADITIONAL) && CPU(ARM_THUMB2) /* Sanity Check */ 273 # error "Cannot use both of WTF_CPU_ARM_TRADITIONAL and WTF_CPU_ARM_THUMB2 platforms" 274 #endif /* !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2) */ 275 276 #endif /* ARM */ 277 278 279 280 /* ==== OS() - underlying operating system; only to be used for mandated low-level services like 281 virtual memory, not to choose a GUI toolkit ==== */ 282 283 /* OS(ANDROID) - Android */ 284 #ifdef ANDROID 285 #define WTF_OS_ANDROID 1 286 #endif 287 288 /* OS(AIX) - AIX */ 289 #ifdef _AIX 290 #define WTF_OS_AIX 1 291 #endif 292 293 /* OS(DARWIN) - Any Darwin-based OS, including Mac OS X and iPhone OS */ 294 #ifdef __APPLE__ 295 #define WTF_OS_DARWIN 1 296 297 /* FIXME: BUILDING_ON_.., and TARGETING... macros should be folded into the OS() system */ 298 #include <AvailabilityMacros.h> 299 #if !defined(MAC_OS_X_VERSION_10_5) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 300 #define BUILDING_ON_TIGER 1 301 #elif !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 302 #define BUILDING_ON_LEOPARD 1 303 #elif !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 304 #define BUILDING_ON_SNOW_LEOPARD 1 305 #endif 306 #if !defined(MAC_OS_X_VERSION_10_5) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 307 #define TARGETING_TIGER 1 308 #elif !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6 309 #define TARGETING_LEOPARD 1 310 #elif !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7 311 #define TARGETING_SNOW_LEOPARD 1 312 #endif 313 #include <TargetConditionals.h> 314 315 #endif 316 317 /* OS(IPHONE_OS) - iPhone OS */ 318 /* OS(MAC_OS_X) - Mac OS X (not including iPhone OS) */ 319 #if OS(DARWIN) && ((defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED) \ 320 || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) \ 321 || (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR)) 322 #define WTF_OS_IPHONE_OS 1 323 #elif OS(DARWIN) && defined(TARGET_OS_MAC) && TARGET_OS_MAC 324 #define WTF_OS_MAC_OS_X 1 325 #endif 326 327 /* OS(FREEBSD) - FreeBSD */ 328 #ifdef __FreeBSD__ 329 #define WTF_OS_FREEBSD 1 330 #endif 331 332 /* OS(HAIKU) - Haiku */ 333 #ifdef __HAIKU__ 334 #define WTF_OS_HAIKU 1 335 #endif 336 337 /* OS(LINUX) - Linux */ 338 #ifdef __linux__ 339 #define WTF_OS_LINUX 1 340 #endif 341 342 /* OS(NETBSD) - NetBSD */ 343 #if defined(__NetBSD__) 344 #define WTF_PLATFORM_NETBSD 1 345 #endif 346 347 /* OS(OPENBSD) - OpenBSD */ 348 #ifdef __OpenBSD__ 349 #define WTF_OS_OPENBSD 1 350 #endif 351 352 /* OS(QNX) - QNX */ 353 #if defined(__QNXNTO__) 354 #define WTF_OS_QNX 1 355 #endif 356 357 /* OS(SOLARIS) - Solaris */ 358 #if defined(sun) || defined(__sun) 359 #define WTF_OS_SOLARIS 1 360 #endif 361 362 /* OS(WINCE) - Windows CE; note that for this platform OS(WINDOWS) is also defined */ 363 #if defined(_WIN32_WCE) 364 #define WTF_OS_WINCE 1 365 #endif 366 367 /* OS(WINDOWS) - Any version of Windows */ 368 #if defined(WIN32) || defined(_WIN32) 369 #define WTF_OS_WINDOWS 1 370 #endif 371 372 /* OS(SYMBIAN) - Symbian */ 373 #if defined (__SYMBIAN32__) 374 /* we are cross-compiling, it is not really windows */ 375 #undef WTF_OS_WINDOWS 376 #undef WTF_PLATFORM_WIN 377 #define WTF_OS_SYMBIAN 1 378 #endif 379 380 /* OS(UNIX) - Any Unix-like system */ 381 #if OS(AIX) \ 382 || OS(ANDROID) \ 383 || OS(DARWIN) \ 384 || OS(FREEBSD) \ 385 || OS(HAIKU) \ 386 || OS(LINUX) \ 387 || OS(NETBSD) \ 388 || OS(OPENBSD) \ 389 || OS(QNX) \ 390 || OS(SOLARIS) \ 391 || OS(SYMBIAN) \ 392 || defined(unix) \ 393 || defined(__unix) \ 394 || defined(__unix__) 395 #define WTF_OS_UNIX 1 396 #endif 397 398 /* Operating environments */ 399 400 /* FIXME: these are all mixes of OS, operating environment and policy choices. */ 401 /* PLATFORM(CHROMIUM) */ 402 /* PLATFORM(QT) */ 403 /* PLATFORM(WX) */ 404 /* PLATFORM(GTK) */ 405 /* PLATFORM(HAIKU) */ 406 /* PLATFORM(MAC) */ 407 /* PLATFORM(WIN) */ 408 #if defined(BUILDING_CHROMIUM__) 409 #define WTF_PLATFORM_CHROMIUM 1 410 #elif defined(BUILDING_QT__) 411 #define WTF_PLATFORM_QT 1 412 #elif defined(BUILDING_WX__) 413 #define WTF_PLATFORM_WX 1 414 #elif defined(BUILDING_GTK__) 415 #define WTF_PLATFORM_GTK 1 416 #elif defined(BUILDING_HAIKU__) 417 #define WTF_PLATFORM_HAIKU 1 418 #elif defined(BUILDING_BREWMP__) 419 #define WTF_PLATFORM_BREWMP 1 420 #if defined(AEE_SIMULATOR) 421 #define WTF_PLATFORM_BREWMP_SIMULATOR 1 422 #else 423 #define WTF_PLATFORM_BREWMP_SIMULATOR 0 424 #endif 425 #undef WTF_OS_WINDOWS 426 #undef WTF_PLATFORM_WIN 427 #elif OS(DARWIN) 428 #define WTF_PLATFORM_MAC 1 429 #elif OS(WINDOWS) 430 #define WTF_PLATFORM_WIN 1 431 #endif 432 433 /* PLATFORM(IPHONE) */ 434 /* FIXME: this is sometimes used as an OS switch and sometimes for higher-level things */ 435 #if (defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) 436 #define WTF_PLATFORM_IPHONE 1 437 #endif 438 439 /* PLATFORM(IPHONE_SIMULATOR) */ 440 #if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR 441 #define WTF_PLATFORM_IPHONE 1 442 #define WTF_PLATFORM_IPHONE_SIMULATOR 1 443 #else 444 #define WTF_PLATFORM_IPHONE_SIMULATOR 0 445 #endif 446 447 #if !defined(WTF_PLATFORM_IPHONE) 448 #define WTF_PLATFORM_IPHONE 0 449 #endif 450 451 /* PLATFORM(ANDROID) */ 452 /* FIXME: this is sometimes used as an OS() switch, and other times to drive 453 policy choices */ 454 #if defined(ANDROID) 455 #define WTF_PLATFORM_ANDROID 1 456 #endif 457 458 /* Graphics engines */ 459 460 /* PLATFORM(CG) and PLATFORM(CI) */ 461 #if PLATFORM(MAC) || PLATFORM(IPHONE) 462 #define WTF_PLATFORM_CG 1 463 #endif 464 #if PLATFORM(MAC) && !PLATFORM(IPHONE) 465 #define WTF_PLATFORM_CI 1 466 #endif 467 468 /* PLATFORM(SKIA) for Win/Linux, CG/CI for Mac */ 469 #if PLATFORM(CHROMIUM) 470 #define ENABLE_HISTORY_ALWAYS_ASYNC 1 471 #if OS(DARWIN) 472 #define WTF_PLATFORM_CG 1 473 #define WTF_PLATFORM_CI 1 474 #define WTF_USE_ATSUI 1 475 #define WTF_USE_CORE_TEXT 1 476 #else 477 #define WTF_PLATFORM_SKIA 1 478 #endif 479 #endif 480 481 #if PLATFORM(GTK) 482 #define WTF_PLATFORM_CAIRO 1 483 #endif 484 485 486 /* OS(WINCE) && PLATFORM(QT) 487 We can not determine the endianess at compile time. For 488 Qt for Windows CE the endianess is specified in the 489 device specific makespec 490 */ 491 #if OS(WINCE) && PLATFORM(QT) 492 # include <QtGlobal> 493 # undef WTF_CPU_BIG_ENDIAN 494 # undef WTF_CPU_MIDDLE_ENDIAN 495 # if Q_BYTE_ORDER == Q_BIG_ENDIAN 496 # define WTF_CPU_BIG_ENDIAN 1 497 # endif 498 499 # include <ce_time.h> 500 #endif 501 502 #if (PLATFORM(IPHONE) || PLATFORM(MAC) || PLATFORM(WIN) || (PLATFORM(QT) && OS(DARWIN) && !ENABLE(SINGLE_THREADED))) && !defined(ENABLE_JSC_MULTIPLE_THREADS) 503 #define ENABLE_JSC_MULTIPLE_THREADS 1 504 #endif 505 506 /* On Windows, use QueryPerformanceCounter by default */ 507 #if OS(WINDOWS) 508 #define WTF_USE_QUERY_PERFORMANCE_COUNTER 1 509 #endif 510 511 #if OS(WINCE) && !PLATFORM(QT) 512 #undef ENABLE_JSC_MULTIPLE_THREADS 513 #define ENABLE_JSC_MULTIPLE_THREADS 0 514 #define USE_SYSTEM_MALLOC 0 515 #define ENABLE_ICONDATABASE 0 516 #define ENABLE_JAVASCRIPT_DEBUGGER 0 517 #define ENABLE_FTPDIR 0 518 #define ENABLE_PAN_SCROLLING 0 519 #define ENABLE_WML 1 520 #define HAVE_ACCESSIBILITY 0 521 522 #define NOMINMAX /* Windows min and max conflict with standard macros */ 523 #define NOSHLWAPI /* shlwapi.h not available on WinCe */ 524 525 /* MSDN documentation says these functions are provided with uspce.lib. But we cannot find this file. */ 526 #define __usp10__ /* disable "usp10.h" */ 527 528 #define _INC_ASSERT /* disable "assert.h" */ 529 #define assert(x) 530 531 /* _countof is only included in CE6; for CE5 we need to define it ourself */ 532 #ifndef _countof 533 #define _countof(x) (sizeof(x) / sizeof((x)[0])) 534 #endif 535 536 #endif /* OS(WINCE) && !PLATFORM(QT) */ 537 538 #if PLATFORM(QT) 539 #define WTF_USE_QT4_UNICODE 1 540 #elif OS(WINCE) 541 #define WTF_USE_WINCE_UNICODE 1 542 #elif PLATFORM(GTK) 543 /* The GTK+ Unicode backend is configurable */ 544 #else 545 #define WTF_USE_ICU_UNICODE 1 546 #endif 547 548 #if PLATFORM(MAC) && !PLATFORM(IPHONE) 549 #define WTF_PLATFORM_CF 1 550 #define WTF_USE_PTHREADS 1 551 #define HAVE_PTHREAD_RWLOCK 1 552 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_TIGER) && CPU(X86_64) 553 #define WTF_USE_PLUGIN_HOST_PROCESS 1 554 #endif 555 #if !defined(ENABLE_MAC_JAVA_BRIDGE) 556 #define ENABLE_MAC_JAVA_BRIDGE 1 557 #endif 558 #if !defined(ENABLE_DASHBOARD_SUPPORT) 559 #define ENABLE_DASHBOARD_SUPPORT 1 560 #endif 561 #define HAVE_READLINE 1 562 #define HAVE_RUNLOOP_TIMER 1 563 #endif /* PLATFORM(MAC) && !PLATFORM(IPHONE) */ 564 565 #if PLATFORM(CHROMIUM) && OS(DARWIN) 566 #define WTF_PLATFORM_CF 1 567 #define WTF_USE_PTHREADS 1 568 #define HAVE_PTHREAD_RWLOCK 1 569 #endif 570 571 #if PLATFORM(QT) && OS(DARWIN) 572 #define WTF_PLATFORM_CF 1 573 #endif 574 575 #if PLATFORM(IPHONE) 576 #define ENABLE_CONTEXT_MENUS 0 577 #define ENABLE_DRAG_SUPPORT 0 578 #define ENABLE_FTPDIR 1 579 #define ENABLE_GEOLOCATION 1 580 #define ENABLE_ICONDATABASE 0 581 #define ENABLE_INSPECTOR 0 582 #define ENABLE_MAC_JAVA_BRIDGE 0 583 #define ENABLE_NETSCAPE_PLUGIN_API 0 584 #define ENABLE_ORIENTATION_EVENTS 1 585 #define ENABLE_REPAINT_THROTTLING 1 586 #define HAVE_READLINE 1 587 #define WTF_PLATFORM_CF 1 588 #define WTF_USE_PTHREADS 1 589 #define HAVE_PTHREAD_RWLOCK 1 590 #endif 591 592 #if PLATFORM(ANDROID) 593 #define WTF_USE_PTHREADS 1 594 #define WTF_PLATFORM_SKIA 1 595 #define USE_SYSTEM_MALLOC 1 596 #define ENABLE_MAC_JAVA_BRIDGE 1 597 #define LOG_DISABLED 1 598 /* Prevents Webkit from drawing the caret in textfields and textareas 599 This prevents unnecessary invals. */ 600 #define ENABLE_TEXT_CARET 1 601 #define ENABLE_JAVASCRIPT_DEBUGGER 0 602 #define ENABLE_ORIENTATION_EVENTS 1 603 #endif 604 605 #if PLATFORM(WIN) 606 #define WTF_USE_WININET 1 607 #endif 608 609 #if PLATFORM(WX) 610 #define ENABLE_ASSEMBLER 1 611 #if OS(DARWIN) 612 #define WTF_PLATFORM_CF 1 613 #endif 614 #endif 615 616 #if PLATFORM(GTK) 617 #if HAVE(PTHREAD_H) 618 #define WTF_USE_PTHREADS 1 619 #define HAVE_PTHREAD_RWLOCK 1 620 #endif 621 #endif 622 623 #if PLATFORM(HAIKU) 624 #define HAVE_POSIX_MEMALIGN 1 625 #define WTF_USE_CURL 1 626 #define WTF_USE_PTHREADS 1 627 #define HAVE_PTHREAD_RWLOCK 1 628 #define USE_SYSTEM_MALLOC 1 629 #define ENABLE_NETSCAPE_PLUGIN_API 0 630 #endif 631 632 #if PLATFORM(BREWMP) 633 #define USE_SYSTEM_MALLOC 1 634 #endif 635 636 #if !defined(HAVE_ACCESSIBILITY) 637 #if PLATFORM(IPHONE) || PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(CHROMIUM) 638 #define HAVE_ACCESSIBILITY 1 639 #endif 640 #endif /* !defined(HAVE_ACCESSIBILITY) */ 641 642 #if OS(UNIX) && !OS(SYMBIAN) 643 #define HAVE_SIGNAL_H 1 644 #endif 645 646 #if !OS(WINDOWS) && !OS(SOLARIS) && !OS(QNX) \ 647 && !OS(SYMBIAN) && !OS(HAIKU) && !OS(RVCT) \ 648 && !OS(ANDROID) && !PLATFORM(BREWMP) 649 #define HAVE_TM_GMTOFF 1 650 #define HAVE_TM_ZONE 1 651 #define HAVE_TIMEGM 1 652 #endif 653 654 #if OS(DARWIN) 655 656 #define HAVE_ERRNO_H 1 657 #define HAVE_LANGINFO_H 1 658 #define HAVE_MMAP 1 659 #define HAVE_MERGESORT 1 660 #define HAVE_SBRK 1 661 #define HAVE_STRINGS_H 1 662 #define HAVE_SYS_PARAM_H 1 663 #define HAVE_SYS_TIME_H 1 664 #define HAVE_SYS_TIMEB_H 1 665 666 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) 667 668 #define HAVE_DISPATCH_H 1 669 670 #if !PLATFORM(IPHONE) && !PLATFORM(QT) 671 #define HAVE_MADV_FREE_REUSE 1 672 #define HAVE_MADV_FREE 1 673 #define HAVE_PTHREAD_SETNAME_NP 1 674 #endif 675 676 #endif 677 678 #if PLATFORM(IPHONE) 679 #define HAVE_MADV_FREE 1 680 #endif 681 682 #elif OS(WINDOWS) 683 684 #if OS(WINCE) 685 #define HAVE_ERRNO_H 0 686 #else 687 #define HAVE_SYS_TIMEB_H 1 688 #endif 689 #define HAVE_VIRTUALALLOC 1 690 691 #elif OS(SYMBIAN) 692 693 #define HAVE_ERRNO_H 1 694 #define HAVE_MMAP 0 695 #define HAVE_SBRK 1 696 697 #define HAVE_SYS_TIME_H 1 698 #define HAVE_STRINGS_H 1 699 700 #if !COMPILER(RVCT) 701 #define HAVE_SYS_PARAM_H 1 702 #endif 703 704 #elif PLATFORM(BREWMP) 705 706 #define HAVE_ERRNO_H 1 707 708 #elif OS(QNX) 709 710 #define HAVE_ERRNO_H 1 711 #define HAVE_MMAP 1 712 #define HAVE_SBRK 1 713 #define HAVE_STRINGS_H 1 714 #define HAVE_SYS_PARAM_H 1 715 #define HAVE_SYS_TIME_H 1 716 717 #elif OS(ANDROID) 718 719 #define HAVE_ERRNO_H 1 720 #define HAVE_LANGINFO_H 0 721 #define HAVE_MMAP 1 722 #define HAVE_SBRK 1 723 #define HAVE_STRINGS_H 1 724 #define HAVE_SYS_PARAM_H 1 725 #define HAVE_SYS_TIME_H 1 726 727 #else 728 729 /* FIXME: is this actually used or do other platforms generate their own config.h? */ 730 731 #define HAVE_ERRNO_H 1 732 /* As long as Haiku doesn't have a complete support of locale this will be disabled. */ 733 #if !OS(HAIKU) 734 #define HAVE_LANGINFO_H 1 735 #endif 736 #define HAVE_MMAP 1 737 #define HAVE_SBRK 1 738 #define HAVE_STRINGS_H 1 739 #define HAVE_SYS_PARAM_H 1 740 #define HAVE_SYS_TIME_H 1 741 742 #endif 743 744 /* ENABLE macro defaults */ 745 746 /* fastMalloc match validation allows for runtime verification that 747 new is matched by delete, fastMalloc is matched by fastFree, etc. */ 748 #if !defined(ENABLE_FAST_MALLOC_MATCH_VALIDATION) 749 #define ENABLE_FAST_MALLOC_MATCH_VALIDATION 0 750 #endif 751 752 #if !defined(ENABLE_ICONDATABASE) 753 #define ENABLE_ICONDATABASE 1 754 #endif 755 756 #if !defined(ENABLE_DATABASE) 757 #define ENABLE_DATABASE 1 758 #endif 759 760 #if !defined(ENABLE_JAVASCRIPT_DEBUGGER) 761 #define ENABLE_JAVASCRIPT_DEBUGGER 1 762 #endif 763 764 #if !defined(ENABLE_FTPDIR) 765 #define ENABLE_FTPDIR 1 766 #endif 767 768 #if !defined(ENABLE_CONTEXT_MENUS) 769 #define ENABLE_CONTEXT_MENUS 1 770 #endif 771 772 #if !defined(ENABLE_DRAG_SUPPORT) 773 #define ENABLE_DRAG_SUPPORT 1 774 #endif 775 776 #if !defined(ENABLE_DASHBOARD_SUPPORT) 777 #define ENABLE_DASHBOARD_SUPPORT 0 778 #endif 779 780 #if !defined(ENABLE_INSPECTOR) 781 #define ENABLE_INSPECTOR 1 782 #endif 783 784 #if !defined(ENABLE_MAC_JAVA_BRIDGE) 785 #define ENABLE_MAC_JAVA_BRIDGE 0 786 #endif 787 788 #if !defined(ENABLE_NETSCAPE_PLUGIN_API) 789 #define ENABLE_NETSCAPE_PLUGIN_API 1 790 #endif 791 792 #if !defined(WTF_USE_PLUGIN_HOST_PROCESS) 793 #define WTF_USE_PLUGIN_HOST_PROCESS 0 794 #endif 795 796 #if !defined(ENABLE_ORIENTATION_EVENTS) 797 #define ENABLE_ORIENTATION_EVENTS 0 798 #endif 799 800 #if !defined(ENABLE_OPCODE_STATS) 801 #define ENABLE_OPCODE_STATS 0 802 #endif 803 804 #define ENABLE_SAMPLING_COUNTERS 0 805 #define ENABLE_SAMPLING_FLAGS 0 806 #define ENABLE_OPCODE_SAMPLING 0 807 #define ENABLE_CODEBLOCK_SAMPLING 0 808 #if ENABLE(CODEBLOCK_SAMPLING) && !ENABLE(OPCODE_SAMPLING) 809 #error "CODEBLOCK_SAMPLING requires OPCODE_SAMPLING" 810 #endif 811 #if ENABLE(OPCODE_SAMPLING) || ENABLE(SAMPLING_FLAGS) 812 #define ENABLE_SAMPLING_THREAD 1 813 #endif 814 815 #if !defined(ENABLE_GEOLOCATION) 816 #define ENABLE_GEOLOCATION 0 817 #endif 818 819 #if !defined(ENABLE_NOTIFICATIONS) 820 #define ENABLE_NOTIFICATIONS 0 821 #endif 822 823 #if !defined(ENABLE_TEXT_CARET) 824 #define ENABLE_TEXT_CARET 1 825 #endif 826 827 #if !defined(ENABLE_COMPOSITED_FIXED_ELEMENTS) 828 #define ENABLE_COMPOSITED_FIXED_ELEMENTS 0 829 #endif 830 831 // ENABLE_ARCHIVE is an Android addition. We need this default value to allow 832 // us to build on Mac. 833 // FIXME: Upstream to webkit.org. 834 #if !defined(ENABLE_ARCHIVE) 835 #define ENABLE_ARCHIVE 1 836 #endif 837 838 #if !defined(ENABLE_ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL) 839 #define ENABLE_ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL 0 840 #endif 841 842 #if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32) && !defined(WTF_USE_JSVALUE32_64) 843 #if (CPU(X86_64) && (OS(UNIX) || OS(WINDOWS))) || CPU(IA64) || CPU(ALPHA) 844 #define WTF_USE_JSVALUE64 1 845 #elif CPU(ARM) || CPU(PPC64) 846 #define WTF_USE_JSVALUE32 1 847 #elif OS(WINDOWS) && COMPILER(MINGW) 848 /* Using JSVALUE32_64 causes padding/alignement issues for JITStubArg 849 on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ 850 #define WTF_USE_JSVALUE32 1 851 #else 852 #define WTF_USE_JSVALUE32_64 1 853 #endif 854 #endif /* !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32) && !defined(WTF_USE_JSVALUE32_64) */ 855 856 #if !defined(ENABLE_REPAINT_THROTTLING) 857 #define ENABLE_REPAINT_THROTTLING 0 858 #endif 859 860 #if !defined(ENABLE_JIT) 861 862 /* The JIT is tested & working on x86_64 Mac */ 863 #if CPU(X86_64) && PLATFORM(MAC) 864 #define ENABLE_JIT 1 865 /* The JIT is tested & working on x86 Mac */ 866 #elif CPU(X86) && PLATFORM(MAC) 867 #define ENABLE_JIT 1 868 #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1 869 #elif CPU(ARM_THUMB2) && PLATFORM(IPHONE) 870 #define ENABLE_JIT 1 871 /* The JIT is tested & working on Android */ 872 #elif CPU(ARM_THUMB2) && PLATFORM(ANDROID) && ENABLE(ANDROID_JSC_JIT) 873 #define ENABLE_JIT 1 874 /* The JIT is tested & working on x86 Windows */ 875 #elif CPU(X86) && PLATFORM(WIN) 876 #define ENABLE_JIT 1 877 #endif 878 879 #if PLATFORM(QT) || PLATFORM(WX) 880 #if CPU(X86_64) && OS(DARWIN) 881 #define ENABLE_JIT 1 882 #elif CPU(X86) && OS(DARWIN) 883 #define ENABLE_JIT 1 884 #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1 885 #elif CPU(X86) && OS(WINDOWS) && COMPILER(MINGW) && GCC_VERSION >= 40100 886 #define ENABLE_JIT 1 887 #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1 888 #elif CPU(X86) && OS(WINDOWS) && COMPILER(MSVC) 889 #define ENABLE_JIT 1 890 #define WTF_USE_JIT_STUB_ARGUMENT_REGISTER 1 891 #elif CPU(X86) && OS(LINUX) && GCC_VERSION >= 40100 892 #define ENABLE_JIT 1 893 #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1 894 #elif CPU(X86_64) && OS(LINUX) && GCC_VERSION >= 40100 895 #define ENABLE_JIT 1 896 #elif CPU(ARM_TRADITIONAL) && OS(LINUX) 897 #define ENABLE_JIT 1 898 #endif 899 #endif /* PLATFORM(QT) */ 900 901 #endif /* !defined(ENABLE_JIT) */ 902 903 /* CPU architecture specific optimizations */ 904 #if CPU(ARM_TRADITIONAL) 905 #if ENABLE(JIT) && !defined(ENABLE_JIT_OPTIMIZE_MOD) && WTF_ARM_ARCH_AT_LEAST(5) 906 #define ENABLE_JIT_OPTIMIZE_MOD 1 907 #endif 908 #endif 909 910 #if ENABLE(JIT) 911 #ifndef ENABLE_JIT_OPTIMIZE_CALL 912 #define ENABLE_JIT_OPTIMIZE_CALL 1 913 #endif 914 #ifndef ENABLE_JIT_OPTIMIZE_NATIVE_CALL 915 #define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 1 916 #endif 917 #ifndef ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS 918 #define ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS 1 919 #endif 920 #ifndef ENABLE_JIT_OPTIMIZE_METHOD_CALLS 921 #define ENABLE_JIT_OPTIMIZE_METHOD_CALLS 1 922 #endif 923 #ifndef ENABLE_JIT_OPTIMIZE_MOD 924 #define ENABLE_JIT_OPTIMIZE_MOD 0 925 #endif 926 #endif 927 928 #if CPU(X86) && COMPILER(MSVC) 929 #define JSC_HOST_CALL __fastcall 930 #elif CPU(X86) && COMPILER(GCC) 931 #define JSC_HOST_CALL __attribute__ ((fastcall)) 932 #else 933 #define JSC_HOST_CALL 934 #endif 935 936 #if COMPILER(GCC) && !ENABLE(JIT) 937 #define HAVE_COMPUTED_GOTO 1 938 #endif 939 940 #if ENABLE(JIT) && defined(COVERAGE) 941 #define WTF_USE_INTERPRETER 0 942 #else 943 #define WTF_USE_INTERPRETER 1 944 #endif 945 946 /* Yet Another Regex Runtime. */ 947 #if !defined(ENABLE_YARR_JIT) 948 949 /* YARR supports x86 & x86-64, and has been tested on Mac and Windows. */ 950 #if (CPU(X86) && PLATFORM(MAC)) \ 951 || (CPU(X86_64) && PLATFORM(MAC)) \ 952 || (CPU(ARM_THUMB2) && PLATFORM(IPHONE)) \ 953 || (CPU(ARM_THUMB2) && PLATFORM(ANDROID) && ENABLE(ANDROID_JSC_JIT)) \ 954 || (CPU(X86) && PLATFORM(WIN)) \ 955 || (CPU(X86) && PLATFORM(WX)) 956 #define ENABLE_YARR 1 957 #define ENABLE_YARR_JIT 1 958 #endif 959 960 #if PLATFORM(QT) 961 #if (CPU(X86) && OS(WINDOWS) && COMPILER(MINGW) && GCC_VERSION >= 40100) \ 962 || (CPU(X86) && OS(WINDOWS) && COMPILER(MSVC)) \ 963 || (CPU(X86) && OS(LINUX) && GCC_VERSION >= 40100) \ 964 || (CPU(X86_64) && OS(LINUX) && GCC_VERSION >= 40100) \ 965 || (CPU(ARM_TRADITIONAL) && OS(LINUX)) 966 #define ENABLE_YARR 1 967 #define ENABLE_YARR_JIT 1 968 #endif 969 #endif 970 971 #endif /* !defined(ENABLE_YARR_JIT) */ 972 973 /* Sanity Check */ 974 #if ENABLE(YARR_JIT) && !ENABLE(YARR) 975 #error "YARR_JIT requires YARR" 976 #endif 977 978 #if ENABLE(JIT) || ENABLE(YARR_JIT) 979 #define ENABLE_ASSEMBLER 1 980 #endif 981 /* Setting this flag prevents the assembler from using RWX memory; this may improve 982 security but currectly comes at a significant performance cost. */ 983 #if PLATFORM(IPHONE) 984 #define ENABLE_ASSEMBLER_WX_EXCLUSIVE 1 985 #else 986 #define ENABLE_ASSEMBLER_WX_EXCLUSIVE 0 987 #endif 988 989 #if !defined(ENABLE_PAN_SCROLLING) && OS(WINDOWS) 990 #define ENABLE_PAN_SCROLLING 1 991 #endif 992 993 /* Use the QXmlStreamReader implementation for XMLTokenizer */ 994 /* Use the QXmlQuery implementation for XSLTProcessor */ 995 #if PLATFORM(QT) 996 #define WTF_USE_QXMLSTREAM 1 997 #define WTF_USE_QXMLQUERY 1 998 #endif 999 1000 #if !PLATFORM(QT) 1001 #define WTF_USE_FONT_FAST_PATH 1 1002 #endif 1003 1004 /* Accelerated compositing */ 1005 #if PLATFORM(MAC) 1006 #if !defined(BUILDING_ON_TIGER) 1007 #define WTF_USE_ACCELERATED_COMPOSITING 1 1008 #endif 1009 #endif 1010 1011 #if PLATFORM(ANDROID) && !defined WTF_USE_ACCELERATED_COMPOSITING 1012 #define WTF_USE_ACCELERATED_COMPOSITING 1 1013 #endif 1014 1015 #if PLATFORM(IPHONE) 1016 #define WTF_USE_ACCELERATED_COMPOSITING 1 1017 #endif 1018 1019 /* FIXME: Defining ENABLE_3D_RENDERING here isn't really right, but it's always used with 1020 with WTF_USE_ACCELERATED_COMPOSITING, and it allows the feature to be turned on and 1021 off in one place. */ 1022 #if PLATFORM(WIN) 1023 #include "QuartzCorePresent.h" 1024 #if QUARTZCORE_PRESENT 1025 #define WTF_USE_ACCELERATED_COMPOSITING 1 1026 #define ENABLE_3D_RENDERING 1 1027 #endif 1028 #endif 1029 1030 #if COMPILER(GCC) 1031 #define WARN_UNUSED_RETURN __attribute__ ((warn_unused_result)) 1032 #else 1033 #define WARN_UNUSED_RETURN 1034 #endif 1035 1036 #if !ENABLE(NETSCAPE_PLUGIN_API) || (ENABLE(NETSCAPE_PLUGIN_API) && ((OS(UNIX) && (PLATFORM(QT) || PLATFORM(WX))) || PLATFORM(GTK))) 1037 #define ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH 1 1038 #endif 1039 1040 /* Set up a define for a common error that is intended to cause a build error -- thus the space after Error. */ 1041 #define WTF_PLATFORM_CFNETWORK Error USE_macro_should_be_used_with_CFNETWORK 1042 1043 #define ENABLE_JSC_ZOMBIES 0 1044 1045 #endif /* WTF_Platform_h */ 1046