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.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 #ifndef WTF_Platform_h
29 #define WTF_Platform_h
31 /* Include compiler specific macros */
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)
40 /* ==== Platform adaptation macros: these describe properties of the target environment. ==== */
42 /* CPU() - the target CPU architecture */
43 #define CPU(WTF_FEATURE) (defined WTF_CPU_##WTF_FEATURE && WTF_CPU_##WTF_FEATURE)
44 /* 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 /* OS() - underlying operating system; only to be used for mandated low-level services like
47 virtual memory, not to choose a GUI toolkit */
48 #define OS(WTF_FEATURE) (defined WTF_OS_##WTF_FEATURE && WTF_OS_##WTF_FEATURE)
51 /* ==== 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)
59 /* ==== CPU() - the target CPU architecture ==== */
61 /* This also defines CPU(BIG_ENDIAN) or CPU(MIDDLE_ENDIAN) or neither, as appropriate. */
63 /* CPU(ALPHA) - DEC Alpha */
64 #if defined(__alpha__)
65 #define WTF_CPU_ALPHA 1
68 /* CPU(IA64) - Itanium / IA-64 */
70 #define WTF_CPU_IA64 1
71 /* 32-bit mode on Itanium */
72 #if !defined(__LP64__)
73 #define WTF_CPU_IA64_32 1
77 /* CPU(MIPS) - MIPS 32-bit */
78 /* 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_)) \
81 #define WTF_CPU_MIPS 1
82 #if defined(__MIPSEB__)
83 #define WTF_CPU_BIG_ENDIAN 1
85 #define WTF_MIPS_PIC (defined __PIC__)
86 #define WTF_MIPS_ARCH __mips
87 #define WTF_MIPS_ISA(v) (defined WTF_MIPS_ARCH && WTF_MIPS_ARCH == v)
88 #define WTF_MIPS_ISA_AT_LEAST(v) (defined WTF_MIPS_ARCH && WTF_MIPS_ARCH >= v)
89 #define WTF_MIPS_ARCH_REV __mips_isa_rev
90 #define WTF_MIPS_ISA_REV(v) (defined WTF_MIPS_ARCH_REV && WTF_MIPS_ARCH_REV == v)
91 #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 /* MIPS requires allocators to use aligned memory */
94 #define WTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1
97 /* CPU(PPC) - PowerPC 32-bit */
98 #if defined(__ppc__) \
100 || defined(__powerpc__) \
101 || defined(__powerpc) \
102 || defined(__POWERPC__) \
105 #define WTF_CPU_PPC 1
106 #define WTF_CPU_BIG_ENDIAN 1
109 /* CPU(PPC64) - PowerPC 64-bit */
110 #if defined(__ppc64__) \
111 || defined(__PPC64__)
112 #define WTF_CPU_PPC64 1
113 #define WTF_CPU_BIG_ENDIAN 1
116 /* CPU(SH4) - SuperH SH-4 */
118 #define WTF_CPU_SH4 1
121 /* CPU(SPARC32) - SPARC 32-bit */
122 #if defined(__sparc) && !defined(__arch64__) || defined(__sparcv8)
123 #define WTF_CPU_SPARC32 1
124 #define WTF_CPU_BIG_ENDIAN 1
127 /* CPU(SPARC64) - SPARC 64-bit */
128 #if defined(__sparc__) && defined(__arch64__) || defined (__sparcv9)
129 #define WTF_CPU_SPARC64 1
130 #define WTF_CPU_BIG_ENDIAN 1
133 /* CPU(SPARC) - any SPARC, true for CPU(SPARC32) and CPU(SPARC64) */
134 #if CPU(SPARC32) || CPU(SPARC64)
135 #define WTF_CPU_SPARC 1
138 /* CPU(S390X) - S390 64-bit */
139 #if defined(__s390x__)
140 #define WTF_CPU_S390X 1
141 #define WTF_CPU_BIG_ENDIAN 1
144 /* CPU(S390) - S390 32-bit */
145 #if defined(__s390__)
146 #define WTF_CPU_S390 1
147 #define WTF_CPU_BIG_ENDIAN 1
150 /* CPU(X86) - i386 / x86 32-bit */
151 #if defined(__i386__) \
153 || defined(_M_IX86) \
155 || defined(__THW_INTEL)
156 #define WTF_CPU_X86 1
159 /* CPU(X86_64) - AMD64 / Intel64 / x86_64 64-bit */
160 #if defined(__x86_64__) \
162 #define WTF_CPU_X86_64 1
165 /* CPU(ARM) - ARM, any version*/
167 || defined(__arm__) \
170 #define WTF_CPU_ARM 1
172 #if defined(__ARMEB__) || (COMPILER(RVCT) && defined(__BIG_ENDIAN))
173 #define WTF_CPU_BIG_ENDIAN 1
175 #elif !defined(__ARM_EABI__) \
176 && !defined(__EABI__) \
177 && !defined(__VFP_FP__) \
178 && !defined(_WIN32_WCE) \
180 #define WTF_CPU_MIDDLE_ENDIAN 1
184 #define WTF_ARM_ARCH_AT_LEAST(N) (CPU(ARM) && WTF_ARM_ARCH_VERSION >= N)
186 /* Set WTF_ARM_ARCH_VERSION */
187 #if defined(__ARM_ARCH_4__) \
188 || defined(__ARM_ARCH_4T__) \
189 || defined(__MARM_ARMV4__) \
191 #define WTF_ARM_ARCH_VERSION 4
193 #elif defined(__ARM_ARCH_5__) \
194 || defined(__ARM_ARCH_5T__) \
195 || defined(__MARM_ARMV5__)
196 #define WTF_ARM_ARCH_VERSION 5
198 #elif defined(__ARM_ARCH_5E__) \
199 || defined(__ARM_ARCH_5TE__) \
200 || defined(__ARM_ARCH_5TEJ__)
201 #define WTF_ARM_ARCH_VERSION 5
202 /*ARMv5TE requires allocators to use aligned memory*/
203 #define WTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1
205 #elif defined(__ARM_ARCH_6__) \
206 || defined(__ARM_ARCH_6J__) \
207 || defined(__ARM_ARCH_6K__) \
208 || defined(__ARM_ARCH_6Z__) \
209 || defined(__ARM_ARCH_6ZK__) \
210 || defined(__ARM_ARCH_6T2__) \
211 || defined(__ARMV6__)
212 #define WTF_ARM_ARCH_VERSION 6
214 #elif defined(__ARM_ARCH_7A__) \
215 || defined(__ARM_ARCH_7R__)
216 #define WTF_ARM_ARCH_VERSION 7
218 /* RVCT sets _TARGET_ARCH_ARM */
219 #elif defined(__TARGET_ARCH_ARM)
220 #define WTF_ARM_ARCH_VERSION __TARGET_ARCH_ARM
222 #if defined(__TARGET_ARCH_5E) \
223 || defined(__TARGET_ARCH_5TE) \
224 || defined(__TARGET_ARCH_5TEJ)
225 /*ARMv5TE requires allocators to use aligned memory*/
226 #define WTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1
230 #define WTF_ARM_ARCH_VERSION 0
234 /* Set WTF_THUMB_ARCH_VERSION */
235 #if defined(__ARM_ARCH_4T__)
236 #define WTF_THUMB_ARCH_VERSION 1
238 #elif defined(__ARM_ARCH_5T__) \
239 || defined(__ARM_ARCH_5TE__) \
240 || defined(__ARM_ARCH_5TEJ__)
241 #define WTF_THUMB_ARCH_VERSION 2
243 #elif defined(__ARM_ARCH_6J__) \
244 || defined(__ARM_ARCH_6K__) \
245 || defined(__ARM_ARCH_6Z__) \
246 || defined(__ARM_ARCH_6ZK__) \
247 || defined(__ARM_ARCH_6M__)
248 #define WTF_THUMB_ARCH_VERSION 3
250 #elif defined(__ARM_ARCH_6T2__) \
251 || defined(__ARM_ARCH_7__) \
252 || defined(__ARM_ARCH_7A__) \
253 || defined(__ARM_ARCH_7R__) \
254 || defined(__ARM_ARCH_7M__)
255 #define WTF_THUMB_ARCH_VERSION 4
257 /* RVCT sets __TARGET_ARCH_THUMB */
258 #elif defined(__TARGET_ARCH_THUMB)
259 #define WTF_THUMB_ARCH_VERSION __TARGET_ARCH_THUMB
262 #define WTF_THUMB_ARCH_VERSION 0
266 /* CPU(ARMV5_OR_LOWER) - ARM instruction set v5 or earlier */
267 /* On ARMv5 and below the natural alignment is required.
268 And there are some other differences for v5 or earlier. */
269 #if !defined(ARMV5_OR_LOWER) && !WTF_ARM_ARCH_AT_LEAST(6)
270 #define WTF_CPU_ARMV5_OR_LOWER 1
274 /* CPU(ARM_TRADITIONAL) - Thumb2 is not available, only traditional ARM (v4 or greater) */
275 /* CPU(ARM_THUMB2) - Thumb2 instruction set is available */
276 /* Only one of these will be defined. */
277 #if !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2)
278 # if defined(thumb2) || defined(__thumb2__) \
279 || ((defined(__thumb) || defined(__thumb__)) && WTF_THUMB_ARCH_VERSION == 4)
280 # define WTF_CPU_ARM_TRADITIONAL 0
281 # define WTF_CPU_ARM_THUMB2 1
282 # elif WTF_ARM_ARCH_AT_LEAST(4)
283 # define WTF_CPU_ARM_TRADITIONAL 1
284 # define WTF_CPU_ARM_THUMB2 0
286 # error "Not supported ARM architecture"
288 #elif CPU(ARM_TRADITIONAL) && CPU(ARM_THUMB2) /* Sanity Check */
289 # error "Cannot use both of WTF_CPU_ARM_TRADITIONAL and WTF_CPU_ARM_THUMB2 platforms"
290 #endif /* !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2) */
292 #if defined(__ARM_NEON__) && !defined(WTF_CPU_ARM_NEON)
293 #define WTF_CPU_ARM_NEON 1
298 #if CPU(ARM) || CPU(MIPS) || CPU(SH4)
299 #define WTF_CPU_NEEDS_ALIGNED_ACCESS 1
302 /* ==== OS() - underlying operating system; only to be used for mandated low-level services like
303 virtual memory, not to choose a GUI toolkit ==== */
305 /* OS(ANDROID) - Android */
307 #define WTF_OS_ANDROID 1
315 /* OS(DARWIN) - Any Darwin-based OS, including Mac OS X and iPhone OS */
317 #define WTF_OS_DARWIN 1
319 #include <Availability.h>
320 #include <AvailabilityMacros.h>
321 #include <TargetConditionals.h>
325 /* OS(MAC_OS_X) - Mac OS X (not including iOS) */
326 #if OS(DARWIN) && ((defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED) \
327 || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) \
328 || (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR))
330 #elif OS(DARWIN) && defined(TARGET_OS_MAC) && TARGET_OS_MAC
331 #define WTF_OS_MAC_OS_X 1
332 /* FIXME: BUILDING_ON_.., and TARGETING... macros should be folded into the OS() system */
333 #if !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
334 #define BUILDING_ON_LEOPARD 1
335 #elif !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
336 #define BUILDING_ON_SNOW_LEOPARD 1
337 #elif !defined(MAC_OS_X_VERSION_10_8) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8
338 #define BUILDING_ON_LION 1
340 #if !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
341 #define TARGETING_LEOPARD 1
342 #elif !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7
343 #define TARGETING_SNOW_LEOPARD 1
344 #elif !defined(MAC_OS_X_VERSION_10_8) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8
345 #define TARGETING_LION 1
349 /* OS(FREEBSD) - FreeBSD */
350 #if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
351 #define WTF_OS_FREEBSD 1
354 /* OS(LINUX) - Linux */
356 #define WTF_OS_LINUX 1
359 /* OS(NETBSD) - NetBSD */
360 #if defined(__NetBSD__)
361 #define WTF_OS_NETBSD 1
364 /* OS(OPENBSD) - OpenBSD */
366 #define WTF_OS_OPENBSD 1
370 #if defined(__QNXNTO__)
374 /* OS(SOLARIS) - Solaris */
375 #if defined(sun) || defined(__sun)
376 #define WTF_OS_SOLARIS 1
379 /* OS(WINCE) - Windows CE; note that for this platform OS(WINDOWS) is also defined */
380 #if defined(_WIN32_WCE)
381 #define WTF_OS_WINCE 1
384 /* OS(WINDOWS) - Any version of Windows */
385 #if defined(WIN32) || defined(_WIN32)
386 #define WTF_OS_WINDOWS 1
389 #define WTF_OS_WIN ERROR "USE WINDOWS WITH OS NOT WIN"
390 #define WTF_OS_MAC ERROR "USE MAC_OS_X WITH OS NOT MAC"
392 /* OS(UNIX) - Any Unix-like system */
405 #define WTF_OS_UNIX 1
408 /* Operating environments */
410 /* FIXME: these are all mixes of OS, operating environment and policy choices. */
411 /* PLATFORM(CHROMIUM) */
415 /* PLATFORM(BLACKBERRY) */
418 #if defined(BUILDING_CHROMIUM__)
419 #define WTF_PLATFORM_CHROMIUM 1
420 #elif defined(BUILDING_QT__)
421 #define WTF_PLATFORM_QT 1
422 #elif defined(BUILDING_WX__)
423 #define WTF_PLATFORM_WX 1
424 #elif defined(BUILDING_GTK__)
425 #define WTF_PLATFORM_GTK 1
426 #elif defined(BUILDING_BLACKBERRY__)
427 #define WTF_PLATFORM_BLACKBERRY 1
429 #define WTF_PLATFORM_MAC 1
431 #define WTF_PLATFORM_WIN 1
435 /* FIXME: this is sometimes used as an OS switch and sometimes for higher-level things */
436 #if (defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
437 #define WTF_PLATFORM_IOS 1
440 /* PLATFORM(IOS_SIMULATOR) */
441 #if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR
442 #define WTF_PLATFORM_IOS 1
443 #define WTF_PLATFORM_IOS_SIMULATOR 1
445 #define WTF_PLATFORM_IOS_SIMULATOR 0
448 #if !defined(WTF_PLATFORM_IOS)
449 #define WTF_PLATFORM_IOS 0
452 /* Graphics engines */
454 /* USE(CG) and PLATFORM(CI) */
455 #if PLATFORM(MAC) || PLATFORM(IOS)
458 #if PLATFORM(MAC) || PLATFORM(IOS) || (PLATFORM(WIN) && USE(CG))
462 /* USE(SKIA) for Win/Linux, CG for Mac, unless enabled */
463 #if PLATFORM(CHROMIUM)
465 #if USE(SKIA_ON_MAC_CHROMIUM)
466 #define WTF_USE_SKIA 1
470 #define WTF_USE_ATSUI 1
471 #define WTF_USE_CORE_TEXT 1
472 #define WTF_USE_ICCJPEG 1
474 #define WTF_USE_SKIA 1
475 #define WTF_USE_CHROMIUM_NET 1
479 #if PLATFORM(BLACKBERRY)
480 #define ENABLE_DRAG_SUPPORT 0
481 #define USE_SYSTEM_MALLOC 1
482 #define WTF_USE_MERSENNE_TWISTER_19937 1
483 #define WTF_USE_SKIA 1
487 #define WTF_USE_CAIRO 1
493 #define WTF_USE_MERSENNE_TWISTER_19937 1
496 /* On Windows, use QueryPerformanceCounter by default */
498 #define WTF_USE_QUERY_PERFORMANCE_COUNTER 1
501 #if OS(WINCE) && !PLATFORM(QT)
502 #define NOMINMAX /* Windows min and max conflict with standard macros */
503 #define NOSHLWAPI /* shlwapi.h not available on WinCe */
505 /* MSDN documentation says these functions are provided with uspce.lib. But we cannot find this file. */
506 #define __usp10__ /* disable "usp10.h" */
508 #define _INC_ASSERT /* disable "assert.h" */
511 #endif /* OS(WINCE) && !PLATFORM(QT) */
514 #ifndef WTF_USE_ICU_UNICODE
515 #define WTF_USE_QT4_UNICODE 1
518 #define WTF_USE_WINCE_UNICODE 1
520 /* The GTK+ Unicode backend is configurable */
522 #define WTF_USE_ICU_UNICODE 1
525 #if PLATFORM(MAC) && !PLATFORM(IOS)
526 #if !defined(BUILDING_ON_LEOPARD) && CPU(X86_64)
527 #define WTF_USE_PLUGIN_HOST_PROCESS 1
529 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
530 #define ENABLE_GESTURE_EVENTS 1
531 #define ENABLE_RUBBER_BANDING 1
532 #define WTF_USE_SCROLLBAR_PAINTER 1
534 #if !defined(ENABLE_JAVA_BRIDGE)
535 #define ENABLE_JAVA_BRIDGE 1
537 #if !defined(ENABLE_DASHBOARD_SUPPORT)
538 #define ENABLE_DASHBOARD_SUPPORT 1
541 #define WTF_USE_PTHREADS 1
542 #define HAVE_PTHREAD_RWLOCK 1
543 #define HAVE_READLINE 1
544 #define HAVE_RUNLOOP_TIMER 1
545 #define ENABLE_FULLSCREEN_API 1
546 #define ENABLE_SMOOTH_SCROLLING 1
547 #define ENABLE_WEB_ARCHIVE 1
548 #define ENABLE_WEB_AUDIO 1
549 #if defined(ENABLE_VIDEO)
550 #define ENABLE_VIDEO_TRACK 1
552 #endif /* PLATFORM(MAC) && !PLATFORM(IOS) */
554 #if PLATFORM(CHROMIUM) && OS(DARWIN)
556 #define WTF_USE_PTHREADS 1
557 #define HAVE_PTHREAD_RWLOCK 1
559 #define WTF_USE_WK_SCROLLBAR_PAINTER 1
563 #define DONT_FINALIZE_ON_MAIN_THREAD 1
566 #if PLATFORM(QT) && OS(DARWIN)
568 #define HAVE_DISPATCH_H 1
571 #if OS(DARWIN) && !PLATFORM(GTK) && !PLATFORM(QT)
572 #define ENABLE_PURGEABLE_MEMORY 1
576 #define ENABLE_CONTEXT_MENUS 0
577 #define ENABLE_DRAG_SUPPORT 0
578 #define ENABLE_DATA_TRANSFER_ITEMS 0
579 #define ENABLE_FTPDIR 1
580 #define ENABLE_GEOLOCATION 1
581 #define ENABLE_ICONDATABASE 0
582 #define ENABLE_INSPECTOR 1
583 #define ENABLE_JAVA_BRIDGE 0
584 #define ENABLE_NETSCAPE_PLUGIN_API 0
585 #define ENABLE_ORIENTATION_EVENTS 1
586 #define ENABLE_REPAINT_THROTTLING 1
587 #define ENABLE_WEB_ARCHIVE 1
588 #define HAVE_NETWORK_CFDATA_ARRAY_CALLBACK 1
589 #define HAVE_PTHREAD_RWLOCK 1
590 #define HAVE_READLINE 1
591 #define HAVE_RUNLOOP_TIMER 0
593 #define WTF_USE_CFNETWORK 1
594 #define WTF_USE_PTHREADS 1
596 #if PLATFORM(IOS_SIMULATOR)
597 #define ENABLE_INTERPRETER 1
599 #define ENABLE_YARR_JIT 0
601 #define ENABLE_INTERPRETER 1
603 #define ENABLE_YARR_JIT 1
608 #if PLATFORM(WIN) && !OS(WINCE)
610 #define WTF_USE_PTHREADS 0
613 #if PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(CHROMIUM) && !PLATFORM(WIN_CAIRO)
614 #define WTF_USE_CFNETWORK 1
617 #if USE(CFNETWORK) || PLATFORM(MAC) || PLATFORM(IOS)
618 #define WTF_USE_CFURLCACHE 1
619 #define WTF_USE_CFURLSTORAGESESSIONS 1
622 #if PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(CHROMIUM) && !PLATFORM(QT)
623 #define ENABLE_WEB_ARCHIVE 1
626 #if PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(CHROMIUM) && !PLATFORM(WIN_CAIRO) && !PLATFORM(QT)
627 #define ENABLE_FULLSCREEN_API 1
632 #define ENABLE_ASSEMBLER 1
635 #define ENABLE_GLOBAL_FASTMALLOC_NEW 0
638 #define WTF_USE_CORE_TEXT 1
639 #define ENABLE_WEB_ARCHIVE 1
645 #define WTF_USE_PTHREADS 1
646 #define HAVE_PTHREAD_RWLOCK 1
648 #elif PLATFORM(QT) && OS(UNIX)
649 #define WTF_USE_PTHREADS 1
650 #define HAVE_PTHREAD_RWLOCK 1
653 #if !defined(HAVE_ACCESSIBILITY)
654 #if PLATFORM(IOS) || PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(CHROMIUM)
655 #define HAVE_ACCESSIBILITY 1
657 #endif /* !defined(HAVE_ACCESSIBILITY) */
660 #define HAVE_SIGNAL_H 1
663 #if !defined(HAVE_VASPRINTF)
664 #if !COMPILER(MSVC) && !COMPILER(RVCT) && !COMPILER(MINGW) && !(COMPILER(GCC) && OS(QNX))
665 #define HAVE_VASPRINTF 1
669 #if !defined(HAVE_STRNSTR)
670 #if OS(DARWIN) || (OS(FREEBSD) && !defined(__GLIBC__))
671 #define HAVE_STRNSTR 1
675 #if !OS(WINDOWS) && !OS(SOLARIS) \
678 #define HAVE_TM_GMTOFF 1
679 #define HAVE_TM_ZONE 1
680 #define HAVE_TIMEGM 1
685 #define HAVE_ERRNO_H 1
686 #define HAVE_LANGINFO_H 1
688 #define HAVE_MERGESORT 1
690 #define HAVE_STRINGS_H 1
691 #define HAVE_SYS_PARAM_H 1
692 #define HAVE_SYS_TIME_H 1
693 #define HAVE_SYS_TIMEB_H 1
694 #define WTF_USE_ACCELERATE 1
696 #ifndef TARGETING_LEOPARD
698 #define HAVE_DISPATCH_H 1
699 #define HAVE_HOSTED_CORE_ANIMATION 1
702 #define HAVE_MADV_FREE_REUSE 1
703 #define HAVE_MADV_FREE 1
704 #define HAVE_PTHREAD_SETNAME_NP 1
710 #define HAVE_MADV_FREE 1
711 #define HAVE_PTHREAD_SETNAME_NP 1
717 #define HAVE_ERRNO_H 0
719 #define HAVE_SYS_TIMEB_H 1
720 #define HAVE_ALIGNED_MALLOC 1
721 #define HAVE_ISDEBUGGERPRESENT 1
723 #define HAVE_VIRTUALALLOC 1
727 #define HAVE_ERRNO_H 1
729 #define HAVE_MADV_FREE_REUSE 1
730 #define HAVE_MADV_FREE 1
732 #define HAVE_STRINGS_H 1
733 #define HAVE_SYS_PARAM_H 1
734 #define HAVE_SYS_TIME_H 1
735 #define WTF_USE_PTHREADS 1
739 #define HAVE_ERRNO_H 1
740 #define HAVE_LANGINFO_H 0
743 #define HAVE_STRINGS_H 1
744 #define HAVE_SYS_PARAM_H 1
745 #define HAVE_SYS_TIME_H 1
749 /* FIXME: is this actually used or do other platforms generate their own config.h? */
751 #define HAVE_ERRNO_H 1
752 #define HAVE_LANGINFO_H 1
755 #define HAVE_STRINGS_H 1
756 #define HAVE_SYS_PARAM_H 1
757 #define HAVE_SYS_TIME_H 1
761 /* ENABLE macro defaults */
764 /* We must not customize the global operator new and delete for the Qt port. */
765 #define ENABLE_GLOBAL_FASTMALLOC_NEW 0
767 #define USE_SYSTEM_MALLOC 1
771 /* fastMalloc match validation allows for runtime verification that
772 new is matched by delete, fastMalloc is matched by fastFree, etc. */
773 #if !defined(ENABLE_FAST_MALLOC_MATCH_VALIDATION)
774 #define ENABLE_FAST_MALLOC_MATCH_VALIDATION 0
777 #if !defined(ENABLE_ICONDATABASE)
778 #define ENABLE_ICONDATABASE 1
781 #if !defined(ENABLE_SQL_DATABASE)
782 #define ENABLE_SQL_DATABASE 1
785 #if !defined(ENABLE_JAVASCRIPT_DEBUGGER)
786 #define ENABLE_JAVASCRIPT_DEBUGGER 1
789 #if !defined(ENABLE_FTPDIR)
790 #define ENABLE_FTPDIR 1
793 #if !defined(ENABLE_CONTEXT_MENUS)
794 #define ENABLE_CONTEXT_MENUS 1
797 #if !defined(ENABLE_DRAG_SUPPORT)
798 #define ENABLE_DRAG_SUPPORT 1
801 #if !defined(ENABLE_DATA_TRANSFER_ITEMS)
802 #define ENABLE_DATA_TRANSFER_ITEMS 0
805 #if !defined(ENABLE_DASHBOARD_SUPPORT)
806 #define ENABLE_DASHBOARD_SUPPORT 0
809 #if !defined(ENABLE_INSPECTOR)
810 #define ENABLE_INSPECTOR 1
813 #if !defined(ENABLE_JAVA_BRIDGE)
814 #define ENABLE_JAVA_BRIDGE 0
817 #if !defined(ENABLE_NETSCAPE_PLUGIN_API)
818 #define ENABLE_NETSCAPE_PLUGIN_API 1
821 #if !defined(ENABLE_NETSCAPE_PLUGIN_METADATA_CACHE)
822 #define ENABLE_NETSCAPE_PLUGIN_METADATA_CACHE 0
825 #if !defined(ENABLE_PURGEABLE_MEMORY)
826 #define ENABLE_PURGEABLE_MEMORY 0
829 #if !defined(WTF_USE_PLUGIN_HOST_PROCESS)
830 #define WTF_USE_PLUGIN_HOST_PROCESS 0
833 #if !defined(ENABLE_ORIENTATION_EVENTS)
834 #define ENABLE_ORIENTATION_EVENTS 0
837 #if !defined(ENABLE_OPCODE_STATS)
838 #define ENABLE_OPCODE_STATS 0
841 #if !defined(ENABLE_GLOBAL_FASTMALLOC_NEW)
842 #define ENABLE_GLOBAL_FASTMALLOC_NEW 1
845 #define ENABLE_DEBUG_WITH_BREAKPOINT 0
846 #define ENABLE_SAMPLING_COUNTERS 0
847 #define ENABLE_SAMPLING_FLAGS 0
848 #define ENABLE_SAMPLING_REGIONS 0
849 #define ENABLE_OPCODE_SAMPLING 0
850 #define ENABLE_CODEBLOCK_SAMPLING 0
851 #if ENABLE(CODEBLOCK_SAMPLING) && !ENABLE(OPCODE_SAMPLING)
852 #error "CODEBLOCK_SAMPLING requires OPCODE_SAMPLING"
854 #if ENABLE(OPCODE_SAMPLING) || ENABLE(SAMPLING_FLAGS) || ENABLE(SAMPLING_REGIONS)
855 #define ENABLE_SAMPLING_THREAD 1
858 #if !defined(ENABLE_GEOLOCATION)
859 #define ENABLE_GEOLOCATION 0
862 #if !defined(ENABLE_GESTURE_RECOGNIZER)
863 #define ENABLE_GESTURE_RECOGNIZER 0
866 #if !defined(ENABLE_VIEWPORT)
867 #define ENABLE_VIEWPORT 0
870 #if !defined(ENABLE_NOTIFICATIONS)
871 #define ENABLE_NOTIFICATIONS 0
875 #define ENABLE_TEXT_CARET 0
878 #if !defined(ENABLE_TEXT_CARET)
879 #define ENABLE_TEXT_CARET 1
882 #if !defined(ENABLE_FULLSCREEN_API)
883 #define ENABLE_FULLSCREEN_API 0
886 #if !defined(ENABLE_POINTER_LOCK)
887 #define ENABLE_POINTER_LOCK 0
890 #if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32_64)
891 #if (CPU(X86_64) && (OS(UNIX) || OS(WINDOWS))) \
892 || (CPU(IA64) && !CPU(IA64_32)) \
897 #define WTF_USE_JSVALUE64 1
899 #define WTF_USE_JSVALUE32_64 1
901 #endif /* !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32_64) */
903 #if !defined(ENABLE_REPAINT_THROTTLING)
904 #define ENABLE_REPAINT_THROTTLING 0
907 /* Disable the JIT on versions of GCC prior to 4.1 */
908 #if !defined(ENABLE_JIT) && COMPILER(GCC) && !GCC_VERSION_AT_LEAST(4, 1, 0)
912 /* JIT is not implemented for Windows 64-bit */
913 #if !defined(ENABLE_JIT) && OS(WINDOWS) && CPU(X86_64)
917 /* The JIT is enabled by default on all x86, x64-64, ARM & MIPS platforms. */
918 #if !defined(ENABLE_JIT) \
919 && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(MIPS)) \
920 && (OS(DARWIN) || !COMPILER(GCC) || GCC_VERSION_AT_LEAST(4, 1, 0)) \
926 #if !defined(ENABLE_DFG_JIT) && ENABLE(JIT)
927 /* Enable the DFG JIT on X86 and X86_64. Only tested on Mac and GNU/Linux. */
928 #if (CPU(X86) || CPU(X86_64)) && (PLATFORM(MAC) || OS(LINUX))
929 #define ENABLE_DFG_JIT 1
931 /* Enable the DFG JIT on ARMv7. Only tested on iOS. */
932 #if CPU(ARM_THUMB2) && PLATFORM(IOS)
933 #define ENABLE_DFG_JIT 1
937 /* Profiling of types and values used by JIT code. DFG_JIT depends on it, but you
938 can enable it manually with DFG turned off if you want to use it as a standalone
939 profiler. In that case, you probably want to also enable VERBOSE_VALUE_PROFILE
941 #if !defined(ENABLE_VALUE_PROFILER) && ENABLE(DFG_JIT)
942 #define ENABLE_VALUE_PROFILER 1
945 #if !defined(ENABLE_VERBOSE_VALUE_PROFILE) && ENABLE(VALUE_PROFILER)
946 #define ENABLE_VERBOSE_VALUE_PROFILE 0
949 #if !defined(ENABLE_SIMPLE_HEAP_PROFILING)
950 #define ENABLE_SIMPLE_HEAP_PROFILING 0
953 /* Counts uses of write barriers using sampling counters. Be sure to also
954 set ENABLE_SAMPLING_COUNTERS to 1. */
955 #if !defined(ENABLE_WRITE_BARRIER_PROFILING)
956 #define ENABLE_WRITE_BARRIER_PROFILING 0
959 /* Ensure that either the JIT or the interpreter has been enabled. */
960 #if !defined(ENABLE_INTERPRETER) && !ENABLE(JIT)
961 #define ENABLE_INTERPRETER 1
963 #if !(ENABLE(JIT) || ENABLE(INTERPRETER))
964 #error You have to have at least one execution model enabled to build JSC
967 #if CPU(SH4) && PLATFORM(QT)
971 /* Configure the JIT */
973 #if !defined(ENABLE_JIT_USE_SOFT_MODULO) && WTF_ARM_ARCH_AT_LEAST(5)
974 #define ENABLE_JIT_USE_SOFT_MODULO 1
978 #if CPU(X86) || CPU(X86_64) || CPU(MIPS)
979 #if !defined(ENABLE_JIT_USE_SOFT_MODULO)
980 #define ENABLE_JIT_USE_SOFT_MODULO 1
984 #if CPU(X86) && COMPILER(MSVC)
985 #define JSC_HOST_CALL __fastcall
986 #elif CPU(X86) && COMPILER(GCC)
987 #define JSC_HOST_CALL __attribute__ ((fastcall))
989 #define JSC_HOST_CALL
992 /* Configure the interpreter */
993 #if COMPILER(GCC) || (RVCT_VERSION_AT_LEAST(4, 0, 0, 0) && defined(__GNUC__))
994 #define HAVE_COMPUTED_GOTO 1
996 #if HAVE(COMPUTED_GOTO) && ENABLE(INTERPRETER)
997 #define ENABLE_COMPUTED_GOTO_INTERPRETER 1
1000 /* Regular Expression Tracing - Set to 1 to trace RegExp's in jsc. Results dumped at exit */
1001 #define ENABLE_REGEXP_TRACING 0
1003 /* Yet Another Regex Runtime - turned on by default for JIT enabled ports. */
1004 #if PLATFORM(CHROMIUM)
1005 #define ENABLE_YARR_JIT 0
1007 #elif ENABLE(JIT) && !defined(ENABLE_YARR_JIT)
1008 #define ENABLE_YARR_JIT 1
1010 /* Setting this flag compares JIT results with interpreter results. */
1011 #define ENABLE_YARR_JIT_DEBUG 0
1014 #if ENABLE(JIT) || ENABLE(YARR_JIT)
1015 #define ENABLE_ASSEMBLER 1
1018 /* Pick which allocator to use; we only need an executable allocator if the assembler is compiled in.
1019 On x86-64 we use a single fixed mmap, on other platforms we mmap on demand. */
1020 #if ENABLE(ASSEMBLER)
1021 #if CPU(X86_64) || PLATFORM(IOS)
1022 #define ENABLE_EXECUTABLE_ALLOCATOR_FIXED 1
1024 #define ENABLE_EXECUTABLE_ALLOCATOR_DEMAND 1
1028 #if !defined(ENABLE_PAN_SCROLLING) && OS(WINDOWS)
1029 #define ENABLE_PAN_SCROLLING 1
1032 #if !defined(ENABLE_SMOOTH_SCROLLING)
1033 #define ENABLE_SMOOTH_SCROLLING 0
1036 #if !defined(ENABLE_WEB_ARCHIVE)
1037 #define ENABLE_WEB_ARCHIVE 0
1040 /* Use the QXmlStreamReader implementation for XMLDocumentParser */
1041 /* Use the QXmlQuery implementation for XSLTProcessor */
1044 #define WTF_USE_QXMLSTREAM 1
1045 #define WTF_USE_QXMLQUERY 1
1050 /* Complex text framework */
1051 #ifndef BUILDING_ON_LEOPARD
1052 #define WTF_USE_ATSUI 0
1053 #define WTF_USE_CORE_TEXT 1
1055 #define WTF_USE_ATSUI 1
1056 #define WTF_USE_CORE_TEXT 0
1060 /* Accelerated compositing */
1061 #if PLATFORM(MAC) || PLATFORM(IOS) || PLATFORM(QT) || (PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(WIN_CAIRO)) || PLATFORM(EFL)
1062 #define WTF_USE_ACCELERATED_COMPOSITING 1
1065 #if (PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD)) || PLATFORM(IOS)
1066 #define WTF_USE_PROTECTION_SPACE_AUTH_CALLBACK 1
1069 #if !ENABLE(NETSCAPE_PLUGIN_API) || (ENABLE(NETSCAPE_PLUGIN_API) && ((OS(UNIX) && (PLATFORM(QT) || PLATFORM(WX))) || PLATFORM(GTK) || PLATFORM(EFL)))
1070 #define ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH 1
1073 #if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION)
1074 #define ENABLE_THREADED_SCROLLING 1
1077 /* Set up a define for a common error that is intended to cause a build error -- thus the space after Error. */
1078 #define WTF_PLATFORM_CFNETWORK Error USE_macro_should_be_used_with_CFNETWORK
1080 /* FIXME: Eventually we should enable this for all platforms and get rid of the define. */
1081 #if PLATFORM(IOS) || PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(QT)
1082 #define WTF_USE_PLATFORM_STRATEGIES 1
1086 #define WTF_USE_CROSS_PLATFORM_CONTEXT_MENUS 1
1089 /* Geolocation request policy. pre-emptive policy is to acquire user permission before acquiring location.
1090 Client based implementations will have option to choose between pre-emptive and nonpre-emptive permission policy.
1091 pre-emptive permission policy is enabled by default for all client-based implementations. */
1092 #if ENABLE(CLIENT_BASED_GEOLOCATION)
1093 #define WTF_USE_PREEMPT_GEOLOCATION_PERMISSION 1
1097 #define ENABLE_BRANCH_COMPACTION 1
1100 #if !defined(ENABLE_THREADING_LIBDISPATCH) && HAVE(DISPATCH_H)
1101 #define ENABLE_THREADING_LIBDISPATCH 1
1102 #elif !defined(ENABLE_THREADING_OPENMP) && defined(_OPENMP)
1103 #define ENABLE_THREADING_OPENMP 1
1104 #elif !defined(THREADING_GENERIC)
1105 #define ENABLE_THREADING_GENERIC 1
1108 #if ENABLE(GLIB_SUPPORT)
1109 #include "GTypedefs.h"
1112 /* FIXME: This define won't be needed once #27551 is fully landed. However,
1113 since most ports try to support sub-project independence, adding new headers
1114 to WTF causes many ports to break, and so this way we can address the build
1115 breakages one port at a time. */
1117 #define WTF_USE_EXPORT_MACROS 1
1119 #define WTF_USE_EXPORT_MACROS 0
1122 #if (PLATFORM(QT) && !OS(DARWIN)) || PLATFORM(GTK) || PLATFORM(EFL)
1123 #define WTF_USE_UNIX_DOMAIN_SOCKETS 1
1126 #if !defined(ENABLE_COMPARE_AND_SWAP) && COMPILER(GCC) && (CPU(X86) || CPU(X86_64) || CPU(ARM_THUMB2))
1127 #define ENABLE_COMPARE_AND_SWAP 1
1130 #if !defined(ENABLE_PARALLEL_GC) && (PLATFORM(MAC) || PLATFORM(IOS)) && ENABLE(COMPARE_AND_SWAP)
1131 #define ENABLE_PARALLEL_GC 1
1135 #ifndef ENABLE_GC_VALIDATION
1136 #define ENABLE_GC_VALIDATION 1
1140 #if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
1141 #define WTF_USE_AVFOUNDATION 1
1144 #if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(EFL) || (PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(WIN_CAIRO)) || PLATFORM(QT)
1145 #define WTF_USE_REQUEST_ANIMATION_FRAME_TIMER 1
1149 #define WTF_USE_REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR 1
1152 #if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
1153 #define HAVE_INVERTED_WHEEL_EVENTS 1
1157 #define WTF_USE_COREAUDIO 1
1160 #if PLATFORM(CHROMIUM)
1161 #if !defined(WTF_USE_V8)
1162 #define WTF_USE_V8 1
1164 #endif /* PLATFORM(CHROMIUM) */
1166 #if !defined(WTF_USE_V8)
1167 #define WTF_USE_V8 0
1168 #endif /* !defined(WTF_USE_V8) */
1170 /* Using V8 implies not using JSC and vice versa */
1171 #define WTF_USE_JSC !WTF_USE_V8
1173 #if ENABLE(NOTIFICATIONS) && PLATFORM(MAC)
1174 #define ENABLE_TEXT_NOTIFICATIONS_ONLY 1
1177 #endif /* WTF_Platform_h */