Platform.h 33.4 KB
Newer Older
mjs's avatar
mjs committed
1
/*
2
 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3
 * Copyright (C) 2007-2009 Torch Mobile, Inc.
4
 * Copyright (C) 2010, 2011 Research In Motion Limited. All rights reserved.
mjs's avatar
mjs committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
eric@webkit.org's avatar
eric@webkit.org committed
25
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mjs's avatar
mjs committed
26 27
 */

mjs's avatar
mjs committed
28 29
#ifndef WTF_Platform_h
#define WTF_Platform_h
mjs's avatar
mjs committed
30

31
/* Include compiler specific macros */
32
#include <wtf/Compiler.h>
33

34
/* ==== PLATFORM handles OS, operating environment, graphics API, and
35
   CPU. This macro will be phased out in favor of platform adaptation
36
   macros, policy decision macros, and top-level port definitions. ==== */
37
#define PLATFORM(WTF_FEATURE) (defined WTF_PLATFORM_##WTF_FEATURE  && WTF_PLATFORM_##WTF_FEATURE)
38

39 40

/* ==== Platform adaptation macros: these describe properties of the target environment. ==== */
41 42 43 44

/* CPU() - the target CPU architecture */
#define CPU(WTF_FEATURE) (defined WTF_CPU_##WTF_FEATURE  && WTF_CPU_##WTF_FEATURE)
/* HAVE() - specific system features (headers, functions or similar) that are present or not */
45
#define HAVE(WTF_FEATURE) (defined HAVE_##WTF_FEATURE  && HAVE_##WTF_FEATURE)
46 47 48 49
/* OS() - underlying operating system; only to be used for mandated low-level services like 
   virtual memory, not to choose a GUI toolkit */
#define OS(WTF_FEATURE) (defined WTF_OS_##WTF_FEATURE  && WTF_OS_##WTF_FEATURE)

50 51 52

/* ==== Policy decision macros: these define policy choices for a particular port. ==== */

53
/* USE() - use a particular third-party library or optional OS service */
54
#define USE(WTF_FEATURE) (defined WTF_USE_##WTF_FEATURE  && WTF_USE_##WTF_FEATURE)
55
/* ENABLE() - turn on a specific feature of WebKit */
56
#define ENABLE(WTF_FEATURE) (defined ENABLE_##WTF_FEATURE  && ENABLE_##WTF_FEATURE)
mjs's avatar
mjs committed
57

58

59 60 61 62 63 64 65 66 67 68 69 70
/* ==== CPU() - the target CPU architecture ==== */

/* This also defines CPU(BIG_ENDIAN) or CPU(MIDDLE_ENDIAN) or neither, as appropriate. */

/* CPU(ALPHA) - DEC Alpha */
#if defined(__alpha__)
#define WTF_CPU_ALPHA 1
#endif

/* CPU(IA64) - Itanium / IA-64 */
#if defined(__ia64__)
#define WTF_CPU_IA64 1
71 72 73 74
/* 32-bit mode on Itanium */
#if !defined(__LP64__)
#define WTF_CPU_IA64_32 1
#endif
75 76
#endif

77 78
/* CPU(MIPS) - MIPS 32-bit */
/* Note: Only O32 ABI is tested, so we enable it for O32 ABI for now.  */
79
#if (defined(mips) || defined(__mips__) || defined(MIPS) || defined(_MIPS_)) \
80 81 82 83 84 85 86 87 88 89 90 91
    && defined(_ABIO32)
#define WTF_CPU_MIPS 1
#if defined(__MIPSEB__)
#define WTF_CPU_BIG_ENDIAN 1
#endif
#define WTF_MIPS_PIC (defined __PIC__)
#define WTF_MIPS_ARCH __mips
#define WTF_MIPS_ISA(v) (defined WTF_MIPS_ARCH && WTF_MIPS_ARCH == v)
#define WTF_MIPS_ISA_AT_LEAST(v) (defined WTF_MIPS_ARCH && WTF_MIPS_ARCH >= v)
#define WTF_MIPS_ARCH_REV __mips_isa_rev
#define WTF_MIPS_ISA_REV(v) (defined WTF_MIPS_ARCH_REV && WTF_MIPS_ARCH_REV == v)
#define WTF_MIPS_DOUBLE_FLOAT (defined __mips_hard_float && !defined __mips_single_float)
92
#define WTF_MIPS_FP64 (defined __mips_fpr && __mips_fpr == 64)
93 94
/* MIPS requires allocators to use aligned memory */
#define WTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1
95 96
#endif /* MIPS */

97 98
/* CPU(PPC) - PowerPC 32-bit */
#if   defined(__ppc__)     \
99 100 101 102 103 104
    || defined(__PPC__)     \
    || defined(__powerpc__) \
    || defined(__powerpc)   \
    || defined(__POWERPC__) \
    || defined(_M_PPC)      \
    || defined(__PPC)
105 106 107 108 109 110
#define WTF_CPU_PPC 1
#define WTF_CPU_BIG_ENDIAN 1
#endif

/* CPU(PPC64) - PowerPC 64-bit */
#if   defined(__ppc64__) \
111
    || defined(__PPC64__)
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
#define WTF_CPU_PPC64 1
#define WTF_CPU_BIG_ENDIAN 1
#endif

/* CPU(SH4) - SuperH SH-4 */
#if defined(__SH4__)
#define WTF_CPU_SH4 1
#endif

/* CPU(SPARC32) - SPARC 32-bit */
#if defined(__sparc) && !defined(__arch64__) || defined(__sparcv8)
#define WTF_CPU_SPARC32 1
#define WTF_CPU_BIG_ENDIAN 1
#endif

/* CPU(SPARC64) - SPARC 64-bit */
#if defined(__sparc__) && defined(__arch64__) || defined (__sparcv9)
#define WTF_CPU_SPARC64 1
#define WTF_CPU_BIG_ENDIAN 1
#endif

/* CPU(SPARC) - any SPARC, true for CPU(SPARC32) and CPU(SPARC64) */
#if CPU(SPARC32) || CPU(SPARC64)
135
#define WTF_CPU_SPARC 1
136 137
#endif

138 139 140 141 142 143 144 145 146 147 148 149
/* CPU(S390X) - S390 64-bit */
#if defined(__s390x__)
#define WTF_CPU_S390X 1
#define WTF_CPU_BIG_ENDIAN 1
#endif

/* CPU(S390) - S390 32-bit */
#if defined(__s390__)
#define WTF_CPU_S390 1
#define WTF_CPU_BIG_ENDIAN 1
#endif

150 151
/* CPU(X86) - i386 / x86 32-bit */
#if   defined(__i386__) \
152 153 154 155
    || defined(i386)     \
    || defined(_M_IX86)  \
    || defined(_X86_)    \
    || defined(__THW_INTEL)
156 157 158 159 160
#define WTF_CPU_X86 1
#endif

/* CPU(X86_64) - AMD64 / Intel64 / x86_64 64-bit */
#if   defined(__x86_64__) \
161
    || defined(_M_X64)
162 163 164 165 166
#define WTF_CPU_X86_64 1
#endif

/* CPU(ARM) - ARM, any version*/
#if   defined(arm) \
167 168 169
    || defined(__arm__) \
    || defined(ARM) \
    || defined(_ARM_)
170 171
#define WTF_CPU_ARM 1

172 173 174 175
#if defined(__ARM_PCS_VFP)
#define WTF_CPU_ARM_HARDFP 1
#endif

176
#if defined(__ARMEB__) || (COMPILER(RVCT) && defined(__BIG_ENDIAN))
177 178 179
#define WTF_CPU_BIG_ENDIAN 1

#elif !defined(__ARM_EABI__) \
180 181
    && !defined(__EABI__) \
    && !defined(__VFP_FP__) \
182 183
    && !defined(_WIN32_WCE) \
    && !defined(ANDROID)
184 185 186 187 188 189 190 191
#define WTF_CPU_MIDDLE_ENDIAN 1

#endif

#define WTF_ARM_ARCH_AT_LEAST(N) (CPU(ARM) && WTF_ARM_ARCH_VERSION >= N)

/* Set WTF_ARM_ARCH_VERSION */
#if   defined(__ARM_ARCH_4__) \
192 193 194
    || defined(__ARM_ARCH_4T__) \
    || defined(__MARM_ARMV4__) \
    || defined(_ARMV4I_)
195 196 197
#define WTF_ARM_ARCH_VERSION 4

#elif defined(__ARM_ARCH_5__) \
198 199
    || defined(__ARM_ARCH_5T__) \
    || defined(__MARM_ARMV5__)
200 201
#define WTF_ARM_ARCH_VERSION 5

202 203 204 205 206 207 208
#elif defined(__ARM_ARCH_5E__) \
    || defined(__ARM_ARCH_5TE__) \
    || defined(__ARM_ARCH_5TEJ__)
#define WTF_ARM_ARCH_VERSION 5
/*ARMv5TE requires allocators to use aligned memory*/
#define WTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1

209
#elif defined(__ARM_ARCH_6__) \
210 211 212 213 214 215
    || defined(__ARM_ARCH_6J__) \
    || defined(__ARM_ARCH_6K__) \
    || defined(__ARM_ARCH_6Z__) \
    || defined(__ARM_ARCH_6ZK__) \
    || defined(__ARM_ARCH_6T2__) \
    || defined(__ARMV6__)
216 217 218
#define WTF_ARM_ARCH_VERSION 6

#elif defined(__ARM_ARCH_7A__) \
219
    || defined(__ARM_ARCH_7R__)
220 221 222 223 224 225
#define WTF_ARM_ARCH_VERSION 7

/* RVCT sets _TARGET_ARCH_ARM */
#elif defined(__TARGET_ARCH_ARM)
#define WTF_ARM_ARCH_VERSION __TARGET_ARCH_ARM

226 227 228 229 230 231 232
#if defined(__TARGET_ARCH_5E) \
    || defined(__TARGET_ARCH_5TE) \
    || defined(__TARGET_ARCH_5TEJ)
/*ARMv5TE requires allocators to use aligned memory*/
#define WTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1
#endif

233 234 235 236 237 238 239 240 241 242
#else
#define WTF_ARM_ARCH_VERSION 0

#endif

/* Set WTF_THUMB_ARCH_VERSION */
#if   defined(__ARM_ARCH_4T__)
#define WTF_THUMB_ARCH_VERSION 1

#elif defined(__ARM_ARCH_5T__) \
243 244
    || defined(__ARM_ARCH_5TE__) \
    || defined(__ARM_ARCH_5TEJ__)
245 246 247
#define WTF_THUMB_ARCH_VERSION 2

#elif defined(__ARM_ARCH_6J__) \
248 249 250 251
    || defined(__ARM_ARCH_6K__) \
    || defined(__ARM_ARCH_6Z__) \
    || defined(__ARM_ARCH_6ZK__) \
    || defined(__ARM_ARCH_6M__)
252 253 254
#define WTF_THUMB_ARCH_VERSION 3

#elif defined(__ARM_ARCH_6T2__) \
255 256 257 258
    || defined(__ARM_ARCH_7__) \
    || defined(__ARM_ARCH_7A__) \
    || defined(__ARM_ARCH_7R__) \
    || defined(__ARM_ARCH_7M__)
259 260 261 262 263 264 265 266 267 268 269 270 271 272
#define WTF_THUMB_ARCH_VERSION 4

/* RVCT sets __TARGET_ARCH_THUMB */
#elif defined(__TARGET_ARCH_THUMB)
#define WTF_THUMB_ARCH_VERSION __TARGET_ARCH_THUMB

#else
#define WTF_THUMB_ARCH_VERSION 0
#endif


/* CPU(ARMV5_OR_LOWER) - ARM instruction set v5 or earlier */
/* On ARMv5 and below the natural alignment is required. 
   And there are some other differences for v5 or earlier. */
273
#if !defined(ARMV5_OR_LOWER) && !WTF_ARM_ARCH_AT_LEAST(6)
274 275 276 277 278 279 280 281 282
#define WTF_CPU_ARMV5_OR_LOWER 1
#endif


/* CPU(ARM_TRADITIONAL) - Thumb2 is not available, only traditional ARM (v4 or greater) */
/* CPU(ARM_THUMB2) - Thumb2 instruction set is available */
/* Only one of these will be defined. */
#if !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2)
#  if defined(thumb2) || defined(__thumb2__) \
283
    || ((defined(__thumb) || defined(__thumb__)) && WTF_THUMB_ARCH_VERSION == 4)
284 285 286 287 288 289 290 291 292 293
#    define WTF_CPU_ARM_TRADITIONAL 0
#    define WTF_CPU_ARM_THUMB2 1
#  elif WTF_ARM_ARCH_AT_LEAST(4)
#    define WTF_CPU_ARM_TRADITIONAL 1
#    define WTF_CPU_ARM_THUMB2 0
#  else
#    error "Not supported ARM architecture"
#  endif
#elif CPU(ARM_TRADITIONAL) && CPU(ARM_THUMB2) /* Sanity Check */
#  error "Cannot use both of WTF_CPU_ARM_TRADITIONAL and WTF_CPU_ARM_THUMB2 platforms"
mjs@apple.com's avatar
mjs@apple.com committed
294
#endif /* !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2) */
295

296 297 298 299
#if defined(__ARM_NEON__) && !defined(WTF_CPU_ARM_NEON)
#define WTF_CPU_ARM_NEON 1
#endif

300 301 302 303 304
#if CPU(ARM_NEON) && (!COMPILER(GCC) || GCC_VERSION_AT_LEAST(4, 7, 0))
// All NEON intrinsics usage can be disabled by this macro.
#define HAVE_ARM_NEON_INTRINSICS 1
#endif

305 306
#endif /* ARM */

307
#if CPU(ARM) || CPU(MIPS) || CPU(SH4) || CPU(SPARC)
308 309
#define WTF_CPU_NEEDS_ALIGNED_ACCESS 1
#endif
310

311 312 313
/* ==== OS() - underlying operating system; only to be used for mandated low-level services like 
   virtual memory, not to choose a GUI toolkit ==== */

314 315 316 317 318
/* OS(ANDROID) - Android */
#ifdef ANDROID
#define WTF_OS_ANDROID 1
#endif

319 320 321 322
/* OS(AIX) - AIX */
#ifdef _AIX
#define WTF_OS_AIX 1
#endif
mjs's avatar
mjs committed
323

324
/* OS(DARWIN) - Any Darwin-based OS, including Mac OS X and iPhone OS */
mjs's avatar
mjs committed
325
#ifdef __APPLE__
326 327
#define WTF_OS_DARWIN 1

328
#include <Availability.h>
kevino@webkit.org's avatar
kevino@webkit.org committed
329
#include <AvailabilityMacros.h>
330 331 332 333 334 335 336 337 338 339 340
#include <TargetConditionals.h>
#endif

/* OS(IOS) - iOS */
/* OS(MAC_OS_X) - Mac OS X (not including iOS) */
#if OS(DARWIN) && ((defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED) \
    || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)                 \
    || (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR))
#define WTF_OS_IOS 1
#elif OS(DARWIN) && defined(TARGET_OS_MAC) && TARGET_OS_MAC
#define WTF_OS_MAC_OS_X 1
341 342 343 344 345 346 347 348 349 350 351 352 353

/* FIXME: These can be removed after sufficient time has passed since the removal of BUILDING_ON / TARGETING macros. */

#define ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MIN_REQUIRED 0 / 0
#define ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MAX_ALLOWED 0 / 0

#define BUILDING_ON_LEOPARD ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MIN_REQUIRED
#define BUILDING_ON_SNOW_LEOPARD ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MIN_REQUIRED
#define BUILDING_ON_LION ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MIN_REQUIRED

#define TARGETING_LEOPARD ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MAX_ALLOWED
#define TARGETING_SNOW_LEOPARD ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MAX_ALLOWED
#define TARGETING_LION ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MAX_ALLOWED
mjs's avatar
mjs committed
354 355
#endif

356
/* OS(FREEBSD) - FreeBSD */
357
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
358 359 360
#define WTF_OS_FREEBSD 1
#endif

361 362 363 364 365
/* OS(HURD) - GNU/Hurd */
#ifdef __GNU__
#define WTF_OS_HURD 1
#endif

366
/* OS(LINUX) - Linux */
367
#ifdef __linux__
368
#define WTF_OS_LINUX 1
369 370
#endif

371 372
/* OS(NETBSD) - NetBSD */
#if defined(__NetBSD__)
373
#define WTF_OS_NETBSD 1
oliver's avatar
oliver committed
374 375
#endif

376
/* OS(OPENBSD) - OpenBSD */
377
#ifdef __OpenBSD__
378
#define WTF_OS_OPENBSD 1
379 380
#endif

381 382 383
/* OS(QNX) - QNX */
#if defined(__QNXNTO__)
#define WTF_OS_QNX 1
384 385
#endif

386 387 388
/* OS(SOLARIS) - Solaris */
#if defined(sun) || defined(__sun)
#define WTF_OS_SOLARIS 1
389 390
#endif

391 392 393
/* OS(WINCE) - Windows CE; note that for this platform OS(WINDOWS) is also defined */
#if defined(_WIN32_WCE)
#define WTF_OS_WINCE 1
394 395
#endif

396 397 398
/* OS(WINDOWS) - Any version of Windows */
#if defined(WIN32) || defined(_WIN32)
#define WTF_OS_WINDOWS 1
399 400
#endif

401 402 403
#define WTF_OS_WIN ERROR "USE WINDOWS WITH OS NOT WIN"
#define WTF_OS_MAC ERROR "USE MAC_OS_X WITH OS NOT MAC"

404 405
/* OS(UNIX) - Any Unix-like system */
#if   OS(AIX)              \
406
    || OS(ANDROID)          \
407 408
    || OS(DARWIN)           \
    || OS(FREEBSD)          \
409
    || OS(HURD)             \
410 411 412 413 414 415 416 417
    || OS(LINUX)            \
    || OS(NETBSD)           \
    || OS(OPENBSD)          \
    || OS(QNX)              \
    || OS(SOLARIS)          \
    || defined(unix)        \
    || defined(__unix)      \
    || defined(__unix__)
418
#define WTF_OS_UNIX 1
mjs's avatar
mjs committed
419 420
#endif

weinig's avatar
weinig committed
421
/* Operating environments */
mjs's avatar
mjs committed
422

mjs@apple.com's avatar
mjs@apple.com committed
423
/* FIXME: these are all mixes of OS, operating environment and policy choices. */
424
/* PLATFORM(CHROMIUM) */
425
/* PLATFORM(QT) */
426
/* PLATFORM(WX) */
zecke's avatar
/:  
zecke committed
427
/* PLATFORM(GTK) */
428
/* PLATFORM(BLACKBERRY) */
weinig's avatar
weinig committed
429 430
/* PLATFORM(MAC) */
/* PLATFORM(WIN) */
431 432 433
#if defined(BUILDING_CHROMIUM__)
#define WTF_PLATFORM_CHROMIUM 1
#elif defined(BUILDING_QT__)
mjs's avatar
mjs committed
434
#define WTF_PLATFORM_QT 1
435 436
#elif defined(BUILDING_WX__)
#define WTF_PLATFORM_WX 1
zecke's avatar
/:  
zecke committed
437 438
#elif defined(BUILDING_GTK__)
#define WTF_PLATFORM_GTK 1
439 440
#elif defined(BUILDING_BLACKBERRY__)
#define WTF_PLATFORM_BLACKBERRY 1
441
#elif OS(DARWIN)
mjs's avatar
mjs committed
442
#define WTF_PLATFORM_MAC 1
443
#elif OS(WINDOWS)
mjs's avatar
mjs committed
444
#define WTF_PLATFORM_WIN 1
mjs's avatar
mjs committed
445
#endif
ggaren's avatar
ggaren committed
446

447
/* PLATFORM(IOS) */
mjs@apple.com's avatar
mjs@apple.com committed
448
/* FIXME: this is sometimes used as an OS switch and sometimes for higher-level things */
449
#if (defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
450
#define WTF_PLATFORM_IOS 1
451 452
#endif

453
/* PLATFORM(IOS_SIMULATOR) */
454
#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR
455 456
#define WTF_PLATFORM_IOS 1
#define WTF_PLATFORM_IOS_SIMULATOR 1
457 458
#endif

459 460
/* Graphics engines */

461
/* USE(CG) and PLATFORM(CI) */
462
#if PLATFORM(MAC) || PLATFORM(IOS)
463
#define WTF_USE_CG 1
464
#endif
465
#if PLATFORM(MAC) || PLATFORM(IOS) || (PLATFORM(WIN) && USE(CG))
466
#define WTF_USE_CA 1
467
#endif
eric@webkit.org's avatar
eric@webkit.org committed
468

469
/* USE(SKIA) for Win/Linux/Mac/Android */
eric@webkit.org's avatar
eric@webkit.org committed
470
#if PLATFORM(CHROMIUM)
471
#if OS(DARWIN)
472
#define WTF_USE_SKIA 1
473
#define WTF_USE_ICCJPEG 1
474
#define WTF_USE_QCMSLIB 1
475 476
#elif OS(ANDROID)
#define WTF_USE_SKIA 1
477
#define WTF_USE_LOW_QUALITY_IMAGE_INTERPOLATION 1
478 479
#define WTF_USE_LOW_QUALITY_IMAGE_NO_JPEG_DITHERING 1
#define WTF_USE_LOW_QUALITY_IMAGE_NO_JPEG_FANCY_UPSAMPLING 1
480
#else
481
#define WTF_USE_SKIA 1
482 483
#define WTF_USE_ICCJPEG 1
#define WTF_USE_QCMSLIB 1
eric@webkit.org's avatar
eric@webkit.org committed
484
#endif
485
#endif
eric@webkit.org's avatar
eric@webkit.org committed
486

487
#if OS(QNX)
488
#define USE_SYSTEM_MALLOC 1
489 490 491
#endif

#if PLATFORM(BLACKBERRY)
492 493
#define WTF_USE_MERSENNE_TWISTER_19937 1
#define WTF_USE_SKIA 1
494 495 496
#define WTF_USE_LOW_QUALITY_IMAGE_INTERPOLATION 1
#define WTF_USE_LOW_QUALITY_IMAGE_NO_JPEG_DITHERING 1
#define WTF_USE_LOW_QUALITY_IMAGE_NO_JPEG_FANCY_UPSAMPLING 1
497 498
#endif

499
#if PLATFORM(GTK)
500
#define WTF_USE_CAIRO 1
kov@webkit.org's avatar
kov@webkit.org committed
501
#define ENABLE_GLOBAL_FASTMALLOC_NEW 0
502 503
#endif

504

505
#if OS(WINCE)
506
#define WTF_USE_MERSENNE_TWISTER_19937 1
507 508
#endif

509
/* On Windows, use QueryPerformanceCounter by default */
510
#if OS(WINDOWS)
511 512 513
#define WTF_USE_QUERY_PERFORMANCE_COUNTER  1
#endif

514
#if OS(WINCE) && !PLATFORM(QT)
mjs@apple.com's avatar
mjs@apple.com committed
515
#define NOSHLWAPI      /* shlwapi.h not available on WinCe */
516

mjs@apple.com's avatar
mjs@apple.com committed
517 518
/* MSDN documentation says these functions are provided with uspce.lib.  But we cannot find this file. */
#define __usp10__      /* disable "usp10.h" */
519

mjs@apple.com's avatar
mjs@apple.com committed
520
#define _INC_ASSERT    /* disable "assert.h" */
521 522
#define assert(x)

523
#endif  /* OS(WINCE) && !PLATFORM(QT) */
524

525
#if OS(WINCE) && !PLATFORM(QT)
526
#define WTF_USE_WCHAR_UNICODE 1
527 528
#elif PLATFORM(GTK)
/* The GTK+ Unicode backend is configurable */
darin's avatar
darin committed
529
#else
mjs's avatar
mjs committed
530
#define WTF_USE_ICU_UNICODE 1
mjs's avatar
mjs committed
531 532
#endif

533
#if PLATFORM(MAC) && !PLATFORM(IOS)
534
#if CPU(X86_64)
535 536
#define WTF_USE_PLUGIN_HOST_PROCESS 1
#endif
537
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
538
#define ENABLE_GESTURE_EVENTS 1
539
#define ENABLE_RUBBER_BANDING 1
540
#define WTF_USE_SCROLLBAR_PAINTER 1
541
#define HAVE_XPC 1
542
#endif
543
#if !defined(ENABLE_DASHBOARD_SUPPORT)
544
#define ENABLE_DASHBOARD_SUPPORT 1
545
#endif
546
#define WTF_USE_CF 1
547 548
#define WTF_USE_PTHREADS 1
#define HAVE_PTHREAD_RWLOCK 1
ggaren@apple.com's avatar
ggaren@apple.com committed
549
#define HAVE_READLINE 1
550
#define HAVE_RUNLOOP_TIMER 1
551
#define ENABLE_FULLSCREEN_API 1
552
#define ENABLE_SMOOTH_SCROLLING 1
553
#define ENABLE_WEB_ARCHIVE 1
554
#define ENABLE_WEB_AUDIO 1
555
#if defined(ENABLE_VIDEO)
556
#define ENABLE_VIDEO_TRACK 1
557
#endif
558
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
559 560
#define HAVE_LAYER_HOSTING_IN_WINDOW_SERVER 1
#endif
561
#define WTF_USE_APPKIT 1
562
#define WTF_USE_SECURITY_FRAMEWORK 1
563
#endif /* PLATFORM(MAC) && !PLATFORM(IOS) */
ggaren's avatar
ggaren committed
564

565
#if PLATFORM(CHROMIUM) && OS(DARWIN)
566
#define WTF_USE_CF 1
567
#define WTF_USE_PTHREADS 1
568
#define HAVE_PTHREAD_RWLOCK 1
569 570

#define WTF_USE_WK_SCROLLBAR_PAINTER 1
571 572
#endif

573 574 575 576
#if PLATFORM(IOS)
#define DONT_FINALIZE_ON_MAIN_THREAD 1
#endif

577
#if PLATFORM(QT) && OS(DARWIN)
578
#define WTF_USE_CF 1
579
#endif
580

mrowe@apple.com's avatar
mrowe@apple.com committed
581
#if OS(DARWIN) && !PLATFORM(GTK) && !PLATFORM(QT)
582 583 584
#define ENABLE_PURGEABLE_MEMORY 1
#endif

585
#if PLATFORM(IOS)
bolsinga@apple.com's avatar
bolsinga@apple.com committed
586
#define ENABLE_CONTEXT_MENUS 0
bolsinga@apple.com's avatar
bolsinga@apple.com committed
587
#define ENABLE_DRAG_SUPPORT 0
588 589
#define ENABLE_GEOLOCATION 1
#define ENABLE_ICONDATABASE 0
590
#define ENABLE_INSPECTOR 1
591
#define ENABLE_NETSCAPE_PLUGIN_API 0
592
#define ENABLE_ORIENTATION_EVENTS 1
593
#define ENABLE_REPAINT_THROTTLING 1
594 595 596
#define ENABLE_WEB_ARCHIVE 1
#define HAVE_NETWORK_CFDATA_ARRAY_CALLBACK 1
#define HAVE_PTHREAD_RWLOCK 1
597
#define HAVE_READLINE 1
598
#define WTF_USE_CF 1
599
#define WTF_USE_CFNETWORK 1
600
#define WTF_USE_PTHREADS 1
601 602 603 604 605 606

#if PLATFORM(IOS_SIMULATOR)
    #define ENABLE_JIT 0
    #define ENABLE_YARR_JIT 0
#else
    #define ENABLE_JIT 1
607
    #define ENABLE_LLINT 1
608 609 610
    #define ENABLE_YARR_JIT 1
#endif

611
#define WTF_USE_APPKIT 0
612
#define WTF_USE_SECURITY_FRAMEWORK 0
613 614
#endif

615
#if PLATFORM(WIN) && !OS(WINCE)
616
#define WTF_USE_CF 1
ggaren's avatar
ggaren committed
617 618
#endif

619
#if PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(CHROMIUM) && !PLATFORM(WIN_CAIRO)
620 621 622
#define WTF_USE_CFNETWORK 1
#endif

623
#if USE(CFNETWORK) || PLATFORM(MAC) || PLATFORM(IOS)
624
#define WTF_USE_CFURLCACHE 1
625
#define WTF_USE_CFURLSTORAGESESSIONS 1
626 627
#endif

628 629 630 631
#if PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(CHROMIUM) && !PLATFORM(QT)
#define ENABLE_WEB_ARCHIVE 1
#endif

632
#if PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(CHROMIUM) && !PLATFORM(WIN_CAIRO) && !PLATFORM(QT)
633 634 635
#define ENABLE_FULLSCREEN_API 1
#endif

636
#if PLATFORM(WX)
637
#if !CPU(PPC)
638
#if !defined(ENABLE_ASSEMBLER)
639
#define ENABLE_ASSEMBLER 1
640
#endif
641 642
#define ENABLE_JIT 1
#endif
643
#define ENABLE_GLOBAL_FASTMALLOC_NEW 0
644
#define ENABLE_LLINT 0
645
#if OS(DARWIN)
646
#define WTF_USE_CF 1
647
#define ENABLE_WEB_ARCHIVE 1
648
#endif
649 650
#endif

651
#if OS(UNIX) && (PLATFORM(GTK) || PLATFORM(QT))
652 653
#define WTF_USE_PTHREADS 1
#define HAVE_PTHREAD_RWLOCK 1
654 655
#endif

656
#if !defined(HAVE_ACCESSIBILITY)
657
#if PLATFORM(IOS) || PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && !OS(ANDROID))
658 659
#define HAVE_ACCESSIBILITY 1
#endif
660
#endif /* !defined(HAVE_ACCESSIBILITY) */
661

662
#if OS(UNIX)
663
#define HAVE_SIGNAL_H 1
664 665 666 667 668
#define WTF_USE_OS_RANDOMNESS 1
#endif

#if (OS(FREEBSD) || OS(OPENBSD)) && !defined(__GLIBC__)
#define HAVE_PTHREAD_NP_H 1
669 670
#endif

671
#if !defined(HAVE_VASPRINTF)
672
#if !COMPILER(MSVC) && !COMPILER(RVCT) && !COMPILER(MINGW) && !(COMPILER(GCC) && OS(QNX))
673 674 675 676
#define HAVE_VASPRINTF 1
#endif
#endif

677
#if !defined(HAVE_STRNSTR)
678
#if OS(DARWIN) || (OS(FREEBSD) && !defined(__GLIBC__))
679 680 681 682
#define HAVE_STRNSTR 1
#endif
#endif

683
#if !OS(WINDOWS) && !OS(SOLARIS) \
684
    && !OS(RVCT) \
685
    && !OS(ANDROID)
686 687 688
#define HAVE_TM_GMTOFF 1
#define HAVE_TM_ZONE 1
#define HAVE_TIMEGM 1
689
#endif
690

691
#if OS(DARWIN)
ggaren@apple.com's avatar
ggaren@apple.com committed
692 693

#define HAVE_ERRNO_H 1
kevino@webkit.org's avatar
kevino@webkit.org committed
694
#define HAVE_LANGINFO_H 1
ggaren@apple.com's avatar
ggaren@apple.com committed
695 696 697 698 699 700
#define HAVE_MMAP 1
#define HAVE_MERGESORT 1
#define HAVE_STRINGS_H 1
#define HAVE_SYS_PARAM_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TIMEB_H 1
701
#define WTF_USE_ACCELERATE 1
ggaren@apple.com's avatar
ggaren@apple.com committed
702

fpizlo@apple.com's avatar
fpizlo@apple.com committed
703
#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
704 705

#define HAVE_DISPATCH_H 1
706
#define HAVE_HOSTED_CORE_ANIMATION 1
707

708
#if !PLATFORM(IOS)
709
#define HAVE_MADV_FREE_REUSE 1
oliver@apple.com's avatar
oliver@apple.com committed
710
#define HAVE_MADV_FREE 1
711
#define HAVE_PTHREAD_SETNAME_NP 1
712
#endif
oliver@apple.com's avatar
oliver@apple.com committed
713

714 715
#endif

716
#if PLATFORM(IOS)
717
#define HAVE_MADV_FREE 1
718
#define HAVE_PTHREAD_SETNAME_NP 1
719 720
#endif

721
#elif OS(WINDOWS)
ggaren@apple.com's avatar
ggaren@apple.com committed
722

723
#if !OS(WINCE)
ggaren@apple.com's avatar
ggaren@apple.com committed
724
#define HAVE_SYS_TIMEB_H 1
725
#define HAVE_ALIGNED_MALLOC 1
726
#define HAVE_ISDEBUGGERPRESENT 1
727
#endif
ggaren@apple.com's avatar
ggaren@apple.com committed
728
#define HAVE_VIRTUALALLOC 1
729
#define WTF_USE_OS_RANDOMNESS 1
ggaren@apple.com's avatar
ggaren@apple.com committed
730

731
#elif OS(QNX)
732 733 734

#define HAVE_ERRNO_H 1
#define HAVE_MMAP 1
735 736
#define HAVE_MADV_FREE_REUSE 1
#define HAVE_MADV_FREE 1
737 738
#define HAVE_STRINGS_H 1
#define HAVE_SYS_PARAM_H 1
739
#define HAVE_SYS_TIME_H 1
740
#define WTF_USE_PTHREADS 1
741

742 743 744 745 746 747 748 749
#elif OS(ANDROID)

#define HAVE_ERRNO_H 1
#define HAVE_NMAP 1
#define HAVE_STRINGS_H 1
#define HAVE_SYS_PARAM_H 1
#define HAVE_SYS_TIME_H 1

ggaren@apple.com's avatar
ggaren@apple.com committed
750 751 752 753 754
#else

/* FIXME: is this actually used or do other platforms generate their own config.h? */

#define HAVE_ERRNO_H 1
755
#define HAVE_LANGINFO_H 1
ggaren@apple.com's avatar
ggaren@apple.com committed
756 757 758 759 760 761 762
#define HAVE_MMAP 1
#define HAVE_STRINGS_H 1
#define HAVE_SYS_PARAM_H 1
#define HAVE_SYS_TIME_H 1

#endif

ddkilzer@apple.com's avatar
ddkilzer@apple.com committed
763 764
/* ENABLE macro defaults */

765
#if PLATFORM(QT)
766
/* We must not customize the global operator new and delete for the Qt port. */
767
#define ENABLE_GLOBAL_FASTMALLOC_NEW 0
768
#if !OS(UNIX)
769 770
#define USE_SYSTEM_MALLOC 1
#endif
771 772
#endif

773 774 775
#if !defined(ENABLE_ICONDATABASE)
#define ENABLE_ICONDATABASE 1
#endif
776

777 778
#if !defined(ENABLE_SQL_DATABASE)
#define ENABLE_SQL_DATABASE 1
hausmann's avatar
hausmann committed
779 780
#endif

pkasting@chromium.org's avatar
pkasting@chromium.org committed
781 782 783 784
#if !defined(ENABLE_JAVASCRIPT_DEBUGGER)
#define ENABLE_JAVASCRIPT_DEBUGGER 1
#endif

785
#if !defined(ENABLE_FTPDIR)
beidson's avatar
beidson committed
786 787 788
#define ENABLE_FTPDIR 1
#endif

bolsinga@apple.com's avatar
bolsinga@apple.com committed
789 790 791 792
#if !defined(ENABLE_CONTEXT_MENUS)
#define ENABLE_CONTEXT_MENUS 1
#endif

bolsinga@apple.com's avatar
bolsinga@apple.com committed
793 794 795 796
#if !defined(ENABLE_DRAG_SUPPORT)
#define ENABLE_DRAG_SUPPORT 1
#endif

bolsinga@apple.com's avatar
bolsinga@apple.com committed
797 798 799 800
#if !defined(ENABLE_INSPECTOR)
#define ENABLE_INSPECTOR 1
#endif

ddkilzer@apple.com's avatar
ddkilzer@apple.com committed
801
#if !defined(ENABLE_NETSCAPE_PLUGIN_API)
eric@webkit.org's avatar
eric@webkit.org committed
802
#define ENABLE_NETSCAPE_PLUGIN_API 1
ddkilzer@apple.com's avatar
ddkilzer@apple.com committed
803 804
#endif

805 806 807 808
#if !defined(ENABLE_GLOBAL_FASTMALLOC_NEW)
#define ENABLE_GLOBAL_FASTMALLOC_NEW 1
#endif

809 810 811 812
#if !defined(ENABLE_PARSED_STYLE_SHEET_CACHING)
#define ENABLE_PARSED_STYLE_SHEET_CACHING 1
#endif

813
#if !defined(ENABLE_SUBPIXEL_LAYOUT)
814 815 816
#if PLATFORM(CHROMIUM)
#define ENABLE_SUBPIXEL_LAYOUT 1 
#else
817 818
#define ENABLE_SUBPIXEL_LAYOUT 0
#endif
819
#endif
820

821 822 823 824 825 826 827 828
#if !defined(ENABLE_GESTURE_ANIMATION)
#if PLATFORM(QT) || !ENABLE(SMOOTH_SCROLLING)
#define ENABLE_GESTURE_ANIMATION 0
#else
#define ENABLE_GESTURE_ANIMATION 1
#endif
#endif

829 830 831 832 833 834 835 836
#if !defined(ENABLE_SATURATED_LAYOUT_ARITHMETIC)
#define ENABLE_SATURATED_LAYOUT_ARITHMETIC 0
#endif

#if ENABLE(ENABLE_SATURATED_LAYOUT_ARITHMETIC) && !ENABLE(ENABLE_SUBPIXEL_LAYOUT)
#error "ENABLE_SATURATED_LAYOUT_ARITHMETIC requires ENABLE_SUBPIXEL_LAYOUT"
#endif

837
#define ENABLE_DEBUG_WITH_BREAKPOINT 0
ggaren@apple.com's avatar
ggaren@apple.com committed
838 839
#define ENABLE_SAMPLING_COUNTERS 0
#define ENABLE_SAMPLING_FLAGS 0
840
#define ENABLE_SAMPLING_REGIONS 0
841
#define ENABLE_OPCODE_SAMPLING 0
842
#define ENABLE_CODEBLOCK_SAMPLING 0
843 844
#if ENABLE(CODEBLOCK_SAMPLING) && !ENABLE(OPCODE_SAMPLING)
#error "CODEBLOCK_SAMPLING requires OPCODE_SAMPLING"
845
#endif
846
#if ENABLE(OPCODE_SAMPLING) || ENABLE(SAMPLING_FLAGS) || ENABLE(SAMPLING_REGIONS)
847
#define ENABLE_SAMPLING_THREAD 1
848
#endif
849

850
#if !defined(ENABLE_TEXT_CARET) && !PLATFORM(IOS)
abarth@webkit.org's avatar
abarth@webkit.org committed
851 852 853
#define ENABLE_TEXT_CARET 1
#endif

854
#if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32_64)
855
#if (CPU(X86_64) && (OS(UNIX) || OS(WINDOWS))) \
856
    || (CPU(IA64) && !CPU(IA64_32)) \
857
    || CPU(ALPHA) \
858
    || CPU(SPARC64) \
859
    || CPU(S390X) \
860
    || CPU(PPC64)
861 862
#define WTF_USE_JSVALUE64 1
#else
863
#define WTF_USE_JSVALUE32_64 1
864
#endif
865
#endif /* !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32_64) */
866

867 868
/* Disable the JIT on versions of GCC prior to 4.1 */
#if !defined(ENABLE_JIT) && COMPILER(GCC) && !GCC_VERSION_AT_LEAST(4, 1, 0)
869
#define ENABLE_JIT 0
870 871
#endif

872 873
/* JIT is not implemented for Windows 64-bit */
#if !defined(ENABLE_JIT) && OS(WINDOWS) && CPU(X86_64)
874
#define ENABLE_JIT 0
875
#define ENABLE_YARR_JIT 0
876 877
#endif

878 879 880 881
#if !defined(ENABLE_JIT) && CPU(SH4) && PLATFORM(QT)
#define ENABLE_JIT 1
#endif

882
/* The JIT is enabled by default on all x86, x86-64, ARM & MIPS platforms. */
883 884
#if !defined(ENABLE_JIT) \
    && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(MIPS)) \
885
    && (OS(DARWIN) || !COMPILER(GCC) || GCC_VERSION_AT_LEAST(4, 1, 0)) \
886 887
    && !OS(WINCE) \
    && !OS(QNX)
cwzwarich@webkit.org's avatar
cwzwarich@webkit.org committed
888
#define ENABLE_JIT 1
889 890
#endif

891 892 893
/* If possible, try to enable a disassembler. This is optional. We proceed in two
   steps: first we try to find some disassembler that we can use, and then we
   decide if the high-level disassembler API can be enabled. */
894 895
#if !defined(WTF_USE_UDIS86) && ENABLE(JIT) && (PLATFORM(MAC) || (PLATFORM(QT) && OS(LINUX))) \
    && (CPU(X86) || CPU(X86_64))
896 897 898 899 900 901 902
#define WTF_USE_UDIS86 1
#endif

#if !defined(ENABLE_DISASSEMBLER) && USE(UDIS86)
#define ENABLE_DISASSEMBLER 1
#endif

903 904 905 906 907 908 909 910