blob: 404fa95cb955cf30df858069000ef9154dddc762 [file] [log] [blame]
darin707988e2006-01-16 01:29:54 +00001/*
aroben@apple.com259fc312008-01-08 17:43:23 +00002 * Copyright (C) 2004, 2005, 2006 Apple Inc.
eric@webkit.org8b2edd02009-09-09 22:35:57 +00003 * Copyright (C) 2009 Google Inc. All rights reserved.
4 *
darin707988e2006-01-16 01:29:54 +00005 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
ddkilzerc8eccec2007-09-26 02:29:57 +000017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
darin707988e2006-01-16 01:29:54 +000019 *
ossy@webkit.org37441862010-11-10 18:43:50 +000020 */
darin707988e2006-01-16 01:29:54 +000021
mrowe@apple.com12b7c2d2008-09-04 21:00:02 +000022#if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
eric@webkit.orgd99f85b2010-05-15 13:37:59 +000023#ifdef BUILDING_WITH_CMAKE
24#include "cmakeconfig.h"
25#else
jmalonzo@webkit.org6afc5d42008-09-04 20:26:16 +000026#include "autotoolsconfig.h"
27#endif
eric@webkit.orgd99f85b2010-05-15 13:37:59 +000028#endif
jmalonzo@webkit.org6afc5d42008-09-04 20:26:16 +000029
mjsbb863512006-05-09 09:27:55 +000030#include <wtf/Platform.h>
mjs3bfb61b2006-03-02 09:12:06 +000031
jamesr@google.comaefdd9a2010-04-23 21:13:32 +000032#if !PLATFORM(CHROMIUM) && OS(WINDOWS) && !defined(BUILDING_WX__) && !COMPILER(GCC)
sfalken@apple.com46fc85a2009-04-20 21:25:37 +000033#if defined(BUILDING_JavaScriptCore) || defined(BUILDING_WTF)
34#define JS_EXPORTDATA __declspec(dllexport)
35#else
36#define JS_EXPORTDATA __declspec(dllimport)
37#endif
38#if defined(BUILDING_WebCore) || defined(BUILDING_WebKit)
39#define WEBKIT_EXPORTDATA __declspec(dllexport)
40#else
41#define WEBKIT_EXPORTDATA __declspec(dllimport)
42#endif
ap@apple.com1348bdf2010-01-08 00:15:05 +000043#define JS_EXPORTCLASS JS_EXPORTDATA
sfalken@apple.com46fc85a2009-04-20 21:25:37 +000044#else
45#define JS_EXPORTDATA
ap@apple.com1348bdf2010-01-08 00:15:05 +000046#define JS_EXPORTCLASS
sfalken@apple.combcff7fb2009-04-20 21:47:02 +000047#define WEBKIT_EXPORTDATA
sfalken@apple.com46fc85a2009-04-20 21:25:37 +000048#endif
49
mrowe@apple.com4d7e81e2007-11-20 16:06:23 +000050#ifdef __APPLE__
darin71e27492006-01-25 03:35:00 +000051#define HAVE_FUNC_USLEEP 1
weinigf18aae32006-08-03 21:55:57 +000052#endif /* __APPLE__ */
darin71e27492006-01-25 03:35:00 +000053
mjs@apple.comacbcc282010-01-05 08:58:28 +000054#if OS(WINDOWS)
darin707988e2006-01-16 01:29:54 +000055
sfalkenc3cff1c2006-05-26 00:36:30 +000056#ifndef _WIN32_WINNT
hyatt89166da2006-05-21 06:58:12 +000057#define _WIN32_WINNT 0x0500
sfalkenc3cff1c2006-05-26 00:36:30 +000058#endif
59
60#ifndef WINVER
61#define WINVER 0x0500
62#endif
63
aroben@apple.com06d35b92008-03-27 01:43:54 +000064// If we don't define these, they get defined in windef.h.
aroben@apple.com1840f962007-11-12 11:02:47 +000065// We want to use std::min and std::max.
arobenfee2e822007-06-12 21:50:34 +000066#ifndef max
arobena6c43b92006-12-08 22:34:07 +000067#define max max
arobenfee2e822007-06-12 21:50:34 +000068#endif
69#ifndef min
arobena6c43b92006-12-08 22:34:07 +000070#define min min
arobenfee2e822007-06-12 21:50:34 +000071#endif
72
kevino@webkit.org79fbef92007-11-24 00:52:18 +000073// CURL needs winsock, so don't prevent inclusion of it
bfulgham@webkit.org147773f2009-06-12 21:36:08 +000074#if !USE(CURL)
arobenfee2e822007-06-12 21:50:34 +000075#ifndef _WINSOCKAPI_
76#define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h
77#endif
bfulgham@webkit.org147773f2009-06-12 21:36:08 +000078#endif
bdashdb309122006-11-20 12:59:36 +000079
mjs@apple.comacbcc282010-01-05 08:58:28 +000080#endif /* OS(WINDOWS) */
weinigf18aae32006-08-03 21:55:57 +000081
eric@webkit.orgb8ec05a2009-11-20 06:03:15 +000082#if PLATFORM(ANDROID)
commit-queue@webkit.org807a3eb2010-10-05 15:53:45 +000083// Android uses a single set of include directories when building WebKit and
84// JavaScriptCore. Since WebCore/ is included before JavaScriptCore/, Android
85// includes JavaScriptCore/config.h explicitly here to make sure it gets picked
86// up.
87#include <JavaScriptCore/config.h>
88
eric@webkit.orgb8ec05a2009-11-20 06:03:15 +000089#define WEBCORE_NAVIGATOR_VENDOR "Google Inc."
90// This must be defined before we include FastMalloc.h, below.
91#define USE_SYSTEM_MALLOC 1
92#define LOG_DISABLED 1
93#include <wtf/Assertions.h>
94// Central place to set which optional features Android uses.
95#define ENABLE_CHANNEL_MESSAGING 1
96#define ENABLE_DOM_STORAGE 1
97#undef ENABLE_FTPDIR // Enabled by default in Platform.h
98#define ENABLE_FTPDIR 0
99#ifndef ENABLE_SVG
100#define ENABLE_SVG 0
101#endif
102#define ENABLE_VIDEO 1
103#define ENABLE_WORKERS 1
104#define ENABLE_XBL 0
dbates@webkit.orga8f3d6a2010-01-08 06:16:22 +0000105#define ENABLE_XHTMLMP 0
eric@webkit.orgb8ec05a2009-11-20 06:03:15 +0000106#define ENABLE_XPATH 0
107#define ENABLE_XSLT 0
108#define ENABLE_ARCHIVE 0
109#define ENABLE_OFFLINE_WEB_APPLICATIONS 1
110#undef ENABLE_GEOLOCATION // Disabled by default in Platform.h
111#define ENABLE_GEOLOCATION 1
112#undef ENABLE_INSPECTOR // Enabled by default in Platform.h
113#define ENABLE_INSPECTOR 0
114#define ENABLE_EVENT_SOURCE 0
115#endif /* PLATFORM(ANDROID) */
116
darin707988e2006-01-16 01:29:54 +0000117#ifdef __cplusplus
118
119// These undefs match up with defines in WebCorePrefix.h for Mac OS X.
120// Helps us catch if anyone uses new or delete by accident in code and doesn't include "config.h".
121#undef new
122#undef delete
mjsbb863512006-05-09 09:27:55 +0000123#include <wtf/FastMalloc.h>
darin707988e2006-01-16 01:29:54 +0000124
125#endif
eseidel864b4dd2006-02-24 01:11:00 +0000126
kevino@webkit.orgb7dc1ba2009-09-07 17:53:09 +0000127// On MSW, wx headers need to be included before windows.h is.
128// The only way we can always ensure this is if we include wx here.
129#if PLATFORM(WX)
kevino@webkit.orgb7dc1ba2009-09-07 17:53:09 +0000130#include <wx/defs.h>
131#endif
132
kevinob9b68c92007-10-28 19:18:04 +0000133// this breaks compilation of <QFontDatabase>, at least, so turn it off for now
134// Also generates errors on wx on Windows, presumably because these functions
beidson@apple.comb3c7b2b2008-04-08 21:28:08 +0000135// are used from wx headers.
eric@webkit.org8b2edd02009-09-09 22:35:57 +0000136#if !PLATFORM(QT) && !PLATFORM(WX) && !PLATFORM(CHROMIUM)
darineb0d86d2007-10-16 20:13:24 +0000137#include <wtf/DisallowCType.h>
darin84ee4822007-10-16 22:02:41 +0000138#endif
darineb0d86d2007-10-16 20:13:24 +0000139
mrowe@apple.comfbe724c2008-09-03 23:46:54 +0000140#if COMPILER(MSVC)
141#define SKIP_STATIC_CONSTRUCTORS_ON_MSVC 1
laszlo.1.gombos@nokia.com3c67e742010-04-05 14:28:27 +0000142#elif !COMPILER(WINSCW)
mrowe@apple.comfbe724c2008-09-03 23:46:54 +0000143#define SKIP_STATIC_CONSTRUCTORS_ON_GCC 1
eseidel864b4dd2006-02-24 01:11:00 +0000144#endif
anderscacd71fdd2006-09-14 01:56:44 +0000145
arobenfee2e822007-06-12 21:50:34 +0000146#if PLATFORM(WIN)
bfulgham@webkit.org5742b26b2009-07-13 18:34:44 +0000147#if defined(WIN_CAIRO)
148#undef WTF_PLATFORM_CG
149#define WTF_PLATFORM_CAIRO 1
150#undef WTF_USE_CFNETWORK
151#define WTF_USE_CURL 1
152#ifndef _WINSOCKAPI_
153#define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h
154#endif
paroga@webkit.org380e9452010-11-23 00:18:47 +0000155#elif !OS(WINCE)
arobenfee2e822007-06-12 21:50:34 +0000156#define WTF_PLATFORM_CG 1
157#undef WTF_PLATFORM_CAIRO
158#define WTF_USE_CFNETWORK 1
bfulgham@webkit.org5742b26b2009-07-13 18:34:44 +0000159#undef WTF_USE_CURL
160#endif
anderscacd71fdd2006-09-14 01:56:44 +0000161#endif
bdash880df152006-11-11 02:55:57 +0000162
mitz@apple.comc0b050b2008-09-06 22:39:34 +0000163#if PLATFORM(MAC)
simon.fraser@apple.comccf36902009-03-17 19:24:35 +0000164// New theme
hyatt@apple.com084394f2008-10-17 21:26:46 +0000165#define WTF_USE_NEW_THEME 1
simon.fraser@apple.comccf36902009-03-17 19:24:35 +0000166#endif // PLATFORM(MAC)
mitz@apple.comc0b050b2008-09-06 22:39:34 +0000167
mjs@apple.comacbcc282010-01-05 08:58:28 +0000168#if OS(SYMBIAN)
bdash880df152006-11-11 02:55:57 +0000169#define USE_SYSTEM_MALLOC 1
bdash880df152006-11-11 02:55:57 +0000170#endif
arobenfee2e822007-06-12 21:50:34 +0000171
eric@webkit.org3eefe672008-09-04 01:32:26 +0000172#if PLATFORM(CHROMIUM)
eric@webkit.org8b2edd02009-09-09 22:35:57 +0000173
mjs@apple.comacbcc282010-01-05 08:58:28 +0000174#if !OS(DARWIN)
eric@webkit.org8b2edd02009-09-09 22:35:57 +0000175// Define SKIA on non-Mac.
176#define WTF_PLATFORM_SKIA 1
mjs@apple.comacbcc282010-01-05 08:58:28 +0000177#endif /* !OS(DARWIN) */
eric@webkit.org8b2edd02009-09-09 22:35:57 +0000178
179// Chromium uses this file instead of JavaScriptCore/config.h to compile
180// JavaScriptCore/wtf (chromium doesn't compile the rest of JSC). Therefore,
181// this define is required.
182#define WTF_CHANGES 1
183
184#define WTF_USE_GOOGLEURL 1
185
186#if !defined(WTF_USE_V8)
eric@webkit.org3eefe672008-09-04 01:32:26 +0000187#define WTF_USE_V8 1
eric@webkit.org8b2edd02009-09-09 22:35:57 +0000188#endif
189
190#undef WTF_USE_CFNETWORK
191
eric@webkit.org3eefe672008-09-04 01:32:26 +0000192#endif /* PLATFORM(CHROMIUM) */
eric@webkit.org8b2edd02009-09-09 22:35:57 +0000193
194#if !defined(WTF_USE_V8)
195#define WTF_USE_V8 0
eric@webkit.org3eefe672008-09-04 01:32:26 +0000196#endif /* !defined(WTF_USE_V8) */
197
198/* Using V8 implies not using JSC and vice versa */
commit-queue@webkit.org909c9d92010-07-03 03:08:25 +0000199#if !defined(WTF_USE_JSC)
eric@webkit.org3eefe672008-09-04 01:32:26 +0000200#define WTF_USE_JSC !WTF_USE_V8
commit-queue@webkit.org909c9d92010-07-03 03:08:25 +0000201#endif
eric@webkit.org3eefe672008-09-04 01:32:26 +0000202
arobenfee2e822007-06-12 21:50:34 +0000203#if PLATFORM(CG)
204#ifndef CGFLOAT_DEFINED
205#ifdef __LP64__
206typedef double CGFloat;
207#else
208typedef float CGFloat;
209#endif
210#define CGFLOAT_DEFINED 1
211#endif
212#endif /* PLATFORM(CG) */
aroben808a0022007-06-27 04:07:35 +0000213
beidson7a243282007-07-14 22:25:31 +0000214#ifdef BUILDING_ON_TIGER
weinig951fc8d2007-07-14 22:59:57 +0000215#undef ENABLE_FTPDIR
beidson7a243282007-07-14 22:25:31 +0000216#define ENABLE_FTPDIR 0
217#endif
mrowe@apple.com02a10022008-03-05 22:44:12 +0000218
219#if PLATFORM(WIN) && PLATFORM(CG)
220#define WTF_USE_SAFARI_THEME 1
221#endif
tonikitoo@webkit.org81c027d2010-07-29 13:19:43 +0000222
hausmann@webkit.orgfc184bd2010-09-12 13:33:34 +0000223#if PLATFORM(QT) && USE(V8) && defined(Q_WS_X11)
224/* protect ourselves from evil X11 defines */
225#include <bridge/npruntime_internal.h>
226#endif
227