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