1 /* 2 * Copyright (C) 2006-2017 Apple Inc. All rights reserved. 3 * Copyright (C) 2007-2009 Torch Mobile, Inc. 4 * Copyright (C) 2010, 2011 Research In Motion Limited. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28 #ifndef WTF_Platform_h 29 #define WTF_Platform_h 30 31 /* Include compiler specific macros */ 32 #include <wtf/Compiler.h> 33 34 /* ==== PLATFORM handles OS, operating environment, graphics API, and 35 CPU. This macro will be phased out in favor of platform adaptation 36 macros, policy decision macros, and top-level port definitions. ==== */ 37 #define PLATFORM(WTF_FEATURE) (defined WTF_PLATFORM_##WTF_FEATURE && WTF_PLATFORM_##WTF_FEATURE) 38 39 40 /* ==== Platform adaptation macros: these describe properties of the target environment. ==== */ 41 42 /* CPU() - the target CPU architecture */ 43 #define CPU(WTF_FEATURE) (defined WTF_CPU_##WTF_FEATURE && WTF_CPU_##WTF_FEATURE) 44 /* HAVE() - specific system features (headers, functions or similar) that are present or not */ 45 #define HAVE(WTF_FEATURE) (defined HAVE_##WTF_FEATURE && HAVE_##WTF_FEATURE) 46 /* OS() - underlying operating system; only to be used for mandated low-level services like 47 virtual memory, not to choose a GUI toolkit */ 48 #define OS(WTF_FEATURE) (defined WTF_OS_##WTF_FEATURE && WTF_OS_##WTF_FEATURE) 49 50 51 /* ==== Policy decision macros: these define policy choices for a particular port. ==== */ 52 53 /* USE() - use a particular third-party library or optional OS service */ 54 #define USE(WTF_FEATURE) (defined USE_##WTF_FEATURE && USE_##WTF_FEATURE) 55 /* ENABLE() - turn on a specific feature of WebKit */ 56 #define ENABLE(WTF_FEATURE) (defined ENABLE_##WTF_FEATURE && ENABLE_##WTF_FEATURE) 57 58 #if PLATFORM(JAVA) // tav todo temp 59 #define JS_EXPORT_PRIVATE 60 #endif 61 62 /* COMPILER(SUNCC) */ 63 #if defined(__SUNPRO_CC) || defined(__SUNPRO_C) 64 #define WTF_COMPILER_SUNCC 1 65 #endif 66 67 /* ==== CPU() - the target CPU architecture ==== */ 68 69 /* This also defines CPU(BIG_ENDIAN) or CPU(MIDDLE_ENDIAN) or neither, as appropriate. */ 70 71 /* CPU(ALPHA) - DEC Alpha */ 72 #if defined(__alpha__) 73 #define WTF_CPU_ALPHA 1 74 #endif 75 76 /* CPU(HPPA) - HP PA-RISC */ 77 #if defined(__hppa__) || defined(__hppa64__) 78 #define WTF_CPU_HPPA 1 79 #define WTF_CPU_BIG_ENDIAN 1 80 #endif 81 82 /* CPU(IA64) - Itanium / IA-64 */ 83 #if defined(__ia64__) 84 #define WTF_CPU_IA64 1 85 /* 32-bit mode on Itanium */ 86 #if !defined(__LP64__) 87 #define WTF_CPU_IA64_32 1 88 #endif 89 #endif 90 91 /* CPU(MIPS) - MIPS 32-bit and 64-bit */ 92 #if (defined(mips) || defined(__mips__) || defined(MIPS) || defined(_MIPS_) || defined(__mips64)) 93 #if defined(_ABI64) && (_MIPS_SIM == _ABI64) 94 #define WTF_CPU_MIPS64 1 95 #define WTF_MIPS_ARCH __mips64 96 #else 97 #define WTF_CPU_MIPS 1 98 #define WTF_MIPS_ARCH __mips 99 #endif 100 #if defined(__MIPSEB__) 101 #define WTF_CPU_BIG_ENDIAN 1 102 #endif 103 #define WTF_MIPS_PIC (defined __PIC__) 104 #define WTF_MIPS_ISA(v) (defined WTF_MIPS_ARCH && WTF_MIPS_ARCH == v) 105 #define WTF_MIPS_ISA_AT_LEAST(v) (defined WTF_MIPS_ARCH && WTF_MIPS_ARCH >= v) 106 #define WTF_MIPS_ARCH_REV __mips_isa_rev 107 #define WTF_MIPS_ISA_REV(v) (defined WTF_MIPS_ARCH_REV && WTF_MIPS_ARCH_REV == v) 108 #define WTF_MIPS_DOUBLE_FLOAT (defined __mips_hard_float && !defined __mips_single_float) 109 #define WTF_MIPS_FP64 (defined __mips_fpr && __mips_fpr == 64) 110 /* MIPS requires allocators to use aligned memory */ 111 #define USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1 112 #endif /* MIPS */ 113 114 /* CPU(PPC64) - PowerPC 64-bit Big Endian */ 115 #if ( defined(__ppc64__) \ 116 || defined(__PPC64__)) \ 117 && defined(__BYTE_ORDER__) \ 118 && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) 119 #define WTF_CPU_PPC64 1 120 #define WTF_CPU_BIG_ENDIAN 1 121 #endif 122 123 /* CPU(PPC64) - PowerPC 64-bit Little Endian */ 124 #if ( defined(__ppc64__) \ 125 || defined(__PPC64__) \ 126 || defined(__ppc64le__) \ 127 || defined(__PPC64LE__)) \ 128 && defined(__BYTE_ORDER__) \ 129 && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) 130 #define WTF_CPU_PPC64LE 1 131 #endif 132 133 /* CPU(PPC) - PowerPC 32-bit */ 134 #if ( defined(__ppc__) \ 135 || defined(__PPC__) \ 136 || defined(__powerpc__) \ 137 || defined(__powerpc) \ 138 || defined(__POWERPC__) \ 139 || defined(_M_PPC) \ 140 || defined(__PPC)) \ 141 && !CPU(PPC64) \ 142 && defined(__BYTE_ORDER__) \ 143 && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) 144 #define WTF_CPU_PPC 1 145 #define WTF_CPU_BIG_ENDIAN 1 146 #endif 147 148 /* CPU(SH4) - SuperH SH-4 */ 149 #if defined(__SH4__) 150 #define WTF_CPU_SH4 1 151 #endif 152 153 /* CPU(S390X) - S390 64-bit */ 154 #if defined(__s390x__) 155 #define WTF_CPU_S390X 1 156 #define WTF_CPU_BIG_ENDIAN 1 157 #endif 158 159 /* CPU(S390) - S390 32-bit */ 160 #if ( defined(__s390__) \ 161 && !CPU(S390X)) 162 #define WTF_CPU_S390 1 163 #define WTF_CPU_BIG_ENDIAN 1 164 #endif 165 166 /* CPU(X86) - i386 / x86 32-bit */ 167 #if defined(__i386__) \ 168 || defined(i386) \ 169 || defined(_M_IX86) \ 170 || defined(_X86_) \ 171 || defined(__THW_INTEL) 172 #define WTF_CPU_X86 1 173 174 #if defined(__SSE2__) || (defined(_M_IX86_FP) && _M_IX86_FP >= 2) 175 #define WTF_CPU_X86_SSE2 1 176 #endif 177 178 #endif 179 180 /* CPU(X86_64) - AMD64 / Intel64 / x86_64 64-bit */ 181 #if defined(__x86_64__) \ 182 || defined(_M_X64) 183 #define WTF_CPU_X86_64 1 184 #define WTF_CPU_X86_SSE2 1 185 #endif 186 187 /* CPU(ARM64) - Apple */ 188 #if (defined(__arm64__) && defined(__APPLE__)) || defined(__aarch64__) 189 #define WTF_CPU_ARM64 1 190 191 #if defined(__arm64e__) 192 #define WTF_CPU_ARM64E 1 193 #endif 194 #endif 195 196 /* CPU(ARM) - ARM, any version*/ 197 #define WTF_ARM_ARCH_AT_LEAST(N) (CPU(ARM) && WTF_ARM_ARCH_VERSION >= N) 198 199 #if defined(arm) \ 200 || defined(__arm__) \ 201 || defined(ARM) \ 202 || defined(_ARM_) 203 #define WTF_CPU_ARM 1 204 205 #if defined(__ARM_PCS_VFP) 206 #define WTF_CPU_ARM_HARDFP 1 207 #endif 208 209 #if defined(__ARMEB__) 210 #define WTF_CPU_BIG_ENDIAN 1 211 212 #elif !defined(__ARM_EABI__) \ 213 && !defined(__EABI__) \ 214 && !defined(__VFP_FP__) \ 215 && !defined(_WIN32_WCE) 216 #define WTF_CPU_MIDDLE_ENDIAN 1 217 218 #endif 219 220 /* Set WTF_ARM_ARCH_VERSION */ 221 #if defined(__ARM_ARCH_4__) \ 222 || defined(__ARM_ARCH_4T__) \ 223 || defined(__MARM_ARMV4__) 224 #define WTF_ARM_ARCH_VERSION 4 225 226 #elif defined(__ARM_ARCH_5__) \ 227 || defined(__ARM_ARCH_5T__) \ 228 || defined(__MARM_ARMV5__) 229 #define WTF_ARM_ARCH_VERSION 5 230 231 #elif defined(__ARM_ARCH_5E__) \ 232 || defined(__ARM_ARCH_5TE__) \ 233 || defined(__ARM_ARCH_5TEJ__) 234 #define WTF_ARM_ARCH_VERSION 5 235 /*ARMv5TE requires allocators to use aligned memory*/ 236 #define USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1 237 238 #elif defined(__ARM_ARCH_6__) \ 239 || defined(__ARM_ARCH_6J__) \ 240 || defined(__ARM_ARCH_6K__) \ 241 || defined(__ARM_ARCH_6Z__) \ 242 || defined(__ARM_ARCH_6ZK__) \ 243 || defined(__ARM_ARCH_6T2__) \ 244 || defined(__ARMV6__) 245 #define WTF_ARM_ARCH_VERSION 6 246 247 #elif defined(__ARM_ARCH_7A__) \ 248 || defined(__ARM_ARCH_7K__) \ 249 || defined(__ARM_ARCH_7R__) \ 250 || defined(__ARM_ARCH_7S__) 251 #define WTF_ARM_ARCH_VERSION 7 252 253 #elif defined(__ARM_ARCH_8__) \ 254 || defined(__ARM_ARCH_8A__) 255 #define WTF_ARM_ARCH_VERSION 8 256 257 /* MSVC sets _M_ARM */ 258 #elif defined(_M_ARM) 259 #define WTF_ARM_ARCH_VERSION _M_ARM 260 261 /* RVCT sets _TARGET_ARCH_ARM */ 262 #elif defined(__TARGET_ARCH_ARM) 263 #define WTF_ARM_ARCH_VERSION __TARGET_ARCH_ARM 264 265 #if defined(__TARGET_ARCH_5E) \ 266 || defined(__TARGET_ARCH_5TE) \ 267 || defined(__TARGET_ARCH_5TEJ) 268 /*ARMv5TE requires allocators to use aligned memory*/ 269 #define USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1 270 #endif 271 272 #else 273 #define WTF_ARM_ARCH_VERSION 0 274 275 #endif 276 277 /* Set WTF_THUMB_ARCH_VERSION */ 278 #if defined(__ARM_ARCH_4T__) 279 #define WTF_THUMB_ARCH_VERSION 1 280 281 #elif defined(__ARM_ARCH_5T__) \ 282 || defined(__ARM_ARCH_5TE__) \ 283 || defined(__ARM_ARCH_5TEJ__) 284 #define WTF_THUMB_ARCH_VERSION 2 285 286 #elif defined(__ARM_ARCH_6J__) \ 287 || defined(__ARM_ARCH_6K__) \ 288 || defined(__ARM_ARCH_6Z__) \ 289 || defined(__ARM_ARCH_6ZK__) \ 290 || defined(__ARM_ARCH_6M__) 291 #define WTF_THUMB_ARCH_VERSION 3 292 293 #elif defined(__ARM_ARCH_6T2__) \ 294 || defined(__ARM_ARCH_7__) \ 295 || defined(__ARM_ARCH_7A__) \ 296 || defined(__ARM_ARCH_7K__) \ 297 || defined(__ARM_ARCH_7M__) \ 298 || defined(__ARM_ARCH_7R__) \ 299 || defined(__ARM_ARCH_7S__) 300 #define WTF_THUMB_ARCH_VERSION 4 301 302 /* RVCT sets __TARGET_ARCH_THUMB */ 303 #elif defined(__TARGET_ARCH_THUMB) 304 #define WTF_THUMB_ARCH_VERSION __TARGET_ARCH_THUMB 305 306 #else 307 #define WTF_THUMB_ARCH_VERSION 0 308 #endif 309 310 311 /* CPU(ARMV5_OR_LOWER) - ARM instruction set v5 or earlier */ 312 /* On ARMv5 and below the natural alignment is required. 313 And there are some other differences for v5 or earlier. */ 314 #if !defined(ARMV5_OR_LOWER) && !WTF_ARM_ARCH_AT_LEAST(6) 315 #define WTF_CPU_ARMV5_OR_LOWER 1 316 #endif 317 318 319 /* CPU(ARM_TRADITIONAL) - Thumb2 is not available, only traditional ARM (v4 or greater) */ 320 /* CPU(ARM_THUMB2) - Thumb2 instruction set is available */ 321 /* Only one of these will be defined. */ 322 #if !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2) 323 # if defined(thumb2) || defined(__thumb2__) \ 324 || ((defined(__thumb) || defined(__thumb__)) && WTF_THUMB_ARCH_VERSION == 4) 325 # define WTF_CPU_ARM_TRADITIONAL 0 326 # define WTF_CPU_ARM_THUMB2 1 327 # elif WTF_ARM_ARCH_AT_LEAST(4) 328 # define WTF_CPU_ARM_TRADITIONAL 1 329 # define WTF_CPU_ARM_THUMB2 0 330 # else 331 # error "Not supported ARM architecture" 332 # endif 333 #elif CPU(ARM_TRADITIONAL) && CPU(ARM_THUMB2) /* Sanity Check */ 334 # error "Cannot use both of WTF_CPU_ARM_TRADITIONAL and WTF_CPU_ARM_THUMB2 platforms" 335 #endif /* !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2) */ 336 337 #if defined(__ARM_NEON__) && !defined(WTF_CPU_ARM_NEON) 338 #define WTF_CPU_ARM_NEON 1 339 #endif 340 341 #if CPU(ARM_NEON) 342 /* All NEON intrinsics usage can be disabled by this macro. */ 343 #define HAVE_ARM_NEON_INTRINSICS 1 344 #endif 345 346 #if (defined(__VFP_FP__) && !defined(__SOFTFP__)) 347 #define WTF_CPU_ARM_VFP 1 348 #endif 349 350 #if defined(__ARM_ARCH_7K__) 351 #define WTF_CPU_APPLE_ARMV7K 1 352 #endif 353 354 #if defined(__ARM_ARCH_7S__) 355 #define WTF_CPU_APPLE_ARMV7S 1 356 #endif 357 358 #if defined(__ARM_ARCH_EXT_IDIV__) || CPU(APPLE_ARMV7S) 359 #define HAVE_ARM_IDIV_INSTRUCTIONS 1 360 #endif 361 362 #endif /* ARM */ 363 364 #if CPU(ARM) || CPU(MIPS) || CPU(SH4) || CPU(ALPHA) || CPU(HPPA) 365 #define WTF_CPU_NEEDS_ALIGNED_ACCESS 1 366 #endif 367 368 /* ==== OS() - underlying operating system; only to be used for mandated low-level services like 369 virtual memory, not to choose a GUI toolkit ==== */ 370 371 /* OS(AIX) - AIX */ 372 #ifdef _AIX 373 #define WTF_OS_AIX 1 374 #endif 375 376 /* OS(DARWIN) - Any Darwin-based OS, including Mac OS X and iPhone OS */ 377 #ifdef __APPLE__ 378 #define WTF_OS_DARWIN 1 379 380 #include <Availability.h> 381 #include <AvailabilityMacros.h> 382 #include <TargetConditionals.h> 383 #endif 384 385 /* OS(IOS) - iOS */ 386 /* OS(MAC_OS_X) - Mac OS X (not including iOS) */ 387 #if OS(DARWIN) && ((defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED) \ 388 || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) \ 389 || (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR)) 390 #define WTF_OS_IOS 1 391 #elif OS(DARWIN) && defined(TARGET_OS_MAC) && TARGET_OS_MAC 392 #define WTF_OS_MAC_OS_X 1 393 #endif 394 395 /* OS(FREEBSD) - FreeBSD */ 396 #if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) 397 #define WTF_OS_FREEBSD 1 398 #endif 399 400 /* OS(HURD) - GNU/Hurd */ 401 #ifdef __GNU__ 402 #define WTF_OS_HURD 1 403 #endif 404 405 /* OS(LINUX) - Linux */ 406 #ifdef __linux__ 407 #define WTF_OS_LINUX 1 408 #endif 409 410 /* OS(NETBSD) - NetBSD */ 411 #if defined(__NetBSD__) 412 #define WTF_OS_NETBSD 1 413 #endif 414 415 /* OS(OPENBSD) - OpenBSD */ 416 #ifdef __OpenBSD__ 417 #define WTF_OS_OPENBSD 1 418 #endif 419 420 /* OS(SOLARIS) - Solaris */ 421 #if defined(sun) || defined(__sun) 422 #define WTF_OS_SOLARIS 1 423 #endif 424 425 /* OS(WINDOWS) - Any version of Windows */ 426 #if defined(WIN32) || defined(_WIN32) 427 #define WTF_OS_WINDOWS 1 428 #endif 429 430 #define WTF_OS_WIN ERROR "USE WINDOWS WITH OS NOT WIN" 431 #define WTF_OS_MAC ERROR "USE MAC_OS_X WITH OS NOT MAC" 432 433 /* OS(UNIX) - Any Unix-like system */ 434 #if OS(AIX) \ 435 || OS(DARWIN) \ 436 || OS(FREEBSD) \ 437 || OS(HURD) \ 438 || OS(LINUX) \ 439 || OS(NETBSD) \ 440 || OS(OPENBSD) \ 441 || OS(SOLARIS) \ 442 || defined(unix) \ 443 || defined(__unix) \ 444 || defined(__unix__) 445 #define WTF_OS_UNIX 1 446 #endif 447 448 /* Operating environments */ 449 450 /* Export macro support. Detects the attributes available for shared library symbol export 451 decorations. */ 452 #if OS(WINDOWS) || (COMPILER_HAS_CLANG_DECLSPEC(dllimport) && COMPILER_HAS_CLANG_DECLSPEC(dllexport)) 453 #define USE_DECLSPEC_ATTRIBUTE 1 454 #define USE_VISIBILITY_ATTRIBUTE 0 455 #elif defined(__GNUC__) 456 #define USE_DECLSPEC_ATTRIBUTE 0 457 #define USE_VISIBILITY_ATTRIBUTE 1 458 #else 459 #define USE_DECLSPEC_ATTRIBUTE 0 460 #define USE_VISIBILITY_ATTRIBUTE 0 461 #endif 462 463 /* Standard libraries */ 464 #if defined(HAVE_FEATURES_H) && HAVE_FEATURES_H 465 /* If the included features.h is glibc's one, __GLIBC__ is defined. */ 466 #include <features.h> 467 #endif 468 469 /* FIXME: these are all mixes of OS, operating environment and policy choices. */ 470 /* PLATFORM(GTK) */ 471 /* PLATFORM(MAC) */ 472 /* PLATFORM(IOS) */ 473 /* PLATFORM(IOS_SIMULATOR) */ 474 /* PLATFORM(WIN) */ 475 #if defined(BUILDING_GTK__) 476 #define WTF_PLATFORM_GTK 1 477 #elif defined(BUILDING_JAVA__) 478 #define WTF_PLATFORM_JAVA 1 479 #elif defined(BUILDING_WPE__) 480 #define WTF_PLATFORM_WPE 1 481 #elif defined(BUILDING_JSCONLY__) 482 /* JSCOnly does not provide PLATFORM() macro */ 483 #elif OS(MAC_OS_X) 484 #define WTF_PLATFORM_MAC 1 485 #elif OS(IOS) 486 #define WTF_PLATFORM_IOS 1 487 #if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR 488 #define WTF_PLATFORM_IOS_SIMULATOR 1 489 #endif 490 #elif OS(WINDOWS) 491 #define WTF_PLATFORM_WIN 1 492 #endif 493 494 /* PLATFORM(COCOA) */ 495 #if PLATFORM(MAC) || PLATFORM(IOS) 496 #define WTF_PLATFORM_COCOA 1 497 #endif 498 499 #if PLATFORM(COCOA) 500 #if defined __has_include && __has_include(<CoreFoundation/CFPriv.h>) 501 #define USE_APPLE_INTERNAL_SDK 1 502 #endif 503 #endif 504 505 /* PLATFORM(APPLETV) */ 506 #if defined(TARGET_OS_TV) && TARGET_OS_TV 507 #define WTF_PLATFORM_APPLETV 1 508 #endif 509 510 /* PLATFORM(WATCHOS) */ 511 #if defined(TARGET_OS_WATCH) && TARGET_OS_WATCH 512 #define WTF_PLATFORM_WATCHOS 1 513 #endif 514 515 /* Graphics engines */ 516 517 /* USE(CG) and PLATFORM(CI) */ 518 #if PLATFORM(COCOA) || (PLATFORM(WIN) && !USE(WINGDI) && !PLATFORM(WIN_CAIRO) && !USE(DIRECT2D)) 519 #define USE_CG 1 520 #endif 521 #if PLATFORM(COCOA) || (PLATFORM(WIN) && USE(CG) && !USE(DIRECT2D)) 522 #define USE_CA 1 523 #endif 524 525 #if PLATFORM(GTK) || PLATFORM(WPE) 526 #define USE_CAIRO 1 527 #define USE_GLIB 1 528 #define USE_FREETYPE 1 529 #define USE_HARFBUZZ 1 530 #define USE_SOUP 1 531 #define USE_WEBP 1 532 #define USE_FILE_LOCK 1 533 #endif 534 535 #if PLATFORM(GTK) 536 #define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_36 537 #endif 538 539 #if PLATFORM(GTK) && !defined(GTK_API_VERSION_2) 540 #define GDK_VERSION_MIN_REQUIRED GDK_VERSION_3_6 541 #endif 542 543 #if USE(SOUP) 544 #define SOUP_VERSION_MIN_REQUIRED SOUP_VERSION_2_42 545 #endif 546 547 /* On Windows, use QueryPerformanceCounter by default */ 548 #if OS(WINDOWS) 549 #define USE_QUERY_PERFORMANCE_COUNTER 1 550 #endif 551 552 #if PLATFORM(COCOA) 553 554 #define USE_CF 1 555 #define USE_FOUNDATION 1 556 #define USE_NETWORK_CFDATA_ARRAY_CALLBACK 1 557 #define ENABLE_USER_MESSAGE_HANDLERS 1 558 #define HAVE_OUT_OF_PROCESS_LAYER_HOSTING 1 559 #define HAVE_DTRACE 0 560 #define USE_FILE_LOCK 1 561 562 #if !PLATFORM(WATCHOS) && !PLATFORM(APPLETV) 563 #define ENABLE_DATA_DETECTION 1 564 #define HAVE_AVKIT 1 565 #define HAVE_PARENTAL_CONTROLS 1 566 #endif 567 568 #endif 569 570 #if PLATFORM(MAC) 571 572 #if __MAC_OS_X_VERSION_MIN_REQUIRED < 101200 573 #define USE_QTKIT 1 574 #else 575 #define USE_QTKIT 0 576 #endif 577 578 #define USE_APPKIT 1 579 #define HAVE_RUNLOOP_TIMER 1 580 #define HAVE_SEC_IDENTITY 1 581 #define HAVE_SEC_KEYCHAIN 1 582 583 #if CPU(X86_64) 584 #define HAVE_NETWORK_EXTENSION 1 585 #define USE_PLUGIN_HOST_PROCESS 1 586 #endif 587 588 /* OS X defines a series of platform macros for debugging. */ 589 /* Some of them are really annoying because they use common names (e.g. check()). */ 590 /* Disable those macros so that we are not limited in how we name methods and functions. */ 591 #undef __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 592 #define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 593 594 #endif /* PLATFORM(MAC) */ 595 596 #if PLATFORM(IOS) 597 598 #define HAVE_NETWORK_EXTENSION 1 599 #define HAVE_READLINE 1 600 #define USE_UIKIT_EDITING 1 601 #define USE_WEB_THREAD 1 602 603 #if !PLATFORM(WATCHOS) && !PLATFORM(APPLETV) 604 #define USE_QUICK_LOOK 1 605 #endif 606 607 #if TARGET_OS_IOS 608 #define HAVE_APP_LINKS 1 609 #endif 610 611 #if CPU(ARM64) 612 #define ENABLE_JIT_CONSTANT_BLINDING 0 613 #endif 614 615 #if CPU(ARM_NEON) 616 #undef HAVE_ARM_NEON_INTRINSICS 617 #define HAVE_ARM_NEON_INTRINSICS 0 618 #endif 619 620 #endif /* PLATFORM(IOS) */ 621 622 #if PLATFORM(JAVA) 623 #define USE_NPOBJECT 0 624 #define ENABLE_JAVA_BRIDGE 1 625 #define ENABLE_JAVA_JSC 1 626 #if !OS(WINDOWS) 627 #define USE_PTHREADS 1 628 #define HAVE_PTHREAD_RWLOCK 1 629 #endif /* !OS(WINDOWS) */ 630 #if defined(__TARGET_ARCH_ARM) 631 #define WTF_ARM_ARCH_VERSION __TARGET_ARCH_ARM 632 #endif /* __TARGET_ARCH_ARM */ 633 #if defined(__TARGET_ARCH_THUMB) 634 #define WTF_THUMB_ARCH_VERSION __TARGET_ARCH_THUMB 635 #endif /* __TARGET_ARCH_THUMB */ 636 #if defined(__TARGET_ARCH_ARM) && defined(__TARGET_ARCH_THUMB) && WTF_THUMB_ARCH_VERSION >= 4 637 #define WTF_CPU_ARM_TRADITIONAL 0 638 #define WTF_CPU_ARM_THUMB2 1 639 #endif /* THUMB2 */ 640 #if COMPILER(MSVC) && _MSC_VER <= 1800 641 #error "Compiler is not supported, use MSVC 2015 or higher" 642 #endif 643 #endif /* PLATFORM(JAVA) */ 644 645 #if (PLATFORM(WIN) && !USE(WINGDI) && !PLATFORM(JAVA)) || (PLATFORM(JAVA) && OS(DARWIN)) 646 #define USE_CF 1 647 #endif 648 649 #if PLATFORM(WIN) && !USE(WINGDI) && !PLATFORM(WIN_CAIRO) 650 #define USE_CFURLCONNECTION 1 651 #endif 652 653 #if !defined(HAVE_ACCESSIBILITY) 654 #if PLATFORM(COCOA) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(WPE) 655 #define HAVE_ACCESSIBILITY 1 656 #endif 657 #endif /* !defined(HAVE_ACCESSIBILITY) */ 658 659 /* FIXME: Remove after CMake build enabled on Darwin */ 660 #if OS(DARWIN) 661 #define HAVE_ERRNO_H 1 662 #define HAVE_LANGINFO_H 1 663 #define HAVE_LOCALTIME_R 1 664 #define HAVE_MMAP 1 665 #define HAVE_REGEX_H 1 666 #define HAVE_SIGNAL_H 1 667 #define HAVE_STAT_BIRTHTIME 1 668 #define HAVE_STRINGS_H 1 669 #define HAVE_STRNSTR 1 670 #define HAVE_SYS_PARAM_H 1 671 #define HAVE_SYS_TIME_H 1 672 #define HAVE_TM_GMTOFF 1 673 #define HAVE_TM_ZONE 1 674 #define HAVE_TIMEGM 1 675 676 #if CPU(X86_64) || CPU(ARM64) 677 #define HAVE_INT128_T 1 678 #endif 679 #endif /* OS(DARWIN) */ 680 681 #if OS(UNIX) 682 #define USE_PTHREADS 1 683 #endif /* OS(UNIX) */ 684 685 #if OS(DARWIN) 686 #if !PLATFORM(JAVA) 687 #define HAVE_DISPATCH_H 1 // todo tav enable when building w/ clang 688 #endif 689 #define HAVE_MADV_FREE 1 690 #define HAVE_MADV_FREE_REUSE 1 691 #define HAVE_MADV_DONTNEED 1 692 #define HAVE_MERGESORT 1 693 #define HAVE_PTHREAD_SETNAME_NP 1 694 #define HAVE_READLINE 1 695 #define HAVE_SYS_TIMEB_H 1 696 697 #if __has_include(<mach/mach_exc.defs>) && !(PLATFORM(WATCHOS) || PLATFORM(APPLETV)) 698 #define HAVE_MACH_EXCEPTIONS 1 699 #endif 700 701 #if !PLATFORM(GTK) 702 #define USE_ACCELERATE 1 703 #endif 704 #if !PLATFORM(IOS) 705 #define HAVE_HOSTED_CORE_ANIMATION 1 706 #endif 707 708 #endif /* OS(DARWIN) */ 709 710 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200) || PLATFORM(IOS) 711 #define HAVE_CFNETWORK_STORAGE_PARTITIONING 1 712 #endif 713 714 #if OS(DARWIN) || ((OS(FREEBSD) || defined(__GLIBC__)) && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS))) 715 #define HAVE_MACHINE_CONTEXT 1 716 #endif 717 718 #if OS(DARWIN) || (OS(LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__)) 719 #define HAVE_BACKTRACE 1 720 #endif 721 722 #if OS(DARWIN) || OS(LINUX) 723 #if PLATFORM(GTK) 724 #if defined(__GLIBC__) && !defined(__UCLIBC__) 725 #define HAVE_BACKTRACE_SYMBOLS 1 726 #endif 727 #endif /* PLATFORM(GTK) */ 728 #define HAVE_DLADDR 1 729 #endif /* OS(DARWIN) || OS(LINUX) */ 730 731 732 /* ENABLE macro defaults */ 733 734 /* FIXME: move out all ENABLE() defines from here to FeatureDefines.h */ 735 736 /* Include feature macros */ 737 #include <wtf/FeatureDefines.h> 738 739 #if OS(WINDOWS) 740 #define USE_SYSTEM_MALLOC 1 741 #endif 742 743 #if !defined(USE_JSVALUE64) && !defined(USE_JSVALUE32_64) 744 #if (CPU(X86_64) && !defined(__ILP32__) && (OS(UNIX) || OS(WINDOWS))) \ 745 || (CPU(IA64) && !CPU(IA64_32)) \ 746 || CPU(ALPHA) \ 747 || CPU(ARM64) \ 748 || CPU(S390X) \ 749 || CPU(MIPS64) \ 750 || CPU(PPC64) \ 751 || CPU(PPC64LE) 752 #define USE_JSVALUE64 1 753 #else 754 #define USE_JSVALUE32_64 1 755 #endif 756 #endif /* !defined(USE_JSVALUE64) && !defined(USE_JSVALUE32_64) */ 757 758 /* The JIT is enabled by default on all x86, x86-64, ARM & MIPS platforms except ARMv7k. */ 759 #if !defined(ENABLE_JIT) \ 760 && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS)) \ 761 && !CPU(APPLE_ARMV7K) \ 762 && !CPU(ARM64E) 763 #define ENABLE_JIT 1 764 #endif 765 766 /* The FTL *does not* work on 32-bit platforms. Disable it even if someone asked us to enable it. */ 767 #if USE(JSVALUE32_64) 768 #undef ENABLE_FTL_JIT 769 #define ENABLE_FTL_JIT 0 770 #endif 771 772 /* The FTL is disabled on the iOS simulator, mostly for simplicity. */ 773 #if PLATFORM(IOS_SIMULATOR) 774 #undef ENABLE_FTL_JIT 775 #define ENABLE_FTL_JIT 0 776 #endif 777 778 /* If possible, try to enable a disassembler. This is optional. We proceed in two 779 steps: first we try to find some disassembler that we can use, and then we 780 decide if the high-level disassembler API can be enabled. */ 781 // FIXME-java: Should we enable UDIS86 on linux? 782 #if !defined(USE_UDIS86) && !PLATFORM(JAVA) && ENABLE(JIT) && ((OS(DARWIN) && !PLATFORM(GTK)) || (OS(LINUX) && PLATFORM(GTK))) \ 783 && (CPU(X86) || CPU(X86_64)) 784 #define USE_UDIS86 1 785 #endif 786 787 #if !defined(ENABLE_DISASSEMBLER) && USE(UDIS86) 788 #define ENABLE_DISASSEMBLER 1 789 #endif 790 791 #if !defined(USE_ARM64_DISASSEMBLER) && ENABLE(JIT) && CPU(ARM64) 792 #define USE_ARM64_DISASSEMBLER 1 793 #endif 794 795 #if !defined(USE_ARMV7_DISASSEMBLER) && ENABLE(JIT) && CPU(ARM_THUMB2) 796 #define USE_ARMV7_DISASSEMBLER 1 797 #endif 798 799 #if !defined(USE_ARM_LLVM_DISASSEMBLER) && ENABLE(JIT) && CPU(ARM_TRADITIONAL) && HAVE(LLVM) 800 #define USE_ARM_LLVM_DISASSEMBLER 1 801 #endif 802 803 #if !defined(ENABLE_DISASSEMBLER) && (USE(UDIS86) || USE(ARMV7_DISASSEMBLER) || USE(ARM64_DISASSEMBLER) || USE(ARM_LLVM_DISASSEMBLER)) 804 #define ENABLE_DISASSEMBLER 1 805 #endif 806 807 #if !defined(ENABLE_DFG_JIT) && ENABLE(JIT) 808 /* Enable the DFG JIT on X86 and X86_64. */ 809 #if (CPU(X86) || CPU(X86_64)) && (OS(DARWIN) || OS(LINUX) || OS(FREEBSD) || OS(WINDOWS) || OS(HURD)) 810 #define ENABLE_DFG_JIT 1 811 #endif 812 /* Enable the DFG JIT on ARMv7. Only tested on iOS and Qt/GTK+ Linux. */ 813 #if (CPU(ARM_THUMB2) || CPU(ARM64)) && (PLATFORM(IOS) || PLATFORM(GTK) || PLATFORM(WPE)) 814 #define ENABLE_DFG_JIT 1 815 #endif 816 /* Enable the DFG JIT on ARM and MIPS. */ 817 #if CPU(ARM_TRADITIONAL) || CPU(MIPS) 818 #define ENABLE_DFG_JIT 1 819 #endif 820 #endif 821 822 /* Concurrent JS only works on 64-bit platforms because it requires that 823 values get stored to atomically. This is trivially true on 64-bit platforms, 824 but not true at all on 32-bit platforms where values are composed of two 825 separate sub-values. */ 826 #if ENABLE(DFG_JIT) && USE(JSVALUE64) 827 #define ENABLE_CONCURRENT_JS 1 828 #endif 829 830 #if __has_include(<System/pthread_machdep.h>) 831 #define HAVE_FAST_TLS 1 832 #endif 833 834 #if (CPU(X86_64) || CPU(ARM64)) && HAVE(FAST_TLS) 835 #define ENABLE_FAST_TLS_JIT 1 836 #endif 837 838 /* This controls whether B3 is built. B3 is needed for FTL JIT and WebAssembly */ 839 #if ENABLE(FTL_JIT) || ENABLE(WEBASSEMBLY) 840 #define ENABLE_B3_JIT 1 841 #endif 842 843 /* If the baseline jit is not available, then disable upper tiers as well: */ 844 #if !ENABLE(JIT) 845 #undef ENABLE_DFG_JIT 846 #undef ENABLE_FTL_JIT 847 #undef ENABLE_B3_JIT 848 #define ENABLE_DFG_JIT 0 849 #define ENABLE_FTL_JIT 0 850 #define ENABLE_B3_JIT 0 851 #endif 852 853 /* The SamplingProfiler is the probabilistic and low-overhead profiler used by 854 * JSC to measure where time is spent inside a JavaScript program. 855 * In configurations other than Windows and Darwin, because layout of mcontext_t depends on standard libraries (like glibc), 856 * sampling profiler is enabled if WebKit uses pthreads and glibc. */ 857 #if !defined(ENABLE_SAMPLING_PROFILER) 858 #if ENABLE(JIT) && (OS(WINDOWS) || HAVE(MACHINE_CONTEXT)) 859 #define ENABLE_SAMPLING_PROFILER 1 860 #else 861 #define ENABLE_SAMPLING_PROFILER 0 862 #endif 863 #endif 864 865 #if ENABLE(WEBASSEMBLY) && HAVE(MACHINE_CONTEXT) 866 #define ENABLE_WEBASSEMBLY_FAST_MEMORY 1 867 #endif 868 869 /* Counts uses of write barriers using sampling counters. Be sure to also 870 set ENABLE_SAMPLING_COUNTERS to 1. */ 871 #if !defined(ENABLE_WRITE_BARRIER_PROFILING) 872 #define ENABLE_WRITE_BARRIER_PROFILING 0 873 #endif 874 875 /* Logs all allocation-related activity that goes through fastMalloc or the 876 JSC GC (both cells and butterflies). Also logs marking. Note that this 877 isn't a completely accurate view of the heap since it doesn't include all 878 butterfly resize operations, doesn't tell you what is going on with weak 879 references (other than to tell you when they're marked), and doesn't 880 track direct mmap() allocations or things like JIT allocation. */ 881 #if !defined(ENABLE_ALLOCATION_LOGGING) 882 #define ENABLE_ALLOCATION_LOGGING 0 883 #endif 884 885 /* Enable verification that that register allocations are not made within generated control flow. 886 Turned on for debug builds. */ 887 #if !defined(ENABLE_DFG_REGISTER_ALLOCATION_VALIDATION) && ENABLE(DFG_JIT) 888 #if !defined(NDEBUG) 889 #define ENABLE_DFG_REGISTER_ALLOCATION_VALIDATION 1 890 #else 891 #define ENABLE_DFG_REGISTER_ALLOCATION_VALIDATION 0 892 #endif 893 #endif 894 895 /* Configure the JIT */ 896 #if CPU(X86) && COMPILER(MSVC) 897 #define JSC_HOST_CALL __fastcall 898 #elif CPU(X86) && COMPILER(GCC_OR_CLANG) 899 #define JSC_HOST_CALL __attribute__ ((fastcall)) 900 #else 901 #define JSC_HOST_CALL 902 #endif 903 904 #if CPU(X86) && OS(WINDOWS) 905 #define CALLING_CONVENTION_IS_STDCALL 1 906 #ifndef CDECL 907 #if COMPILER(MSVC) 908 #define CDECL __cdecl 909 #else 910 #define CDECL __attribute__ ((__cdecl)) 911 #endif 912 #endif 913 #else 914 #define CALLING_CONVENTION_IS_STDCALL 0 915 #endif 916 917 #if CPU(X86) 918 #define WTF_COMPILER_SUPPORTS_FASTCALL_CALLING_CONVENTION 1 919 #ifndef FASTCALL 920 #if COMPILER(MSVC) 921 #define FASTCALL __fastcall 922 #else 923 #define FASTCALL __attribute__ ((fastcall)) 924 #endif 925 #endif 926 #else 927 #define WTF_COMPILER_SUPPORTS_FASTCALL_CALLING_CONVENTION 0 928 #endif 929 930 #if ENABLE(JIT) && CALLING_CONVENTION_IS_STDCALL 931 #define JIT_OPERATION CDECL 932 #else 933 #define JIT_OPERATION 934 #endif 935 936 /* Configure the interpreter */ 937 #if COMPILER(GCC_OR_CLANG) 938 #define HAVE_COMPUTED_GOTO 1 939 #endif 940 941 /* Determine if we need to enable Computed Goto Opcodes or not: */ 942 #if HAVE(COMPUTED_GOTO) || ENABLE(JIT) 943 #define ENABLE_COMPUTED_GOTO_OPCODES 1 944 #endif 945 946 #if ENABLE(JIT) && !COMPILER(MSVC) && \ 947 (CPU(X86) || CPU(X86_64) || CPU(ARM64) || (CPU(ARM_THUMB2) && OS(DARWIN))) 948 /* This feature works by embedding the OpcodeID in the 32 bit just before the generated LLint code 949 that executes each opcode. It cannot be supported by the CLoop since there's no way to embed the 950 OpcodeID word in the CLoop's switch statement cases. It is also currently not implemented for MSVC. 951 */ 952 #define USE_LLINT_EMBEDDED_OPCODE_ID 1 953 #endif 954 955 /* Regular Expression Tracing - Set to 1 to trace RegExp's in jsc. Results dumped at exit */ 956 #define ENABLE_REGEXP_TRACING 0 957 958 /* Yet Another Regex Runtime - turned on by default for JIT enabled ports. */ 959 #if !defined(ENABLE_YARR_JIT) && ENABLE(JIT) 960 #define ENABLE_YARR_JIT 1 961 962 /* Setting this flag compares JIT results with interpreter results. */ 963 #define ENABLE_YARR_JIT_DEBUG 0 964 #endif 965 966 /* If either the JIT or the RegExp JIT is enabled, then the Assembler must be 967 enabled as well: */ 968 #if ENABLE(JIT) || ENABLE(YARR_JIT) 969 #if defined(ENABLE_ASSEMBLER) && !ENABLE_ASSEMBLER 970 #error "Cannot enable the JIT or RegExp JIT without enabling the Assembler" 971 #else 972 #undef ENABLE_ASSEMBLER 973 #define ENABLE_ASSEMBLER 1 974 #endif 975 #endif 976 977 /* If the Disassembler is enabled, then the Assembler must be enabled as well: */ 978 #if ENABLE(DISASSEMBLER) 979 #if defined(ENABLE_ASSEMBLER) && !ENABLE_ASSEMBLER 980 #error "Cannot enable the Disassembler without enabling the Assembler" 981 #else 982 #undef ENABLE_ASSEMBLER 983 #define ENABLE_ASSEMBLER 1 984 #endif 985 #endif 986 987 /* Enable the following if you want to use the MacroAssembler::probe() facility 988 to do JIT debugging. */ 989 #if (CPU(X86) || CPU(X86_64) || CPU(ARM64) || (CPU(ARM_THUMB2) && PLATFORM(IOS))) && ENABLE(JIT) && OS(DARWIN) 990 #define ENABLE_MASM_PROBE 1 991 #else 992 #define ENABLE_MASM_PROBE 0 993 #endif 994 995 #ifndef ENABLE_EXCEPTION_SCOPE_VERIFICATION 996 #ifdef NDEBUG 997 #define ENABLE_EXCEPTION_SCOPE_VERIFICATION 0 998 #else 999 #define ENABLE_EXCEPTION_SCOPE_VERIFICATION 1 1000 #endif 1001 #endif 1002 1003 #if ENABLE(JIT) && HAVE(MACHINE_CONTEXT) && (CPU(X86) || CPU(X86_64) || CPU(ARM64)) 1004 #define ENABLE_SIGNAL_BASED_VM_TRAPS 1 1005 #endif 1006 1007 /* CSS Selector JIT Compiler */ 1008 #if !defined(ENABLE_CSS_SELECTOR_JIT) 1009 #if (CPU(X86_64) || CPU(ARM64) || (CPU(ARM_THUMB2) && PLATFORM(IOS))) && ENABLE(JIT) && (OS(DARWIN) || PLATFORM(GTK) || PLATFORM(WPE)) 1010 #define ENABLE_CSS_SELECTOR_JIT 1 1011 #else 1012 #define ENABLE_CSS_SELECTOR_JIT 0 1013 #endif 1014 #endif 1015 1016 #if ENABLE(WEBGL) && PLATFORM(WIN) 1017 #define USE_OPENGL 1 1018 #define USE_OPENGL_ES_2 1 1019 #define USE_EGL 1 1020 #endif 1021 1022 #if ENABLE(VIDEO) && PLATFORM(WIN_CAIRO) 1023 #if ENABLE(GSTREAMER_WINCAIRO) 1024 #define USE_MEDIA_FOUNDATION 0 1025 #define USE_GLIB 1 1026 #define USE_GSTREAMER 1 1027 #else 1028 #define USE_MEDIA_FOUNDATION 1 1029 #endif 1030 #endif 1031 1032 #if PLATFORM(WIN_CAIRO) 1033 #define USE_TEXTURE_MAPPER 1 1034 #elif PLATFORM(JAVA) 1035 #define USE_TEXTURE_MAPPER 1 1036 #endif 1037 1038 #if USE(TEXTURE_MAPPER) && ENABLE(GRAPHICS_CONTEXT_3D) && !defined(USE_TEXTURE_MAPPER_GL) 1039 #define USE_TEXTURE_MAPPER_GL 1 1040 #endif 1041 1042 #if PLATFORM(COCOA) 1043 #define USE_PROTECTION_SPACE_AUTH_CALLBACK 1 1044 #endif 1045 1046 #if PLATFORM(COCOA) && HAVE(ACCESSIBILITY) 1047 #define USE_ACCESSIBILITY_CONTEXT_MENUS 1 1048 #endif 1049 1050 #if CPU(ARM_THUMB2) || CPU(ARM64) 1051 #define ENABLE_BRANCH_COMPACTION 1 1052 #endif 1053 1054 #if !defined(ENABLE_THREADING_LIBDISPATCH) && HAVE(DISPATCH_H) 1055 #define ENABLE_THREADING_LIBDISPATCH 1 1056 #elif !defined(ENABLE_THREADING_OPENMP) && defined(_OPENMP) 1057 #define ENABLE_THREADING_OPENMP 1 1058 #elif !defined(THREADING_GENERIC) 1059 #define ENABLE_THREADING_GENERIC 1 1060 #endif 1061 1062 #if USE(GLIB) 1063 #include <wtf/glib/GTypedefs.h> 1064 #endif 1065 1066 /* FIXME: This define won't be needed once #27551 is fully landed. However, 1067 since most ports try to support sub-project independence, adding new headers 1068 to WTF causes many ports to break, and so this way we can address the build 1069 breakages one port at a time. */ 1070 #if !defined(USE_EXPORT_MACROS) && (PLATFORM(COCOA) || OS(WINDOWS)) 1071 #define USE_EXPORT_MACROS 1 1072 #endif 1073 1074 #if !defined(USE_EXPORT_MACROS_FOR_TESTING) && (PLATFORM(GTK) || OS(WINDOWS)) 1075 #define USE_EXPORT_MACROS_FOR_TESTING 1 1076 #endif 1077 1078 #if PLATFORM(GTK) || PLATFORM(WPE) 1079 #define USE_UNIX_DOMAIN_SOCKETS 1 1080 #endif 1081 1082 #if !defined(USE_IMLANG_FONT_LINK2) 1083 #define USE_IMLANG_FONT_LINK2 1 1084 #endif 1085 1086 #if !defined(ENABLE_GC_VALIDATION) && !defined(NDEBUG) 1087 #define ENABLE_GC_VALIDATION 1 1088 #endif 1089 1090 #if !defined(ENABLE_BINDING_INTEGRITY) && !OS(WINDOWS) 1091 #define ENABLE_BINDING_INTEGRITY 1 1092 #endif 1093 1094 #if PLATFORM(COCOA) 1095 #define USE_AVFOUNDATION 1 1096 #endif 1097 1098 #if PLATFORM(WIN) && !USE(WINGDI) 1099 #include <wtf/AVFoundationHeaderDetection.h> 1100 #endif 1101 1102 #if PLATFORM(WIN) && USE(CG) && HAVE(AVCF) 1103 #define USE_AVFOUNDATION 1 1104 1105 #if HAVE(AVCF_LEGIBLE_OUTPUT) 1106 #define HAVE_AVFOUNDATION_MEDIA_SELECTION_GROUP 1 1107 #define HAVE_AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT 1 1108 #define HAVE_MEDIA_ACCESSIBILITY_FRAMEWORK 1 1109 #endif 1110 1111 #endif 1112 1113 #if !defined(ENABLE_TREE_DEBUGGING) 1114 #if !defined(NDEBUG) 1115 #define ENABLE_TREE_DEBUGGING 1 1116 #else 1117 #define ENABLE_TREE_DEBUGGING 0 1118 #endif 1119 #endif 1120 1121 #if PLATFORM(IOS) || PLATFORM(MAC) 1122 #define USE_COREMEDIA 1 1123 #define HAVE_AVFOUNDATION_VIDEO_OUTPUT 1 1124 #endif 1125 1126 #if PLATFORM(IOS) || PLATFORM(MAC) || (OS(WINDOWS) && USE(CG)) 1127 #define HAVE_AVFOUNDATION_MEDIA_SELECTION_GROUP 1 1128 #endif 1129 1130 #if PLATFORM(IOS) || PLATFORM(MAC) || (OS(WINDOWS) && USE(CG)) 1131 #define HAVE_AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT 1 1132 #define HAVE_MEDIA_ACCESSIBILITY_FRAMEWORK 1 1133 #endif 1134 1135 #if PLATFORM(IOS) || PLATFORM(MAC) 1136 #define HAVE_AVFOUNDATION_LOADER_DELEGATE 1 1137 #endif 1138 1139 #if PLATFORM(MAC) || (PLATFORM(IOS) && ENABLE(WEB_RTC)) 1140 #define USE_VIDEOTOOLBOX 1 1141 #endif 1142 1143 #if PLATFORM(COCOA) || PLATFORM(GTK) || PLATFORM(WPE) 1144 #define USE_REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR 1 1145 #endif 1146 1147 #if PLATFORM(MAC) 1148 #define USE_COREAUDIO 1 1149 #endif 1150 1151 #if !defined(USE_ZLIB) && !PLATFORM(JAVA) 1152 #define USE_ZLIB 1 1153 #endif 1154 1155 #ifndef HAVE_QOS_CLASSES 1156 #if PLATFORM(COCOA) 1157 #define HAVE_QOS_CLASSES 1 1158 #endif 1159 #endif 1160 1161 #ifndef HAVE_VOUCHERS 1162 #if PLATFORM(COCOA) 1163 #define HAVE_VOUCHERS 1 1164 #endif 1165 #endif 1166 1167 #define USE_GRAMMAR_CHECKING 1 1168 1169 #if PLATFORM(COCOA) || PLATFORM(GTK) 1170 #define USE_UNIFIED_TEXT_CHECKING 1 1171 #endif 1172 #if PLATFORM(MAC) 1173 #define USE_AUTOMATIC_TEXT_REPLACEMENT 1 1174 #endif 1175 1176 #if PLATFORM(MAC) 1177 /* Some platforms provide UI for suggesting autocorrection. */ 1178 #define USE_AUTOCORRECTION_PANEL 1 1179 #endif 1180 1181 #if PLATFORM(COCOA) 1182 /* Some platforms use spelling and autocorrection markers to provide visual cue. On such platform, if word with marker is edited, we need to remove the marker. */ 1183 #define USE_MARKER_REMOVAL_UPON_EDITING 1 1184 #endif 1185 1186 #if PLATFORM(MAC) 1187 #define USE_INSERTION_UNDO_GROUPING 1 1188 #endif 1189 1190 #if PLATFORM(COCOA) 1191 #define HAVE_TIMINGDATAOPTIONS 1 1192 #endif 1193 1194 #if PLATFORM(COCOA) 1195 #define USE_AUDIO_SESSION 1 1196 #endif 1197 1198 #if PLATFORM(COCOA) && !PLATFORM(IOS_SIMULATOR) 1199 #define USE_IOSURFACE 1 1200 #endif 1201 1202 #if PLATFORM(COCOA) 1203 #define ENABLE_RESOURCE_USAGE 1 1204 #endif 1205 1206 #if PLATFORM(GTK) || PLATFORM(WPE) 1207 #undef ENABLE_OPENTYPE_VERTICAL 1208 #define ENABLE_OPENTYPE_VERTICAL 1 1209 #define ENABLE_CSS3_TEXT_DECORATION_SKIP_INK 1 1210 #endif 1211 1212 #if PLATFORM(GTK) 1213 #define USE_WOFF2 1 1214 #endif 1215 1216 #if PLATFORM(COCOA) 1217 #define ENABLE_CSS3_TEXT_DECORATION_SKIP_INK 1 1218 #endif 1219 1220 #if COMPILER(MSVC) 1221 #undef __STDC_FORMAT_MACROS 1222 #define __STDC_FORMAT_MACROS 1223 #undef __STDC_LIMIT_MACROS 1224 #define __STDC_LIMIT_MACROS 1225 #endif 1226 1227 #if PLATFORM(MAC) 1228 #define HAVE_NS_ACTIVITY 1 1229 #endif 1230 1231 #if (OS(DARWIN) && USE(CG)) || (USE(FREETYPE) && !PLATFORM(GTK)) || (PLATFORM(WIN) && (USE(CG) || USE(CAIRO))) 1232 #undef ENABLE_OPENTYPE_MATH 1233 #define ENABLE_OPENTYPE_MATH 1 1234 #endif 1235 1236 /* Set TARGET_OS_IPHONE to 0 by default to allow using it as a guard 1237 * in cross-platform the same way as it is used in OS(DARWIN) code. */ 1238 #if !defined(TARGET_OS_IPHONE) && !OS(DARWIN) 1239 #define TARGET_OS_IPHONE 0 1240 #endif 1241 1242 #if PLATFORM(COCOA) 1243 #define USE_MEDIATOOLBOX 1 1244 #endif 1245 1246 /* FIXME: Enable USE_OS_LOG when building with the public iOS 10 SDK once we fix <rdar://problem/27758343>. */ 1247 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200) || (PLATFORM(IOS) && USE(APPLE_INTERNAL_SDK)) 1248 #define USE_OS_LOG 1 1249 #if USE(APPLE_INTERNAL_SDK) 1250 #define USE_OS_STATE 1 1251 #endif 1252 #endif 1253 1254 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200) || PLATFORM(IOS) 1255 #define HAVE_SEC_TRUST_SERIALIZATION 1 1256 #endif 1257 1258 #if !defined(WTF_DEFAULT_EVENT_LOOP) 1259 #define WTF_DEFAULT_EVENT_LOOP 1 1260 #endif 1261 1262 #if WTF_DEFAULT_EVENT_LOOP 1263 #if USE(GLIB) 1264 /* Use GLib's event loop abstraction. Primarily GTK port uses it. */ 1265 #define USE_GLIB_EVENT_LOOP 1 1266 #elif OS(WINDOWS) 1267 /* Use Windows message pump abstraction. 1268 * Even if the port is AppleWin, we use the Windows message pump system for the event loop, 1269 * so that USE(WINDOWS_EVENT_LOOP) && USE(CF) can be true. 1270 * And PLATFORM(WIN) and PLATFORM(GTK) are exclusive. If the port is GTK, 1271 * PLATFORM(WIN) should be false. And in that case, GLib's event loop is used. 1272 */ 1273 #define USE_WINDOWS_EVENT_LOOP 1 1274 #elif PLATFORM(COCOA) 1275 /* OS X and IOS. Use CoreFoundation & GCD abstraction. */ 1276 #define USE_COCOA_EVENT_LOOP 1 1277 #else 1278 #define USE_GENERIC_EVENT_LOOP 1 1279 #endif 1280 #endif 1281 1282 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 1283 #define USE_MEDIAREMOTE 1 1284 #endif 1285 1286 #if COMPILER(MSVC) 1287 /* Enable strict runtime stack buffer checks. */ 1288 #pragma strict_gs_check(on) 1289 #endif 1290 1291 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101201 && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 1292 #define HAVE_TOUCH_BAR 1 1293 #define HAVE_ADVANCED_SPELL_CHECKING 1 1294 1295 #if defined(__LP64__) 1296 #define ENABLE_WEB_PLAYBACK_CONTROLS_MANAGER 1 1297 #endif 1298 #endif /* PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101201 && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 */ 1299 1300 #if PLATFORM(COCOA) && ENABLE(WEB_RTC) 1301 #define USE_LIBWEBRTC 1 1302 #endif 1303 1304 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) || USE(GCRYPT) 1305 #define HAVE_RSA_PSS 1 1306 #endif 1307 1308 #if !OS(WINDOWS) && !OS(SOLARIS) 1309 #define HAVE_STACK_BOUNDS_FOR_NEW_THREAD 1 1310 #endif 1311 1312 #endif /* WTF_Platform_h */