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 // Force LOG_ERROR() to be enabled in all builds. All other logging and
    680 // assertions are enabled in debug builds only.
    681 #define ERROR_DISABLED 0
    682 
    683 // This must be defined before we include FastMalloc.h in config.h.
    684 #define USE_SYSTEM_MALLOC 1
    685 
    686 // USE defines
    687 #define WTF_USE_PTHREADS 1
    688 #define WTF_USE_SKIA 1
    689 #if !defined WTF_USE_ACCELERATED_COMPOSITING
    690 #define WTF_USE_ACCELERATED_COMPOSITING 1
    691 #define ENABLE_3D_RENDERING 1
    692 #endif
    693 
    694 // ENABLE guards
    695 #define ENABLE_JAVA_BRIDGE 1
    696 // Prevents Webkit from drawing the caret in textfields and textareas
    697 // This prevents unnecessary invals.
    698 #define ENABLE_TEXT_CARET 1
    699 #define ENABLE_JAVASCRIPT_DEBUGGER 0
    700 #define ENABLE_ORIENTATION_EVENTS 1
    701 #if !defined(ENABLE_JIT) && !ENABLE(ANDROID_JSC_JIT)
    702 #define ENABLE_JIT 0
    703 #endif
    704 #define ENABLE_WEB_ARCHIVE 1
    705 #define ENABLE_FULLSCREEN_API 1
    706 #define ENABLE_DOM_STORAGE 1
    707 #define ENABLE_FTPDIR 0
    708 #ifndef ENABLE_SVG
    709 #define ENABLE_SVG 0
    710 #endif
    711 #define ENABLE_VIDEO 1
    712 #if ENABLE_SVG
    713 #if !defined(ENABLE_SVG_ANIMATION)
    714 #define ENABLE_SVG_ANIMATION 0
    715 #endif
    716 #define ENABLE_SVG_AS_IMAGE 1
    717 #define ENABLE_SVG_FILTERS 1
    718 #define ENABLE_SVG_FONTS 1
    719 #define ENABLE_SVG_FOREIGN_OBJECT 1
    720 #define ENABLE_SVG_USE 1
    721 #endif
    722 #define ENABLE_XBL 0
    723 #define ENABLE_XHTMLMP 0
    724 #define ENABLE_XPATH 1
    725 #define ENABLE_XSLT 1
    726 #define ENABLE_OFFLINE_WEB_APPLICATIONS 1
    727 #define ENABLE_TOUCH_EVENTS 1
    728 #define ENABLE_GEOLOCATION 1
    729 #define ENABLE_CLIENT_BASED_GEOLOCATION 1
    730 #define ENABLE_INSPECTOR 0
    731 #define ENABLE_EVENT_SOURCE 0
    732 #define ENABLE_DEVICE_ORIENTATION 1
    733 #define ENABLE_FILE_READER 1
    734 #define ENABLE_BLOB 1
    735 // Converts ListBoxes to dropdown popup lists.
    736 #define ENABLE_NO_LISTBOX_RENDERING 1
    737 #define ENABLE_LINK_PREFETCH 1
    738 #define ENABLE_WEB_TIMING 1
    739 #define ENABLE_MEDIA_CAPTURE 1
    740 
    741 // Android ENABLE guards not present upstream
    742 #define ENABLE_COMPOSITED_FIXED_ELEMENTS 1 // FIXME: Rename to ENABLE_ANDROID_COMPOSITED_FIXED_ELEMENTS
    743 #define ENABLE_APPLICATION_INSTALLED 1 // FIXME: Rename to ENABLE_ANDROID_APPLICATION_INSTALLED
    744 #define ENABLE_ANDROID_INSTALLABLE_WEB_APPS 1
    745 // Enable scrollable divs in separate layers.  This might be upstreamed to
    746 // webkit.org but for now, it is just an Android feature.
    747 #define ENABLE_ANDROID_OVERFLOW_SCROLL 1
    748 
    749 // Other Android guards not present upstream
    750 #define ANDROID_FLATTEN_FRAMESET
    751 #define ANDROID_LAYOUT
    752 #define ANDROID_FIX
    753 // Ensure that the fixed elements are always relative to the top document.
    754 #define ANDROID_FIXED_ELEMENTS
    755 // Passes the webkit-originated changes of a focused textfield to our UI
    756 // thread
    757 #define ANDROID_ACCEPT_CHANGES_TO_FOCUSED_TEXTFIELDS
    758 #define ANDROID_META_SUPPORT
    759 #define ANDROID_MULTIPLE_WINDOWS
    760 #define ANDROID_CSS_TAP_HIGHLIGHT_COLOR
    761 #define ANDROID_BLOCK_NETWORK_IMAGE
    762 // Changes needed to support native plugins (npapi.h). If the change is generic,
    763 // it may be under a different #define (see: PLUGIN_PLATFORM_SETVALUE,
    764 // PLUGIN_SCHEDULE_TIMER)
    765 #define ANDROID_PLUGINS
    766 // This enables a portable implementation of NPN_[Un]ScheduleTimer
    767 // Will submit this as a patch to apple
    768 #define PLUGIN_SCHEDULE_TIMER // FIXME: Rename to ANDROID_PLUGIN_SCHEDULE_TIMER
    769 // This adds platformInit() and platformSetValue() to pluginview
    770 // Will submit this as a patch to apple
    771 #define PLUGIN_PLATFORM_SETVALUE // FIXME: Rename to ANDROID_PLUGIN_PLATFORM_SETVALUE
    772 // This enables logging the DOM tree, Render tree even for the release build
    773 #define ANDROID_DOM_LOGGING
    774 // Notify WebViewCore when a clipped out rectangle is drawn,
    775 // so that all invals are captured by the display tree.
    776 #define ANDROID_CAPTURE_OFFSCREEN_PAINTS
    777 // Enable dumping the display tree to a file (triggered in WebView.java)
    778 #define ANDROID_DUMP_DISPLAY_TREE
    779 // Animated GIF support.
    780 #define ANDROID_ANIMATED_GIF
    781 // apple-touch-icon support in <link> tags
    782 #define ANDROID_APPLE_TOUCH_ICON
    783 
    784 // This is present in JavaScriptCore/config.h, which Android does not use.
    785 #define WTF_CHANGES 1
    786 #endif /* PLATFORM(ANDROID) */
    787 
    788 #if PLATFORM(WIN) && !OS(WINCE)
    789 #define WTF_USE_CF 1
    790 #define WTF_USE_PTHREADS 0
    791 #endif
    792 
    793 #if PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(CHROMIUM) && !defined(WIN_CAIRO)
    794 #define WTF_USE_CFNETWORK 1
    795 #endif
    796 
    797 #if USE(CFNETWORK) || PLATFORM(MAC)
    798 #define WTF_USE_CFURLCACHE 1
    799 #define WTF_USE_CFURLSTORAGESESSIONS 1
    800 #endif
    801 
    802 #if PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(CHROMIUM) && !PLATFORM(QT)
    803 #define ENABLE_WEB_ARCHIVE 1
    804 #endif
    805 
    806 #if PLATFORM(WX)
    807 #define ENABLE_ASSEMBLER 1
    808 #define ENABLE_GLOBAL_FASTMALLOC_NEW 0
    809 #if OS(DARWIN)
    810 #define WTF_USE_CF 1
    811 #ifndef BUILDING_ON_TIGER
    812 #define WTF_USE_CORE_TEXT 1
    813 #define ENABLE_WEB_ARCHIVE 1
    814 #else
    815 #define WTF_USE_ATSUI 1
    816 #endif
    817 #endif
    818 #endif
    819 
    820 #if PLATFORM(GTK)
    821 #if HAVE(PTHREAD_H)
    822 #define WTF_USE_PTHREADS 1
    823 #define HAVE_PTHREAD_RWLOCK 1
    824 #endif
    825 #endif
    826 
    827 #if PLATFORM(HAIKU)
    828 #define HAVE_POSIX_MEMALIGN 1
    829 #define WTF_USE_CURL 1
    830 #define WTF_USE_PTHREADS 1
    831 #define HAVE_PTHREAD_RWLOCK 1
    832 #define USE_SYSTEM_MALLOC 1
    833 #define ENABLE_NETSCAPE_PLUGIN_API 0
    834 #endif
    835 
    836 #if PLATFORM(BREWMP)
    837 #define USE_SYSTEM_MALLOC 1
    838 #endif
    839 
    840 #if PLATFORM(BREWMP_SIMULATOR)
    841 #define ENABLE_JIT 0
    842 #endif
    843 
    844 #if !defined(HAVE_ACCESSIBILITY)
    845 #if PLATFORM(IOS) || PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(CHROMIUM)
    846 #define HAVE_ACCESSIBILITY 1
    847 #endif
    848 #endif /* !defined(HAVE_ACCESSIBILITY) */
    849 
    850 #if OS(UNIX) && !OS(SYMBIAN)
    851 #define HAVE_SIGNAL_H 1
    852 #endif
    853 
    854 #if !defined(HAVE_STRNSTR)
    855 #if OS(DARWIN) || OS(FREEBSD)
    856 #define HAVE_STRNSTR 1
    857 #endif
    858 #endif
    859 
    860 #if !OS(WINDOWS) && !OS(SOLARIS) && !OS(QNX) \
    861     && !OS(SYMBIAN) && !OS(HAIKU) && !OS(RVCT) \
    862     && !OS(ANDROID) && !PLATFORM(BREWMP)
    863 #define HAVE_TM_GMTOFF 1
    864 #define HAVE_TM_ZONE 1
    865 #define HAVE_TIMEGM 1
    866 #endif
    867 
    868 #if OS(DARWIN)
    869 
    870 #define HAVE_ERRNO_H 1
    871 #define HAVE_LANGINFO_H 1
    872 #define HAVE_MMAP 1
    873 #define HAVE_MERGESORT 1
    874 #define HAVE_SBRK 1
    875 #define HAVE_STRINGS_H 1
    876 #define HAVE_SYS_PARAM_H 1
    877 #define HAVE_SYS_TIME_H 1
    878 #define HAVE_SYS_TIMEB_H 1
    879 #define WTF_USE_ACCELERATE 1
    880 
    881 #if !defined(TARGETING_TIGER) && !defined(TARGETING_LEOPARD)
    882 
    883 #define HAVE_DISPATCH_H 1
    884 #define HAVE_HOSTED_CORE_ANIMATION 1
    885 
    886 #if !PLATFORM(IOS)
    887 #define HAVE_MADV_FREE_REUSE 1
    888 #define HAVE_MADV_FREE 1
    889 #define HAVE_PTHREAD_SETNAME_NP 1
    890 #endif
    891 
    892 #endif
    893 
    894 #if PLATFORM(IOS)
    895 #define HAVE_MADV_FREE 1
    896 #endif
    897 
    898 #elif OS(WINDOWS)
    899 
    900 #if OS(WINCE)
    901 #define HAVE_ERRNO_H 0
    902 #else
    903 #define HAVE_SYS_TIMEB_H 1
    904 #define HAVE_ALIGNED_MALLOC 1
    905 #define HAVE_ISDEBUGGERPRESENT 1
    906 #endif
    907 #define HAVE_VIRTUALALLOC 1
    908 
    909 #elif OS(SYMBIAN)
    910 
    911 #define HAVE_ERRNO_H 1
    912 #define HAVE_MMAP 0
    913 #define HAVE_SBRK 1
    914 
    915 #define HAVE_SYS_TIME_H 1
    916 #define HAVE_STRINGS_H 1
    917 
    918 #if !COMPILER(RVCT)
    919 #define HAVE_SYS_PARAM_H 1
    920 #endif
    921 
    922 #elif PLATFORM(BREWMP)
    923 
    924 #define HAVE_ERRNO_H 1
    925 
    926 #elif OS(QNX)
    927 
    928 #define HAVE_ERRNO_H 1
    929 #define HAVE_MMAP 1
    930 #define HAVE_SBRK 1
    931 #define HAVE_STRINGS_H 1
    932 #define HAVE_SYS_PARAM_H 1
    933 #define HAVE_SYS_TIME_H 1
    934 
    935 #elif OS(ANDROID)
    936 
    937 #define HAVE_ERRNO_H 1
    938 #define HAVE_LANGINFO_H 0
    939 #define HAVE_MMAP 1
    940 #define HAVE_SBRK 1
    941 #define HAVE_STRINGS_H 1
    942 #define HAVE_SYS_PARAM_H 1
    943 #define HAVE_SYS_TIME_H 1
    944 
    945 #else
    946 
    947 /* FIXME: is this actually used or do other platforms generate their own config.h? */
    948 
    949 #define HAVE_ERRNO_H 1
    950 /* As long as Haiku doesn't have a complete support of locale this will be disabled. */
    951 #if !OS(HAIKU)
    952 #define HAVE_LANGINFO_H 1
    953 #endif
    954 #define HAVE_MMAP 1
    955 #define HAVE_SBRK 1
    956 #define HAVE_STRINGS_H 1
    957 #define HAVE_SYS_PARAM_H 1
    958 #define HAVE_SYS_TIME_H 1
    959 
    960 #endif
    961 
    962 /* ENABLE macro defaults */
    963 
    964 #if PLATFORM(QT)
    965 /* We must not customize the global operator new and delete for the Qt port. */
    966 #define ENABLE_GLOBAL_FASTMALLOC_NEW 0
    967 #if !OS(UNIX) || OS(SYMBIAN)
    968 #define USE_SYSTEM_MALLOC 1
    969 #endif
    970 #endif
    971 
    972 /* fastMalloc match validation allows for runtime verification that
    973    new is matched by delete, fastMalloc is matched by fastFree, etc. */
    974 #if !defined(ENABLE_FAST_MALLOC_MATCH_VALIDATION)
    975 #define ENABLE_FAST_MALLOC_MATCH_VALIDATION 0
    976 #endif
    977 
    978 #if !defined(ENABLE_ICONDATABASE)
    979 #define ENABLE_ICONDATABASE 1
    980 #endif
    981 
    982 #if !defined(ENABLE_DATABASE)
    983 #define ENABLE_DATABASE 1
    984 #endif
    985 
    986 #if !defined(ENABLE_JAVASCRIPT_DEBUGGER)
    987 #define ENABLE_JAVASCRIPT_DEBUGGER 1
    988 #endif
    989 
    990 #if !defined(ENABLE_FTPDIR)
    991 #define ENABLE_FTPDIR 1
    992 #endif
    993 
    994 #if !defined(ENABLE_CONTEXT_MENUS)
    995 #define ENABLE_CONTEXT_MENUS 1
    996 #endif
    997 
    998 #if !defined(ENABLE_DRAG_SUPPORT)
    999 #define ENABLE_DRAG_SUPPORT 1
   1000 #endif
   1001 
   1002 #if !defined(ENABLE_DATA_TRANSFER_ITEMS)
   1003 #define ENABLE_DATA_TRANSFER_ITEMS 0
   1004 #endif
   1005 
   1006 #if !defined(ENABLE_DASHBOARD_SUPPORT)
   1007 #define ENABLE_DASHBOARD_SUPPORT 0
   1008 #endif
   1009 
   1010 #if !defined(ENABLE_INSPECTOR)
   1011 #define ENABLE_INSPECTOR 1
   1012 #endif
   1013 
   1014 #if !defined(ENABLE_JAVA_BRIDGE)
   1015 #define ENABLE_JAVA_BRIDGE 0
   1016 #endif
   1017 
   1018 #if !defined(ENABLE_NETSCAPE_PLUGIN_API)
   1019 #define ENABLE_NETSCAPE_PLUGIN_API 1
   1020 #endif
   1021 
   1022 #if !defined(ENABLE_NETSCAPE_PLUGIN_METADATA_CACHE)
   1023 #define ENABLE_NETSCAPE_PLUGIN_METADATA_CACHE 0
   1024 #endif
   1025 
   1026 #if !defined(ENABLE_PURGEABLE_MEMORY)
   1027 #define ENABLE_PURGEABLE_MEMORY 0
   1028 #endif
   1029 
   1030 #if !defined(WTF_USE_PLUGIN_HOST_PROCESS)
   1031 #define WTF_USE_PLUGIN_HOST_PROCESS 0
   1032 #endif
   1033 
   1034 #if !defined(ENABLE_ORIENTATION_EVENTS)
   1035 #define ENABLE_ORIENTATION_EVENTS 0
   1036 #endif
   1037 
   1038 #if !defined(ENABLE_OPCODE_STATS)
   1039 #define ENABLE_OPCODE_STATS 0
   1040 #endif
   1041 
   1042 #if !defined(ENABLE_GLOBAL_FASTMALLOC_NEW)
   1043 #define ENABLE_GLOBAL_FASTMALLOC_NEW 1
   1044 #endif
   1045 
   1046 #define ENABLE_DEBUG_WITH_BREAKPOINT 0
   1047 #define ENABLE_SAMPLING_COUNTERS 0
   1048 #define ENABLE_SAMPLING_FLAGS 0
   1049 #define ENABLE_OPCODE_SAMPLING 0
   1050 #define ENABLE_CODEBLOCK_SAMPLING 0
   1051 #if ENABLE(CODEBLOCK_SAMPLING) && !ENABLE(OPCODE_SAMPLING)
   1052 #error "CODEBLOCK_SAMPLING requires OPCODE_SAMPLING"
   1053 #endif
   1054 #if ENABLE(OPCODE_SAMPLING) || ENABLE(SAMPLING_FLAGS)
   1055 #define ENABLE_SAMPLING_THREAD 1
   1056 #endif
   1057 
   1058 #if !defined(ENABLE_GEOLOCATION)
   1059 #define ENABLE_GEOLOCATION 0
   1060 #endif
   1061 
   1062 #if !defined(ENABLE_GESTURE_RECOGNIZER)
   1063 #define ENABLE_GESTURE_RECOGNIZER 0
   1064 #endif
   1065 
   1066 #if !defined(ENABLE_NOTIFICATIONS)
   1067 #define ENABLE_NOTIFICATIONS 0
   1068 #endif
   1069 
   1070 #if PLATFORM(IOS)
   1071 #define ENABLE_TEXT_CARET 0
   1072 #endif
   1073 
   1074 #if !defined(ENABLE_TEXT_CARET)
   1075 #define ENABLE_TEXT_CARET 1
   1076 #endif
   1077 
   1078 #if !defined(ENABLE_ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL)
   1079 #define ENABLE_ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL 0
   1080 #endif
   1081 
   1082 #if !defined(ENABLE_FULLSCREEN_API)
   1083 #define ENABLE_FULLSCREEN_API 0
   1084 #endif
   1085 
   1086 #if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32_64)
   1087 #if (CPU(X86_64) && (OS(UNIX) || OS(WINDOWS))) \
   1088     || (CPU(IA64) && !CPU(IA64_32)) \
   1089     || CPU(ALPHA) \
   1090     || CPU(SPARC64) \
   1091     || CPU(S390X) \
   1092     || CPU(PPC64)
   1093 #define WTF_USE_JSVALUE64 1
   1094 #else
   1095 #define WTF_USE_JSVALUE32_64 1
   1096 #endif
   1097 #endif /* !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32_64) */
   1098 
   1099 #if !defined(ENABLE_REPAINT_THROTTLING)
   1100 #define ENABLE_REPAINT_THROTTLING 0
   1101 #endif
   1102 
   1103 /* Disable the JIT on versions of GCC prior to 4.1 */
   1104 #if !defined(ENABLE_JIT) && COMPILER(GCC) && !GCC_VERSION_AT_LEAST(4, 1, 0)
   1105 #define ENABLE_JIT 0
   1106 #endif
   1107 
   1108 /* JIT is not implemented for 64 bit on MSVC */
   1109 #if !defined(ENABLE_JIT) && COMPILER(MSVC) && CPU(X86_64)
   1110 #define ENABLE_JIT 0
   1111 #endif
   1112 
   1113 /* The JIT is enabled by default on all x86, x64-64, ARM & MIPS platforms. */
   1114 #if !defined(ENABLE_JIT) \
   1115     && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(MIPS)) \
   1116     && (OS(DARWIN) || !COMPILER(GCC) || GCC_VERSION_AT_LEAST(4, 1, 0)) \
   1117     && !OS(WINCE)
   1118 #define ENABLE_JIT 1
   1119 #endif
   1120 
   1121 /* Currently only implemented for JSVALUE64, only tested on PLATFORM(MAC) */
   1122 #if ENABLE(JIT) && USE(JSVALUE64) && PLATFORM(MAC)
   1123 #define ENABLE_DFG_JIT 1
   1124 /* Enabled with restrictions to circumvent known performance regressions. */
   1125 #define ENABLE_DFG_JIT_RESTRICTIONS 1
   1126 #endif
   1127 
   1128 /* Ensure that either the JIT or the interpreter has been enabled. */
   1129 #if !defined(ENABLE_INTERPRETER) && !ENABLE(JIT)
   1130 #define ENABLE_INTERPRETER 1
   1131 #endif
   1132 #if !(ENABLE(JIT) || ENABLE(INTERPRETER))
   1133 #error You have to have at least one execution model enabled to build JSC
   1134 #endif
   1135 
   1136 #if CPU(SH4) && PLATFORM(QT)
   1137 #define ENABLE_JIT 1
   1138 #define ENABLE_YARR 1
   1139 #define ENABLE_YARR_JIT 1
   1140 #define WTF_USE_JIT_STUB_ARGUMENT_REGISTER 1
   1141 #define ENABLE_ASSEMBLER 1
   1142 #endif
   1143 
   1144 /* Configure the JIT */
   1145 #if ENABLE(JIT)
   1146     #if CPU(ARM)
   1147     #if !defined(ENABLE_JIT_USE_SOFT_MODULO) && WTF_ARM_ARCH_AT_LEAST(5)
   1148     #define ENABLE_JIT_USE_SOFT_MODULO 1
   1149     #endif
   1150     #endif
   1151 
   1152     #ifndef ENABLE_JIT_OPTIMIZE_CALL
   1153     #define ENABLE_JIT_OPTIMIZE_CALL 1
   1154     #endif
   1155     #ifndef ENABLE_JIT_OPTIMIZE_NATIVE_CALL
   1156     #define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 1
   1157     #endif
   1158     #ifndef ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS
   1159     #define ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS 1
   1160     #endif
   1161     #ifndef ENABLE_JIT_OPTIMIZE_METHOD_CALLS
   1162     #define ENABLE_JIT_OPTIMIZE_METHOD_CALLS 1
   1163     #endif
   1164 #endif
   1165 
   1166 #if CPU(X86) && COMPILER(MSVC)
   1167 #define JSC_HOST_CALL __fastcall
   1168 #elif CPU(X86) && COMPILER(GCC)
   1169 #define JSC_HOST_CALL __attribute__ ((fastcall))
   1170 #else
   1171 #define JSC_HOST_CALL
   1172 #endif
   1173 
   1174 /* Configure the interpreter */
   1175 #if COMPILER(GCC) || (RVCT_VERSION_AT_LEAST(4, 0, 0, 0) && defined(__GNUC__))
   1176 #define HAVE_COMPUTED_GOTO 1
   1177 #endif
   1178 #if HAVE(COMPUTED_GOTO) && ENABLE(INTERPRETER)
   1179 #define ENABLE_COMPUTED_GOTO_INTERPRETER 1
   1180 #endif
   1181 
   1182 /* Regular Expression Tracing - Set to 1 to trace RegExp's in jsc.  Results dumped at exit */
   1183 #define ENABLE_REGEXP_TRACING 0
   1184 
   1185 /* Yet Another Regex Runtime - turned on by default for JIT enabled ports. */
   1186 #if PLATFORM(CHROMIUM)
   1187 #define ENABLE_YARR_JIT 0
   1188 
   1189 #elif ENABLE(JIT) && !defined(ENABLE_YARR_JIT)
   1190 #define ENABLE_YARR_JIT 1
   1191 
   1192 /* Setting this flag compares JIT results with interpreter results. */
   1193 #define ENABLE_YARR_JIT_DEBUG 0
   1194 #endif
   1195 
   1196 #if ENABLE(JIT) || ENABLE(YARR_JIT)
   1197 #define ENABLE_ASSEMBLER 1
   1198 #endif
   1199 /* Setting this flag prevents the assembler from using RWX memory; this may improve
   1200    security but currectly comes at a significant performance cost. */
   1201 #if PLATFORM(IOS)
   1202 #define ENABLE_ASSEMBLER_WX_EXCLUSIVE 1
   1203 #endif
   1204 
   1205 /* Pick which allocator to use; we only need an executable allocator if the assembler is compiled in.
   1206    On x86-64 we use a single fixed mmap, on other platforms we mmap on demand. */
   1207 #if ENABLE(ASSEMBLER)
   1208 #if CPU(X86_64)
   1209 #define ENABLE_EXECUTABLE_ALLOCATOR_FIXED 1
   1210 #else
   1211 #define ENABLE_EXECUTABLE_ALLOCATOR_DEMAND 1
   1212 #endif
   1213 #endif
   1214 
   1215 #if !defined(ENABLE_PAN_SCROLLING) && OS(WINDOWS)
   1216 #define ENABLE_PAN_SCROLLING 1
   1217 #endif
   1218 
   1219 #if !defined(ENABLE_SMOOTH_SCROLLING)
   1220 #define ENABLE_SMOOTH_SCROLLING 0
   1221 #endif
   1222 
   1223 #if !defined(ENABLE_WEB_ARCHIVE)
   1224 #define ENABLE_WEB_ARCHIVE 0
   1225 #endif
   1226 
   1227 /* Use the QXmlStreamReader implementation for XMLDocumentParser */
   1228 /* Use the QXmlQuery implementation for XSLTProcessor */
   1229 #if PLATFORM(QT)
   1230 #define WTF_USE_QXMLSTREAM 1
   1231 #define WTF_USE_QXMLQUERY 1
   1232 #endif
   1233 
   1234 #if PLATFORM(MAC)
   1235 /* Complex text framework */
   1236 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
   1237 #define WTF_USE_ATSUI 0
   1238 #define WTF_USE_CORE_TEXT 1
   1239 #else
   1240 #define WTF_USE_ATSUI 1
   1241 #define WTF_USE_CORE_TEXT 0
   1242 #endif
   1243 #endif
   1244 
   1245 /* Accelerated compositing */
   1246 #if (PLATFORM(MAC) && !defined(BUILDING_ON_TIGER)) || PLATFORM(IOS) || PLATFORM(QT) || (PLATFORM(WIN) && !OS(WINCE) &&!defined(WIN_CAIRO))
   1247 #define WTF_USE_ACCELERATED_COMPOSITING 1
   1248 #endif
   1249 
   1250 #if (PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)) || PLATFORM(IOS)
   1251 #define WTF_USE_PROTECTION_SPACE_AUTH_CALLBACK 1
   1252 #endif
   1253 
   1254 #if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
   1255 #define WTF_USE_AVFOUNDATION 1
   1256 #endif
   1257 
   1258 #if COMPILER(GCC)
   1259 #define WARN_UNUSED_RETURN __attribute__ ((warn_unused_result))
   1260 #else
   1261 #define WARN_UNUSED_RETURN
   1262 #endif
   1263 
   1264 #if !ENABLE(NETSCAPE_PLUGIN_API) || (ENABLE(NETSCAPE_PLUGIN_API) && ((OS(UNIX) && (PLATFORM(QT) || PLATFORM(WX))) || PLATFORM(GTK)))
   1265 #define ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH 1
   1266 #endif
   1267 
   1268 /* Set up a define for a common error that is intended to cause a build error -- thus the space after Error. */
   1269 #define WTF_PLATFORM_CFNETWORK Error USE_macro_should_be_used_with_CFNETWORK
   1270 
   1271 #define ENABLE_JSC_ZOMBIES 0
   1272 
   1273 /* FIXME: Eventually we should enable this for all platforms and get rid of the define. */
   1274 #if PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(QT)
   1275 #define WTF_USE_PLATFORM_STRATEGIES 1
   1276 #endif
   1277 
   1278 #if PLATFORM(WIN)
   1279 #define WTF_USE_CROSS_PLATFORM_CONTEXT_MENUS 1
   1280 #endif
   1281 
   1282 /* Geolocation request policy. pre-emptive policy is to acquire user permission before acquiring location.
   1283    Client based implementations will have option to choose between pre-emptive and nonpre-emptive permission policy.
   1284    pre-emptive permission policy is enabled by default for all client-based implementations. */
   1285 #if ENABLE(CLIENT_BASED_GEOLOCATION)
   1286 #define WTF_USE_PREEMPT_GEOLOCATION_PERMISSION 1
   1287 #endif
   1288 
   1289 #if CPU(ARM_THUMB2)
   1290 #define ENABLE_BRANCH_COMPACTION 1
   1291 #endif
   1292 
   1293 #if ENABLE(GLIB_SUPPORT)
   1294 #include "GTypedefs.h"
   1295 #endif
   1296 
   1297 /* FIXME: This define won't be needed once #27551 is fully landed. However,
   1298    since most ports try to support sub-project independence, adding new headers
   1299    to WTF causes many ports to break, and so this way we can address the build
   1300    breakages one port at a time. */
   1301 #define WTF_USE_EXPORT_MACROS 0
   1302 
   1303 #if PLATFORM(QT) || PLATFORM(GTK)
   1304 #define WTF_USE_UNIX_DOMAIN_SOCKETS 1
   1305 #endif
   1306 
   1307 #endif /* WTF_Platform_h */
   1308