Platform.h 32.2 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
#if defined(__ARMEB__) || (COMPILER(RVCT) && defined(__BIG_ENDIAN))
173
174
175
#define WTF_CPU_BIG_ENDIAN 1

#elif !defined(__ARM_EABI__) \
176
177
    && !defined(__EABI__) \
    && !defined(__VFP_FP__) \
178
179
    && !defined(_WIN32_WCE) \
    && !defined(ANDROID)
180
181
182
183
184
185
186
187
#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__) \
188
189
190
    || defined(__ARM_ARCH_4T__) \
    || defined(__MARM_ARMV4__) \
    || defined(_ARMV4I_)
191
192
193
#define WTF_ARM_ARCH_VERSION 4

#elif defined(__ARM_ARCH_5__) \
194
195
    || defined(__ARM_ARCH_5T__) \
    || defined(__MARM_ARMV5__)
196
197
#define WTF_ARM_ARCH_VERSION 5

198
199
200
201
202
203
204
#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

205
#elif defined(__ARM_ARCH_6__) \
206
207
208
209
210
211
    || defined(__ARM_ARCH_6J__) \
    || defined(__ARM_ARCH_6K__) \
    || defined(__ARM_ARCH_6Z__) \
    || defined(__ARM_ARCH_6ZK__) \
    || defined(__ARM_ARCH_6T2__) \
    || defined(__ARMV6__)
212
213
214
#define WTF_ARM_ARCH_VERSION 6

#elif defined(__ARM_ARCH_7A__) \
215
    || defined(__ARM_ARCH_7R__)
216
217
218
219
220
221
#define WTF_ARM_ARCH_VERSION 7

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

222
223
224
225
226
227
228
#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

229
230
231
232
233
234
235
236
237
238
#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__) \
239
240
    || defined(__ARM_ARCH_5TE__) \
    || defined(__ARM_ARCH_5TEJ__)
241
242
243
#define WTF_THUMB_ARCH_VERSION 2

#elif defined(__ARM_ARCH_6J__) \
244
245
246
247
    || defined(__ARM_ARCH_6K__) \
    || defined(__ARM_ARCH_6Z__) \
    || defined(__ARM_ARCH_6ZK__) \
    || defined(__ARM_ARCH_6M__)
248
249
250
#define WTF_THUMB_ARCH_VERSION 3

#elif defined(__ARM_ARCH_6T2__) \
251
252
253
254
    || defined(__ARM_ARCH_7__) \
    || defined(__ARM_ARCH_7A__) \
    || defined(__ARM_ARCH_7R__) \
    || defined(__ARM_ARCH_7M__)
255
256
257
258
259
260
261
262
263
264
265
266
267
268
#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. */
269
#if !defined(ARMV5_OR_LOWER) && !WTF_ARM_ARCH_AT_LEAST(6)
270
271
272
273
274
275
276
277
278
#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__) \
279
    || ((defined(__thumb) || defined(__thumb__)) && WTF_THUMB_ARCH_VERSION == 4)
280
281
282
283
284
285
286
287
288
289
#    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
290
#endif /* !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2) */
291

292
293
294
295
#if defined(__ARM_NEON__) && !defined(WTF_CPU_ARM_NEON)
#define WTF_CPU_ARM_NEON 1
#endif

296
297
298
299
300
#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

301
302
#endif /* ARM */

303
#if CPU(ARM) || CPU(MIPS) || CPU(SH4) || CPU(SPARC)
304
305
#define WTF_CPU_NEEDS_ALIGNED_ACCESS 1
#endif
306

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

310
311
312
313
314
/* OS(ANDROID) - Android */
#ifdef ANDROID
#define WTF_OS_ANDROID 1
#endif

315
316
317
318
/* OS(AIX) - AIX */
#ifdef _AIX
#define WTF_OS_AIX 1
#endif
mjs's avatar
mjs committed
319

320
/* OS(DARWIN) - Any Darwin-based OS, including Mac OS X and iPhone OS */
mjs's avatar
mjs committed
321
#ifdef __APPLE__
322
323
#define WTF_OS_DARWIN 1

324
#include <Availability.h>
kevino@webkit.org's avatar
kevino@webkit.org committed
325
#include <AvailabilityMacros.h>
326
327
328
329
330
331
332
333
334
335
336
#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
337
338
339
340
341
342
343
344
345
346
347
348
349

/* 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
350
351
#endif

352
/* OS(FREEBSD) - FreeBSD */
353
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
354
355
356
#define WTF_OS_FREEBSD 1
#endif

357
358
359
360
361
/* OS(HURD) - GNU/Hurd */
#ifdef __GNU__
#define WTF_OS_HURD 1
#endif

362
/* OS(LINUX) - Linux */
363
#ifdef __linux__
364
#define WTF_OS_LINUX 1
365
366
#endif

367
368
/* OS(NETBSD) - NetBSD */
#if defined(__NetBSD__)
369
#define WTF_OS_NETBSD 1
oliver's avatar
oliver committed
370
371
#endif

372
/* OS(OPENBSD) - OpenBSD */
373
#ifdef __OpenBSD__
374
#define WTF_OS_OPENBSD 1
375
376
#endif

377
378
379
/* OS(QNX) - QNX */
#if defined(__QNXNTO__)
#define WTF_OS_QNX 1
380
381
#endif

382
383
384
/* OS(SOLARIS) - Solaris */
#if defined(sun) || defined(__sun)
#define WTF_OS_SOLARIS 1
385
386
#endif

387
388
389
/* OS(WINCE) - Windows CE; note that for this platform OS(WINDOWS) is also defined */
#if defined(_WIN32_WCE)
#define WTF_OS_WINCE 1
390
391
#endif

392
393
394
/* OS(WINDOWS) - Any version of Windows */
#if defined(WIN32) || defined(_WIN32)
#define WTF_OS_WINDOWS 1
395
396
#endif

397
398
399
#define WTF_OS_WIN ERROR "USE WINDOWS WITH OS NOT WIN"
#define WTF_OS_MAC ERROR "USE MAC_OS_X WITH OS NOT MAC"

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

weinig's avatar
weinig committed
417
/* Operating environments */
mjs's avatar
mjs committed
418

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

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

449
/* PLATFORM(IOS_SIMULATOR) */
450
#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR
451
452
#define WTF_PLATFORM_IOS 1
#define WTF_PLATFORM_IOS_SIMULATOR 1
453
454
#endif

455
456
/* Graphics engines */

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

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

483
#if OS(QNX)
484
#define USE_SYSTEM_MALLOC 1
485
486
487
#endif

#if PLATFORM(BLACKBERRY)
488
489
#define WTF_USE_MERSENNE_TWISTER_19937 1
#define WTF_USE_SKIA 1
490
491
492
#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
493
494
#endif

495
#if PLATFORM(GTK)
496
#define WTF_USE_CAIRO 1
kov@webkit.org's avatar
kov@webkit.org committed
497
#define ENABLE_GLOBAL_FASTMALLOC_NEW 0
498
499
#endif

500

501
#if OS(WINCE)
502
#define WTF_USE_MERSENNE_TWISTER_19937 1
503
504
#endif

505
/* On Windows, use QueryPerformanceCounter by default */
506
#if OS(WINDOWS)
507
508
509
#define WTF_USE_QUERY_PERFORMANCE_COUNTER  1
#endif

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

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

mjs@apple.com's avatar
mjs@apple.com committed
516
#define _INC_ASSERT    /* disable "assert.h" */
517
518
#define assert(x)

519
#endif  /* OS(WINCE) && !PLATFORM(QT) */
520

521
#if PLATFORM(QT)
522
#ifndef WTF_USE_ICU_UNICODE
hyatt's avatar
hyatt committed
523
#define WTF_USE_QT4_UNICODE 1
524
#endif
525
#elif OS(WINCE)
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
544
#if !defined(ENABLE_JAVA_BRIDGE)
#define ENABLE_JAVA_BRIDGE 1
545
546
#endif
#if !defined(ENABLE_DASHBOARD_SUPPORT)
547
#define ENABLE_DASHBOARD_SUPPORT 1
548
#endif
549
#define WTF_USE_CF 1
550
551
#define WTF_USE_PTHREADS 1
#define HAVE_PTHREAD_RWLOCK 1
ggaren@apple.com's avatar
ggaren@apple.com committed
552
#define HAVE_READLINE 1
553
#define HAVE_RUNLOOP_TIMER 1
554
#define ENABLE_FULLSCREEN_API 1
555
#define ENABLE_SMOOTH_SCROLLING 1
556
#define ENABLE_WEB_ARCHIVE 1
557
#define ENABLE_WEB_AUDIO 1
558
#if defined(ENABLE_VIDEO)
559
#define ENABLE_VIDEO_TRACK 1
560
#endif
561
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
562
563
#define HAVE_LAYER_HOSTING_IN_WINDOW_SERVER 1
#endif
564
#define WTF_USE_APPKIT 1
565
#define WTF_USE_SECURITY_FRAMEWORK 1
566
#endif /* PLATFORM(MAC) && !PLATFORM(IOS) */
ggaren's avatar
ggaren committed
567

568
#if PLATFORM(CHROMIUM) && OS(DARWIN)
569
#define WTF_USE_CF 1
570
#define WTF_USE_PTHREADS 1
571
#define HAVE_PTHREAD_RWLOCK 1
572
573

#define WTF_USE_WK_SCROLLBAR_PAINTER 1
574
575
#endif

576
577
578
579
#if PLATFORM(IOS)
#define DONT_FINALIZE_ON_MAIN_THREAD 1
#endif

580
#if PLATFORM(QT) && OS(DARWIN)
581
#define WTF_USE_CF 1
582
#endif
583

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

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

#if PLATFORM(IOS_SIMULATOR)
607
    #define ENABLE_CLASSIC_INTERPRETER 1
608
609
610
    #define ENABLE_JIT 0
    #define ENABLE_YARR_JIT 0
#else
611
    #define ENABLE_CLASSIC_INTERPRETER 0
612
    #define ENABLE_JIT 1
613
    #define ENABLE_LLINT 1
614
615
616
    #define ENABLE_YARR_JIT 1
#endif

617
#define WTF_USE_APPKIT 0
618
#define WTF_USE_SECURITY_FRAMEWORK 0
619
620
#endif

621
#if PLATFORM(WIN) && !OS(WINCE)
622
#define WTF_USE_CF 1
ggaren's avatar
ggaren committed
623
624
#endif

625
#if PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(CHROMIUM) && !PLATFORM(WIN_CAIRO)
626
627
628
#define WTF_USE_CFNETWORK 1
#endif

629
#if USE(CFNETWORK) || PLATFORM(MAC) || PLATFORM(IOS)
630
#define WTF_USE_CFURLCACHE 1
631
#define WTF_USE_CFURLSTORAGESESSIONS 1
632
633
#endif

634
635
636
637
#if PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(CHROMIUM) && !PLATFORM(QT)
#define ENABLE_WEB_ARCHIVE 1
#endif

638
#if PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(CHROMIUM) && !PLATFORM(WIN_CAIRO) && !PLATFORM(QT)
639
640
641
#define ENABLE_FULLSCREEN_API 1
#endif

642
#if PLATFORM(WX)
643
#if !CPU(PPC)
644
#define ENABLE_ASSEMBLER 1
645
646
#define ENABLE_JIT 1
#endif
647
#define ENABLE_GLOBAL_FASTMALLOC_NEW 0
648
#define ENABLE_LLINT 0
649
#if OS(DARWIN)
650
#define WTF_USE_CF 1
651
#define ENABLE_WEB_ARCHIVE 1
652
#endif
653
654
#endif

655
#if OS(UNIX) && (PLATFORM(GTK) || PLATFORM(QT))
656
657
#define WTF_USE_PTHREADS 1
#define HAVE_PTHREAD_RWLOCK 1
658
659
#endif

660
#if !defined(HAVE_ACCESSIBILITY)
661
#if PLATFORM(IOS) || PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && !OS(ANDROID))
662
663
#define HAVE_ACCESSIBILITY 1
#endif
664
#endif /* !defined(HAVE_ACCESSIBILITY) */
665

666
#if OS(UNIX)
667
#define HAVE_SIGNAL_H 1
668
669
670
671
672
#define WTF_USE_OS_RANDOMNESS 1
#endif

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

675
#if !defined(HAVE_VASPRINTF)
676
#if !COMPILER(MSVC) && !COMPILER(RVCT) && !COMPILER(MINGW) && !(COMPILER(GCC) && OS(QNX))
677
678
679
680
#define HAVE_VASPRINTF 1
#endif
#endif

681
#if !defined(HAVE_STRNSTR)
682
#if OS(DARWIN) || (OS(FREEBSD) && !defined(__GLIBC__))
683
684
685
686
#define HAVE_STRNSTR 1
#endif
#endif

687
#if !OS(WINDOWS) && !OS(SOLARIS) \
688
    && !OS(RVCT) \
689
    && !OS(ANDROID)
690
691
692
#define HAVE_TM_GMTOFF 1
#define HAVE_TM_ZONE 1
#define HAVE_TIMEGM 1
693
#endif
694

695
#if OS(DARWIN)
ggaren@apple.com's avatar
ggaren@apple.com committed
696
697

#define HAVE_ERRNO_H 1
kevino@webkit.org's avatar
kevino@webkit.org committed
698
#define HAVE_LANGINFO_H 1
ggaren@apple.com's avatar
ggaren@apple.com committed
699
700
701
702
703
704
705
#define HAVE_MMAP 1
#define HAVE_MERGESORT 1
#define HAVE_SBRK 1
#define HAVE_STRINGS_H 1
#define HAVE_SYS_PARAM_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TIMEB_H 1
706
#define WTF_USE_ACCELERATE 1
ggaren@apple.com's avatar
ggaren@apple.com committed
707

fpizlo@apple.com's avatar
fpizlo@apple.com committed
708
#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
709
710

#define HAVE_DISPATCH_H 1
711
#define HAVE_HOSTED_CORE_ANIMATION 1
712

713
#if !PLATFORM(IOS)
714
#define HAVE_MADV_FREE_REUSE 1
oliver@apple.com's avatar
oliver@apple.com committed
715
#define HAVE_MADV_FREE 1
716
#define HAVE_PTHREAD_SETNAME_NP 1
717
#endif
oliver@apple.com's avatar
oliver@apple.com committed
718

719
720
#endif

721
#if PLATFORM(IOS)
722
#define HAVE_MADV_FREE 1
723
#define HAVE_PTHREAD_SETNAME_NP 1
724
725
#endif

726
#elif OS(WINDOWS)
ggaren@apple.com's avatar
ggaren@apple.com committed
727

728
#if !OS(WINCE)
ggaren@apple.com's avatar
ggaren@apple.com committed
729
#define HAVE_SYS_TIMEB_H 1
730
#define HAVE_ALIGNED_MALLOC 1
731
#define HAVE_ISDEBUGGERPRESENT 1
732
#endif
ggaren@apple.com's avatar
ggaren@apple.com committed
733
#define HAVE_VIRTUALALLOC 1
734
#define WTF_USE_OS_RANDOMNESS 1
ggaren@apple.com's avatar
ggaren@apple.com committed
735

736
#elif OS(QNX)
737
738
739

#define HAVE_ERRNO_H 1
#define HAVE_MMAP 1
740
741
#define HAVE_MADV_FREE_REUSE 1
#define HAVE_MADV_FREE 1
742
743
744
#define HAVE_SBRK 1
#define HAVE_STRINGS_H 1
#define HAVE_SYS_PARAM_H 1
745
#define HAVE_SYS_TIME_H 1
746
#define WTF_USE_PTHREADS 1
747

748
749
750
751
752
753
754
755
756
#elif OS(ANDROID)

#define HAVE_ERRNO_H 1
#define HAVE_NMAP 1
#define HAVE_SBRK 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
757
758
759
760
761
#else

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

#define HAVE_ERRNO_H 1
762
#define HAVE_LANGINFO_H 1
ggaren@apple.com's avatar
ggaren@apple.com committed
763
764
765
766
767
768
769
770
#define HAVE_MMAP 1
#define HAVE_SBRK 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
771
772
/* ENABLE macro defaults */

773
#if PLATFORM(QT)
774
/* We must not customize the global operator new and delete for the Qt port. */
775
#define ENABLE_GLOBAL_FASTMALLOC_NEW 0
776
#if !OS(UNIX)
777
778
#define USE_SYSTEM_MALLOC 1
#endif
779
780
#endif

781
782
783
#if !defined(ENABLE_ICONDATABASE)
#define ENABLE_ICONDATABASE 1
#endif
784

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

pkasting@chromium.org's avatar
pkasting@chromium.org committed
789
790
791
792
#if !defined(ENABLE_JAVASCRIPT_DEBUGGER)
#define ENABLE_JAVASCRIPT_DEBUGGER 1
#endif

793
#if !defined(ENABLE_FTPDIR)
beidson's avatar
beidson committed
794
795
796
#define ENABLE_FTPDIR 1
#endif

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

bolsinga@apple.com's avatar
bolsinga@apple.com committed
801
802
803
804
#if !defined(ENABLE_DRAG_SUPPORT)
#define ENABLE_DRAG_SUPPORT 1
#endif

bolsinga@apple.com's avatar
bolsinga@apple.com committed
805
806
807
808
#if !defined(ENABLE_INSPECTOR)
#define ENABLE_INSPECTOR 1
#endif

ddkilzer@apple.com's avatar
ddkilzer@apple.com committed
809
#if !defined(ENABLE_NETSCAPE_PLUGIN_API)
eric@webkit.org's avatar
eric@webkit.org committed
810
#define ENABLE_NETSCAPE_PLUGIN_API 1
ddkilzer@apple.com's avatar
ddkilzer@apple.com committed
811
812
#endif

813
814
815
816
#if !defined(ENABLE_GLOBAL_FASTMALLOC_NEW)
#define ENABLE_GLOBAL_FASTMALLOC_NEW 1
#endif

817
818
819
820
#if !defined(ENABLE_PARSED_STYLE_SHEET_CACHING)
#define ENABLE_PARSED_STYLE_SHEET_CACHING 1
#endif

821
#if !defined(ENABLE_SUBPIXEL_LAYOUT)
822
823
824
#if PLATFORM(CHROMIUM)
#define ENABLE_SUBPIXEL_LAYOUT 1 
#else
825
826
#define ENABLE_SUBPIXEL_LAYOUT 0
#endif
827
#endif
828

829
830
831
832
833
834
835
836
#if !defined(ENABLE_GESTURE_ANIMATION)
#if PLATFORM(QT) || !ENABLE(SMOOTH_SCROLLING)
#define ENABLE_GESTURE_ANIMATION 0
#else
#define ENABLE_GESTURE_ANIMATION 1
#endif
#endif

837
838
839
840
841
842
843
844
#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

845
#define ENABLE_DEBUG_WITH_BREAKPOINT 0
ggaren@apple.com's avatar
ggaren@apple.com committed
846
847
#define ENABLE_SAMPLING_COUNTERS 0
#define ENABLE_SAMPLING_FLAGS 0
848
#define ENABLE_SAMPLING_REGIONS 0
849
#define ENABLE_OPCODE_SAMPLING 0
850
#define ENABLE_CODEBLOCK_SAMPLING 0
851
852
#if ENABLE(CODEBLOCK_SAMPLING) && !ENABLE(OPCODE_SAMPLING)
#error "CODEBLOCK_SAMPLING requires OPCODE_SAMPLING"
853
#endif
854
#if ENABLE(OPCODE_SAMPLING) || ENABLE(SAMPLING_FLAGS) || ENABLE(SAMPLING_REGIONS)
855
#define ENABLE_SAMPLING_THREAD 1
856
#endif
857

858
#if !defined(ENABLE_TEXT_CARET) && !PLATFORM(IOS)
abarth@webkit.org's avatar
abarth@webkit.org committed
859
860
861
#define ENABLE_TEXT_CARET 1
#endif

862
#if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32_64)
863
#if (CPU(X86_64) && (OS(UNIX) || OS(WINDOWS))) \
864
    || (CPU(IA64) && !CPU(IA64_32)) \
865
    || CPU(ALPHA) \
866
    || CPU(SPARC64) \
867
    || CPU(S390X) \
868
    || CPU(PPC64)
869
870
#define WTF_USE_JSVALUE64 1
#else
871
#define WTF_USE_JSVALUE32_64 1
872
#endif
873
#endif /* !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32_64) */
874

875
876
/* Disable the JIT on versions of GCC prior to 4.1 */
#if !defined(ENABLE_JIT) && COMPILER(GCC) && !GCC_VERSION_AT_LEAST(4, 1, 0)
877
#define ENABLE_JIT 0
878
879
#endif

880
881
/* JIT is not implemented for Windows 64-bit */
#if !defined(ENABLE_JIT) && OS(WINDOWS) && CPU(X86_64)
882
883
884
#define ENABLE_JIT 0
#endif

885
886
887
888
#if !defined(ENABLE_JIT) && CPU(SH4) && PLATFORM(QT)
#define ENABLE_JIT 1
#endif

889
/* The JIT is enabled by default on all x86, x86-64, ARM & MIPS platforms. */
890
891
#if !defined(ENABLE_JIT) \
    && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(MIPS)) \
892
    && (OS(DARWIN) || !COMPILER(GCC) || GCC_VERSION_AT_LEAST(4, 1, 0)) \
893
894
    && !OS(WINCE) \
    && !OS(QNX)
cwzwarich@webkit.org's avatar
cwzwarich@webkit.org committed
895
#define ENABLE_JIT 1
896
897
#endif

898
899
900
901
902
903
904
905
906
907
908
/* 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. */
#if !defined(WTF_USE_UDIS86) && ENABLE(JIT) && PLATFORM(MAC) && (CPU(X86) || CPU(X86_64))
#define WTF_USE_UDIS86 1
#endif

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

909
910
/* On some of the platforms where we have a JIT, we want to also have the 
   low-level interpreter. */
wingo@igalia.com's avatar
wingo@igalia.com committed
911
912
913
914
915
#if !defined(ENABLE_LLINT) \
    && ENABLE(JIT) \
    && (OS(DARWIN) || OS(LINUX)) \
    && (PLATFORM(MAC) || PLATFORM(IOS) || PLATFORM(GTK)) \
    && (CPU(X86) || CPU(X86_64) || CPU(ARM_THUMB2))
916
917
918
#define ENABLE_LLINT 1
#endif

919
920
921
#if !defined(ENABLE_DFG_JIT) && ENABLE(JIT)
/* Enable the DFG JIT on X86 and X86_64.  Only tested on Mac and GNU/Linux. */
#if (CPU(X86) || CPU(X86_64)) && (PLATFORM(MAC) || OS(LINUX))
922
923
#define ENABLE_DFG_JIT 1
#endif
924
/* Enable the DFG JIT on ARMv7.  Only tested on iOS. */
925
#if CPU(ARM_THUMB2) && (PLATFORM(IOS) || PLATFORM(BLACKBERRY))
926
927
#define ENABLE_DFG_JIT 1
#endif
928
929
930
931
/* Enable the DFG JIT on ARM. */
#if CPU(ARM_TRADITIONAL)
#define ENABLE_DFG_JIT 1
#endif
932
#endif
933

fpizlo@apple.com's avatar
fpizlo@apple.com committed
934
935
936
937
/* Profiling of types and values used by JIT code. DFG_JIT depends on it, but you
   can enable it manually with DFG turned off if you want to use it as a standalone
   profiler. In that case, you probably want to also enable VERBOSE_VALUE_PROFILE
   below. */
938
#if !defined(ENABLE_VALUE_PROFILER) && ENABLE(DFG_JIT)
939
#define ENABLE_VALUE_PROFILER 1
940
941
#endif

942
943
944
945
#if !defined(ENABLE_VERBOSE_VALUE_PROFILE) && ENABLE(VALUE_PROFILER)
#define ENABLE_VERBOSE_VALUE_PROFILE 0
#endif

946
947
948
949
#if !defined(ENABLE_SIMPLE_HEAP_PROFILING)
#define ENABLE_SIMPLE_HEAP_PROFILING 0
#endif

950
951
952
953
954
955
/* Counts uses of write barriers using sampling counters. Be sure to also
   set ENABLE_SAMPLING_COUNTERS to 1. */
#if !defined(ENABLE_WRITE_BARRIER_PROFILING)
#define ENABLE_WRITE_BARRIER_PROFILING 0
#endif

956
/* Ensure that either the JIT or the interpreter has been enabled. */
957
958
#if !defined(ENABLE_CLASSIC_INTERPRETER) && !ENABLE(JIT)
#define ENABLE_CLASSIC_INTERPRETER 1
959
#endif
960
#if !(ENABLE(JIT) || ENABLE(CLASSIC_INTERPRETER))
961
#error You have to have at least one execution model enabled to build JSC
962
#endif
963

964
/* Configure the JIT */
965
#if CPU(X86) && COMPILER(MSVC)
966
#define JSC_HOST_CALL __fastcall
967
#elif CPU(X86) && COMPILER(GCC)
968
#define JSC_HOST_CALL __attribute__ ((fastcall))
969
#else
970
#define JSC_HOST_CALL
971
972
#endif