Home | History | Annotate | Download | only in wtf
      1 /*
      2  * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc.  All rights reserved.
      3  * Copyright (C) 2007-2009 Torch Mobile, Inc.
      4  * Copyright (C) Research In Motion Limited 2010. 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 COMPUTER, 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 COMPUTER, 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 /* ==== PLATFORM handles OS, operating environment, graphics API, and
     32    CPU. This macro will be phased out in favor of platform adaptation
     33    macros, policy decision macros, and top-level port definitions. ==== */
     34 #define PLATFORM(WTF_FEATURE) (defined WTF_PLATFORM_##WTF_FEATURE  && WTF_PLATFORM_##WTF_FEATURE)
     35 
     36 
     37 /* ==== Platform adaptation macros: these describe properties of the target environment. ==== */
     38 
     39 /* COMPILER() - the compiler being used to build the project */
     40 #define COMPILER(WTF_FEATURE) (defined WTF_COMPILER_##WTF_FEATURE  && WTF_COMPILER_##WTF_FEATURE)
     41 /* CPU() - the target CPU architecture */
     42 #define CPU(WTF_FEATURE) (defined WTF_CPU_##WTF_FEATURE  && WTF_CPU_##WTF_FEATURE)
     43 /* HAVE() - specific system features (headers, functions or similar) that are present or not */
     44 #define HAVE(WTF_FEATURE) (defined HAVE_##WTF_FEATURE  && HAVE_##WTF_FEATURE)
     45 /* OS() - underlying operating system; only to be used for mandated low-level services like
     46    virtual memory, not to choose a GUI toolkit */
     47 #define OS(WTF_FEATURE) (defined WTF_OS_##WTF_FEATURE  && WTF_OS_##WTF_FEATURE)
     48 
     49 
     50 /* ==== Policy decision macros: these define policy choices for a particular port. ==== */
     51 
     52 /* USE() - use a particular third-party library or optional OS service */
     53 #define USE(WTF_FEATURE) (defined WTF_USE_##WTF_FEATURE  && WTF_USE_##WTF_FEATURE)
     54 /* ENABLE() - turn on a specific feature of WebKit */
     55 #define ENABLE(WTF_FEATURE) (defined ENABLE_##WTF_FEATURE  && ENABLE_##WTF_FEATURE)
     56 
     57 
     58 
     59 /* ==== COMPILER() - the compiler being used to build the project ==== */
     60 
     61 /* COMPILER(MSVC) Microsoft Visual C++ */
     62 /* COMPILER(MSVC7_OR_LOWER) Microsoft Visual C++ 2003 or lower*/
     63 /* COMPILER(MSVC9_OR_LOWER) Microsoft Visual C++ 2008 or lower*/
     64 #if defined(_MSC_VER)
     65 #define WTF_COMPILER_MSVC 1
     66 #if _MSC_VER < 1400
     67 #define WTF_COMPILER_MSVC7_OR_LOWER 1
     68 #elif _MSC_VER < 1600
     69 #define WTF_COMPILER_MSVC9_OR_LOWER 1
     70 #endif
     71 #endif
     72 
     73 /* COMPILER(RVCT)  - ARM RealView Compilation Tools */
     74 /* COMPILER(RVCT4_OR_GREATER) - ARM RealView Compilation Tools 4.0 or greater */
     75 #if defined(__CC_ARM) || defined(__ARMCC__)
     76 #define WTF_COMPILER_RVCT 1
     77 #define RVCT_VERSION_AT_LEAST(major, minor, patch, build) (__ARMCC_VERSION >= (major * 100000 + minor * 10000 + patch * 1000 + build))
     78 #else
     79 /* Define this for !RVCT compilers, just so we can write things like RVCT_VERSION_AT_LEAST(3, 0, 0, 0). */
     80 #define RVCT_VERSION_AT_LEAST(major, minor, patch, build) 0
     81 #endif
     82 
     83 /* COMPILER(GCC) - GNU Compiler Collection */
     84 /* --gnu option of the RVCT compiler also defines __GNUC__ */
     85 #if defined(__GNUC__) && !COMPILER(RVCT)
     86 #define WTF_COMPILER_GCC 1
     87 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
     88 #define GCC_VERSION_AT_LEAST(major, minor, patch) (GCC_VERSION >= (major * 10000 + minor * 100 + patch))
     89 #else
     90 /* Define this for !GCC compilers, just so we can write things like GCC_VERSION_AT_LEAST(4, 1, 0). */
     91 #define GCC_VERSION_AT_LEAST(major, minor, patch) 0
     92 #endif
     93 
     94 /* COMPILER(MINGW) - MinGW GCC */
     95 /* COMPILER(MINGW64) - mingw-w64 GCC - only used as additional check to exclude mingw.org specific functions */
     96 #if defined(__MINGW32__)
     97 #define WTF_COMPILER_MINGW 1
     98 #include <_mingw.h> /* private MinGW header */
     99     #if defined(__MINGW64_VERSION_MAJOR) /* best way to check for mingw-w64 vs mingw.org */
    100         #define WTF_COMPILER_MINGW64 1
    101     #endif /* __MINGW64_VERSION_MAJOR */
    102 #endif /* __MINGW32__ */
    103 
    104 /* COMPILER(WINSCW) - CodeWarrior for Symbian emulator */
    105 #if defined(__WINSCW__)
    106 #define WTF_COMPILER_WINSCW 1
    107 /* cross-compiling, it is not really windows */
    108 #undef WIN32
    109 #undef _WIN32
    110 #endif
    111 
    112 /* COMPILER(INTEL) - Intel C++ Compiler */
    113 #if defined(__INTEL_COMPILER)
    114 #define WTF_COMPILER_INTEL 1
    115 #endif
    116 
    117 /* COMPILER(SUNCC) */
    118 #if defined(__SUNPRO_CC) || defined(__SUNPRO_C)
    119 #define WTF_COMPILER_SUNCC 1
    120 #endif
    121 
    122 /* ==== CPU() - the target CPU architecture ==== */
    123 
    124 /* This also defines CPU(BIG_ENDIAN) or CPU(MIDDLE_ENDIAN) or neither, as appropriate. */
    125 
    126 /* CPU(ALPHA) - DEC Alpha */
    127 #if defined(__alpha__)
    128 #define WTF_CPU_ALPHA 1
    129 #endif
    130 
    131 /* CPU(IA64) - Itanium / IA-64 */
    132 #if defined(__ia64__)
    133 #define WTF_CPU_IA64 1
    134 /* 32-bit mode on Itanium */
    135 #if !defined(__LP64__)
    136 #define WTF_CPU_IA64_32 1
    137 #endif
    138 #endif
    139 
    140 /* CPU(MIPS) - MIPS 32-bit */
    141 /* Note: Only O32 ABI is tested, so we enable it for O32 ABI for now.  */
    142 #if (defined(mips) || defined(__mips__) || defined(MIPS) || defined(_MIPS_)) \
    143     && defined(_ABIO32)
    144 #define WTF_CPU_MIPS 1
    145 #if defined(__MIPSEB__)
    146 #define WTF_CPU_BIG_ENDIAN 1
    147 #endif
    148 #define WTF_MIPS_PIC (defined __PIC__)
    149 #define WTF_MIPS_ARCH __mips
    150 #define WTF_MIPS_ISA(v) (defined WTF_MIPS_ARCH && WTF_MIPS_ARCH == v)
    151 #define WTF_MIPS_ISA_AT_LEAST(v) (defined WTF_MIPS_ARCH && WTF_MIPS_ARCH >= v)
    152 #define WTF_MIPS_ARCH_REV __mips_isa_rev
    153 #define WTF_MIPS_ISA_REV(v) (defined WTF_MIPS_ARCH_REV && WTF_MIPS_ARCH_REV == v)
    154 #define WTF_MIPS_DOUBLE_FLOAT (defined __mips_hard_float && !defined __mips_single_float)
    155 #define WTF_MIPS_FP64 (defined __mips_fpr && __mips_fpr == 64)
    156 /* MIPS requires allocators to use aligned memory */
    157 #define WTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1
    158 #endif /* MIPS */
    159 
    160 /* CPU(PPC) - PowerPC 32-bit */
    161 #if   defined(__ppc__)     \
    162     || defined(__PPC__)     \
    163     || defined(__powerpc__) \
    164     || defined(__powerpc)   \
    165     || defined(__POWERPC__) \
    166     || defined(_M_PPC)      \
    167     || defined(__PPC)
    168 #define WTF_CPU_PPC 1
    169 #define WTF_CPU_BIG_ENDIAN 1
    170 #endif
    171 
    172 /* CPU(PPC64) - PowerPC 64-bit */
    173 #if   defined(__ppc64__) \
    174     || defined(__PPC64__)
    175 #define WTF_CPU_PPC64 1
    176 #define WTF_CPU_BIG_ENDIAN 1
    177 #endif
    178 
    179 /* CPU(SH4) - SuperH SH-4 */
    180 #if defined(__SH4__)
    181 #define WTF_CPU_SH4 1
    182 #endif
    183 
    184 /* CPU(SPARC32) - SPARC 32-bit */
    185 #if defined(__sparc) && !defined(__arch64__) || defined(__sparcv8)
    186 #define WTF_CPU_SPARC32 1
    187 #define WTF_CPU_BIG_ENDIAN 1
    188 #endif
    189 
    190 /* CPU(SPARC64) - SPARC 64-bit */
    191 #if defined(__sparc__) && defined(__arch64__) || defined (__sparcv9)
    192 #define WTF_CPU_SPARC64 1
    193 #define WTF_CPU_BIG_ENDIAN 1
    194 #endif
    195 
    196 /* CPU(SPARC) - any SPARC, true for CPU(SPARC32) and CPU(SPARC64) */
    197 #if CPU(SPARC32) || CPU(SPARC64)
    198 #define WTF_CPU_SPARC 1
    199 #endif
    200 
    201 /* CPU(S390X) - S390 64-bit */
    202 #if defined(__s390x__)
    203 #define WTF_CPU_S390X 1
    204 #define WTF_CPU_BIG_ENDIAN 1
    205 #endif
    206 
    207 /* CPU(S390) - S390 32-bit */
    208 #if defined(__s390__)
    209 #define WTF_CPU_S390 1
    210 #define WTF_CPU_BIG_ENDIAN 1
    211 #endif
    212 
    213 /* CPU(X86) - i386 / x86 32-bit */
    214 #if   defined(__i386__) \
    215     || defined(i386)     \
    216     || defined(_M_IX86)  \
    217     || defined(_X86_)    \
    218     || defined(__THW_INTEL)
    219 #define WTF_CPU_X86 1
    220 #endif
    221 
    222 /* CPU(X86_64) - AMD64 / Intel64 / x86_64 64-bit */
    223 #if   defined(__x86_64__) \
    224     || defined(_M_X64)
    225 #define WTF_CPU_X86_64 1
    226 #endif
    227 
    228 /* CPU(ARM) - ARM, any version*/
    229 #if   defined(arm) \
    230     || defined(__arm__) \
    231     || defined(ARM) \
    232     || defined(_ARM_)
    233 #define WTF_CPU_ARM 1
    234 
    235 #if defined(__ARMEB__) || (COMPILER(RVCT) && defined(__BIG_ENDIAN))
    236 #define WTF_CPU_BIG_ENDIAN 1
    237 
    238 #elif !defined(__ARM_EABI__) \
    239     && !defined(__EABI__) \
    240     && !defined(__VFP_FP__) \
    241     && !defined(_WIN32_WCE) \
    242     && !defined(ANDROID)
    243 #define WTF_CPU_MIDDLE_ENDIAN 1
    244 
    245 #endif
    246 
    247 #define WTF_ARM_ARCH_AT_LEAST(N) (CPU(ARM) && WTF_ARM_ARCH_VERSION >= N)
    248 
    249 /* Set WTF_ARM_ARCH_VERSION */
    250 #if   defined(__ARM_ARCH_4__) \
    251     || defined(__ARM_ARCH_4T__) \
    252     || defined(__MARM_ARMV4__) \
    253     || defined(_ARMV4I_)
    254 #define WTF_ARM_ARCH_VERSION 4
    255 
    256 #elif defined(__ARM_ARCH_5__) \
    257     || defined(__ARM_ARCH_5T__) \
    258     || defined(__MARM_ARMV5__)
    259 #define WTF_ARM_ARCH_VERSION 5
    260 
    261 #elif defined(__ARM_ARCH_5E__) \
    262     || defined(__ARM_ARCH_5TE__) \
    263     || defined(__ARM_ARCH_5TEJ__)
    264 #define WTF_ARM_ARCH_VERSION 5
    265 /*ARMv5TE requires allocators to use aligned memory*/
    266 #define WTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1
    267 
    268 #elif defined(__ARM_ARCH_6__) \
    269     || defined(__ARM_ARCH_6J__) \
    270     || defined(__ARM_ARCH_6K__) \
    271     || defined(__ARM_ARCH_6Z__) \
    272     || defined(__ARM_ARCH_6ZK__) \
    273     || defined(__ARM_ARCH_6T2__) \
    274     || defined(__ARMV6__)
    275 #define WTF_ARM_ARCH_VERSION 6
    276 
    277 #elif defined(__ARM_ARCH_7A__) \
    278     || defined(__ARM_ARCH_7R__)
    279 #define WTF_ARM_ARCH_VERSION 7
    280 
    281 /* RVCT sets _TARGET_ARCH_ARM */
    282 #elif defined(__TARGET_ARCH_ARM)
    283 #define WTF_ARM_ARCH_VERSION __TARGET_ARCH_ARM
    284 
    285 #if defined(__TARGET_ARCH_5E) \
    286     || defined(__TARGET_ARCH_5TE) \
    287     || defined(__TARGET_ARCH_5TEJ)
    288 /*ARMv5TE requires allocators to use aligned memory*/
    289 #define WTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1
    290 #endif
    291 
    292 #else
    293 #define WTF_ARM_ARCH_VERSION 0
    294 
    295 #endif
    296 
    297 /* Set WTF_THUMB_ARCH_VERSION */
    298 #if   defined(__ARM_ARCH_4T__)
    299 #define WTF_THUMB_ARCH_VERSION 1
    300 
    301 #elif defined(__ARM_ARCH_5T__) \
    302     || defined(__ARM_ARCH_5TE__) \
    303     || defined(__ARM_ARCH_5TEJ__)
    304 #define WTF_THUMB_ARCH_VERSION 2
    305 
    306 #elif defined(__ARM_ARCH_6J__) \
    307     || defined(__ARM_ARCH_6K__) \
    308     || defined(__ARM_ARCH_6Z__) \
    309     || defined(__ARM_ARCH_6ZK__) \
    310     || defined(__ARM_ARCH_6M__)
    311 #define WTF_THUMB_ARCH_VERSION 3
    312 
    313 #elif defined(__ARM_ARCH_6T2__) \
    314     || defined(__ARM_ARCH_7__) \
    315     || defined(__ARM_ARCH_7A__) \
    316     || defined(__ARM_ARCH_7R__) \
    317     || defined(__ARM_ARCH_7M__)
    318 #define WTF_THUMB_ARCH_VERSION 4
    319 
    320 /* RVCT sets __TARGET_ARCH_THUMB */
    321 #elif defined(__TARGET_ARCH_THUMB)
    322 #define WTF_THUMB_ARCH_VERSION __TARGET_ARCH_THUMB
    323 
    324 #else
    325 #define WTF_THUMB_ARCH_VERSION 0
    326 #endif
    327 
    328 
    329 /* CPU(ARMV5_OR_LOWER) - ARM instruction set v5 or earlier */
    330 /* On ARMv5 and below the natural alignment is required.
    331    And there are some other differences for v5 or earlier. */
    332 #if !defined(ARMV5_OR_LOWER) && !WTF_ARM_ARCH_AT_LEAST(6)
    333 #define WTF_CPU_ARMV5_OR_LOWER 1
    334 #endif
    335 
    336 
    337 /* CPU(ARM_TRADITIONAL) - Thumb2 is not available, only traditional ARM (v4 or greater) */
    338 /* CPU(ARM_THUMB2) - Thumb2 instruction set is available */
    339 /* Only one of these will be defined. */
    340 #if !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2)
    341 #  if defined(thumb2) || defined(__thumb2__) \
    342     || ((defined(__thumb) || defined(__thumb__)) && WTF_THUMB_ARCH_VERSION == 4)
    343 #    define WTF_CPU_ARM_TRADITIONAL 0
    344 #    define WTF_CPU_ARM_THUMB2 1
    345 #  elif WTF_ARM_ARCH_AT_LEAST(4)
    346 #    define WTF_CPU_ARM_TRADITIONAL 1
    347 #    define WTF_CPU_ARM_THUMB2 0
    348 #  else
    349 #    error "Not supported ARM architecture"
    350 #  endif
    351 #elif CPU(ARM_TRADITIONAL) && CPU(ARM_THUMB2) /* Sanity Check */
    352 #  error "Cannot use both of WTF_CPU_ARM_TRADITIONAL and WTF_CPU_ARM_THUMB2 platforms"
    353 #endif /* !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2) */
    354 
    355 #if defined(__ARM_NEON__) && !defined(WTF_CPU_ARM_NEON)
    356 #define WTF_CPU_ARM_NEON 1
    357 #endif
    358 
    359 #endif /* ARM */
    360 
    361 #if CPU(ARM) || CPU(MIPS)
    362 #define WTF_CPU_NEEDS_ALIGNED_ACCESS 1
    363 #endif
    364 
    365 /* ==== OS() - underlying operating system; only to be used for mandated low-level services like
    366    virtual memory, not to choose a GUI toolkit ==== */
    367 
    368 /* OS(ANDROID) - Android */
    369 #ifdef ANDROID
    370 #define WTF_OS_ANDROID 1
    371 #endif
    372 
    373 /* OS(AIX) - AIX */
    374 #ifdef _AIX
    375 #define WTF_OS_AIX 1
    376 #endif
    377 
    378 /* OS(DARWIN) - Any Darwin-based OS, including Mac OS X and iPhone OS */
    379 #ifdef __APPLE__
    380 #define WTF_OS_DARWIN 1
    381 
    382 /* FIXME: BUILDING_ON_.., and TARGETING... macros should be folded into the OS() system */
    383 #include <AvailabilityMacros.h>
    384 #if !defined(MAC_OS_X_VERSION_10_5) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
    385 #define BUILDING_ON_TIGER 1
    386 #elif !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
    387 #define BUILDING_ON_LEOPARD 1
    388 #elif !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
    389 #define BUILDING_ON_SNOW_LEOPARD 1
    390 #endif
    391 #if !defined(MAC_OS_X_VERSION_10_5) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
    392 #define TARGETING_TIGER 1
    393 #elif !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
    394 #define TARGETING_LEOPARD 1
    395 #elif !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7
    396 #define TARGETING_SNOW_LEOPARD 1
    397 #endif
    398 #include <TargetConditionals.h>
    399 
    400 #endif
    401 
    402 /* OS(IOS) - iOS */
    403 /* OS(MAC_OS_X) - Mac OS X (not including iOS) */
    404 #if OS(DARWIN) && ((defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED)  \
    405     || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)                   \
    406     || (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR))
    407 #define WTF_OS_IOS 1
    408 #elif OS(DARWIN) && defined(TARGET_OS_MAC) && TARGET_OS_MAC
    409 #define WTF_OS_MAC_OS_X 1
    410 #endif
    411 
    412 /* OS(FREEBSD) - FreeBSD */
    413 #if defined(__FreeBSD__) || defined(__DragonFly__)
    414 #define WTF_OS_FREEBSD 1
    415 #endif
    416 
    417 /* OS(HAIKU) - Haiku */
    418 #ifdef __HAIKU__
    419 #define WTF_OS_HAIKU 1
    420 #endif
    421 
    422 /* OS(LINUX) - Linux */
    423 #ifdef __linux__
    424 #define WTF_OS_LINUX 1
    425 #endif
    426 
    427 /* OS(NETBSD) - NetBSD */
    428 #if defined(__NetBSD__)
    429 #define WTF_OS_NETBSD 1
    430 #endif
    431 
    432 /* OS(OPENBSD) - OpenBSD */
    433 #ifdef __OpenBSD__
    434 #define WTF_OS_OPENBSD 1
    435 #endif
    436 
    437 /* OS(QNX) - QNX */
    438 #if defined(__QNXNTO__)
    439 #define WTF_OS_QNX 1
    440 #endif
    441 
    442 /* OS(SOLARIS) - Solaris */
    443 #if defined(sun) || defined(__sun)
    444 #define WTF_OS_SOLARIS 1
    445 #endif
    446 
    447 /* OS(WINCE) - Windows CE; note that for this platform OS(WINDOWS) is also defined */
    448 #if defined(_WIN32_WCE)
    449 #define WTF_OS_WINCE 1
    450 #endif
    451 
    452 /* OS(WINDOWS) - Any version of Windows */
    453 #if defined(WIN32) || defined(_WIN32)
    454 #define WTF_OS_WINDOWS 1
    455 #endif
    456 
    457 /* OS(SYMBIAN) - Symbian */
    458 #if defined (__SYMBIAN32__)
    459 #define WTF_OS_SYMBIAN 1
    460 #endif
    461 
    462 /* OS(UNIX) - Any Unix-like system */
    463 #if   OS(AIX)              \
    464     || OS(ANDROID)          \
    465     || OS(DARWIN)           \
    466     || OS(FREEBSD)          \
    467     || OS(HAIKU)            \
    468     || OS(LINUX)            \
    469     || OS(NETBSD)           \
    470     || OS(OPENBSD)          \
    471     || OS(QNX)              \
    472     || OS(SOLARIS)          \
    473     || OS(SYMBIAN)          \
    474     || defined(unix)        \
    475     || defined(__unix)      \
    476     || defined(__unix__)
    477 #define WTF_OS_UNIX 1
    478 #endif
    479 
    480 /* Operating environments */
    481 
    482 /* FIXME: these are all mixes of OS, operating environment and policy choices. */
    483 /* PLATFORM(CHROMIUM) */
    484 /* PLATFORM(QT) */
    485 /* PLATFORM(WX) */
    486 /* PLATFORM(GTK) */
    487 /* PLATFORM(HAIKU) */
    488 /* PLATFORM(MAC) */
    489 /* PLATFORM(WIN) */
    490 #if defined(BUILDING_CHROMIUM__)
    491 #define WTF_PLATFORM_CHROMIUM 1
    492 #elif defined(BUILDING_QT__)
    493 #define WTF_PLATFORM_QT 1
    494 #elif defined(BUILDING_WX__)
    495 #define WTF_PLATFORM_WX 1
    496 #elif defined(BUILDING_GTK__)
    497 #define WTF_PLATFORM_GTK 1
    498 #elif defined(BUILDING_HAIKU__)
    499 #define WTF_PLATFORM_HAIKU 1
    500 #elif defined(BUILDING_BREWMP__)
    501 #define WTF_PLATFORM_BREWMP 1
    502 #if defined(AEE_SIMULATOR)
    503 #define WTF_PLATFORM_BREWMP_SIMULATOR 1
    504 #else
    505 #define WTF_PLATFORM_BREWMP_SIMULATOR 0
    506 #endif
    507 #undef WTF_OS_WINDOWS
    508 #undef WTF_PLATFORM_WIN
    509 #elif OS(DARWIN)
    510 #define WTF_PLATFORM_MAC 1
    511 #elif OS(WINDOWS)
    512 #define WTF_PLATFORM_WIN 1
    513 #endif
    514 
    515 /* PLATFORM(IOS) */
    516 /* FIXME: this is sometimes used as an OS switch and sometimes for higher-level things */
    517 #if (defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
    518 #define WTF_PLATFORM_IOS 1
    519 #endif
    520 
    521 /* PLATFORM(IOS_SIMULATOR) */
    522 #if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR
    523 #define WTF_PLATFORM_IOS 1
    524 #define WTF_PLATFORM_IOS_SIMULATOR 1
    525 #else
    526 #define WTF_PLATFORM_IOS_SIMULATOR 0
    527 #endif
    528 
    529 #if !defined(WTF_PLATFORM_IOS)
    530 #define WTF_PLATFORM_IOS 0
    531 #endif
    532 
    533 /* PLATFORM(ANDROID) */
    534 /* FIXME: this is sometimes used as an OS() switch, and other times to drive
    535    policy choices */
    536 #if defined(ANDROID)
    537 #define WTF_PLATFORM_ANDROID 1
    538 #endif
    539 
    540 /* Graphics engines */
    541 
    542 /* USE(CG) and PLATFORM(CI) */
    543 #if PLATFORM(MAC) || PLATFORM(IOS)
    544 #define WTF_USE_CG 1
    545 #endif
    546 #if PLATFORM(MAC) || PLATFORM(IOS) || (PLATFORM(WIN) && USE(CG))
    547 #define WTF_USE_CA 1
    548 #endif
    549 
    550 /* USE(SKIA) for Win/Linux, CG for Mac */
    551 #if PLATFORM(CHROMIUM)
    552 #if OS(DARWIN)
    553 #define WTF_USE_CG 1
    554 #define WTF_USE_ATSUI 1
    555 #define WTF_USE_CORE_TEXT 1
    556 #define WTF_USE_ICCJPEG 1
    557 #else
    558 #define WTF_USE_SKIA 1
    559 #define WTF_USE_CHROMIUM_NET 1
    560 #endif
    561 #endif
    562 
    563 #if PLATFORM(BREWMP)
    564 #define WTF_USE_SKIA 1
    565 #endif
    566 
    567 #if PLATFORM(GTK)
    568 #define WTF_USE_CAIRO 1
    569 #endif
    570 
    571 
    572 #if OS(WINCE)
    573 #include <ce_time.h>
    574 #define WTF_USE_MERSENNE_TWISTER_19937 1
    575 #endif
    576 
    577 #if PLATFORM(QT) && OS(UNIX) && !OS(SYMBIAN) && !OS(DARWIN)
    578 #define WTF_USE_PTHREAD_BASED_QT 1
    579 #endif
    580 
    581 #if (PLATFORM(GTK) || PLATFORM(IOS) || PLATFORM(MAC) || PLATFORM(WIN) || (PLATFORM(QT) && (OS(DARWIN) || USE(PTHREAD_BASED_QT)) && !ENABLE(SINGLE_THREADED))) && !defined(ENABLE_JSC_MULTIPLE_THREADS)
    582 #define ENABLE_JSC_MULTIPLE_THREADS 1
    583 #endif
    584 
    585 /* On Windows, use QueryPerformanceCounter by default */
    586 #if OS(WINDOWS)
    587 #define WTF_USE_QUERY_PERFORMANCE_COUNTER  1
    588 #endif
    589 
    590 #if OS(WINCE) && !PLATFORM(QT)
    591 #define NOMINMAX       /* Windows min and max conflict with standard macros */
    592 #define NOSHLWAPI      /* shlwapi.h not available on WinCe */
    593 
    594 /* MSDN documentation says these functions are provided with uspce.lib.  But we cannot find this file. */
    595 #define __usp10__      /* disable "usp10.h" */
    596 
    597 #define _INC_ASSERT    /* disable "assert.h" */
    598 #define assert(x)
    599 
    600 #endif  /* OS(WINCE) && !PLATFORM(QT) */
    601 
    602 #if PLATFORM(QT)
    603 #define WTF_USE_QT4_UNICODE 1
    604 #elif OS(WINCE)
    605 #define WTF_USE_WINCE_UNICODE 1
    606 #elif PLATFORM(BREWMP)
    607 #define WTF_USE_BREWMP_UNICODE 1
    608 #elif PLATFORM(GTK)
    609 /* The GTK+ Unicode backend is configurable */
    610 #else
    611 #define WTF_USE_ICU_UNICODE 1
    612 #endif
    613 
    614 #if PLATFORM(MAC) && !PLATFORM(IOS)
    615 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_TIGER) && CPU(X86_64)
    616 #define WTF_USE_PLUGIN_HOST_PROCESS 1
    617 #endif
    618 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
    619 #define ENABLE_GESTURE_EVENTS 1
    620 #define ENABLE_RUBBER_BANDING 1
    621 #define WTF_USE_WK_SCROLLBAR_PAINTER 1
    622 #endif
    623 #if !defined(ENABLE_JAVA_BRIDGE)
    624 #define ENABLE_JAVA_BRIDGE 1
    625 #endif
    626 #if !defined(ENABLE_DASHBOARD_SUPPORT)
    627 #define ENABLE_DASHBOARD_SUPPORT 1
    628 #endif
    629 #define WTF_USE_CF 1
    630 #define WTF_USE_PTHREADS 1
    631 #define HAVE_PTHREAD_RWLOCK 1
    632 #define HAVE_READLINE 1
    633 #define HAVE_RUNLOOP_TIMER 1
    634 #define ENABLE_FULLSCREEN_API 1
    635 #define ENABLE_SMOOTH_SCROLLING 1
    636 #define ENABLE_WEB_ARCHIVE 1
    637 #endif /* PLATFORM(MAC) && !PLATFORM(IOS) */
    638 
    639 #if PLATFORM(CHROMIUM) && OS(DARWIN)
    640 #define WTF_USE_CF 1
    641 #define WTF_USE_PTHREADS 1
    642 #define HAVE_PTHREAD_RWLOCK 1
    643 #endif
    644 
    645 #if PLATFORM(BREWMP)
    646 #define ENABLE_SINGLE_THREADED 1
    647 #endif
    648 
    649 #if PLATFORM(QT) && OS(DARWIN)
    650 #define WTF_USE_CF 1
    651 #endif
    652 
    653 #if OS(DARWIN) && !defined(BUILDING_ON_TIGER) && !PLATFORM(GTK) && !PLATFORM(QT)
    654 #define ENABLE_PURGEABLE_MEMORY 1
    655 #endif
    656 
    657 #if PLATFORM(IOS)
    658 #define ENABLE_CONTEXT_MENUS 0
    659 #define ENABLE_DRAG_SUPPORT 0
    660 #define ENABLE_DATA_TRANSFER_ITEMS 0
    661 #define ENABLE_FTPDIR 1
    662 #define ENABLE_GEOLOCATION 1
    663 #define ENABLE_ICONDATABASE 0
    664 #define ENABLE_INSPECTOR 0
    665 #define ENABLE_JAVA_BRIDGE 0
    666 #define ENABLE_NETSCAPE_PLUGIN_API 0
    667 #define ENABLE_ORIENTATION_EVENTS 1
    668 #define ENABLE_REPAINT_THROTTLING 1
    669 #define HAVE_READLINE 1
    670 #define WTF_USE_CF 1
    671 #define WTF_USE_PTHREADS 1
    672 #define HAVE_PTHREAD_RWLOCK 1
    673 #define ENABLE_WEB_ARCHIVE 1
    674 #endif
    675 
    676 #if PLATFORM(ANDROID)
    677 #define WEBCORE_NAVIGATOR_VENDOR "Google Inc."
    678 
    679 #define LOG_DISABLED 1
    680 // This must be defined before we include FastMalloc.h in config.h.
    681 #define USE_SYSTEM_MALLOC 1
    682 
    683 // USE defines
    684 #define WTF_USE_PTHREADS 1
    685 #define WTF_USE_SKIA 1
    686 #if !defined WTF_USE_ACCELERATED_COMPOSITING
    687 #define WTF_USE_ACCELERATED_COMPOSITING 1
    688 #define ENABLE_3D_RENDERING 1
    689 #endif
    690 
    691 // ENABLE guards
    692 #define ENABLE_JAVA_BRIDGE 1
    693 // Prevents Webkit from drawing the caret in textfields and textareas
    694 // This prevents unnecessary invals.
    695 #define ENABLE_TEXT_CARET 1
    696 #define ENABLE_JAVASCRIPT_DEBUGGER 0
    697 #define ENABLE_ORIENTATION_EVENTS 1
    698 #if !defined(ENABLE_JIT) && !ENABLE(ANDROID_JSC_JIT)
    699 #define ENABLE_JIT 0
    700 #endif
    701 #define ENABLE_WEB_ARCHIVE 1
    702 #define ENABLE_FULLSCREEN_API 1
    703 #define ENABLE_DOM_STORAGE 1
    704 #define ENABLE_FTPDIR 0
    705 #ifndef ENABLE_SVG
    706 #define ENABLE_SVG 0
    707 #endif
    708 #define ENABLE_VIDEO 1
    709 #if ENABLE_SVG
    710 #if !defined(ENABLE_SVG_ANIMATION)
    711 #define ENABLE_SVG_ANIMATION 0
    712 #endif
    713 #define ENABLE_SVG_AS_IMAGE 1
    714 #define ENABLE_SVG_FILTERS 1
    715 #define ENABLE_SVG_FONTS 1
    716 #define ENABLE_SVG_FOREIGN_OBJECT 1
    717 #define ENABLE_SVG_USE 1
    718 #endif
    719 #define ENABLE_XBL 0
    720 #define ENABLE_XHTMLMP 0
    721 #define ENABLE_XPATH 1
    722 #define ENABLE_XSLT 1
    723 #define ENABLE_OFFLINE_WEB_APPLICATIONS 1
    724 #define ENABLE_TOUCH_EVENTS 1
    725 #define ENABLE_GEOLOCATION 1
    726 #define ENABLE_INSPECTOR 0
    727 #define ENABLE_EVENT_SOURCE 0
    728 #define ENABLE_DEVICE_ORIENTATION 1
    729 #define ENABLE_FILE_READER 1
    730 #define ENABLE_BLOB 1
    731 // Converts ListBoxes to dropdown popup lists.
    732 #define ENABLE_NO_LISTBOX_RENDERING 1
    733 #define ENABLE_LINK_PREFETCH 1
    734 #define ENABLE_WEB_TIMING 1
    735 
    736 // Android ENABLE guards not present upstream
    737 #define ENABLE_COMPOSITED_FIXED_ELEMENTS 1 // FIXME: Rename to ENABLE_ANDROID_COMPOSITED_FIXED_ELEMENTS
    738 #define ENABLE_APPLICATION_INSTALLED 1 // FIXME: Rename to ENABLE_ANDROID_APPLICATION_INSTALLED
    739 #define ENABLE_ANDROID_INSTALLABLE_WEB_APPS 1
    740 // Enable scrollable divs in separate layers.  This might be upstreamed to
    741 // webkit.org but for now, it is just an Android feature.
    742 #define ENABLE_ANDROID_OVERFLOW_SCROLL 1
    743 
    744 // Other Android guards not present upstream
    745 #define ANDROID_FLATTEN_FRAMESET
    746 #define ANDROID_LAYOUT
    747 #define ANDROID_FIX
    748 // Ensure that the fixed elements are always relative to the top document.
    749 #define ANDROID_FIXED_ELEMENTS
    750 // Passes the webkit-originated changes of a focused textfield to our UI
    751 // thread
    752 #define ANDROID_ACCEPT_CHANGES_TO_FOCUSED_TEXTFIELDS
    753 // Allow us to turn off the blinking caret as desired.
    754 #define ANDROID_ALLOW_TURNING_OFF_CARET
    755 #define ANDROID_META_SUPPORT
    756 #define ANDROID_MULTIPLE_WINDOWS
    757 #define ANDROID_CSS_RING
    758 #define ANDROID_CSS_TAP_HIGHLIGHT_COLOR
    759 #define ANDROID_BLOCK_NETWORK_IMAGE
    760 // Changes needed to support native plugins (npapi.h). If the change is generic,
    761 // it may be under a different #define (see: PLUGIN_PLATFORM_SETVALUE,
    762 // PLUGIN_SCHEDULE_TIMER)
    763 #define ANDROID_PLUGINS
    764 // This enables a portable implementation of NPN_[Un]ScheduleTimer
    765 // Will submit this as a patch to apple
    766 #define PLUGIN_SCHEDULE_TIMER // FIXME: Rename to ANDROID_PLUGIN_SCHEDULE_TIMER
    767 // This adds platformInit() and platformSetValue() to pluginview
    768 // Will submit this as a patch to apple
    769 #define PLUGIN_PLATFORM_SETVALUE // FIXME: Rename to ANDROID_PLUGIN_PLATFORM_SETVALUE
    770 // This enables logging the DOM tree, Render tree even for the release build
    771 #define ANDROID_DOM_LOGGING
    772 // Notify WebViewCore when a clipped out rectangle is drawn,
    773 // so that all invals are captured by the display tree.
    774 #define ANDROID_CAPTURE_OFFSCREEN_PAINTS
    775 // Enable dumping the display tree to a file (triggered in WebView.java)
    776 #define ANDROID_DUMP_DISPLAY_TREE
    777 // Animated GIF support.
    778 #define ANDROID_ANIMATED_GIF
    779 // apple-touch-icon support in <link> tags
    780 #define ANDROID_APPLE_TOUCH_ICON
    781 // track changes to the style that may change what is drawn
    782 #define ANDROID_STYLE_VERSION
    783 
    784 #if !defined(WTF_USE_CHROME_NETWORK_STACK)
    785 #define WTF_USE_CHROME_NETWORK_STACK 0
    786 #endif /* !defined(WTF_USE_CHROME_NETWORK_STACK) */
    787 
    788 // This is present in JavaScriptCore/config.h, which Android does not use.
    789 #define WTF_CHANGES 1
    790 #endif /* PLATFORM(ANDROID) */
    791 
    792 #if PLATFORM(WIN) && !OS(WINCE)
    793 #define WTF_USE_CF 1
    794 #define WTF_USE_PTHREADS 0
    795 #endif
    796 
    797 #if PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(CHROMIUM) && !defined(WIN_CAIRO)
    798 #define WTF_USE_CFNETWORK 1
    799 #endif
    800 
    801 #if USE(CFNETWORK) || PLATFORM(MAC)
    802 #define WTF_USE_CFURLCACHE 1
    803 #define WTF_USE_CFURLSTORAGESESSIONS 1
    804 #endif
    805 
    806 #if PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(CHROMIUM) && !PLATFORM(QT)
    807 #define ENABLE_WEB_ARCHIVE 1
    808 #endif
    809 
    810 #if PLATFORM(WX)
    811 #define ENABLE_ASSEMBLER 1
    812 #define ENABLE_GLOBAL_FASTMALLOC_NEW 0
    813 #if OS(DARWIN)
    814 #define WTF_USE_CF 1
    815 #ifndef BUILDING_ON_TIGER
    816 #define WTF_USE_CORE_TEXT 1
    817 #define ENABLE_WEB_ARCHIVE 1
    818 #else
    819 #define WTF_USE_ATSUI 1
    820 #endif
    821 #endif
    822 #endif
    823 
    824 #if PLATFORM(GTK)
    825 #if HAVE(PTHREAD_H)
    826 #define WTF_USE_PTHREADS 1
    827 #define HAVE_PTHREAD_RWLOCK 1
    828 #endif
    829 #endif
    830 
    831 #if PLATFORM(HAIKU)
    832 #define HAVE_POSIX_MEMALIGN 1
    833 #define WTF_USE_CURL 1
    834 #define WTF_USE_PTHREADS 1
    835 #define HAVE_PTHREAD_RWLOCK 1
    836 #define USE_SYSTEM_MALLOC 1
    837 #define ENABLE_NETSCAPE_PLUGIN_API 0
    838 #endif
    839 
    840 #if PLATFORM(BREWMP)
    841 #define USE_SYSTEM_MALLOC 1
    842 #endif
    843 
    844 #if PLATFORM(BREWMP_SIMULATOR)
    845 #define ENABLE_JIT 0
    846 #endif
    847 
    848 #if !defined(HAVE_ACCESSIBILITY)
    849 #if PLATFORM(IOS) || PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(CHROMIUM)
    850 #define HAVE_ACCESSIBILITY 1
    851 #endif
    852 #endif /* !defined(HAVE_ACCESSIBILITY) */
    853 
    854 #if OS(UNIX) && !OS(SYMBIAN)
    855 #define HAVE_SIGNAL_H 1
    856 #endif
    857 
    858 #if !defined(HAVE_STRNSTR)
    859 #if OS(DARWIN) || OS(FREEBSD)
    860 #define HAVE_STRNSTR 1
    861 #endif
    862 #endif
    863 
    864 #if !OS(WINDOWS) && !OS(SOLARIS) && !OS(QNX) \
    865     && !OS(SYMBIAN) && !OS(HAIKU) && !OS(RVCT) \
    866     && !OS(ANDROID) && !PLATFORM(BREWMP)
    867 #define HAVE_TM_GMTOFF 1
    868 #define HAVE_TM_ZONE 1
    869 #define HAVE_TIMEGM 1
    870 #endif
    871 
    872 #if OS(DARWIN)
    873 
    874 #define HAVE_ERRNO_H 1
    875 #define HAVE_LANGINFO_H 1
    876 #define HAVE_MMAP 1
    877 #define HAVE_MERGESORT 1
    878 #define HAVE_SBRK 1
    879 #define HAVE_STRINGS_H 1
    880 #define HAVE_SYS_PARAM_H 1
    881 #define HAVE_SYS_TIME_H 1
    882 #define HAVE_SYS_TIMEB_H 1
    883 #define WTF_USE_ACCELERATE 1
    884 
    885 #if !defined(TARGETING_TIGER) && !defined(TARGETING_LEOPARD)
    886 
    887 #define HAVE_DISPATCH_H 1
    888 #define HAVE_HOSTED_CORE_ANIMATION 1
    889 
    890 #if !PLATFORM(IOS)
    891 #define HAVE_MADV_FREE_REUSE 1
    892 #define HAVE_MADV_FREE 1
    893 #define HAVE_PTHREAD_SETNAME_NP 1
    894 #endif
    895 
    896 #endif
    897 
    898 #if PLATFORM(IOS)
    899 #define HAVE_MADV_FREE 1
    900 #endif
    901 
    902 #elif OS(WINDOWS)
    903 
    904 #if OS(WINCE)
    905 #define HAVE_ERRNO_H 0
    906 #else
    907 #define HAVE_SYS_TIMEB_H 1
    908 #define HAVE_ALIGNED_MALLOC 1
    909 #define HAVE_ISDEBUGGERPRESENT 1
    910 #endif
    911 #define HAVE_VIRTUALALLOC 1
    912 
    913 #elif OS(SYMBIAN)
    914 
    915 #define HAVE_ERRNO_H 1
    916 #define HAVE_MMAP 0
    917 #define HAVE_SBRK 1
    918 
    919 #define HAVE_SYS_TIME_H 1
    920 #define HAVE_STRINGS_H 1
    921 
    922 #if !COMPILER(RVCT)
    923 #define HAVE_SYS_PARAM_H 1
    924 #endif
    925 
    926 #elif PLATFORM(BREWMP)
    927 
    928 #define HAVE_ERRNO_H 1
    929 
    930 #elif OS(QNX)
    931 
    932 #define HAVE_ERRNO_H 1
    933 #define HAVE_MMAP 1
    934 #define HAVE_SBRK 1
    935 #define HAVE_STRINGS_H 1
    936 #define HAVE_SYS_PARAM_H 1
    937 #define HAVE_SYS_TIME_H 1
    938 
    939 #elif OS(ANDROID)
    940 
    941 #define HAVE_ERRNO_H 1
    942 #define HAVE_LANGINFO_H 0
    943 #define HAVE_MMAP 1
    944 #define HAVE_SBRK 1
    945 #define HAVE_STRINGS_H 1
    946 #define HAVE_SYS_PARAM_H 1
    947 #define HAVE_SYS_TIME_H 1
    948 
    949 #else
    950 
    951 /* FIXME: is this actually used or do other platforms generate their own config.h? */
    952 
    953 #define HAVE_ERRNO_H 1
    954 /* As long as Haiku doesn't have a complete support of locale this will be disabled. */
    955 #if !OS(HAIKU)
    956 #define HAVE_LANGINFO_H 1
    957 #endif
    958 #define HAVE_MMAP 1
    959 #define HAVE_SBRK 1
    960 #define HAVE_STRINGS_H 1
    961 #define HAVE_SYS_PARAM_H 1
    962 #define HAVE_SYS_TIME_H 1
    963 
    964 #endif
    965 
    966 /* ENABLE macro defaults */
    967 
    968 #if PLATFORM(QT)
    969 /* We must not customize the global operator new and delete for the Qt port. */
    970 #define ENABLE_GLOBAL_FASTMALLOC_NEW 0
    971 #if !OS(UNIX) || OS(SYMBIAN)
    972 #define USE_SYSTEM_MALLOC 1
    973 #endif
    974 #endif
    975 
    976 /* fastMalloc match validation allows for runtime verification that
    977    new is matched by delete, fastMalloc is matched by fastFree, etc. */
    978 #if !defined(ENABLE_FAST_MALLOC_MATCH_VALIDATION)
    979 #define ENABLE_FAST_MALLOC_MATCH_VALIDATION 0
    980 #endif
    981 
    982 #if !defined(ENABLE_ICONDATABASE)
    983 #define ENABLE_ICONDATABASE 1
    984 #endif
    985 
    986 #if !defined(ENABLE_DATABASE)
    987 #define ENABLE_DATABASE 1
    988 #endif
    989 
    990 #if !defined(ENABLE_JAVASCRIPT_DEBUGGER)
    991 #define ENABLE_JAVASCRIPT_DEBUGGER 1
    992 #endif
    993 
    994 #if !defined(ENABLE_FTPDIR)
    995 #define ENABLE_FTPDIR 1
    996 #endif
    997 
    998 #if !defined(ENABLE_CONTEXT_MENUS)
    999 #define ENABLE_CONTEXT_MENUS 1
   1000 #endif
   1001 
   1002 #if !defined(ENABLE_DRAG_SUPPORT)
   1003 #define ENABLE_DRAG_SUPPORT 1
   1004 #endif
   1005 
   1006 #if !defined(ENABLE_DATA_TRANSFER_ITEMS)
   1007 #define ENABLE_DATA_TRANSFER_ITEMS 0
   1008 #endif
   1009 
   1010 #if !defined(ENABLE_DASHBOARD_SUPPORT)
   1011 #define ENABLE_DASHBOARD_SUPPORT 0
   1012 #endif
   1013 
   1014 #if !defined(ENABLE_INSPECTOR)
   1015 #define ENABLE_INSPECTOR 1
   1016 #endif
   1017 
   1018 #if !defined(ENABLE_JAVA_BRIDGE)
   1019 #define ENABLE_JAVA_BRIDGE 0
   1020 #endif
   1021 
   1022 #if !defined(ENABLE_NETSCAPE_PLUGIN_API)
   1023 #define ENABLE_NETSCAPE_PLUGIN_API 1
   1024 #endif
   1025 
   1026 #if !defined(ENABLE_NETSCAPE_PLUGIN_METADATA_CACHE)
   1027 #define ENABLE_NETSCAPE_PLUGIN_METADATA_CACHE 0
   1028 #endif
   1029 
   1030 #if !defined(ENABLE_PURGEABLE_MEMORY)
   1031 #define ENABLE_PURGEABLE_MEMORY 0
   1032 #endif
   1033 
   1034 #if !defined(WTF_USE_PLUGIN_HOST_PROCESS)
   1035 #define WTF_USE_PLUGIN_HOST_PROCESS 0
   1036 #endif
   1037 
   1038 #if !defined(ENABLE_ORIENTATION_EVENTS)
   1039 #define ENABLE_ORIENTATION_EVENTS 0
   1040 #endif
   1041 
   1042 #if !defined(ENABLE_OPCODE_STATS)
   1043 #define ENABLE_OPCODE_STATS 0
   1044 #endif
   1045 
   1046 #if !defined(ENABLE_GLOBAL_FASTMALLOC_NEW)
   1047 #define ENABLE_GLOBAL_FASTMALLOC_NEW 1
   1048 #endif
   1049 
   1050 #define ENABLE_DEBUG_WITH_BREAKPOINT 0
   1051 #define ENABLE_SAMPLING_COUNTERS 0
   1052 #define ENABLE_SAMPLING_FLAGS 0
   1053 #define ENABLE_OPCODE_SAMPLING 0
   1054 #define ENABLE_CODEBLOCK_SAMPLING 0
   1055 #if ENABLE(CODEBLOCK_SAMPLING) && !ENABLE(OPCODE_SAMPLING)
   1056 #error "CODEBLOCK_SAMPLING requires OPCODE_SAMPLING"
   1057 #endif
   1058 #if ENABLE(OPCODE_SAMPLING) || ENABLE(SAMPLING_FLAGS)
   1059 #define ENABLE_SAMPLING_THREAD 1
   1060 #endif
   1061 
   1062 #if !defined(ENABLE_GEOLOCATION)
   1063 #define ENABLE_GEOLOCATION 0
   1064 #endif
   1065 
   1066 #if !defined(ENABLE_GESTURE_RECOGNIZER)
   1067 #define ENABLE_GESTURE_RECOGNIZER 0
   1068 #endif
   1069 
   1070 #if !defined(ENABLE_NOTIFICATIONS)
   1071 #define ENABLE_NOTIFICATIONS 0
   1072 #endif
   1073 
   1074 #if PLATFORM(IOS)
   1075 #define ENABLE_TEXT_CARET 0
   1076 #endif
   1077 
   1078 #if !defined(ENABLE_TEXT_CARET)
   1079 #define ENABLE_TEXT_CARET 1
   1080 #endif
   1081 
   1082 #if !defined(ENABLE_ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL)
   1083 #define ENABLE_ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL 0
   1084 #endif
   1085 
   1086 #if !defined(ENABLE_FULLSCREEN_API)
   1087 #define ENABLE_FULLSCREEN_API 0
   1088 #endif
   1089 
   1090 #if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32_64)
   1091 #if (CPU(X86_64) && (OS(UNIX) || OS(WINDOWS))) \
   1092     || (CPU(IA64) && !CPU(IA64_32)) \
   1093     || CPU(ALPHA) \
   1094     || CPU(SPARC64) \
   1095     || CPU(S390X) \
   1096     || CPU(PPC64)
   1097 #define WTF_USE_JSVALUE64 1
   1098 #else
   1099 #define WTF_USE_JSVALUE32_64 1
   1100 #endif
   1101 #endif /* !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32_64) */
   1102 
   1103 #if !defined(ENABLE_REPAINT_THROTTLING)
   1104 #define ENABLE_REPAINT_THROTTLING 0
   1105 #endif
   1106 
   1107 /* Disable the JIT on versions of GCC prior to 4.1 */
   1108 #if !defined(ENABLE_JIT) && COMPILER(GCC) && !GCC_VERSION_AT_LEAST(4, 1, 0)
   1109 #define ENABLE_JIT 0
   1110 #endif
   1111 
   1112 /* JIT is not implemented for 64 bit on MSVC */
   1113 #if !defined(ENABLE_JIT) && COMPILER(MSVC) && CPU(X86_64)
   1114 #define ENABLE_JIT 0
   1115 #endif
   1116 
   1117 /* The JIT is enabled by default on all x86, x64-64, ARM & MIPS platforms. */
   1118 #if !defined(ENABLE_JIT) \
   1119     && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(MIPS)) \
   1120     && (OS(DARWIN) || !COMPILER(GCC) || GCC_VERSION_AT_LEAST(4, 1, 0)) \
   1121     && !OS(WINCE)
   1122 #define ENABLE_JIT 1
   1123 #endif
   1124 
   1125 /* Currently only implemented for JSVALUE64, only tested on PLATFORM(MAC) */
   1126 #if ENABLE(JIT) && USE(JSVALUE64) && PLATFORM(MAC)
   1127 #define ENABLE_DFG_JIT 1
   1128 /* Enabled with restrictions to circumvent known performance regressions. */
   1129 #define ENABLE_DFG_JIT_RESTRICTIONS 1
   1130 #endif
   1131 
   1132 /* Ensure that either the JIT or the interpreter has been enabled. */
   1133 #if !defined(ENABLE_INTERPRETER) && !ENABLE(JIT)
   1134 #define ENABLE_INTERPRETER 1
   1135 #endif
   1136 #if !(ENABLE(JIT) || ENABLE(INTERPRETER))
   1137 #error You have to have at least one execution model enabled to build JSC
   1138 #endif
   1139 
   1140 #if CPU(SH4) && PLATFORM(QT)
   1141 #define ENABLE_JIT 1
   1142 #define ENABLE_YARR 1
   1143 #define ENABLE_YARR_JIT 1
   1144 #define WTF_USE_JIT_STUB_ARGUMENT_REGISTER 1
   1145 #define ENABLE_ASSEMBLER 1
   1146 #endif
   1147 
   1148 /* Configure the JIT */
   1149 #if ENABLE(JIT)
   1150     #if CPU(ARM)
   1151     #if !defined(ENABLE_JIT_USE_SOFT_MODULO) && WTF_ARM_ARCH_AT_LEAST(5)
   1152     #define ENABLE_JIT_USE_SOFT_MODULO 1
   1153     #endif
   1154     #endif
   1155 
   1156     #ifndef ENABLE_JIT_OPTIMIZE_CALL
   1157     #define ENABLE_JIT_OPTIMIZE_CALL 1
   1158     #endif
   1159     #ifndef ENABLE_JIT_OPTIMIZE_NATIVE_CALL
   1160     #define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 1
   1161     #endif
   1162     #ifndef ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS
   1163     #define ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS 1
   1164     #endif
   1165     #ifndef ENABLE_JIT_OPTIMIZE_METHOD_CALLS
   1166     #define ENABLE_JIT_OPTIMIZE_METHOD_CALLS 1
   1167     #endif
   1168 #endif
   1169 
   1170 #if CPU(X86) && COMPILER(MSVC)
   1171 #define JSC_HOST_CALL __fastcall
   1172 #elif CPU(X86) && COMPILER(GCC)
   1173 #define JSC_HOST_CALL __attribute__ ((fastcall))
   1174 #else
   1175 #define JSC_HOST_CALL
   1176 #endif
   1177 
   1178 /* Configure the interpreter */
   1179 #if COMPILER(GCC) || (RVCT_VERSION_AT_LEAST(4, 0, 0, 0) && defined(__GNUC__))
   1180 #define HAVE_COMPUTED_GOTO 1
   1181 #endif
   1182 #if HAVE(COMPUTED_GOTO) && ENABLE(INTERPRETER)
   1183 #define ENABLE_COMPUTED_GOTO_INTERPRETER 1
   1184 #endif
   1185 
   1186 /* Regular Expression Tracing - Set to 1 to trace RegExp's in jsc.  Results dumped at exit */
   1187 #define ENABLE_REGEXP_TRACING 0
   1188 
   1189 /* Yet Another Regex Runtime - turned on by default for JIT enabled ports. */
   1190 #if PLATFORM(CHROMIUM)
   1191 #define ENABLE_YARR_JIT 0
   1192 
   1193 #elif ENABLE(JIT) && !defined(ENABLE_YARR_JIT)
   1194 #define ENABLE_YARR_JIT 1
   1195 
   1196 /* Setting this flag compares JIT results with interpreter results. */
   1197 #define ENABLE_YARR_JIT_DEBUG 0
   1198 #endif
   1199 
   1200 #if ENABLE(JIT) || ENABLE(YARR_JIT)
   1201 #define ENABLE_ASSEMBLER 1
   1202 #endif
   1203 /* Setting this flag prevents the assembler from using RWX memory; this may improve
   1204    security but currectly comes at a significant performance cost. */
   1205 #if PLATFORM(IOS)
   1206 #define ENABLE_ASSEMBLER_WX_EXCLUSIVE 1
   1207 #endif
   1208 
   1209 /* Pick which allocator to use; we only need an executable allocator if the assembler is compiled in.
   1210    On x86-64 we use a single fixed mmap, on other platforms we mmap on demand. */
   1211 #if ENABLE(ASSEMBLER)
   1212 #if CPU(X86_64)
   1213 #define ENABLE_EXECUTABLE_ALLOCATOR_FIXED 1
   1214 #else
   1215 #define ENABLE_EXECUTABLE_ALLOCATOR_DEMAND 1
   1216 #endif
   1217 #endif
   1218 
   1219 #if !defined(ENABLE_PAN_SCROLLING) && OS(WINDOWS)
   1220 #define ENABLE_PAN_SCROLLING 1
   1221 #endif
   1222 
   1223 #if !defined(ENABLE_SMOOTH_SCROLLING)
   1224 #define ENABLE_SMOOTH_SCROLLING 0
   1225 #endif
   1226 
   1227 #if !defined(ENABLE_WEB_ARCHIVE)
   1228 #define ENABLE_WEB_ARCHIVE 0
   1229 #endif
   1230 
   1231 /* Use the QXmlStreamReader implementation for XMLDocumentParser */
   1232 /* Use the QXmlQuery implementation for XSLTProcessor */
   1233 #if PLATFORM(QT)
   1234 #define WTF_USE_QXMLSTREAM 1
   1235 #define WTF_USE_QXMLQUERY 1
   1236 #endif
   1237 
   1238 #if PLATFORM(MAC)
   1239 /* Complex text framework */
   1240 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
   1241 #define WTF_USE_ATSUI 0
   1242 #define WTF_USE_CORE_TEXT 1
   1243 #else
   1244 #define WTF_USE_ATSUI 1
   1245 #define WTF_USE_CORE_TEXT 0
   1246 #endif
   1247 #endif
   1248 
   1249 /* Accelerated compositing */
   1250 #if (PLATFORM(MAC) && !defined(BUILDING_ON_TIGER)) || PLATFORM(IOS) || PLATFORM(QT) || (PLATFORM(WIN) && !OS(WINCE) &&!defined(WIN_CAIRO))
   1251 #define WTF_USE_ACCELERATED_COMPOSITING 1
   1252 #endif
   1253 
   1254 #if (PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)) || PLATFORM(IOS)
   1255 #define WTF_USE_PROTECTION_SPACE_AUTH_CALLBACK 1
   1256 #endif
   1257 
   1258 #if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
   1259 #define WTF_USE_AVFOUNDATION 1
   1260 #endif
   1261 
   1262 #if COMPILER(GCC)
   1263 #define WARN_UNUSED_RETURN __attribute__ ((warn_unused_result))
   1264 #else
   1265 #define WARN_UNUSED_RETURN
   1266 #endif
   1267 
   1268 #if !ENABLE(NETSCAPE_PLUGIN_API) || (ENABLE(NETSCAPE_PLUGIN_API) && ((OS(UNIX) && (PLATFORM(QT) || PLATFORM(WX))) || PLATFORM(GTK)))
   1269 #define ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH 1
   1270 #endif
   1271 
   1272 /* Set up a define for a common error that is intended to cause a build error -- thus the space after Error. */
   1273 #define WTF_PLATFORM_CFNETWORK Error USE_macro_should_be_used_with_CFNETWORK
   1274 
   1275 #define ENABLE_JSC_ZOMBIES 0
   1276 
   1277 /* FIXME: Eventually we should enable this for all platforms and get rid of the define. */
   1278 #if PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(QT)
   1279 #define WTF_USE_PLATFORM_STRATEGIES 1
   1280 #endif
   1281 
   1282 #if PLATFORM(WIN)
   1283 #define WTF_USE_CROSS_PLATFORM_CONTEXT_MENUS 1
   1284 #endif
   1285 
   1286 /* Geolocation request policy. pre-emptive policy is to acquire user permission before acquiring location.
   1287    Client based implementations will have option to choose between pre-emptive and nonpre-emptive permission policy.
   1288    pre-emptive permission policy is enabled by default for all client-based implementations. */
   1289 #if ENABLE(CLIENT_BASED_GEOLOCATION)
   1290 #define WTF_USE_PREEMPT_GEOLOCATION_PERMISSION 1
   1291 #endif
   1292 
   1293 #if CPU(ARM_THUMB2)
   1294 #define ENABLE_BRANCH_COMPACTION 1
   1295 #endif
   1296 
   1297 #if ENABLE(GLIB_SUPPORT)
   1298 #include "GTypedefs.h"
   1299 #endif
   1300 
   1301 /* FIXME: This define won't be needed once #27551 is fully landed. However,
   1302    since most ports try to support sub-project independence, adding new headers
   1303    to WTF causes many ports to break, and so this way we can address the build
   1304    breakages one port at a time. */
   1305 #define WTF_USE_EXPORT_MACROS 0
   1306 
   1307 #if PLATFORM(QT) || PLATFORM(GTK)
   1308 #define WTF_USE_UNIX_DOMAIN_SOCKETS 1
   1309 #endif
   1310 
   1311 #endif /* WTF_Platform_h */
   1312