Platform.h 5.73 KB
Newer Older
weinig's avatar
weinig committed
1
/* -*- mode: c++; c-basic-offset: 4 -*- */
mjs's avatar
mjs committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
/*
 * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
 *
 * 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
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 */

mjs's avatar
mjs committed
27 28
#ifndef WTF_Platform_h
#define WTF_Platform_h
mjs's avatar
mjs committed
29

weinig's avatar
weinig committed
30
/* PLATFORM handles OS, operating environment, graphics API, and CPU */
mjs's avatar
mjs committed
31 32 33 34
#define PLATFORM(WTF_FEATURE) (defined( WTF_PLATFORM_##WTF_FEATURE ) && WTF_PLATFORM_##WTF_FEATURE)
#define COMPILER(WTF_FEATURE) (defined( WTF_COMPILER_##WTF_FEATURE ) && WTF_COMPILER_##WTF_FEATURE)
#define HAVE(WTF_FEATURE) (defined( HAVE_##WTF_FEATURE ) && HAVE_##WTF_FEATURE)
#define USE(WTF_FEATURE) (defined( WTF_USE_##WTF_FEATURE ) && WTF_USE_##WTF_FEATURE)
mjs's avatar
mjs committed
35
#define ENABLE(WTF_FEATURE) (defined( ENABLE_##WTF_FEATURE ) && ENABLE_##WTF_FEATURE)
mjs's avatar
mjs committed
36

weinig's avatar
weinig committed
37
/* Operating systems - low-level dependencies */
mjs's avatar
mjs committed
38

weinig's avatar
weinig committed
39 40 41
/* PLATFORM(DARWIN) */
/* Operating system level dependencies for Mac OS X / Darwin that should */
/* be used regardless of operating environment */
mjs's avatar
mjs committed
42
#ifdef __APPLE__
mjs's avatar
mjs committed
43
#define WTF_PLATFORM_DARWIN 1
mjs's avatar
mjs committed
44 45
#endif

weinig's avatar
weinig committed
46 47 48
/* PLATFORM(WIN_OS) */
/* Operating system level dependencies for Windows that should be used */
/* regardless of operating environment */
mjs's avatar
mjs committed
49
#if defined(WIN32) || defined(_WIN32)
mjs's avatar
mjs committed
50
#define WTF_PLATFORM_WIN_OS 1
mjs's avatar
mjs committed
51 52
#endif

weinig's avatar
weinig committed
53 54 55 56
/* PLATFORM(UNIX) */
/* Operating system level dependencies for Unix-like systems that */
/* should be used regardless of operating environment */
/* (includes PLATFORM(DARWIN)) */
mjs's avatar
mjs committed
57 58 59 60 61 62
#if   defined(__APPLE__)   \
   || defined(unix)        \
   || defined(__unix)      \
   || defined(__unix__)    \
   || defined (__NetBSD__) \
   || defined(_AIX)
mjs's avatar
mjs committed
63
#define WTF_PLATFORM_UNIX 1
mjs's avatar
mjs committed
64 65
#endif

weinig's avatar
weinig committed
66
/* Operating environments */
mjs's avatar
mjs committed
67

68
/* PLATFORM(QT) */
zecke's avatar
/:  
zecke committed
69
/* PLATFORM(GTK) */
weinig's avatar
weinig committed
70 71
/* PLATFORM(MAC) */
/* PLATFORM(WIN) */
72
#if defined(BUILDING_QT__)
mjs's avatar
mjs committed
73
#define WTF_PLATFORM_QT 1
thatcher's avatar
thatcher committed
74 75 76

/* PLATFORM(KDE) */
#if defined(BUILDING_KDE__)
mjs's avatar
mjs committed
77
#define WTF_PLATFORM_KDE 1
thatcher's avatar
thatcher committed
78 79
#endif

zecke's avatar
/:  
zecke committed
80 81
#elif defined(BUILDING_GTK__)
#define WTF_PLATFORM_GTK 1
82
#elif PLATFORM(DARWIN)
mjs's avatar
mjs committed
83
#define WTF_PLATFORM_MAC 1
84
#elif PLATFORM(WIN_OS)
mjs's avatar
mjs committed
85
#define WTF_PLATFORM_WIN 1
mjs's avatar
mjs committed
86
#endif
ggaren's avatar
ggaren committed
87

88 89 90 91 92
/* Graphics engines */

/* PLATFORM(CG) */
/* PLATFORM(CAIRO) */
#if PLATFORM(MAC)
mjs's avatar
mjs committed
93
#define WTF_PLATFORM_CG 1
94
#define WTF_PLATFORM_CI 1
ap's avatar
ap committed
95
#elif !PLATFORM(QT)
mjs's avatar
mjs committed
96
#define WTF_PLATFORM_CAIRO 1
97 98
#endif

99 100 101 102 103 104 105 106 107 108

#ifdef __S60__
// we are cross-compiling, it is not really windows
#undef WTF_PLATFORM_WIN_OS
#undef WTF_PLATFORM_WIN
#undef WTF_PLATFORM_CAIRO
#define WTF_PLATFORM_S60 1
#define WTF_PLATFORM_SYMBIAN 1
#endif

weinig's avatar
weinig committed
109
/* CPU */
mjs's avatar
mjs committed
110

weinig's avatar
weinig committed
111
/* PLATFORM(PPC) */
mjs's avatar
mjs committed
112 113 114 115 116 117 118
#if   defined(__ppc__)     \
   || defined(__PPC__)     \
   || defined(__powerpc__) \
   || defined(__powerpc)   \
   || defined(__POWERPC__) \
   || defined(_M_PPC)      \
   || defined(__PPC)
mjs's avatar
mjs committed
119 120
#define WTF_PLATFORM_PPC 1
#define WTF_PLATFORM_BIG_ENDIAN 1
mjs's avatar
mjs committed
121 122
#endif

weinig's avatar
weinig committed
123
/* PLATFORM(PPC64) */
mjs's avatar
mjs committed
124 125
#if   defined(__ppc64__) \
   || defined(__PPC64__)
mjs's avatar
mjs committed
126 127
#define WTF_PLATFORM_PPC64 1
#define WTF_PLATFORM_BIG_ENDIAN 1
mjs's avatar
mjs committed
128 129
#endif

ddkilzer's avatar
ddkilzer committed
130 131
#if   defined(arm) \
   || defined(__arm__)
mjs's avatar
mjs committed
132
#define WTF_PLATFORM_ARM 1
133 134 135
#if defined(__ARMEB__)
#define WTF_PLATFORM_BIG_ENDIAN 1
#elif !defined(__ARM_EABI__) && !defined(__ARMEB__)
mjs's avatar
mjs committed
136
#define WTF_PLATFORM_MIDDLE_ENDIAN 1
mjs's avatar
mjs committed
137
#endif
138 139 140 141
#if !defined(__ARM_EABI__)
#define WTF_PLATFORM_FORCE_PACK 1
#endif
#endif
mjs's avatar
mjs committed
142

weinig's avatar
weinig committed
143
/* PLATFORM(X86) */
mjs's avatar
mjs committed
144 145 146 147 148
#if   defined(__i386__) \
   || defined(i386)     \
   || defined(_M_IX86)  \
   || defined(_X86_)    \
   || defined(__THW_INTEL)
mjs's avatar
mjs committed
149
#define WTF_PLATFORM_X86 1
mjs's avatar
mjs committed
150 151
#endif

weinig's avatar
weinig committed
152
/* PLATFORM(X86_64) */
153 154
#if   defined(__x86_64__) \
   || defined(__ia64__)
mjs's avatar
mjs committed
155
#define WTF_PLATFORM_X86_64 1
156 157
#endif

weinig's avatar
weinig committed
158
/* Compiler */
mjs's avatar
mjs committed
159

weinig's avatar
weinig committed
160
/* COMPILER(MSVC) */
mjs's avatar
mjs committed
161
#if defined(_MSC_VER)
mjs's avatar
mjs committed
162
#define WTF_COMPILER_MSVC 1
mjs's avatar
mjs committed
163 164
#endif

weinig's avatar
weinig committed
165
/* COMPILER(GCC) */
mjs's avatar
mjs committed
166
#if defined(__GNUC__)
mjs's avatar
mjs committed
167
#define WTF_COMPILER_GCC 1
mjs's avatar
mjs committed
168 169
#endif

weinig's avatar
weinig committed
170 171
/* COMPILER(BORLAND) */
/* not really fully supported - is this relevant any more? */
mjs's avatar
mjs committed
172
#if defined(__BORLANDC__)
mjs's avatar
mjs committed
173
#define WTF_COMPILER_BORLAND 1
mjs's avatar
mjs committed
174 175
#endif

weinig's avatar
weinig committed
176 177
/* COMPILER(CYGWIN) */
/* not really fully supported - is this relevant any more? */
mjs's avatar
mjs committed
178
#if defined(__CYGWIN__)
mjs's avatar
mjs committed
179
#define WTF_COMPILER_CYGWIN 1
mjs's avatar
mjs committed
180 181
#endif

weinig's avatar
weinig committed
182
/* multiple threads only supported on Mac for now */
mjs's avatar
mjs committed
183
#if PLATFORM(MAC) || PLATFORM(WIN)
mjs's avatar
mjs committed
184
#define WTF_USE_MULTIPLE_THREADS 1
staikos's avatar
staikos committed
185 186
#endif

weinig's avatar
weinig committed
187
/* for Unicode, KDE uses Qt, everything else uses ICU */
hyatt's avatar
hyatt committed
188 189
#if PLATFORM(KDE) || PLATFORM(QT)
#define WTF_USE_QT4_UNICODE 1
190 191
#elif PLATFORM(SYMBIAN)
#define WTF_USE_SYMBIAN_UNICODE 1
darin's avatar
darin committed
192
#else
mjs's avatar
mjs committed
193
#define WTF_USE_ICU_UNICODE 1
mjs's avatar
mjs committed
194 195
#endif

ggaren's avatar
ggaren committed
196
#if PLATFORM(MAC)
mjs's avatar
mjs committed
197
#define WTF_PLATFORM_CF 1
ggaren's avatar
ggaren committed
198 199 200
#endif

#if PLATFORM(WIN)
mjs's avatar
mjs committed
201
#define WTF_USE_WININET 1
ggaren's avatar
ggaren committed
202 203
#endif

zecke's avatar
/:  
zecke committed
204
#if PLATFORM(GTK)
mjs's avatar
mjs committed
205
#define WTF_USE_CURL 1
206 207
#endif

208 209 210 211
#if PLATFORM(QT)
#define USE_SYSTEM_MALLOC 1
#endif

212 213 214
#if !defined(ENABLE_ICONDATABASE)
#define ENABLE_ICONDATABASE 1
#endif
215

216
#if !defined(ENABLE_FTPDIR)
beidson's avatar
beidson committed
217 218 219
#define ENABLE_FTPDIR 1
#endif

mjs's avatar
mjs committed
220
#endif /* WTF_Platform_h */