JavaScriptCore/wtf/Platform.h
changeset 0 4f2f89ce4247
child 2 303757a437d3
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     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 #if defined(__CC_ARM) || defined(__ARMCC__)
       
    75 #define WTF_COMPILER_RVCT 1
       
    76 #endif
       
    77 
       
    78 /* COMPILER(GCC) - GNU Compiler Collection */
       
    79 /* --gnu option of the RVCT compiler also defines __GNUC__ */
       
    80 #if defined(__GNUC__) && !COMPILER(RVCT)
       
    81 #define WTF_COMPILER_GCC 1
       
    82 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
       
    83 #endif
       
    84 
       
    85 /* COMPILER(MINGW) - MinGW GCC */
       
    86 /* COMPILER(MINGW64) - mingw-w64 GCC - only used as additional check to exclude mingw.org specific functions */
       
    87 #if defined(__MINGW32__)
       
    88 #define WTF_COMPILER_MINGW 1
       
    89 #include <_mingw.h> /* private MinGW header */
       
    90     #if defined(__MINGW64_VERSION_MAJOR) /* best way to check for mingw-w64 vs mingw.org */
       
    91         #define WTF_COMPILER_MINGW64 1
       
    92     #endif /* __MINGW64_VERSION_MAJOR */
       
    93 #endif /* __MINGW32__ */
       
    94 
       
    95 /* COMPILER(WINSCW) - CodeWarrior for Symbian emulator */
       
    96 #if defined(__WINSCW__)
       
    97 #define WTF_COMPILER_WINSCW 1
       
    98 /* cross-compiling, it is not really windows */
       
    99 #undef WIN32
       
   100 #undef _WIN32
       
   101 #endif
       
   102 
       
   103 /* COMPILER(INTEL) - Intel C++ Compiler */
       
   104 #if defined(__INTEL_COMPILER)
       
   105 #define WTF_COMPILER_INTEL 1
       
   106 #endif
       
   107 
       
   108 /* ==== CPU() - the target CPU architecture ==== */
       
   109 
       
   110 /* This also defines CPU(BIG_ENDIAN) or CPU(MIDDLE_ENDIAN) or neither, as appropriate. */
       
   111 
       
   112 /* CPU(ALPHA) - DEC Alpha */
       
   113 #if defined(__alpha__)
       
   114 #define WTF_CPU_ALPHA 1
       
   115 #endif
       
   116 
       
   117 /* CPU(IA64) - Itanium / IA-64 */
       
   118 #if defined(__ia64__)
       
   119 #define WTF_CPU_IA64 1
       
   120 /* 32-bit mode on Itanium */
       
   121 #if !defined(__LP64__)
       
   122 #define WTF_CPU_IA64_32 1
       
   123 #endif
       
   124 #endif
       
   125 
       
   126 /* CPU(MIPS) - MIPS 32-bit */
       
   127 /* Note: Only O32 ABI is tested, so we enable it for O32 ABI for now.  */
       
   128 #if (defined(mips) || defined(__mips__)) \
       
   129     && defined(_ABIO32)
       
   130 #define WTF_CPU_MIPS 1
       
   131 #if defined(__MIPSEB__)
       
   132 #define WTF_CPU_BIG_ENDIAN 1
       
   133 #endif
       
   134 #define WTF_MIPS_PIC (defined __PIC__)
       
   135 #define WTF_MIPS_ARCH __mips
       
   136 #define WTF_MIPS_ISA(v) (defined WTF_MIPS_ARCH && WTF_MIPS_ARCH == v)
       
   137 #define WTF_MIPS_ISA_AT_LEAST(v) (defined WTF_MIPS_ARCH && WTF_MIPS_ARCH >= v)
       
   138 #define WTF_MIPS_ARCH_REV __mips_isa_rev
       
   139 #define WTF_MIPS_ISA_REV(v) (defined WTF_MIPS_ARCH_REV && WTF_MIPS_ARCH_REV == v)
       
   140 #define WTF_MIPS_DOUBLE_FLOAT (defined __mips_hard_float && !defined __mips_single_float)
       
   141 #endif /* MIPS */
       
   142 
       
   143 /* CPU(PPC) - PowerPC 32-bit */
       
   144 #if   defined(__ppc__)     \
       
   145     || defined(__PPC__)     \
       
   146     || defined(__powerpc__) \
       
   147     || defined(__powerpc)   \
       
   148     || defined(__POWERPC__) \
       
   149     || defined(_M_PPC)      \
       
   150     || defined(__PPC)
       
   151 #define WTF_CPU_PPC 1
       
   152 #define WTF_CPU_BIG_ENDIAN 1
       
   153 #endif
       
   154 
       
   155 /* CPU(PPC64) - PowerPC 64-bit */
       
   156 #if   defined(__ppc64__) \
       
   157     || defined(__PPC64__)
       
   158 #define WTF_CPU_PPC64 1
       
   159 #define WTF_CPU_BIG_ENDIAN 1
       
   160 #endif
       
   161 
       
   162 /* CPU(SH4) - SuperH SH-4 */
       
   163 #if defined(__SH4__)
       
   164 #define WTF_CPU_SH4 1
       
   165 #endif
       
   166 
       
   167 /* CPU(SPARC32) - SPARC 32-bit */
       
   168 #if defined(__sparc) && !defined(__arch64__) || defined(__sparcv8)
       
   169 #define WTF_CPU_SPARC32 1
       
   170 #define WTF_CPU_BIG_ENDIAN 1
       
   171 #endif
       
   172 
       
   173 /* CPU(SPARC64) - SPARC 64-bit */
       
   174 #if defined(__sparc__) && defined(__arch64__) || defined (__sparcv9)
       
   175 #define WTF_CPU_SPARC64 1
       
   176 #define WTF_CPU_BIG_ENDIAN 1
       
   177 #endif
       
   178 
       
   179 /* CPU(SPARC) - any SPARC, true for CPU(SPARC32) and CPU(SPARC64) */
       
   180 #if CPU(SPARC32) || CPU(SPARC64)
       
   181 #define WTF_CPU_SPARC 1
       
   182 #endif
       
   183 
       
   184 /* CPU(X86) - i386 / x86 32-bit */
       
   185 #if   defined(__i386__) \
       
   186     || defined(i386)     \
       
   187     || defined(_M_IX86)  \
       
   188     || defined(_X86_)    \
       
   189     || defined(__THW_INTEL)
       
   190 #define WTF_CPU_X86 1
       
   191 #endif
       
   192 
       
   193 /* CPU(X86_64) - AMD64 / Intel64 / x86_64 64-bit */
       
   194 #if   defined(__x86_64__) \
       
   195     || defined(_M_X64)
       
   196 #define WTF_CPU_X86_64 1
       
   197 #endif
       
   198 
       
   199 /* CPU(ARM) - ARM, any version*/
       
   200 #if   defined(arm) \
       
   201     || defined(__arm__) \
       
   202     || defined(ARM) \
       
   203     || defined(_ARM_)
       
   204 #define WTF_CPU_ARM 1
       
   205 
       
   206 #if defined(__ARMEB__)
       
   207 #define WTF_CPU_BIG_ENDIAN 1
       
   208 
       
   209 #elif !defined(__ARM_EABI__) \
       
   210     && !defined(__EABI__) \
       
   211     && !defined(__VFP_FP__) \
       
   212     && !defined(_WIN32_WCE) \
       
   213     && !defined(ANDROID)
       
   214 #define WTF_CPU_MIDDLE_ENDIAN 1
       
   215 
       
   216 #endif
       
   217 
       
   218 #define WTF_ARM_ARCH_AT_LEAST(N) (CPU(ARM) && WTF_ARM_ARCH_VERSION >= N)
       
   219 
       
   220 /* Set WTF_ARM_ARCH_VERSION */
       
   221 #if   defined(__ARM_ARCH_4__) \
       
   222     || defined(__ARM_ARCH_4T__) \
       
   223     || defined(__MARM_ARMV4__) \
       
   224     || defined(_ARMV4I_)
       
   225 #define WTF_ARM_ARCH_VERSION 4
       
   226 
       
   227 #elif defined(__ARM_ARCH_5__) \
       
   228     || defined(__ARM_ARCH_5T__) \
       
   229     || defined(__MARM_ARMV5__)
       
   230 #define WTF_ARM_ARCH_VERSION 5
       
   231 
       
   232 #elif defined(__ARM_ARCH_5E__) \
       
   233     || defined(__ARM_ARCH_5TE__) \
       
   234     || defined(__ARM_ARCH_5TEJ__)
       
   235 #define WTF_ARM_ARCH_VERSION 5
       
   236 /*ARMv5TE requires allocators to use aligned memory*/
       
   237 #define WTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1
       
   238 
       
   239 #elif defined(__ARM_ARCH_6__) \
       
   240     || defined(__ARM_ARCH_6J__) \
       
   241     || defined(__ARM_ARCH_6K__) \
       
   242     || defined(__ARM_ARCH_6Z__) \
       
   243     || defined(__ARM_ARCH_6ZK__) \
       
   244     || defined(__ARM_ARCH_6T2__) \
       
   245     || defined(__ARMV6__)
       
   246 #define WTF_ARM_ARCH_VERSION 6
       
   247 
       
   248 #elif defined(__ARM_ARCH_7A__) \
       
   249     || defined(__ARM_ARCH_7R__)
       
   250 #define WTF_ARM_ARCH_VERSION 7
       
   251 
       
   252 /* RVCT sets _TARGET_ARCH_ARM */
       
   253 #elif defined(__TARGET_ARCH_ARM)
       
   254 #define WTF_ARM_ARCH_VERSION __TARGET_ARCH_ARM
       
   255 
       
   256 #if defined(__TARGET_ARCH_5E) \
       
   257     || defined(__TARGET_ARCH_5TE) \
       
   258     || defined(__TARGET_ARCH_5TEJ)
       
   259 /*ARMv5TE requires allocators to use aligned memory*/
       
   260 #define WTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1
       
   261 #endif
       
   262 
       
   263 #else
       
   264 #define WTF_ARM_ARCH_VERSION 0
       
   265 
       
   266 #endif
       
   267 
       
   268 /* Set WTF_THUMB_ARCH_VERSION */
       
   269 #if   defined(__ARM_ARCH_4T__)
       
   270 #define WTF_THUMB_ARCH_VERSION 1
       
   271 
       
   272 #elif defined(__ARM_ARCH_5T__) \
       
   273     || defined(__ARM_ARCH_5TE__) \
       
   274     || defined(__ARM_ARCH_5TEJ__)
       
   275 #define WTF_THUMB_ARCH_VERSION 2
       
   276 
       
   277 #elif defined(__ARM_ARCH_6J__) \
       
   278     || defined(__ARM_ARCH_6K__) \
       
   279     || defined(__ARM_ARCH_6Z__) \
       
   280     || defined(__ARM_ARCH_6ZK__) \
       
   281     || defined(__ARM_ARCH_6M__)
       
   282 #define WTF_THUMB_ARCH_VERSION 3
       
   283 
       
   284 #elif defined(__ARM_ARCH_6T2__) \
       
   285     || defined(__ARM_ARCH_7__) \
       
   286     || defined(__ARM_ARCH_7A__) \
       
   287     || defined(__ARM_ARCH_7R__) \
       
   288     || defined(__ARM_ARCH_7M__)
       
   289 #define WTF_THUMB_ARCH_VERSION 4
       
   290 
       
   291 /* RVCT sets __TARGET_ARCH_THUMB */
       
   292 #elif defined(__TARGET_ARCH_THUMB)
       
   293 #define WTF_THUMB_ARCH_VERSION __TARGET_ARCH_THUMB
       
   294 
       
   295 #else
       
   296 #define WTF_THUMB_ARCH_VERSION 0
       
   297 #endif
       
   298 
       
   299 
       
   300 /* CPU(ARMV5_OR_LOWER) - ARM instruction set v5 or earlier */
       
   301 /* On ARMv5 and below the natural alignment is required. 
       
   302    And there are some other differences for v5 or earlier. */
       
   303 #if !defined(ARMV5_OR_LOWER) && !WTF_ARM_ARCH_AT_LEAST(6)
       
   304 #define WTF_CPU_ARMV5_OR_LOWER 1
       
   305 #endif
       
   306 
       
   307 
       
   308 /* CPU(ARM_TRADITIONAL) - Thumb2 is not available, only traditional ARM (v4 or greater) */
       
   309 /* CPU(ARM_THUMB2) - Thumb2 instruction set is available */
       
   310 /* Only one of these will be defined. */
       
   311 #if !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2)
       
   312 #  if defined(thumb2) || defined(__thumb2__) \
       
   313     || ((defined(__thumb) || defined(__thumb__)) && WTF_THUMB_ARCH_VERSION == 4)
       
   314 #    define WTF_CPU_ARM_TRADITIONAL 0
       
   315 #    define WTF_CPU_ARM_THUMB2 1
       
   316 #  elif WTF_ARM_ARCH_AT_LEAST(4)
       
   317 #    define WTF_CPU_ARM_TRADITIONAL 1
       
   318 #    define WTF_CPU_ARM_THUMB2 0
       
   319 #  else
       
   320 #    error "Not supported ARM architecture"
       
   321 #  endif
       
   322 #elif CPU(ARM_TRADITIONAL) && CPU(ARM_THUMB2) /* Sanity Check */
       
   323 #  error "Cannot use both of WTF_CPU_ARM_TRADITIONAL and WTF_CPU_ARM_THUMB2 platforms"
       
   324 #endif /* !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2) */
       
   325 
       
   326 #endif /* ARM */
       
   327 
       
   328 
       
   329 
       
   330 /* ==== OS() - underlying operating system; only to be used for mandated low-level services like 
       
   331    virtual memory, not to choose a GUI toolkit ==== */
       
   332 
       
   333 /* OS(ANDROID) - Android */
       
   334 #ifdef ANDROID
       
   335 #define WTF_OS_ANDROID 1
       
   336 #endif
       
   337 
       
   338 /* OS(AIX) - AIX */
       
   339 #ifdef _AIX
       
   340 #define WTF_OS_AIX 1
       
   341 #endif
       
   342 
       
   343 /* OS(DARWIN) - Any Darwin-based OS, including Mac OS X and iPhone OS */
       
   344 #ifdef __APPLE__
       
   345 #define WTF_OS_DARWIN 1
       
   346 
       
   347 /* FIXME: BUILDING_ON_.., and TARGETING... macros should be folded into the OS() system */
       
   348 #include <AvailabilityMacros.h>
       
   349 #if !defined(MAC_OS_X_VERSION_10_5) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
       
   350 #define BUILDING_ON_TIGER 1
       
   351 #elif !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
       
   352 #define BUILDING_ON_LEOPARD 1
       
   353 #elif !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
       
   354 #define BUILDING_ON_SNOW_LEOPARD 1
       
   355 #endif
       
   356 #if !defined(MAC_OS_X_VERSION_10_5) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
       
   357 #define TARGETING_TIGER 1
       
   358 #elif !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
       
   359 #define TARGETING_LEOPARD 1
       
   360 #elif !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7
       
   361 #define TARGETING_SNOW_LEOPARD 1
       
   362 #endif
       
   363 #include <TargetConditionals.h>
       
   364 
       
   365 #endif
       
   366 
       
   367 /* OS(IPHONE_OS) - iPhone OS */
       
   368 /* OS(MAC_OS_X) - Mac OS X (not including iPhone OS) */
       
   369 #if OS(DARWIN) && ((defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED)  \
       
   370     || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)                   \
       
   371     || (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR))
       
   372 #define WTF_OS_IPHONE_OS 1
       
   373 #elif OS(DARWIN) && defined(TARGET_OS_MAC) && TARGET_OS_MAC
       
   374 #define WTF_OS_MAC_OS_X 1
       
   375 #endif
       
   376 
       
   377 /* OS(FREEBSD) - FreeBSD */
       
   378 #ifdef __FreeBSD__
       
   379 #define WTF_OS_FREEBSD 1
       
   380 #endif
       
   381 
       
   382 /* OS(HAIKU) - Haiku */
       
   383 #ifdef __HAIKU__
       
   384 #define WTF_OS_HAIKU 1
       
   385 #endif
       
   386 
       
   387 /* OS(LINUX) - Linux */
       
   388 #ifdef __linux__
       
   389 #define WTF_OS_LINUX 1
       
   390 #endif
       
   391 
       
   392 /* OS(NETBSD) - NetBSD */
       
   393 #if defined(__NetBSD__)
       
   394 #define WTF_PLATFORM_NETBSD 1
       
   395 #endif
       
   396 
       
   397 /* OS(OPENBSD) - OpenBSD */
       
   398 #ifdef __OpenBSD__
       
   399 #define WTF_OS_OPENBSD 1
       
   400 #endif
       
   401 
       
   402 /* OS(QNX) - QNX */
       
   403 #if defined(__QNXNTO__)
       
   404 #define WTF_OS_QNX 1
       
   405 #endif
       
   406 
       
   407 /* OS(SOLARIS) - Solaris */
       
   408 #if defined(sun) || defined(__sun)
       
   409 #define WTF_OS_SOLARIS 1
       
   410 #endif
       
   411 
       
   412 /* OS(WINCE) - Windows CE; note that for this platform OS(WINDOWS) is also defined */
       
   413 #if defined(_WIN32_WCE)
       
   414 #define WTF_OS_WINCE 1
       
   415 #endif
       
   416 
       
   417 /* OS(WINDOWS) - Any version of Windows */
       
   418 #if defined(WIN32) || defined(_WIN32)
       
   419 #define WTF_OS_WINDOWS 1
       
   420 #endif
       
   421 
       
   422 /* OS(SYMBIAN) - Symbian */
       
   423 #if defined (__SYMBIAN32__)
       
   424 #define WTF_OS_SYMBIAN 1
       
   425 #endif
       
   426 
       
   427 /* OS(UNIX) - Any Unix-like system */
       
   428 #if   OS(AIX)              \
       
   429     || OS(ANDROID)          \
       
   430     || OS(DARWIN)           \
       
   431     || OS(FREEBSD)          \
       
   432     || OS(HAIKU)            \
       
   433     || OS(LINUX)            \
       
   434     || OS(NETBSD)           \
       
   435     || OS(OPENBSD)          \
       
   436     || OS(QNX)              \
       
   437     || OS(SOLARIS)          \
       
   438     || OS(SYMBIAN)          \
       
   439     || defined(unix)        \
       
   440     || defined(__unix)      \
       
   441     || defined(__unix__)
       
   442 #define WTF_OS_UNIX 1
       
   443 #endif
       
   444 
       
   445 /* Operating environments */
       
   446 
       
   447 /* FIXME: these are all mixes of OS, operating environment and policy choices. */
       
   448 /* PLATFORM(CHROMIUM) */
       
   449 /* PLATFORM(QT) */
       
   450 /* PLATFORM(WX) */
       
   451 /* PLATFORM(GTK) */
       
   452 /* PLATFORM(HAIKU) */
       
   453 /* PLATFORM(MAC) */
       
   454 /* PLATFORM(WIN) */
       
   455 #if defined(BUILDING_CHROMIUM__)
       
   456 #define WTF_PLATFORM_CHROMIUM 1
       
   457 #elif defined(BUILDING_QT__)
       
   458 #define WTF_PLATFORM_QT 1
       
   459 #elif defined(BUILDING_WX__)
       
   460 #define WTF_PLATFORM_WX 1
       
   461 #elif defined(BUILDING_GTK__)
       
   462 #define WTF_PLATFORM_GTK 1
       
   463 #elif defined(BUILDING_HAIKU__)
       
   464 #define WTF_PLATFORM_HAIKU 1
       
   465 #elif defined(BUILDING_BREWMP__)
       
   466 #define WTF_PLATFORM_BREWMP 1
       
   467 #if defined(AEE_SIMULATOR)
       
   468 #define WTF_PLATFORM_BREWMP_SIMULATOR 1
       
   469 #else
       
   470 #define WTF_PLATFORM_BREWMP_SIMULATOR 0
       
   471 #endif
       
   472 #undef WTF_OS_WINDOWS
       
   473 #undef WTF_PLATFORM_WIN
       
   474 #elif OS(DARWIN)
       
   475 #define WTF_PLATFORM_MAC 1
       
   476 #elif OS(WINDOWS)
       
   477 #define WTF_PLATFORM_WIN 1
       
   478 #endif
       
   479 
       
   480 /* PLATFORM(IPHONE) */
       
   481 /* FIXME: this is sometimes used as an OS switch and sometimes for higher-level things */
       
   482 #if (defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
       
   483 #define WTF_PLATFORM_IPHONE 1
       
   484 #endif
       
   485 
       
   486 /* PLATFORM(IPHONE_SIMULATOR) */
       
   487 #if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR
       
   488 #define WTF_PLATFORM_IPHONE 1
       
   489 #define WTF_PLATFORM_IPHONE_SIMULATOR 1
       
   490 #else
       
   491 #define WTF_PLATFORM_IPHONE_SIMULATOR 0
       
   492 #endif
       
   493 
       
   494 #if !defined(WTF_PLATFORM_IPHONE)
       
   495 #define WTF_PLATFORM_IPHONE 0
       
   496 #endif
       
   497 
       
   498 /* PLATFORM(ANDROID) */
       
   499 /* FIXME: this is sometimes used as an OS() switch, and other times to drive
       
   500    policy choices */
       
   501 #if defined(ANDROID)
       
   502 #define WTF_PLATFORM_ANDROID 1
       
   503 #endif
       
   504 
       
   505 /* Graphics engines */
       
   506 
       
   507 /* PLATFORM(CG) and PLATFORM(CI) */
       
   508 #if PLATFORM(MAC) || PLATFORM(IPHONE)
       
   509 #define WTF_PLATFORM_CG 1
       
   510 #endif
       
   511 #if PLATFORM(MAC) && !PLATFORM(IPHONE)
       
   512 #define WTF_PLATFORM_CI 1
       
   513 #endif
       
   514 
       
   515 /* PLATFORM(SKIA) for Win/Linux, CG/CI for Mac */
       
   516 #if PLATFORM(CHROMIUM)
       
   517 #define ENABLE_HISTORY_ALWAYS_ASYNC 1
       
   518 #if OS(DARWIN)
       
   519 #define WTF_PLATFORM_CG 1
       
   520 #define WTF_PLATFORM_CI 1
       
   521 #define WTF_USE_ATSUI 1
       
   522 #define WTF_USE_CORE_TEXT 1
       
   523 #else
       
   524 #define WTF_PLATFORM_SKIA 1
       
   525 #endif
       
   526 #endif
       
   527 
       
   528 #if PLATFORM(BREWMP)
       
   529 #define WTF_PLATFORM_SKIA 1
       
   530 #endif
       
   531 
       
   532 #if PLATFORM(GTK)
       
   533 #define WTF_PLATFORM_CAIRO 1
       
   534 #endif
       
   535 
       
   536 
       
   537 #if OS(WINCE) && PLATFORM(QT)
       
   538 #include <ce_time.h>
       
   539 #endif
       
   540 
       
   541 #if (PLATFORM(IPHONE) || PLATFORM(MAC) || PLATFORM(WIN) || (PLATFORM(QT) && OS(DARWIN) && !ENABLE(SINGLE_THREADED))) && !defined(ENABLE_JSC_MULTIPLE_THREADS)
       
   542 #define ENABLE_JSC_MULTIPLE_THREADS 1
       
   543 #endif
       
   544 
       
   545 /* On Windows, use QueryPerformanceCounter by default */
       
   546 #if OS(WINDOWS)
       
   547 #define WTF_USE_QUERY_PERFORMANCE_COUNTER  1
       
   548 #endif
       
   549 
       
   550 #if OS(WINCE) && !PLATFORM(QT)
       
   551 #undef ENABLE_JSC_MULTIPLE_THREADS
       
   552 #define ENABLE_JSC_MULTIPLE_THREADS        0
       
   553 #define USE_SYSTEM_MALLOC                  0
       
   554 #define ENABLE_ICONDATABASE                0
       
   555 #define ENABLE_JAVASCRIPT_DEBUGGER         0
       
   556 #define ENABLE_FTPDIR                      0
       
   557 #define ENABLE_PAN_SCROLLING               0
       
   558 #define ENABLE_WML                         1
       
   559 #define HAVE_ACCESSIBILITY                 0
       
   560 
       
   561 #define NOMINMAX       /* Windows min and max conflict with standard macros */
       
   562 #define NOSHLWAPI      /* shlwapi.h not available on WinCe */
       
   563 
       
   564 /* MSDN documentation says these functions are provided with uspce.lib.  But we cannot find this file. */
       
   565 #define __usp10__      /* disable "usp10.h" */
       
   566 
       
   567 #define _INC_ASSERT    /* disable "assert.h" */
       
   568 #define assert(x)
       
   569 
       
   570 /* _countof is only included in CE6; for CE5 we need to define it ourself */
       
   571 #ifndef _countof
       
   572 #define _countof(x) (sizeof(x) / sizeof((x)[0]))
       
   573 #endif
       
   574 
       
   575 #endif  /* OS(WINCE) && !PLATFORM(QT) */
       
   576 
       
   577 #if PLATFORM(QT)
       
   578 #define WTF_USE_QT4_UNICODE 1
       
   579 #if !defined(ENABLE_WIDGETS_10_SUPPORT)
       
   580 #define ENABLE_WIDGETS_10_SUPPORT 1
       
   581 #endif
       
   582 #elif OS(WINCE)
       
   583 #define WTF_USE_WINCE_UNICODE 1
       
   584 #elif PLATFORM(GTK)
       
   585 /* The GTK+ Unicode backend is configurable */
       
   586 #else
       
   587 #define WTF_USE_ICU_UNICODE 1
       
   588 #endif
       
   589 
       
   590 #if PLATFORM(MAC) && !PLATFORM(IPHONE)
       
   591 #define WTF_PLATFORM_CF 1
       
   592 #define WTF_USE_PTHREADS 1
       
   593 #define HAVE_PTHREAD_RWLOCK 1
       
   594 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_TIGER) && CPU(X86_64)
       
   595 #define WTF_USE_PLUGIN_HOST_PROCESS 1
       
   596 #endif
       
   597 #if !defined(ENABLE_JAVA_BRIDGE)
       
   598 #define ENABLE_JAVA_BRIDGE 1
       
   599 #endif
       
   600 #if !defined(ENABLE_DASHBOARD_SUPPORT)
       
   601 #define ENABLE_DASHBOARD_SUPPORT 1
       
   602 #endif
       
   603 #define HAVE_READLINE 1
       
   604 #define HAVE_RUNLOOP_TIMER 1
       
   605 #endif /* PLATFORM(MAC) && !PLATFORM(IPHONE) */
       
   606 
       
   607 #if PLATFORM(MAC)
       
   608 #define WTF_USE_CARBON_SECURE_INPUT_MODE 1
       
   609 #endif
       
   610 
       
   611 #if PLATFORM(CHROMIUM) && OS(DARWIN)
       
   612 #define WTF_PLATFORM_CF 1
       
   613 #define WTF_USE_PTHREADS 1
       
   614 #define HAVE_PTHREAD_RWLOCK 1
       
   615 #define WTF_USE_CARBON_SECURE_INPUT_MODE 1
       
   616 #endif
       
   617 
       
   618 #if PLATFORM(BREWMP)
       
   619 #define ENABLE_SINGLE_THREADED 1
       
   620 #endif
       
   621 
       
   622 #if PLATFORM(QT) && OS(DARWIN)
       
   623 #define WTF_PLATFORM_CF 1
       
   624 #endif
       
   625 
       
   626 #if PLATFORM(IPHONE)
       
   627 #define ENABLE_CONTEXT_MENUS 0
       
   628 #define ENABLE_DRAG_SUPPORT 0
       
   629 #define ENABLE_FTPDIR 1
       
   630 #define ENABLE_GEOLOCATION 1
       
   631 #define ENABLE_ICONDATABASE 0
       
   632 #define ENABLE_INSPECTOR 0
       
   633 #define ENABLE_JAVA_BRIDGE 0
       
   634 #define ENABLE_NETSCAPE_PLUGIN_API 0
       
   635 #define ENABLE_ORIENTATION_EVENTS 1
       
   636 #define ENABLE_REPAINT_THROTTLING 1
       
   637 #define HAVE_READLINE 1
       
   638 #define WTF_PLATFORM_CF 1
       
   639 #define WTF_USE_PTHREADS 1
       
   640 #define HAVE_PTHREAD_RWLOCK 1
       
   641 #endif
       
   642 
       
   643 #if PLATFORM(ANDROID)
       
   644 #define WTF_USE_PTHREADS 1
       
   645 #define WTF_PLATFORM_SGL 1
       
   646 #define USE_SYSTEM_MALLOC 1
       
   647 #define ENABLE_JAVA_BRIDGE 1
       
   648 #define LOG_DISABLED 1
       
   649 /* Prevents Webkit from drawing the caret in textfields and textareas
       
   650    This prevents unnecessary invals. */
       
   651 #define ENABLE_TEXT_CARET 1
       
   652 #define ENABLE_JAVASCRIPT_DEBUGGER 0
       
   653 #endif
       
   654 
       
   655 #if PLATFORM(WIN)
       
   656 #define WTF_USE_WININET 1
       
   657 #endif
       
   658 
       
   659 #if PLATFORM(WX)
       
   660 #define ENABLE_ASSEMBLER 1
       
   661 #define ENABLE_GLOBAL_FASTMALLOC_NEW 0
       
   662 #if OS(DARWIN)
       
   663 #define WTF_PLATFORM_CF 1
       
   664 #ifndef BUILDING_ON_TIGER
       
   665 #define WTF_USE_CORE_TEXT 1
       
   666 #else
       
   667 #define WTF_USE_ATSUI 1
       
   668 #endif
       
   669 #endif
       
   670 #endif
       
   671 
       
   672 #if PLATFORM(GTK)
       
   673 #if HAVE(PTHREAD_H)
       
   674 #define WTF_USE_PTHREADS 1
       
   675 #define HAVE_PTHREAD_RWLOCK 1
       
   676 #endif
       
   677 #endif
       
   678 
       
   679 #if PLATFORM(HAIKU)
       
   680 #define HAVE_POSIX_MEMALIGN 1
       
   681 #define WTF_USE_CURL 1
       
   682 #define WTF_USE_PTHREADS 1
       
   683 #define HAVE_PTHREAD_RWLOCK 1
       
   684 #define USE_SYSTEM_MALLOC 1
       
   685 #define ENABLE_NETSCAPE_PLUGIN_API 0
       
   686 #endif
       
   687 
       
   688 #if PLATFORM(BREWMP)
       
   689 #define USE_SYSTEM_MALLOC 1
       
   690 #endif
       
   691 
       
   692 #if !defined(HAVE_ACCESSIBILITY)
       
   693 #if PLATFORM(IPHONE) || PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(CHROMIUM)
       
   694 #define HAVE_ACCESSIBILITY 1
       
   695 #endif
       
   696 #endif /* !defined(HAVE_ACCESSIBILITY) */
       
   697 
       
   698 #if OS(UNIX) && !OS(SYMBIAN)
       
   699 #define HAVE_SIGNAL_H 1
       
   700 #endif
       
   701 
       
   702 #if !OS(WINDOWS) && !OS(SOLARIS) && !OS(QNX) \
       
   703     && !OS(SYMBIAN) && !OS(HAIKU) && !OS(RVCT) \
       
   704     && !OS(ANDROID) && !PLATFORM(BREWMP)
       
   705 #define HAVE_TM_GMTOFF 1
       
   706 #define HAVE_TM_ZONE 1
       
   707 #define HAVE_TIMEGM 1
       
   708 #endif
       
   709 
       
   710 #if OS(DARWIN)
       
   711 
       
   712 #define HAVE_ERRNO_H 1
       
   713 #define HAVE_LANGINFO_H 1
       
   714 #define HAVE_MMAP 1
       
   715 #define HAVE_MERGESORT 1
       
   716 #define HAVE_SBRK 1
       
   717 #define HAVE_STRINGS_H 1
       
   718 #define HAVE_SYS_PARAM_H 1
       
   719 #define HAVE_SYS_TIME_H 1
       
   720 #define HAVE_SYS_TIMEB_H 1
       
   721 
       
   722 #if !defined(TARGETING_TIGER) && !defined(TARGETING_LEOPARD)
       
   723 
       
   724 #define HAVE_DISPATCH_H 1
       
   725 #define HAVE_HOSTED_CORE_ANIMATION 1
       
   726 
       
   727 #if !PLATFORM(IPHONE)
       
   728 #define HAVE_MADV_FREE_REUSE 1
       
   729 #define HAVE_MADV_FREE 1
       
   730 #define HAVE_PTHREAD_SETNAME_NP 1
       
   731 #endif
       
   732 
       
   733 #endif
       
   734 
       
   735 #if PLATFORM(IPHONE)
       
   736 #define HAVE_MADV_FREE 1
       
   737 #endif
       
   738 
       
   739 #elif OS(WINDOWS)
       
   740 
       
   741 #if OS(WINCE)
       
   742 #define HAVE_ERRNO_H 0
       
   743 #else
       
   744 #define HAVE_SYS_TIMEB_H 1
       
   745 #endif
       
   746 #define HAVE_VIRTUALALLOC 1
       
   747 
       
   748 #elif OS(SYMBIAN)
       
   749 
       
   750 #define HAVE_ERRNO_H 1
       
   751 #define HAVE_MMAP 0
       
   752 #define HAVE_SBRK 1
       
   753 
       
   754 #define HAVE_SYS_TIME_H 1
       
   755 #define HAVE_STRINGS_H 1
       
   756 
       
   757 #if !COMPILER(RVCT)
       
   758 #define HAVE_SYS_PARAM_H 1
       
   759 #endif
       
   760 
       
   761 #elif PLATFORM(BREWMP)
       
   762 
       
   763 #define HAVE_ERRNO_H 1
       
   764 
       
   765 #elif OS(QNX)
       
   766 
       
   767 #define HAVE_ERRNO_H 1
       
   768 #define HAVE_MMAP 1
       
   769 #define HAVE_SBRK 1
       
   770 #define HAVE_STRINGS_H 1
       
   771 #define HAVE_SYS_PARAM_H 1
       
   772 #define HAVE_SYS_TIME_H 1
       
   773 
       
   774 #elif OS(ANDROID)
       
   775 
       
   776 #define HAVE_ERRNO_H 1
       
   777 #define HAVE_LANGINFO_H 0
       
   778 #define HAVE_MMAP 1
       
   779 #define HAVE_SBRK 1
       
   780 #define HAVE_STRINGS_H 1
       
   781 #define HAVE_SYS_PARAM_H 1
       
   782 #define HAVE_SYS_TIME_H 1
       
   783 
       
   784 #else
       
   785 
       
   786 /* FIXME: is this actually used or do other platforms generate their own config.h? */
       
   787 
       
   788 #define HAVE_ERRNO_H 1
       
   789 /* As long as Haiku doesn't have a complete support of locale this will be disabled. */
       
   790 #if !OS(HAIKU)
       
   791 #define HAVE_LANGINFO_H 1
       
   792 #endif
       
   793 #define HAVE_MMAP 1
       
   794 #define HAVE_SBRK 1
       
   795 #define HAVE_STRINGS_H 1
       
   796 #define HAVE_SYS_PARAM_H 1
       
   797 #define HAVE_SYS_TIME_H 1
       
   798 
       
   799 #endif
       
   800 
       
   801 /* ENABLE macro defaults */
       
   802 
       
   803 #if PLATFORM(QT)
       
   804 // We must not customize the global operator new and delete for the Qt port.
       
   805 #define ENABLE_GLOBAL_FASTMALLOC_NEW 0
       
   806 #endif
       
   807 
       
   808 /* fastMalloc match validation allows for runtime verification that
       
   809    new is matched by delete, fastMalloc is matched by fastFree, etc. */
       
   810 #if !defined(ENABLE_FAST_MALLOC_MATCH_VALIDATION)
       
   811 #define ENABLE_FAST_MALLOC_MATCH_VALIDATION 0
       
   812 #endif
       
   813 
       
   814 #if !defined(ENABLE_ICONDATABASE)
       
   815 #define ENABLE_ICONDATABASE 1
       
   816 #endif
       
   817 
       
   818 #if !defined(ENABLE_DATABASE)
       
   819 #define ENABLE_DATABASE 1
       
   820 #endif
       
   821 
       
   822 #if !defined(ENABLE_JAVASCRIPT_DEBUGGER)
       
   823 #define ENABLE_JAVASCRIPT_DEBUGGER 1
       
   824 #endif
       
   825 
       
   826 #if !defined(ENABLE_FTPDIR)
       
   827 #define ENABLE_FTPDIR 1
       
   828 #endif
       
   829 
       
   830 #if !defined(ENABLE_CONTEXT_MENUS)
       
   831 #define ENABLE_CONTEXT_MENUS 1
       
   832 #endif
       
   833 
       
   834 #if !defined(ENABLE_DRAG_SUPPORT)
       
   835 #define ENABLE_DRAG_SUPPORT 1
       
   836 #endif
       
   837 
       
   838 #if !defined(ENABLE_DASHBOARD_SUPPORT)
       
   839 #define ENABLE_DASHBOARD_SUPPORT 0
       
   840 #endif
       
   841 
       
   842 #if !defined(ENABLE_WIDGETS_10_SUPPORT)
       
   843 #define ENABLE_WIDGETS_10_SUPPORT 0
       
   844 #endif
       
   845 
       
   846 #if !defined(ENABLE_INSPECTOR)
       
   847 #define ENABLE_INSPECTOR 1
       
   848 #endif
       
   849 
       
   850 #if !defined(ENABLE_JAVA_BRIDGE)
       
   851 #define ENABLE_JAVA_BRIDGE 0
       
   852 #endif
       
   853 
       
   854 #if !defined(ENABLE_NETSCAPE_PLUGIN_API)
       
   855 #define ENABLE_NETSCAPE_PLUGIN_API 1
       
   856 #endif
       
   857 
       
   858 #if !defined(WTF_USE_PLUGIN_HOST_PROCESS)
       
   859 #define WTF_USE_PLUGIN_HOST_PROCESS 0
       
   860 #endif
       
   861 
       
   862 #if !defined(ENABLE_ORIENTATION_EVENTS)
       
   863 #define ENABLE_ORIENTATION_EVENTS 0
       
   864 #endif
       
   865 
       
   866 #if !defined(ENABLE_OPCODE_STATS)
       
   867 #define ENABLE_OPCODE_STATS 0
       
   868 #endif
       
   869 
       
   870 #if !defined(ENABLE_GLOBAL_FASTMALLOC_NEW)
       
   871 #define ENABLE_GLOBAL_FASTMALLOC_NEW 1
       
   872 #endif
       
   873 
       
   874 #define ENABLE_DEBUG_WITH_BREAKPOINT 0
       
   875 #define ENABLE_SAMPLING_COUNTERS 0
       
   876 #define ENABLE_SAMPLING_FLAGS 0
       
   877 #define ENABLE_OPCODE_SAMPLING 0
       
   878 #define ENABLE_CODEBLOCK_SAMPLING 0
       
   879 #if ENABLE(CODEBLOCK_SAMPLING) && !ENABLE(OPCODE_SAMPLING)
       
   880 #error "CODEBLOCK_SAMPLING requires OPCODE_SAMPLING"
       
   881 #endif
       
   882 #if ENABLE(OPCODE_SAMPLING) || ENABLE(SAMPLING_FLAGS)
       
   883 #define ENABLE_SAMPLING_THREAD 1
       
   884 #endif
       
   885 
       
   886 #if !defined(ENABLE_GEOLOCATION)
       
   887 #define ENABLE_GEOLOCATION 0
       
   888 #endif
       
   889 
       
   890 #if !defined(ENABLE_NOTIFICATIONS)
       
   891 #define ENABLE_NOTIFICATIONS 0
       
   892 #endif
       
   893 
       
   894 #if PLATFORM(IPHONE)
       
   895 #define ENABLE_TEXT_CARET 0
       
   896 #endif
       
   897 
       
   898 #if !defined(ENABLE_TEXT_CARET)
       
   899 #define ENABLE_TEXT_CARET 1
       
   900 #endif
       
   901 
       
   902 #if !defined(ENABLE_ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL)
       
   903 #define ENABLE_ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL 0
       
   904 #endif
       
   905 
       
   906 #if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32) && !defined(WTF_USE_JSVALUE32_64)
       
   907 #if (CPU(X86_64) && (OS(UNIX) || OS(WINDOWS))) \
       
   908     || (CPU(IA64) && !CPU(IA64_32)) \
       
   909     || CPU(ALPHA) \
       
   910     || CPU(SPARC64)
       
   911 #define WTF_USE_JSVALUE64 1
       
   912 #elif CPU(ARM_TRADITIONAL) || CPU(PPC64) || CPU(MIPS)
       
   913 #define WTF_USE_JSVALUE32 1
       
   914 #elif OS(WINDOWS) && COMPILER(MINGW)
       
   915 /* Using JSVALUE32_64 causes padding/alignement issues for JITStubArg
       
   916 on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */
       
   917 #define WTF_USE_JSVALUE32 1
       
   918 #else
       
   919 #define WTF_USE_JSVALUE32_64 1
       
   920 #endif
       
   921 #endif /* !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32) && !defined(WTF_USE_JSVALUE32_64) */
       
   922 
       
   923 #if !defined(ENABLE_REPAINT_THROTTLING)
       
   924 #define ENABLE_REPAINT_THROTTLING 0
       
   925 #endif
       
   926 
       
   927 #if !defined(ENABLE_JIT)
       
   928 
       
   929 /* The JIT is tested & working on x86_64 Mac */
       
   930 #if CPU(X86_64) && PLATFORM(MAC)
       
   931     #define ENABLE_JIT 1
       
   932 /* The JIT is tested & working on x86 Mac */
       
   933 #elif CPU(X86) && PLATFORM(MAC)
       
   934     #define ENABLE_JIT 1
       
   935 #elif CPU(ARM_THUMB2) && PLATFORM(IPHONE)
       
   936     #define ENABLE_JIT 1
       
   937 /* The JIT is tested & working on Android */
       
   938 #elif CPU(ARM_THUMB2) && PLATFORM(ANDROID) && ENABLE(ANDROID_JSC_JIT)
       
   939     #define ENABLE_JIT 1
       
   940 /* The JIT is tested & working on x86 Windows */
       
   941 #elif CPU(X86) && PLATFORM(WIN)
       
   942     #define ENABLE_JIT 1
       
   943 #endif
       
   944 
       
   945 #if PLATFORM(QT) || PLATFORM(WX)
       
   946 #if CPU(X86_64) && OS(DARWIN)
       
   947     #define ENABLE_JIT 1
       
   948 #elif CPU(X86) && OS(DARWIN)
       
   949     #define ENABLE_JIT 1
       
   950 #elif CPU(X86) && OS(WINDOWS) && COMPILER(MINGW) && GCC_VERSION >= 40100
       
   951     #define ENABLE_JIT 1
       
   952 #elif CPU(X86) && OS(WINDOWS) && COMPILER(MSVC)
       
   953     #define ENABLE_JIT 1
       
   954 #elif CPU(X86) && OS(LINUX) && GCC_VERSION >= 40100
       
   955     #define ENABLE_JIT 1
       
   956 #elif CPU(X86_64) && OS(LINUX) && GCC_VERSION >= 40100
       
   957     #define ENABLE_JIT 1
       
   958 #elif CPU(ARM_TRADITIONAL) && OS(LINUX)
       
   959     #define ENABLE_JIT 1
       
   960 #elif CPU(ARM_TRADITIONAL) && OS(SYMBIAN) && COMPILER(RVCT)
       
   961     #define ENABLE_JIT 1
       
   962 #elif CPU(MIPS) && OS(LINUX)
       
   963     #define ENABLE_JIT 1
       
   964 #endif
       
   965 #endif /* PLATFORM(QT) */
       
   966 
       
   967 #endif /* !defined(ENABLE_JIT) */
       
   968 
       
   969 #if !ENABLE(JIT)
       
   970 #define ENABLE_INTERPRETER 1
       
   971 #endif
       
   972 
       
   973 #if !(ENABLE(JIT) || ENABLE(INTERPRETER))
       
   974 #error You have to have at least one execution model enabled to build JSC
       
   975 #endif
       
   976 
       
   977 /* CPU architecture specific optimizations */
       
   978 #if CPU(ARM_TRADITIONAL)
       
   979 #if ENABLE(JIT) && !defined(ENABLE_JIT_OPTIMIZE_MOD) && WTF_ARM_ARCH_AT_LEAST(5)
       
   980 #define ENABLE_JIT_OPTIMIZE_MOD 1
       
   981 #endif
       
   982 #endif
       
   983 #if (CPU(X86) && USE(JSVALUE32_64)) || (CPU(X86_64) && USE(JSVALUE64)) \
       
   984      || CPU(ARM) \
       
   985      || CPU(MIPS)
       
   986 #if ENABLE(JIT) && !defined(ENABLE_JIT_OPTIMIZE_NATIVE_CALL)
       
   987 #define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 1
       
   988 #endif
       
   989 #endif
       
   990 
       
   991 #if ENABLE(JIT)
       
   992 #ifndef ENABLE_JIT_OPTIMIZE_CALL
       
   993 #define ENABLE_JIT_OPTIMIZE_CALL 1
       
   994 #endif
       
   995 #ifndef ENABLE_JIT_OPTIMIZE_NATIVE_CALL
       
   996 #define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 0
       
   997 #endif
       
   998 #ifndef ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS
       
   999 #define ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS 1
       
  1000 #endif
       
  1001 #ifndef ENABLE_JIT_OPTIMIZE_METHOD_CALLS
       
  1002 #define ENABLE_JIT_OPTIMIZE_METHOD_CALLS 1
       
  1003 #endif
       
  1004 #ifndef ENABLE_JIT_OPTIMIZE_MOD
       
  1005 #define ENABLE_JIT_OPTIMIZE_MOD 0
       
  1006 #endif
       
  1007 #endif
       
  1008 
       
  1009 #if CPU(X86) && COMPILER(MSVC)
       
  1010 #define JSC_HOST_CALL __fastcall
       
  1011 #elif CPU(X86) && COMPILER(GCC)
       
  1012 #define JSC_HOST_CALL __attribute__ ((fastcall))
       
  1013 #else
       
  1014 #define JSC_HOST_CALL
       
  1015 #endif
       
  1016 
       
  1017 #if COMPILER(GCC)
       
  1018 #define HAVE_COMPUTED_GOTO 1
       
  1019 #endif
       
  1020 
       
  1021 #if HAVE(COMPUTED_GOTO) && ENABLE(INTERPRETER)
       
  1022 #define ENABLE_COMPUTED_GOTO_INTERPRETER 1
       
  1023 #endif
       
  1024 
       
  1025 /* Yet Another Regex Runtime. */
       
  1026 #if !defined(ENABLE_YARR_JIT)
       
  1027 
       
  1028 /* YARR and YARR_JIT is usually turned on for JIT enabled ports */
       
  1029 #if ENABLE(JIT)
       
  1030 #define ENABLE_YARR 1
       
  1031 #define ENABLE_YARR_JIT 1
       
  1032 #endif
       
  1033 
       
  1034 #endif /* !defined(ENABLE_YARR_JIT) */
       
  1035 
       
  1036 /* Sanity Check */
       
  1037 #if ENABLE(YARR_JIT) && !ENABLE(YARR)
       
  1038 #error "YARR_JIT requires YARR"
       
  1039 #endif
       
  1040 
       
  1041 #if ENABLE(JIT) || ENABLE(YARR_JIT)
       
  1042 #define ENABLE_ASSEMBLER 1
       
  1043 #endif
       
  1044 /* Setting this flag prevents the assembler from using RWX memory; this may improve
       
  1045    security but currectly comes at a significant performance cost. */
       
  1046 #if PLATFORM(IPHONE)
       
  1047 #define ENABLE_ASSEMBLER_WX_EXCLUSIVE 1
       
  1048 #else
       
  1049 #define ENABLE_ASSEMBLER_WX_EXCLUSIVE 0
       
  1050 #endif
       
  1051 
       
  1052 /* Pick which allocator to use; we only need an executable allocator if the assembler is compiled in.
       
  1053    On x86-64 we use a single fixed mmap, on other platforms we mmap on demand. */
       
  1054 #if ENABLE(ASSEMBLER)
       
  1055 #if CPU(X86_64)
       
  1056 #define ENABLE_EXECUTABLE_ALLOCATOR_FIXED 1
       
  1057 #else
       
  1058 #define ENABLE_EXECUTABLE_ALLOCATOR_DEMAND 1
       
  1059 #endif
       
  1060 #endif
       
  1061 
       
  1062 #if !defined(ENABLE_PAN_SCROLLING) && OS(WINDOWS)
       
  1063 #define ENABLE_PAN_SCROLLING 1
       
  1064 #endif
       
  1065 
       
  1066 /* Use the QXmlStreamReader implementation for XMLDocumentParser */
       
  1067 /* Use the QXmlQuery implementation for XSLTProcessor */
       
  1068 #if PLATFORM(QT)
       
  1069 #define WTF_USE_QXMLSTREAM 1
       
  1070 #define WTF_USE_QXMLQUERY 1
       
  1071 #endif
       
  1072 
       
  1073 /* Accelerated compositing */
       
  1074 #if PLATFORM(MAC)
       
  1075 #if !defined(BUILDING_ON_TIGER)
       
  1076 #define WTF_USE_ACCELERATED_COMPOSITING 1
       
  1077 #endif
       
  1078 #endif
       
  1079 
       
  1080 #if PLATFORM(IPHONE)
       
  1081 #define WTF_USE_ACCELERATED_COMPOSITING 1
       
  1082 #endif
       
  1083 
       
  1084 /* FIXME: Defining ENABLE_3D_RENDERING here isn't really right, but it's always used with
       
  1085    with WTF_USE_ACCELERATED_COMPOSITING, and it allows the feature to be turned on and
       
  1086    off in one place. */
       
  1087 #if PLATFORM(WIN)
       
  1088 #include "QuartzCorePresent.h"
       
  1089 #if QUARTZCORE_PRESENT
       
  1090 #define WTF_USE_ACCELERATED_COMPOSITING 1
       
  1091 #define ENABLE_3D_RENDERING 1
       
  1092 #endif
       
  1093 #endif
       
  1094 
       
  1095 #if (PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)) || PLATFORM(IPHONE)
       
  1096 #define WTF_USE_PROTECTION_SPACE_AUTH_CALLBACK 1
       
  1097 #endif
       
  1098 
       
  1099 #if COMPILER(GCC)
       
  1100 #define WARN_UNUSED_RETURN __attribute__ ((warn_unused_result))
       
  1101 #else
       
  1102 #define WARN_UNUSED_RETURN
       
  1103 #endif
       
  1104 
       
  1105 #if !ENABLE(NETSCAPE_PLUGIN_API) || (ENABLE(NETSCAPE_PLUGIN_API) && ((OS(UNIX) && (PLATFORM(QT) || PLATFORM(WX))) || PLATFORM(GTK)))
       
  1106 #define ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH 1
       
  1107 #endif
       
  1108 
       
  1109 /* Set up a define for a common error that is intended to cause a build error -- thus the space after Error. */
       
  1110 #define WTF_PLATFORM_CFNETWORK Error USE_macro_should_be_used_with_CFNETWORK
       
  1111 
       
  1112 #define ENABLE_JSC_ZOMBIES 0
       
  1113 
       
  1114 /* FIXME: Eventually we should enable this for all platforms and get rid of the define. */
       
  1115 #if PLATFORM(MAC)
       
  1116 #define WTF_USE_PLATFORM_STRATEGIES 1
       
  1117 #endif
       
  1118 
       
  1119 /* Geolocation request policy. pre-emptive policy is to acquire user permission before acquiring location.
       
  1120    Client based implementations will have option to choose between pre-emptive and nonpre-emptive permission policy.
       
  1121    pre-emptive permission policy is enabled by default for all client-based implementations. */
       
  1122 #if ENABLE(CLIENT_BASED_GEOLOCATION)
       
  1123 #define WTF_USE_PREEMPT_GEOLOCATION_PERMISSION 1
       
  1124 #endif
       
  1125 
       
  1126 #endif /* WTF_Platform_h */