]>
git.saurik.com Git - apple/javascriptcore.git/blob - wtf/Platform.h
2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 #ifndef WTF_Platform_h
27 #define WTF_Platform_h
29 /* PLATFORM handles OS, operating environment, graphics API, and CPU */
30 #define PLATFORM(WTF_FEATURE) (defined( WTF_PLATFORM_##WTF_FEATURE ) && WTF_PLATFORM_##WTF_FEATURE)
31 #define COMPILER(WTF_FEATURE) (defined( WTF_COMPILER_##WTF_FEATURE ) && WTF_COMPILER_##WTF_FEATURE)
32 #define HAVE(WTF_FEATURE) (defined( HAVE_##WTF_FEATURE ) && HAVE_##WTF_FEATURE)
33 #define USE(WTF_FEATURE) (defined( WTF_USE_##WTF_FEATURE ) && WTF_USE_##WTF_FEATURE)
34 #define ENABLE(WTF_FEATURE) (defined( ENABLE_##WTF_FEATURE ) && ENABLE_##WTF_FEATURE)
36 /* Operating systems - low-level dependencies */
38 /* PLATFORM(DARWIN) */
39 /* Operating system level dependencies for Mac OS X / Darwin that should */
40 /* be used regardless of operating environment */
42 #define WTF_PLATFORM_DARWIN 1
43 #include <TargetConditionals.h>
46 /* PLATFORM(WIN_OS) */
47 /* Operating system level dependencies for Windows that should be used */
48 /* regardless of operating environment */
49 #if defined(WIN32) || defined(_WIN32)
50 #define WTF_PLATFORM_WIN_OS 1
53 /* PLATFORM(WIN_CE) */
54 /* Operating system level dependencies for Windows CE that should be used */
55 /* regardless of operating environment */
56 /* Note that for this platform PLATFORM(WIN_OS) is also defined. */
57 #if defined(_WIN32_WCE)
58 #define WTF_PLATFORM_WIN_CE 1
61 /* PLATFORM(FREEBSD) */
62 /* Operating system level dependencies for FreeBSD-like systems that */
63 /* should be used regardless of operating environment */
65 #define WTF_PLATFORM_FREEBSD 1
68 /* PLATFORM(OPENBSD) */
69 /* Operating system level dependencies for OpenBSD systems that */
70 /* should be used regardless of operating environment */
72 #define WTF_PLATFORM_OPENBSD 1
75 /* PLATFORM(SOLARIS) */
76 /* Operating system level dependencies for Solaris that should be used */
77 /* regardless of operating environment */
78 #if defined(sun) || defined(__sun)
79 #define WTF_PLATFORM_SOLARIS 1
82 #if defined (__S60__) || defined (__SYMBIAN32__)
83 /* we are cross-compiling, it is not really windows */
84 #undef WTF_PLATFORM_WIN_OS
85 #undef WTF_PLATFORM_WIN
86 #undef WTF_PLATFORM_CAIRO
87 #define WTF_PLATFORM_S60 1
88 #define WTF_PLATFORM_SYMBIAN 1
92 /* PLATFORM(NETBSD) */
93 /* Operating system level dependencies for NetBSD that should be used */
94 /* regardless of operating environment */
95 #if defined(__NetBSD__)
96 #define WTF_PLATFORM_NETBSD 1
100 /* Operating system level dependencies for Unix-like systems that */
101 /* should be used regardless of operating environment */
102 #if PLATFORM(DARWIN) \
103 || PLATFORM(FREEBSD) \
105 || PLATFORM(NETBSD) \
108 || defined(__unix__) \
110 #define WTF_PLATFORM_UNIX 1
113 /* Operating environments */
115 /* PLATFORM(CHROMIUM) */
120 #if defined(BUILDING_CHROMIUM__)
121 #define WTF_PLATFORM_CHROMIUM 1
122 #elif defined(BUILDING_QT__)
123 #define WTF_PLATFORM_QT 1
126 #if defined(BUILDING_KDE__)
127 #define WTF_PLATFORM_KDE 1
130 #elif defined(BUILDING_WX__)
131 #define WTF_PLATFORM_WX 1
132 #elif defined(BUILDING_GTK__)
133 #define WTF_PLATFORM_GTK 1
134 #elif PLATFORM(DARWIN)
135 #define WTF_PLATFORM_MAC 1
136 #elif PLATFORM(WIN_OS)
137 #define WTF_PLATFORM_WIN 1
140 /* PLATFORM(IPHONE) */
141 #if TARGET_OS_EMBEDDED || TARGET_OS_IPHONE
142 #define WTF_PLATFORM_IPHONE 1
145 /* PLATFORM(IPHONE_SIMULATOR) */
146 #if TARGET_IPHONE_SIMULATOR
147 #define WTF_PLATFORM_IPHONE 1
148 #define WTF_PLATFORM_IPHONE_SIMULATOR 1
150 #define WTF_PLATFORM_IPHONE_SIMULATOR 0
153 #if !defined(WTF_PLATFORM_IPHONE)
154 #define WTF_PLATFORM_IPHONE 0
157 /* Graphics engines */
159 /* PLATFORM(CG) and PLATFORM(CI) */
160 #define WTF_PLATFORM_CG 1
162 /* PLATFORM(SKIA) for Win/Linux, CG/CI for Mac */
163 #if PLATFORM(CHROMIUM)
165 #define WTF_PLATFORM_CG 1
166 #define WTF_PLATFORM_CI 1
167 #define WTF_USE_ATSUI 1
169 #define WTF_PLATFORM_SKIA 1
173 /* Makes PLATFORM(WIN) default to PLATFORM(CAIRO) */
174 /* FIXME: This should be changed from a blacklist to a whitelist */
175 #if !PLATFORM(MAC) && !PLATFORM(QT) && !PLATFORM(WX) && !PLATFORM(CHROMIUM)
176 #define WTF_PLATFORM_CAIRO 1
182 #if defined(__ppc__) \
183 || defined(__PPC__) \
184 || defined(__powerpc__) \
185 || defined(__powerpc) \
186 || defined(__POWERPC__) \
189 #define WTF_PLATFORM_PPC 1
190 #define WTF_PLATFORM_BIG_ENDIAN 1
193 /* PLATFORM(PPC64) */
194 #if defined(__ppc64__) \
195 || defined(__PPC64__)
196 #define WTF_PLATFORM_PPC64 1
197 #define WTF_PLATFORM_BIG_ENDIAN 1
203 #define WTF_PLATFORM_ARM 1
204 #if defined(__ARMEB__)
205 #define WTF_PLATFORM_BIG_ENDIAN 1
206 #elif !defined(__ARM_EABI__) && !defined(__ARMEB__) && !defined(__VFP_FP__)
207 #define WTF_PLATFORM_MIDDLE_ENDIAN 1
209 #if !defined(__ARM_EABI__)
210 #define WTF_PLATFORM_FORCE_PACK 1
215 #if defined(__i386__) \
217 || defined(_M_IX86) \
219 || defined(__THW_INTEL)
220 #define WTF_PLATFORM_X86 1
223 /* PLATFORM(X86_64) */
224 #if defined(__x86_64__) \
225 || defined(__ia64__) \
227 #define WTF_PLATFORM_X86_64 1
230 /* PLATFORM(SPARC64) */
231 #if defined(__sparc64__)
232 #define WTF_PLATFORM_SPARC64 1
233 #define WTF_PLATFORM_BIG_ENDIAN 1
236 /* PLATFORM(WIN_CE) && PLATFORM(QT)
237 We can not determine the endianess at compile time. For
238 Qt for Windows CE the endianess is specified in the
239 device specific makespec
241 #if PLATFORM(WIN_CE) && PLATFORM(QT)
243 # undef WTF_PLATFORM_BIG_ENDIAN
244 # undef WTF_PLATFORM_MIDDLE_ENDIAN
245 # if Q_BYTE_ORDER == Q_BIG_EDIAN
246 # define WTF_PLATFORM_BIG_ENDIAN 1
253 #if defined(_MSC_VER)
254 #define WTF_COMPILER_MSVC 1
256 #define WTF_COMPILER_MSVC7 1
261 #if defined(__GNUC__)
262 #define WTF_COMPILER_GCC 1
265 /* COMPILER(MINGW) */
266 #if defined(MINGW) || defined(__MINGW32__)
267 #define WTF_COMPILER_MINGW 1
270 /* COMPILER(BORLAND) */
271 /* not really fully supported - is this relevant any more? */
272 #if defined(__BORLANDC__)
273 #define WTF_COMPILER_BORLAND 1
276 /* COMPILER(CYGWIN) */
277 /* not really fully supported - is this relevant any more? */
278 #if defined(__CYGWIN__)
279 #define WTF_COMPILER_CYGWIN 1
283 #if defined(__CC_ARM) || defined(__ARMCC__)
284 #define WTF_COMPILER_RVCT 1
287 /* COMPILER(WINSCW) */
288 #if defined(__WINSCW__)
289 #define WTF_COMPILER_WINSCW 1
292 #if (PLATFORM(IPHONE) || PLATFORM(MAC) || PLATFORM(WIN)) && !defined(ENABLE_JSC_MULTIPLE_THREADS)
293 #define ENABLE_JSC_MULTIPLE_THREADS 1
296 /* for Unicode, KDE uses Qt */
297 #if PLATFORM(KDE) || PLATFORM(QT)
298 #define WTF_USE_QT4_UNICODE 1
299 #elif PLATFORM(SYMBIAN)
300 #define WTF_USE_SYMBIAN_UNICODE 1
302 /* The GTK+ Unicode backend is configurable */
304 #define WTF_USE_ICU_UNICODE 1
308 #if PLATFORM(CHROMIUM) && PLATFORM(DARWIN)
309 #define WTF_PLATFORM_CF 1
310 #define WTF_USE_PTHREADS 1
313 #define WTF_PLATFORM_CF 1
314 #define WTF_USE_PTHREADS 1
315 #define ENABLE_FTPDIR 1
317 #define ENABLE_MAC_JAVA_BRIDGE 0
318 #define ENABLE_ICONDATABASE 0
319 #define ENABLE_TOUCH_EVENTS 1
320 #define ENABLE_IPHONE_PPT 1
321 #define ENABLE_GEOLOCATION 1
322 #define ENABLE_NETSCAPE_PLUGIN_API 0
323 #define HAVE_READLINE 1
324 #define DONT_FINALIZE_ON_MAIN_THREAD 1
325 #define HAVE_MADV_FREE 1
326 #define ENABLE_REPAINT_THROTTLING 1
327 #define ENABLE_RESPECT_EXIF_ORIENTATION 1
330 #define WTF_USE_WININET 1
334 #define WTF_USE_CURL 1
335 #define WTF_USE_PTHREADS 1
340 #define WTF_USE_PTHREADS 1
344 #if !defined(HAVE_ACCESSIBILITY)
345 #define HAVE_ACCESSIBILITY 1
346 #endif /* !defined(HAVE_ACCESSIBILITY) */
349 #define HAVE_COMPUTED_GOTO 1
354 #define HAVE_ERRNO_H 1
356 #define HAVE_MERGESORT 1
358 #define HAVE_STRINGS_H 1
359 #define HAVE_SYS_PARAM_H 1
360 #define HAVE_SYS_TIME_H 1
361 #define HAVE_SYS_TIMEB_H 1
363 #elif PLATFORM(WIN_OS)
365 #define HAVE_FLOAT_H 1
367 #define HAVE_ERRNO_H 0
369 #define HAVE_SYS_TIMEB_H 1
371 #define HAVE_VIRTUALALLOC 1
373 #elif PLATFORM(SYMBIAN)
375 #define HAVE_ERRNO_H 1
379 #define HAVE_SYS_TIME_H 1
380 #define HAVE_STRINGS_H 1
383 #define HAVE_SYS_PARAM_H 1
388 /* FIXME: is this actually used or do other platforms generate their own config.h? */
390 #define HAVE_ERRNO_H 1
393 #define HAVE_STRINGS_H 1
394 #define HAVE_SYS_PARAM_H 1
395 #define HAVE_SYS_TIME_H 1
399 /* ENABLE macro defaults */
401 #if !defined(ENABLE_ICONDATABASE)
402 #define ENABLE_ICONDATABASE 1
405 #if !defined(ENABLE_DATABASE)
406 #define ENABLE_DATABASE 1
409 #if !defined(ENABLE_JAVASCRIPT_DEBUGGER)
410 #define ENABLE_JAVASCRIPT_DEBUGGER 1
413 #if !defined(ENABLE_FTPDIR)
414 #define ENABLE_FTPDIR 1
417 #if !defined(ENABLE_DASHBOARD_SUPPORT)
418 #define ENABLE_DASHBOARD_SUPPORT 0
421 #if !defined(ENABLE_MAC_JAVA_BRIDGE)
422 #define ENABLE_MAC_JAVA_BRIDGE 0
425 #if !defined(ENABLE_NETSCAPE_PLUGIN_API)
426 #define ENABLE_NETSCAPE_PLUGIN_API 1
429 #if !defined(ENABLE_RESPECT_EXIF_ORIENTATION)
430 #define ENABLE_RESPECT_EXIF_ORIENTATION 0
433 #if !defined(ENABLE_TOUCH_EVENTS)
434 #define ENABLE_TOUCH_EVENTS 0
437 #if !defined(ENABLE_IPHONE_PPT)
438 #define ENABLE_IPHONE_PPT 0
441 #if !defined(ENABLE_OPCODE_STATS)
442 #define ENABLE_OPCODE_STATS 0
445 #if !defined(ENABLE_CODEBLOCK_SAMPLING)
446 #define ENABLE_CODEBLOCK_SAMPLING 0
449 #if ENABLE(CODEBLOCK_SAMPLING) && !defined(ENABLE_OPCODE_SAMPLING)
450 #define ENABLE_OPCODE_SAMPLING 1
453 #if !defined(ENABLE_OPCODE_SAMPLING)
454 #define ENABLE_OPCODE_SAMPLING 0
457 #if !defined(ENABLE_GEOLOCATION)
458 #define ENABLE_GEOLOCATION 0
461 #if !defined(ENABLE_TEXT_CARET)
462 #define ENABLE_TEXT_CARET 1
465 #if !defined(WTF_USE_ALTERNATE_JSIMMEDIATE) && PLATFORM(X86_64) && PLATFORM(MAC)
466 #define WTF_USE_ALTERNATE_JSIMMEDIATE 1
469 #if !defined(ENABLE_REPAINT_THROTTLING)
470 #define ENABLE_REPAINT_THROTTLING 0
473 #if !defined(ENABLE_JIT)
474 /* x86-64 support is under development. */
475 #if PLATFORM(X86_64) && PLATFORM(MAC)
477 #define WTF_USE_JIT_STUB_ARGUMENT_REGISTER 1
478 /* The JIT is tested & working on x86 Mac */
479 #elif PLATFORM(X86) && PLATFORM(MAC)
481 #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
482 /* The JIT is tested & working on x86 Windows */
483 #elif PLATFORM(X86) && PLATFORM(WIN)
485 #define WTF_USE_JIT_STUB_ARGUMENT_REGISTER 1
487 #define ENABLE_JIT_OPTIMIZE_CALL 1
488 #define ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS 1
489 #define ENABLE_JIT_OPTIMIZE_ARITHMETIC 1
493 #if !(USE(JIT_STUB_ARGUMENT_VA_LIST) || USE(JIT_STUB_ARGUMENT_REGISTER) || USE(JIT_STUB_ARGUMENT_STACK))
494 #error Please define one of the JIT_STUB_ARGUMENT settings.
495 #elif (USE(JIT_STUB_ARGUMENT_VA_LIST) && USE(JIT_STUB_ARGUMENT_REGISTER)) \
496 || (USE(JIT_STUB_ARGUMENT_VA_LIST) && USE(JIT_STUB_ARGUMENT_STACK)) \
497 || (USE(JIT_STUB_ARGUMENT_REGISTER) && USE(JIT_STUB_ARGUMENT_STACK))
498 #error Please do not define more than one of the JIT_STUB_ARGUMENT settings.
502 /* WREC supports x86 & x86-64, and has been tested on Mac and Windows ('cept on 64-bit on Mac). */
503 #if (!defined(ENABLE_WREC) && PLATFORM(X86) && PLATFORM(MAC)) \
504 || (!defined(ENABLE_WREC) && PLATFORM(X86_64) && PLATFORM(MAC)) \
505 || (!defined(ENABLE_WREC) && PLATFORM(X86) && PLATFORM(WIN))
506 #define ENABLE_WREC 1
509 #if ENABLE(JIT) || ENABLE(WREC)
510 #define ENABLE_ASSEMBLER 1
513 #if !defined(ENABLE_PAN_SCROLLING) && PLATFORM(WIN_OS)
514 #define ENABLE_PAN_SCROLLING 1
517 #if !defined(ENABLE_ACTIVEX_TYPE_CONVERSION_WMPLAYER)
518 #define ENABLE_ACTIVEX_TYPE_CONVERSION_WMPLAYER 1
521 /* Use the QtXmlStreamReader implementation for XMLTokenizer */
524 #define WTF_USE_QXMLSTREAM 1
529 #define WTF_USE_FONT_FAST_PATH 1
532 #endif /* WTF_Platform_h */