]> git.saurik.com Git - apple/javascriptcore.git/blame - wtf/Platform.h
JavaScriptCore-461.tar.gz
[apple/javascriptcore.git] / wtf / Platform.h
CommitLineData
b37bf2e1
A
1/* -*- mode: c++; c-basic-offset: 4 -*- */
2/*
3 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
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 CPU */
31#define PLATFORM(WTF_FEATURE) (defined( WTF_PLATFORM_##WTF_FEATURE ) && WTF_PLATFORM_##WTF_FEATURE)
32#define COMPILER(WTF_FEATURE) (defined( WTF_COMPILER_##WTF_FEATURE ) && WTF_COMPILER_##WTF_FEATURE)
33#define HAVE(WTF_FEATURE) (defined( HAVE_##WTF_FEATURE ) && HAVE_##WTF_FEATURE)
34#define USE(WTF_FEATURE) (defined( WTF_USE_##WTF_FEATURE ) && WTF_USE_##WTF_FEATURE)
35#define ENABLE(WTF_FEATURE) (defined( ENABLE_##WTF_FEATURE ) && ENABLE_##WTF_FEATURE)
36
37/* Operating systems - low-level dependencies */
38
39/* PLATFORM(DARWIN) */
40/* Operating system level dependencies for Mac OS X / Darwin that should */
41/* be used regardless of operating environment */
42#ifdef __APPLE__
43#define WTF_PLATFORM_DARWIN 1
44#endif
45
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
51#endif
52
53/* PLATFORM(FREEBSD) */
54/* Operating system level dependencies for FreeBSD-like systems that */
55/* should be used regardless of operating environment */
56#ifdef __FreeBSD__
57#define WTF_PLATFORM_FREEBSD 1
58#endif
59
60/* PLATFORM(SOLARIS) */
61/* Operating system level dependencies for Solaris that should be used */
62/* regardless of operating environment */
63#if defined(sun) || defined(__sun)
64#define WTF_PLATFORM_SOLARIS 1
65#endif
66
67/* PLATFORM(UNIX) */
68/* Operating system level dependencies for Unix-like systems that */
69/* should be used regardless of operating environment */
70#if PLATFORM(DARWIN) \
71 || PLATFORM(FREEBSD) \
72 || defined(unix) \
73 || defined(__unix) \
74 || defined(__unix__) \
75 || defined (__NetBSD__) \
76 || defined(_AIX)
77#define WTF_PLATFORM_UNIX 1
78#endif
79
80/* Operating environments */
81
82/* PLATFORM(QT) */
83/* PLATFORM(GTK) */
84/* PLATFORM(MAC) */
85/* PLATFORM(WIN) */
86#if defined(BUILDING_QT__)
87#define WTF_PLATFORM_QT 1
88
89/* PLATFORM(KDE) */
90#if defined(BUILDING_KDE__)
91#define WTF_PLATFORM_KDE 1
92#endif
93
94#elif defined(BUILDING_WX__)
95#define WTF_PLATFORM_WX 1
96#elif defined(BUILDING_GTK__)
97#define WTF_PLATFORM_GTK 1
98#elif PLATFORM(DARWIN)
99#define WTF_PLATFORM_MAC 1
100#elif PLATFORM(WIN_OS)
101#define WTF_PLATFORM_WIN 1
102#endif
103
104/* Graphics engines */
105
106/* PLATFORM(CG) */
107/* PLATFORM(CAIRO) */
108#if PLATFORM(MAC)
109#define WTF_PLATFORM_CG 1
110#define WTF_PLATFORM_CI 1
111#elif !PLATFORM(QT) && !PLATFORM(WX)
112#define WTF_PLATFORM_CAIRO 1
113#endif
114
115
116#ifdef __S60__
117// we are cross-compiling, it is not really windows
118#undef WTF_PLATFORM_WIN_OS
119#undef WTF_PLATFORM_WIN
120#undef WTF_PLATFORM_CAIRO
121#define WTF_PLATFORM_S60 1
122#define WTF_PLATFORM_SYMBIAN 1
123#endif
124
125/* CPU */
126
127/* PLATFORM(PPC) */
128#if defined(__ppc__) \
129 || defined(__PPC__) \
130 || defined(__powerpc__) \
131 || defined(__powerpc) \
132 || defined(__POWERPC__) \
133 || defined(_M_PPC) \
134 || defined(__PPC)
135#define WTF_PLATFORM_PPC 1
136#define WTF_PLATFORM_BIG_ENDIAN 1
137#endif
138
139/* PLATFORM(PPC64) */
140#if defined(__ppc64__) \
141 || defined(__PPC64__)
142#define WTF_PLATFORM_PPC64 1
143#define WTF_PLATFORM_BIG_ENDIAN 1
144#endif
145
146/* PLATFORM(ARM) */
147#if defined(arm) \
148 || defined(__arm__)
149#define WTF_PLATFORM_ARM 1
150#if defined(__ARMEB__)
151#define WTF_PLATFORM_BIG_ENDIAN 1
152#elif !defined(__ARM_EABI__) && !defined(__ARMEB__) && !defined(__ARMEL__)
153#define WTF_PLATFORM_MIDDLE_ENDIAN 1
154#endif
155#if !defined(__ARM_EABI__)
156#define WTF_PLATFORM_FORCE_PACK 1
157#endif
158#endif
159
160/* PLATFORM(X86) */
161#if defined(__i386__) \
162 || defined(i386) \
163 || defined(_M_IX86) \
164 || defined(_X86_) \
165 || defined(__THW_INTEL)
166#define WTF_PLATFORM_X86 1
167#endif
168
169/* PLATFORM(X86_64) */
170#if defined(__x86_64__) \
171 || defined(__ia64__) \
172 || defined(_M_X64)
173#define WTF_PLATFORM_X86_64 1
174#endif
175
176/* PLATFORM(MAC) */
177#if PLATFORM(DARWIN)
178#define WTF_PLATFORM_CG 1
179#define WTF_PLATFORM_MAC 1
180#include <TargetConditionals.h>
181#endif
182
183/* PLATFORM(IPHONE) */
184#if TARGET_OS_EMBEDDED || TARGET_OS_IPHONE
185#define WTF_PLATFORM_IPHONE 1
186#endif
187
188/* PLATFORM(IPHONE_SIMULATOR) */
189#if TARGET_IPHONE_SIMULATOR
190#define WTF_PLATFORM_IPHONE 1
191#define WTF_PLATFORM_IPHONE_SIMULATOR 1
192#else
193#define WTF_PLATFORM_IPHONE_SIMULATOR 0
194#endif
195
196/* Compiler */
197
198/* COMPILER(MSVC) */
199#if defined(_MSC_VER)
200#define WTF_COMPILER_MSVC 1
201#if _MSC_VER < 1400
202#define WTF_COMPILER_MSVC7 1
203#endif
204#endif
205
206/* COMPILER(GCC) */
207#if defined(__GNUC__)
208#define WTF_COMPILER_GCC 1
209#endif
210
211/* COMPILER(BORLAND) */
212/* not really fully supported - is this relevant any more? */
213#if defined(__BORLANDC__)
214#define WTF_COMPILER_BORLAND 1
215#endif
216
217/* COMPILER(CYGWIN) */
218/* not really fully supported - is this relevant any more? */
219#if defined(__CYGWIN__)
220#define WTF_COMPILER_CYGWIN 1
221#endif
222
223/* multiple threads only supported on Mac for now */
224#define WTF_USE_MULTIPLE_THREADS 1
225
226/* for Unicode, KDE uses Qt, everything else uses ICU */
227#if PLATFORM(KDE) || PLATFORM(QT)
228#define WTF_USE_QT4_UNICODE 1
229#elif PLATFORM(SYMBIAN)
230#define WTF_USE_SYMBIAN_UNICODE 1
231#else
232#define WTF_USE_ICU_UNICODE 1
233#endif
234
235#if PLATFORM(IPHONE_SIMULATOR)
236#define ENABLE_WEB_SCRIPT_DEBUG_SERVER 1
237#else
238#define ENABLE_WEB_SCRIPT_DEBUG_SERVER 0
239#endif
240
241#define WTF_PLATFORM_CF 1
242#define WTF_USE_PTHREADS 1
243
244#define ENABLE_FTPDIR 1
245#define ENABLE_JAVA_BINDINGS 0
246#define ENABLE_ICONDATABASE 0
247#define ENABLE_NETSCAPE_API 0
248#define ENABLE_TOUCH_EVENTS 1
249#define ENABLE_DASHBOARD_SUPPORT 0
250#define ENABLE_IPHONE_PPT 1
251
252#if !defined(WTF_PLATFORM_IPHONE)
253#define WTF_PLATFORM_IPHONE 0
254#endif
255
256#if PLATFORM(DARWIN) && defined(__LP64__)
257#define ENABLE_NETSCAPE_API 0
258#endif
259
260#if PLATFORM(WIN)
261#define WTF_USE_WININET 1
262#endif
263
264#if PLATFORM(WX)
265#define WTF_USE_CURL 1
266#define WTF_USE_PTHREADS 1
267#endif
268
269#if PLATFORM(QT)
270#define USE_SYSTEM_MALLOC 1
271#endif
272
273#if !defined(ENABLE_FTPDIR)
274#define ENABLE_FTPDIR 1
275#endif
276
277#if !defined(ENABLE_JAVA_BINDINGS)
278#define ENABLE_JAVA_BINDINGS 1
279#endif
280
281#if !defined(ENABLE_ICONDATABASE)
282#define ENABLE_ICONDATABASE 1
283#endif
284
285#if !defined(ENABLE_DATABASE)
286#define ENABLE_DATABASE 1
287#endif
288
289#if !defined(ENABLE_FTPDIR)
290#define ENABLE_FTPDIR 1
291#endif
292
293#if !defined(ENABLE_NETSCAPE_API)
294#define ENABLE_NETSCAPE_API 1
295#endif
296
297#if !defined(ENABLE_TOUCH_EVENTS)
298#define ENABLE_TOUCH_EVENTS 0
299#endif
300
301#if !defined(ENABLE_DASHBOARD_SUPPORT)
302#define ENABLE_DASHBOARD_SUPPORT 1
303#endif
304
305#if !defined(ENABLE_IPHONE_PPT)
306#define ENABLE_IPHONE_PPT 0
307#endif
308
309#endif /* WTF_Platform_h */