]> git.saurik.com Git - apple/javascriptcore.git/blob - wtf/Platform.h
JavaScriptCore-584.tar.gz
[apple/javascriptcore.git] / wtf / Platform.h
1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2007-2009 Torch Mobile, Inc.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27 #ifndef WTF_Platform_h
28 #define WTF_Platform_h
29
30 /* ==== PLATFORM handles OS, operating environment, graphics API, and
31 CPU. This macro will be phased out in favor of platform adaptation
32 macros, policy decision macros, and top-level port definitions. ==== */
33 #define PLATFORM(WTF_FEATURE) (defined WTF_PLATFORM_##WTF_FEATURE && WTF_PLATFORM_##WTF_FEATURE)
34
35
36 /* ==== Platform adaptation macros: these describe properties of the target environment. ==== */
37
38 /* COMPILER() - the compiler being used to build the project */
39 #define COMPILER(WTF_FEATURE) (defined WTF_COMPILER_##WTF_FEATURE && WTF_COMPILER_##WTF_FEATURE)
40 /* CPU() - the target CPU architecture */
41 #define CPU(WTF_FEATURE) (defined WTF_CPU_##WTF_FEATURE && WTF_CPU_##WTF_FEATURE)
42 /* HAVE() - specific system features (headers, functions or similar) that are present or not */
43 #define HAVE(WTF_FEATURE) (defined HAVE_##WTF_FEATURE && HAVE_##WTF_FEATURE)
44 /* OS() - underlying operating system; only to be used for mandated low-level services like
45 virtual memory, not to choose a GUI toolkit */
46 #define OS(WTF_FEATURE) (defined WTF_OS_##WTF_FEATURE && WTF_OS_##WTF_FEATURE)
47
48
49 /* ==== Policy decision macros: these define policy choices for a particular port. ==== */
50
51 /* USE() - use a particular third-party library or optional OS service */
52 #define USE(WTF_FEATURE) (defined WTF_USE_##WTF_FEATURE && WTF_USE_##WTF_FEATURE)
53 /* ENABLE() - turn on a specific feature of WebKit */
54 #define ENABLE(WTF_FEATURE) (defined ENABLE_##WTF_FEATURE && ENABLE_##WTF_FEATURE)
55
56
57
58 /* ==== COMPILER() - the compiler being used to build the project ==== */
59
60 /* COMPILER(MSVC) Microsoft Visual C++ */
61 /* COMPILER(MSVC7) Microsoft Visual C++ v7 or lower*/
62 #if defined(_MSC_VER)
63 #define WTF_COMPILER_MSVC 1
64 #if _MSC_VER < 1400
65 #define WTF_COMPILER_MSVC7 1
66 #endif
67 #endif
68
69 /* COMPILER(RVCT) - ARM RealView Compilation Tools */
70 #if defined(__CC_ARM) || defined(__ARMCC__)
71 #define WTF_COMPILER_RVCT 1
72 #endif
73
74 /* COMPILER(GCC) - GNU Compiler Collection */
75 /* --gnu option of the RVCT compiler also defines __GNUC__ */
76 #if defined(__GNUC__) && !COMPILER(RVCT)
77 #define WTF_COMPILER_GCC 1
78 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
79 #endif
80
81 /* COMPILER(MINGW) - MinGW GCC */
82 #if defined(MINGW) || defined(__MINGW32__)
83 #define WTF_COMPILER_MINGW 1
84 #endif
85
86 /* COMPILER(WINSCW) - CodeWarrior for Symbian emulator */
87 #if defined(__WINSCW__)
88 #define WTF_COMPILER_WINSCW 1
89 #endif
90
91
92
93 /* ==== CPU() - the target CPU architecture ==== */
94
95 /* This also defines CPU(BIG_ENDIAN) or CPU(MIDDLE_ENDIAN) or neither, as appropriate. */
96
97 /* CPU(ALPHA) - DEC Alpha */
98 #if defined(__alpha__)
99 #define WTF_CPU_ALPHA 1
100 #endif
101
102 /* CPU(IA64) - Itanium / IA-64 */
103 #if defined(__ia64__)
104 #define WTF_CPU_IA64 1
105 #endif
106
107 /* CPU(PPC) - PowerPC 32-bit */
108 #if defined(__ppc__) \
109 || defined(__PPC__) \
110 || defined(__powerpc__) \
111 || defined(__powerpc) \
112 || defined(__POWERPC__) \
113 || defined(_M_PPC) \
114 || defined(__PPC)
115 #define WTF_CPU_PPC 1
116 #define WTF_CPU_BIG_ENDIAN 1
117 #endif
118
119 /* CPU(PPC64) - PowerPC 64-bit */
120 #if defined(__ppc64__) \
121 || defined(__PPC64__)
122 #define WTF_CPU_PPC64 1
123 #define WTF_CPU_BIG_ENDIAN 1
124 #endif
125
126 /* CPU(SH4) - SuperH SH-4 */
127 #if defined(__SH4__)
128 #define WTF_CPU_SH4 1
129 #endif
130
131 /* CPU(SPARC32) - SPARC 32-bit */
132 #if defined(__sparc) && !defined(__arch64__) || defined(__sparcv8)
133 #define WTF_CPU_SPARC32 1
134 #define WTF_CPU_BIG_ENDIAN 1
135 #endif
136
137 /* CPU(SPARC64) - SPARC 64-bit */
138 #if defined(__sparc__) && defined(__arch64__) || defined (__sparcv9)
139 #define WTF_CPU_SPARC64 1
140 #define WTF_CPU_BIG_ENDIAN 1
141 #endif
142
143 /* CPU(SPARC) - any SPARC, true for CPU(SPARC32) and CPU(SPARC64) */
144 #if CPU(SPARC32) || CPU(SPARC64)
145 #define WTF_CPU_SPARC
146 #endif
147
148 /* CPU(X86) - i386 / x86 32-bit */
149 #if defined(__i386__) \
150 || defined(i386) \
151 || defined(_M_IX86) \
152 || defined(_X86_) \
153 || defined(__THW_INTEL)
154 #define WTF_CPU_X86 1
155 #endif
156
157 /* CPU(X86_64) - AMD64 / Intel64 / x86_64 64-bit */
158 #if defined(__x86_64__) \
159 || defined(_M_X64)
160 #define WTF_CPU_X86_64 1
161 #endif
162
163 /* CPU(ARM) - ARM, any version*/
164 #if defined(arm) \
165 || defined(__arm__)
166 #define WTF_CPU_ARM 1
167
168 #if defined(__ARMEB__)
169 #define WTF_CPU_BIG_ENDIAN 1
170
171 #elif !defined(__ARM_EABI__) \
172 && !defined(__EABI__) \
173 && !defined(__VFP_FP__) \
174 && !defined(ANDROID)
175 #define WTF_CPU_MIDDLE_ENDIAN 1
176
177 #endif
178
179 #define WTF_ARM_ARCH_AT_LEAST(N) (CPU(ARM) && WTF_ARM_ARCH_VERSION >= N)
180
181 /* Set WTF_ARM_ARCH_VERSION */
182 #if defined(__ARM_ARCH_4__) \
183 || defined(__ARM_ARCH_4T__) \
184 || defined(__MARM_ARMV4__) \
185 || defined(_ARMV4I_)
186 #define WTF_ARM_ARCH_VERSION 4
187
188 #elif defined(__ARM_ARCH_5__) \
189 || defined(__ARM_ARCH_5T__) \
190 || defined(__ARM_ARCH_5E__) \
191 || defined(__ARM_ARCH_5TE__) \
192 || defined(__ARM_ARCH_5TEJ__) \
193 || defined(__MARM_ARMV5__)
194 #define WTF_ARM_ARCH_VERSION 5
195
196 #elif defined(__ARM_ARCH_6__) \
197 || defined(__ARM_ARCH_6J__) \
198 || defined(__ARM_ARCH_6K__) \
199 || defined(__ARM_ARCH_6Z__) \
200 || defined(__ARM_ARCH_6ZK__) \
201 || defined(__ARM_ARCH_6T2__) \
202 || defined(__ARMV6__)
203 #define WTF_ARM_ARCH_VERSION 6
204
205 #elif defined(__ARM_ARCH_7A__) \
206 || defined(__ARM_ARCH_7R__)
207 #define WTF_ARM_ARCH_VERSION 7
208
209 /* RVCT sets _TARGET_ARCH_ARM */
210 #elif defined(__TARGET_ARCH_ARM)
211 #define WTF_ARM_ARCH_VERSION __TARGET_ARCH_ARM
212
213 #else
214 #define WTF_ARM_ARCH_VERSION 0
215
216 #endif
217
218 /* Set WTF_THUMB_ARCH_VERSION */
219 #if defined(__ARM_ARCH_4T__)
220 #define WTF_THUMB_ARCH_VERSION 1
221
222 #elif defined(__ARM_ARCH_5T__) \
223 || defined(__ARM_ARCH_5TE__) \
224 || defined(__ARM_ARCH_5TEJ__)
225 #define WTF_THUMB_ARCH_VERSION 2
226
227 #elif defined(__ARM_ARCH_6J__) \
228 || defined(__ARM_ARCH_6K__) \
229 || defined(__ARM_ARCH_6Z__) \
230 || defined(__ARM_ARCH_6ZK__) \
231 || defined(__ARM_ARCH_6M__)
232 #define WTF_THUMB_ARCH_VERSION 3
233
234 #elif defined(__ARM_ARCH_6T2__) \
235 || defined(__ARM_ARCH_7__) \
236 || defined(__ARM_ARCH_7A__) \
237 || defined(__ARM_ARCH_7R__) \
238 || defined(__ARM_ARCH_7M__)
239 #define WTF_THUMB_ARCH_VERSION 4
240
241 /* RVCT sets __TARGET_ARCH_THUMB */
242 #elif defined(__TARGET_ARCH_THUMB)
243 #define WTF_THUMB_ARCH_VERSION __TARGET_ARCH_THUMB
244
245 #else
246 #define WTF_THUMB_ARCH_VERSION 0
247 #endif
248
249
250 /* CPU(ARMV5_OR_LOWER) - ARM instruction set v5 or earlier */
251 /* On ARMv5 and below the natural alignment is required.
252 And there are some other differences for v5 or earlier. */
253 #if !defined(ARMV5_OR_LOWER) && !WTF_ARM_ARCH_AT_LEAST(6)
254 #define WTF_CPU_ARMV5_OR_LOWER 1
255 #endif
256
257
258 /* CPU(ARM_TRADITIONAL) - Thumb2 is not available, only traditional ARM (v4 or greater) */
259 /* CPU(ARM_THUMB2) - Thumb2 instruction set is available */
260 /* Only one of these will be defined. */
261 #if !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2)
262 # if defined(thumb2) || defined(__thumb2__) \
263 || ((defined(__thumb) || defined(__thumb__)) && WTF_THUMB_ARCH_VERSION == 4)
264 # define WTF_CPU_ARM_TRADITIONAL 0
265 # define WTF_CPU_ARM_THUMB2 1
266 # elif WTF_ARM_ARCH_AT_LEAST(4)
267 # define WTF_CPU_ARM_TRADITIONAL 1
268 # define WTF_CPU_ARM_THUMB2 0
269 # else
270 # error "Not supported ARM architecture"
271 # endif
272 #elif CPU(ARM_TRADITIONAL) && CPU(ARM_THUMB2) /* Sanity Check */
273 # error "Cannot use both of WTF_CPU_ARM_TRADITIONAL and WTF_CPU_ARM_THUMB2 platforms"
274 #endif /* !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2) */
275
276 #endif /* ARM */
277
278
279
280 /* ==== OS() - underlying operating system; only to be used for mandated low-level services like
281 virtual memory, not to choose a GUI toolkit ==== */
282
283 /* OS(ANDROID) - Android */
284 #ifdef ANDROID
285 #define WTF_OS_ANDROID 1
286 #endif
287
288 /* OS(AIX) - AIX */
289 #ifdef _AIX
290 #define WTF_OS_AIX 1
291 #endif
292
293 /* OS(DARWIN) - Any Darwin-based OS, including Mac OS X and iPhone OS */
294 #ifdef __APPLE__
295 #define WTF_OS_DARWIN 1
296
297 /* FIXME: BUILDING_ON_.., and TARGETING... macros should be folded into the OS() system */
298 #include <AvailabilityMacros.h>
299 #if !defined(MAC_OS_X_VERSION_10_5) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
300 #define BUILDING_ON_TIGER 1
301 #elif !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
302 #define BUILDING_ON_LEOPARD 1
303 #elif !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
304 #define BUILDING_ON_SNOW_LEOPARD 1
305 #endif
306 #if !defined(MAC_OS_X_VERSION_10_5) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
307 #define TARGETING_TIGER 1
308 #elif !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
309 #define TARGETING_LEOPARD 1
310 #elif !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7
311 #define TARGETING_SNOW_LEOPARD 1
312 #endif
313 #include <Availability.h>
314 #include <TargetConditionals.h>
315
316 #endif
317
318 /* OS(IPHONE_OS) - iPhone OS */
319 /* OS(MAC_OS_X) - Mac OS X (not including iPhone OS) */
320 #if OS(DARWIN) && ((defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED) \
321 || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) \
322 || (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR))
323 #define WTF_OS_IPHONE_OS 1
324 #elif OS(DARWIN) && defined(TARGET_OS_MAC) && TARGET_OS_MAC
325 #define WTF_OS_MAC_OS_X 1
326 #endif
327
328 /* OS(FREEBSD) - FreeBSD */
329 #ifdef __FreeBSD__
330 #define WTF_OS_FREEBSD 1
331 #endif
332
333 /* OS(HAIKU) - Haiku */
334 #ifdef __HAIKU__
335 #define WTF_OS_HAIKU 1
336 #endif
337
338 /* OS(LINUX) - Linux */
339 #ifdef __linux__
340 #define WTF_OS_LINUX 1
341 #endif
342
343 /* OS(NETBSD) - NetBSD */
344 #if defined(__NetBSD__)
345 #define WTF_PLATFORM_NETBSD 1
346 #endif
347
348 /* OS(OPENBSD) - OpenBSD */
349 #ifdef __OpenBSD__
350 #define WTF_OS_OPENBSD 1
351 #endif
352
353 /* OS(QNX) - QNX */
354 #if defined(__QNXNTO__)
355 #define WTF_OS_QNX 1
356 #endif
357
358 /* OS(SOLARIS) - Solaris */
359 #if defined(sun) || defined(__sun)
360 #define WTF_OS_SOLARIS 1
361 #endif
362
363 /* OS(WINCE) - Windows CE; note that for this platform OS(WINDOWS) is also defined */
364 #if defined(_WIN32_WCE)
365 #define WTF_OS_WINCE 1
366 #endif
367
368 /* OS(WINDOWS) - Any version of Windows */
369 #if defined(WIN32) || defined(_WIN32)
370 #define WTF_OS_WINDOWS 1
371 #endif
372
373 /* OS(SYMBIAN) - Symbian */
374 #if defined (__SYMBIAN32__)
375 /* we are cross-compiling, it is not really windows */
376 #undef WTF_OS_WINDOWS
377 #undef WTF_PLATFORM_WIN
378 #define WTF_OS_SYMBIAN 1
379 #endif
380
381 /* OS(UNIX) - Any Unix-like system */
382 #if OS(AIX) \
383 || OS(ANDROID) \
384 || OS(DARWIN) \
385 || OS(FREEBSD) \
386 || OS(HAIKU) \
387 || OS(LINUX) \
388 || OS(NETBSD) \
389 || OS(OPENBSD) \
390 || OS(QNX) \
391 || OS(SOLARIS) \
392 || OS(SYMBIAN) \
393 || defined(unix) \
394 || defined(__unix) \
395 || defined(__unix__)
396 #define WTF_OS_UNIX 1
397 #endif
398
399 /* Operating environments */
400
401 /* FIXME: these are all mixes of OS, operating environment and policy choices. */
402 /* PLATFORM(CHROMIUM) */
403 /* PLATFORM(QT) */
404 /* PLATFORM(WX) */
405 /* PLATFORM(GTK) */
406 /* PLATFORM(HAIKU) */
407 /* PLATFORM(MAC) */
408 /* PLATFORM(WIN) */
409 #if defined(BUILDING_CHROMIUM__)
410 #define WTF_PLATFORM_CHROMIUM 1
411 #elif defined(BUILDING_QT__)
412 #define WTF_PLATFORM_QT 1
413 #elif defined(BUILDING_WX__)
414 #define WTF_PLATFORM_WX 1
415 #elif defined(BUILDING_GTK__)
416 #define WTF_PLATFORM_GTK 1
417 #elif defined(BUILDING_HAIKU__)
418 #define WTF_PLATFORM_HAIKU 1
419 #elif OS(DARWIN)
420 #define WTF_PLATFORM_MAC 1
421 #elif OS(WINDOWS)
422 #define WTF_PLATFORM_WIN 1
423 #endif
424
425 /* PLATFORM(IPHONE) */
426 /* FIXME: this is sometimes used as an OS switch and sometimes for higher-level things */
427 #if (defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
428 #define WTF_PLATFORM_IPHONE 1
429 #endif
430
431 /* PLATFORM(IPHONE_SIMULATOR) */
432 #if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR
433 #define WTF_PLATFORM_IPHONE 1
434 #define WTF_PLATFORM_IPHONE_SIMULATOR 1
435 #else
436 #define WTF_PLATFORM_IPHONE_SIMULATOR 0
437 #endif
438
439 #if !defined(WTF_PLATFORM_IPHONE)
440 #define WTF_PLATFORM_IPHONE 0
441 #endif
442
443 /* PLATFORM(ANDROID) */
444 /* FIXME: this is sometimes used as an OS() switch, and other times to drive
445 policy choices */
446 #if defined(ANDROID)
447 #define WTF_PLATFORM_ANDROID 1
448 #endif
449
450 /* Graphics engines */
451
452 /* PLATFORM(CG) and PLATFORM(CI) */
453 #define WTF_PLATFORM_CG 1
454
455 /* PLATFORM(SKIA) for Win/Linux, CG/CI for Mac */
456 #if PLATFORM(CHROMIUM)
457 #define ENABLE_HISTORY_ALWAYS_ASYNC 1
458 #if OS(DARWIN)
459 #define WTF_PLATFORM_CG 1
460 #define WTF_PLATFORM_CI 1
461 #define WTF_USE_ATSUI 1
462 #define WTF_USE_CORE_TEXT 1
463 #else
464 #define WTF_PLATFORM_SKIA 1
465 #endif
466 #endif
467
468 #if PLATFORM(GTK)
469 #define WTF_PLATFORM_CAIRO 1
470 #endif
471
472
473 /* OS(WINCE) && PLATFORM(QT)
474 We can not determine the endianess at compile time. For
475 Qt for Windows CE the endianess is specified in the
476 device specific makespec
477 */
478 #if OS(WINCE) && PLATFORM(QT)
479 # include <QtGlobal>
480 # undef WTF_PLATFORM_BIG_ENDIAN
481 # undef WTF_PLATFORM_MIDDLE_ENDIAN
482 # if Q_BYTE_ORDER == Q_BIG_EDIAN
483 # define WTF_PLATFORM_BIG_ENDIAN 1
484 # endif
485
486 # include <ce_time.h>
487 #endif
488
489 #if (PLATFORM(IPHONE) || PLATFORM(MAC) || PLATFORM(WIN) || (PLATFORM(QT) && OS(DARWIN) && !ENABLE(SINGLE_THREADED))) && !defined(ENABLE_JSC_MULTIPLE_THREADS)
490 #define ENABLE_JSC_MULTIPLE_THREADS 1
491 #endif
492
493 /* On Windows, use QueryPerformanceCounter by default */
494 #if OS(WINDOWS)
495 #define WTF_USE_QUERY_PERFORMANCE_COUNTER 1
496 #endif
497
498 #if OS(WINCE) && !PLATFORM(QT)
499 #undef ENABLE_JSC_MULTIPLE_THREADS
500 #define ENABLE_JSC_MULTIPLE_THREADS 0
501 #define USE_SYSTEM_MALLOC 0
502 #define ENABLE_ICONDATABASE 0
503 #define ENABLE_JAVASCRIPT_DEBUGGER 0
504 #define ENABLE_FTPDIR 0
505 #define ENABLE_PAN_SCROLLING 0
506 #define ENABLE_WML 1
507 #define HAVE_ACCESSIBILITY 0
508
509 #define NOMINMAX /* Windows min and max conflict with standard macros */
510 #define NOSHLWAPI /* shlwapi.h not available on WinCe */
511
512 /* MSDN documentation says these functions are provided with uspce.lib. But we cannot find this file. */
513 #define __usp10__ /* disable "usp10.h" */
514
515 #define _INC_ASSERT /* disable "assert.h" */
516 #define assert(x)
517
518 /* _countof is only included in CE6; for CE5 we need to define it ourself */
519 #ifndef _countof
520 #define _countof(x) (sizeof(x) / sizeof((x)[0]))
521 #endif
522
523 #endif /* OS(WINCE) && !PLATFORM(QT) */
524
525 #if PLATFORM(QT)
526 #define WTF_USE_QT4_UNICODE 1
527 #elif OS(WINCE)
528 #define WTF_USE_WINCE_UNICODE 1
529 #elif PLATFORM(GTK)
530 /* The GTK+ Unicode backend is configurable */
531 #else
532 #define WTF_USE_ICU_UNICODE 1
533 #endif
534
535
536 #if PLATFORM(CHROMIUM) && OS(DARWIN)
537 #define WTF_PLATFORM_CF 1
538 #define WTF_USE_PTHREADS 1
539 #define HAVE_PTHREAD_RWLOCK 1
540 #endif
541
542 #define DONT_FINALIZE_ON_MAIN_THREAD 1
543
544 #if PLATFORM(QT) && OS(DARWIN)
545 #define WTF_PLATFORM_CF 1
546 #endif
547
548 #define ENABLE_CONTEXT_MENUS 0
549 #define ENABLE_DRAG_SUPPORT 0
550 #define ENABLE_FTPDIR 1
551 #define ENABLE_GEOLOCATION 1
552 #define ENABLE_ICONDATABASE 0
553 #define ENABLE_INSPECTOR 0
554 #define ENABLE_JIT 0
555 #define ENABLE_MAC_JAVA_BRIDGE 0
556 #define ENABLE_NETSCAPE_PLUGIN_API 0
557 #define ENABLE_ORIENTATION_EVENTS 1
558 #define ENABLE_RANGETYPE_AS_TEXT 1
559 #define ENABLE_REPAINT_THROTTLING 1
560 #define ENABLE_RESPECT_EXIF_ORIENTATION 1
561 #define ENABLE_YARR 0
562 #define ENABLE_YARR_JIT 0
563 #define HAVE_PTHREAD_RWLOCK 1
564 #define HAVE_READLINE 1
565 #define HAVE_RUNLOOP_TIMER 0
566 #define WTF_PLATFORM_CF 1
567 #define WTF_USE_PTHREADS 1
568 #define WTF_USE_WEB_THREAD 1
569
570 #if PLATFORM(ANDROID)
571 #define WTF_USE_PTHREADS 1
572 #define WTF_PLATFORM_SGL 1
573 #define USE_SYSTEM_MALLOC 1
574 #define ENABLE_MAC_JAVA_BRIDGE 1
575 #define LOG_DISABLED 1
576 /* Prevents Webkit from drawing the caret in textfields and textareas
577 This prevents unnecessary invals. */
578 #define ENABLE_TEXT_CARET 1
579 #define ENABLE_JAVASCRIPT_DEBUGGER 0
580 #endif
581
582 #if PLATFORM(WIN)
583 #define WTF_USE_WININET 1
584 #endif
585
586 #if PLATFORM(WX)
587 #define ENABLE_ASSEMBLER 1
588 #if OS(DARWIN)
589 #define WTF_PLATFORM_CF 1
590 #endif
591 #endif
592
593 #if PLATFORM(GTK)
594 #if HAVE(PTHREAD_H)
595 #define WTF_USE_PTHREADS 1
596 #define HAVE_PTHREAD_RWLOCK 1
597 #endif
598 #endif
599
600 #if PLATFORM(HAIKU)
601 #define HAVE_POSIX_MEMALIGN 1
602 #define WTF_USE_CURL 1
603 #define WTF_USE_PTHREADS 1
604 #define HAVE_PTHREAD_RWLOCK 1
605 #define USE_SYSTEM_MALLOC 1
606 #define ENABLE_NETSCAPE_PLUGIN_API 0
607 #endif
608
609 #if !defined(HAVE_ACCESSIBILITY)
610 #define HAVE_ACCESSIBILITY 1
611 #endif /* !defined(HAVE_ACCESSIBILITY) */
612
613 #if OS(UNIX) && !OS(SYMBIAN)
614 #define HAVE_SIGNAL_H 1
615 #endif
616
617 #if !OS(WINDOWS) && !OS(SOLARIS) && !OS(QNX) \
618 && !OS(SYMBIAN) && !OS(HAIKU) && !OS(RVCT) \
619 && !OS(ANDROID)
620 #define HAVE_TM_GMTOFF 1
621 #define HAVE_TM_ZONE 1
622 #define HAVE_TIMEGM 1
623 #endif
624
625 #if OS(DARWIN)
626
627 #define HAVE_ERRNO_H 1
628 #define HAVE_LANGINFO_H 1
629 #define HAVE_MMAP 1
630 #define HAVE_MERGESORT 1
631 #define HAVE_SBRK 1
632 #define HAVE_STRINGS_H 1
633 #define HAVE_SYS_PARAM_H 1
634 #define HAVE_SYS_TIME_H 1
635 #define HAVE_SYS_TIMEB_H 1
636
637 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
638
639 #define HAVE_DISPATCH_H 1
640
641
642 #endif
643
644 #define HAVE_MADV_FREE 1
645 #define HAVE_PTHREAD_SETNAME_NP 1
646
647 #elif OS(WINDOWS)
648
649 #if OS(WINCE)
650 #define HAVE_ERRNO_H 0
651 #else
652 #define HAVE_SYS_TIMEB_H 1
653 #endif
654 #define HAVE_VIRTUALALLOC 1
655
656 #elif OS(SYMBIAN)
657
658 #define HAVE_ERRNO_H 1
659 #define HAVE_MMAP 0
660 #define HAVE_SBRK 1
661
662 #define HAVE_SYS_TIME_H 1
663 #define HAVE_STRINGS_H 1
664
665 #if !COMPILER(RVCT)
666 #define HAVE_SYS_PARAM_H 1
667 #endif
668
669 #elif OS(QNX)
670
671 #define HAVE_ERRNO_H 1
672 #define HAVE_MMAP 1
673 #define HAVE_SBRK 1
674 #define HAVE_STRINGS_H 1
675 #define HAVE_SYS_PARAM_H 1
676 #define HAVE_SYS_TIME_H 1
677
678 #elif OS(ANDROID)
679
680 #define HAVE_ERRNO_H 1
681 #define HAVE_LANGINFO_H 0
682 #define HAVE_MMAP 1
683 #define HAVE_SBRK 1
684 #define HAVE_STRINGS_H 1
685 #define HAVE_SYS_PARAM_H 1
686 #define HAVE_SYS_TIME_H 1
687
688 #else
689
690 /* FIXME: is this actually used or do other platforms generate their own config.h? */
691
692 #define HAVE_ERRNO_H 1
693 /* As long as Haiku doesn't have a complete support of locale this will be disabled. */
694 #if !OS(HAIKU)
695 #define HAVE_LANGINFO_H 1
696 #endif
697 #define HAVE_MMAP 1
698 #define HAVE_SBRK 1
699 #define HAVE_STRINGS_H 1
700 #define HAVE_SYS_PARAM_H 1
701 #define HAVE_SYS_TIME_H 1
702
703 #endif
704
705 /* ENABLE macro defaults */
706
707 /* fastMalloc match validation allows for runtime verification that
708 new is matched by delete, fastMalloc is matched by fastFree, etc. */
709 #if !defined(ENABLE_FAST_MALLOC_MATCH_VALIDATION)
710 #define ENABLE_FAST_MALLOC_MATCH_VALIDATION 0
711 #endif
712
713 #if !defined(ENABLE_ICONDATABASE)
714 #define ENABLE_ICONDATABASE 1
715 #endif
716
717 #if !defined(ENABLE_DATABASE)
718 #define ENABLE_DATABASE 1
719 #endif
720
721 #if !defined(ENABLE_JAVASCRIPT_DEBUGGER)
722 #define ENABLE_JAVASCRIPT_DEBUGGER 1
723 #endif
724
725 #if !defined(ENABLE_FTPDIR)
726 #define ENABLE_FTPDIR 1
727 #endif
728
729 #if !defined(ENABLE_CONTEXT_MENUS)
730 #define ENABLE_CONTEXT_MENUS 1
731 #endif
732
733 #if !defined(ENABLE_DRAG_SUPPORT)
734 #define ENABLE_DRAG_SUPPORT 1
735 #endif
736
737 #if !defined(ENABLE_DASHBOARD_SUPPORT)
738 #define ENABLE_DASHBOARD_SUPPORT 0
739 #endif
740
741 #if !defined(ENABLE_GEOLOCATION_PERMISSION_CACHE)
742 #define ENABLE_GEOLOCATION_PERMISSION_CACHE 0
743 #endif
744
745 #if !defined(ENABLE_INSPECTOR)
746 #define ENABLE_INSPECTOR 1
747 #endif
748
749 #if !defined(ENABLE_MAC_JAVA_BRIDGE)
750 #define ENABLE_MAC_JAVA_BRIDGE 0
751 #endif
752
753 #if !defined(ENABLE_NETSCAPE_PLUGIN_API)
754 #define ENABLE_NETSCAPE_PLUGIN_API 1
755 #endif
756
757 #if !defined(WTF_USE_PLUGIN_HOST_PROCESS)
758 #define WTF_USE_PLUGIN_HOST_PROCESS 0
759 #endif
760
761 #if !defined(ENABLE_ORIENTATION_EVENTS)
762 #define ENABLE_ORIENTATION_EVENTS 0
763 #endif
764
765 #if !defined(ENABLE_RESPECT_EXIF_ORIENTATION)
766 #define ENABLE_RESPECT_EXIF_ORIENTATION 0
767 #endif
768
769 #if !defined(ENABLE_OPCODE_STATS)
770 #define ENABLE_OPCODE_STATS 0
771 #endif
772
773 #define ENABLE_SAMPLING_COUNTERS 0
774 #define ENABLE_SAMPLING_FLAGS 0
775 #define ENABLE_OPCODE_SAMPLING 0
776 #define ENABLE_CODEBLOCK_SAMPLING 0
777 #if ENABLE(CODEBLOCK_SAMPLING) && !ENABLE(OPCODE_SAMPLING)
778 #error "CODEBLOCK_SAMPLING requires OPCODE_SAMPLING"
779 #endif
780 #if ENABLE(OPCODE_SAMPLING) || ENABLE(SAMPLING_FLAGS)
781 #define ENABLE_SAMPLING_THREAD 1
782 #endif
783
784 #if !defined(ENABLE_GEOLOCATION)
785 #define ENABLE_GEOLOCATION 0
786 #endif
787
788 #if !defined(ENABLE_NOTIFICATIONS)
789 #define ENABLE_NOTIFICATIONS 0
790 #endif
791
792 #define ENABLE_TEXT_CARET 0
793
794 #if !defined(ENABLE_TEXT_CARET)
795 #define ENABLE_TEXT_CARET 1
796 #endif
797
798 #if !defined(ENABLE_ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL)
799 #define ENABLE_ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL 0
800 #endif
801
802 #if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32) && !defined(WTF_USE_JSVALUE32_64)
803 #if (CPU(X86_64) && (OS(UNIX) || OS(WINDOWS))) || CPU(IA64) || CPU(ALPHA)
804 #define WTF_USE_JSVALUE64 1
805 #elif CPU(ARM) && !PLATFORM(IPHONE) || CPU(PPC64) || (PLATFORM(IPHONE) && defined(WTF_ARM_ARCH_VERSION) && WTF_ARM_ARCH_VERSION == 6 && !defined(__llvm__))
806 /* FIXME: <rdar://problem/7478149> gcc-4.2 compiler bug with USE(JSVALUE32_64) and armv6 target */
807 #define WTF_USE_JSVALUE32 1
808 #elif OS(WINDOWS) && COMPILER(MINGW)
809 /* Using JSVALUE32_64 causes padding/alignement issues for JITStubArg
810 on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */
811 #define WTF_USE_JSVALUE32 1
812 #else
813 #define WTF_USE_JSVALUE32_64 1
814 #endif
815 #endif /* !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32) && !defined(WTF_USE_JSVALUE32_64) */
816
817 #if !defined(ENABLE_REPAINT_THROTTLING)
818 #define ENABLE_REPAINT_THROTTLING 0
819 #endif
820
821 #if !defined(ENABLE_JIT)
822
823 /* The JIT is tested & working on x86_64 Mac */
824 #if CPU(X86_64) && PLATFORM(MAC)
825 #define ENABLE_JIT 1
826 /* The JIT is tested & working on x86 Mac */
827 #elif CPU(X86) && PLATFORM(MAC)
828 #define ENABLE_JIT 1
829 #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
830 #elif CPU(ARM_THUMB2) && PLATFORM(IPHONE)
831 #define ENABLE_JIT 1
832 /* The JIT is tested & working on x86 Windows */
833 #elif CPU(X86) && PLATFORM(WIN)
834 #define ENABLE_JIT 1
835 #endif
836
837 #if PLATFORM(QT)
838 #if CPU(X86_64) && OS(DARWIN)
839 #define ENABLE_JIT 1
840 #elif CPU(X86) && OS(DARWIN)
841 #define ENABLE_JIT 1
842 #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
843 #elif CPU(X86) && OS(WINDOWS) && COMPILER(MINGW) && GCC_VERSION >= 40100
844 #define ENABLE_JIT 1
845 #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
846 #elif CPU(X86) && OS(WINDOWS) && COMPILER(MSVC)
847 #define ENABLE_JIT 1
848 #define WTF_USE_JIT_STUB_ARGUMENT_REGISTER 1
849 #elif CPU(X86) && OS(LINUX) && GCC_VERSION >= 40100
850 #define ENABLE_JIT 1
851 #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
852 #elif CPU(X86_64) && OS(LINUX) && GCC_VERSION >= 40100
853 #define ENABLE_JIT 1
854 #elif CPU(ARM_TRADITIONAL) && OS(LINUX)
855 #define ENABLE_JIT 1
856 #endif
857 #endif /* PLATFORM(QT) */
858
859 #endif /* !defined(ENABLE_JIT) */
860
861 #if ENABLE(JIT)
862 #ifndef ENABLE_JIT_OPTIMIZE_CALL
863 #define ENABLE_JIT_OPTIMIZE_CALL 1
864 #endif
865 #ifndef ENABLE_JIT_OPTIMIZE_NATIVE_CALL
866 #define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 1
867 #endif
868 #ifndef ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS
869 #define ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS 1
870 #endif
871 #ifndef ENABLE_JIT_OPTIMIZE_METHOD_CALLS
872 #define ENABLE_JIT_OPTIMIZE_METHOD_CALLS 1
873 #endif
874 #endif
875
876 #if CPU(X86) && COMPILER(MSVC)
877 #define JSC_HOST_CALL __fastcall
878 #elif CPU(X86) && COMPILER(GCC)
879 #define JSC_HOST_CALL __attribute__ ((fastcall))
880 #else
881 #define JSC_HOST_CALL
882 #endif
883
884 #if COMPILER(GCC) && !ENABLE(JIT)
885 #define HAVE_COMPUTED_GOTO 1
886 #endif
887
888 #if ENABLE(JIT) && defined(COVERAGE)
889 #define WTF_USE_INTERPRETER 0
890 #else
891 #define WTF_USE_INTERPRETER 1
892 #endif
893
894 /* Yet Another Regex Runtime. */
895 #if !defined(ENABLE_YARR_JIT)
896
897 /* YARR supports x86 & x86-64, and has been tested on Mac and Windows. */
898 #if (CPU(X86) && PLATFORM(MAC)) \
899 || (CPU(X86_64) && PLATFORM(MAC)) \
900 || (CPU(ARM_THUMB2) && PLATFORM(IPHONE)) \
901 || (CPU(X86) && PLATFORM(WIN))
902 #define ENABLE_YARR 1
903 #define ENABLE_YARR_JIT 1
904 #endif
905
906 #if PLATFORM(QT)
907 #if (CPU(X86) && OS(WINDOWS) && COMPILER(MINGW) && GCC_VERSION >= 40100) \
908 || (CPU(X86) && OS(WINDOWS) && COMPILER(MSVC)) \
909 || (CPU(X86) && OS(LINUX) && GCC_VERSION >= 40100) \
910 || (CPU(X86_64) && OS(LINUX) && GCC_VERSION >= 40100) \
911 || (CPU(ARM_TRADITIONAL) && OS(LINUX))
912 #define ENABLE_YARR 1
913 #define ENABLE_YARR_JIT 1
914 #endif
915 #endif
916
917 #endif /* !defined(ENABLE_YARR_JIT) */
918
919 /* Sanity Check */
920 #if ENABLE(YARR_JIT) && !ENABLE(YARR)
921 #error "YARR_JIT requires YARR"
922 #endif
923
924 #if ENABLE(JIT) || ENABLE(YARR_JIT)
925 #define ENABLE_ASSEMBLER 1
926 #endif
927 /* Setting this flag prevents the assembler from using RWX memory; this may improve
928 security but currectly comes at a significant performance cost. */
929 #define ENABLE_ASSEMBLER_WX_EXCLUSIVE 1
930
931 #if !defined(ENABLE_PAN_SCROLLING) && OS(WINDOWS)
932 #define ENABLE_PAN_SCROLLING 1
933 #endif
934
935 /* Use the QXmlStreamReader implementation for XMLTokenizer */
936 /* Use the QXmlQuery implementation for XSLTProcessor */
937 #if PLATFORM(QT)
938 #define WTF_USE_QXMLSTREAM 1
939 #define WTF_USE_QXMLQUERY 1
940 #endif
941
942 #if !PLATFORM(QT)
943 #define WTF_USE_FONT_FAST_PATH 1
944 #endif
945
946 /* Accelerated compositing */
947 #if PLATFORM(MAC)
948 #if !defined(BUILDING_ON_TIGER)
949 #define WTF_USE_ACCELERATED_COMPOSITING 1
950 #endif
951 #endif
952
953 #define WTF_USE_ACCELERATED_COMPOSITING 1
954
955 /* FIXME: Defining ENABLE_3D_RENDERING here isn't really right, but it's always used with
956 with WTF_USE_ACCELERATED_COMPOSITING, and it allows the feature to be turned on and
957 off in one place. */
958 #if PLATFORM(WIN)
959 #include "QuartzCorePresent.h"
960 #if QUARTZCORE_PRESENT
961 #define WTF_USE_ACCELERATED_COMPOSITING 1
962 #define ENABLE_3D_RENDERING 1
963 #endif
964 #endif
965
966 #if COMPILER(GCC)
967 #define WARN_UNUSED_RETURN __attribute__ ((warn_unused_result))
968 #else
969 #define WARN_UNUSED_RETURN
970 #endif
971
972 #if !ENABLE(NETSCAPE_PLUGIN_API) || (ENABLE(NETSCAPE_PLUGIN_API) && ((OS(UNIX) && (PLATFORM(QT) || PLATFORM(WX))) || PLATFORM(GTK)))
973 #define ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH 1
974 #endif
975
976 /* Set up a define for a common error that is intended to cause a build error -- thus the space after Error. */
977 #define WTF_PLATFORM_CFNETWORK Error USE_macro_should_be_used_with_CFNETWORK
978
979 #define ENABLE_JSC_ZOMBIES 0
980
981 #endif /* WTF_Platform_h */