blob: 91f4a85bdbb2b059aef8163435c69f3d2f6c2cd2 [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
kevino@webkit.org531cac32011-03-15 14:59:20 +000032/* See note in wtf/Platform.h for more info on EXPORT_MACROS. */
33#if USE(EXPORT_MACROS)
34
35#include <wtf/ExportMacros.h>
36
37#if defined(BUILDING_JavaScriptCore) || defined(BUILDING_WTF)
38#define WTF_EXPORT_PRIVATE WTF_EXPORT
39#define JS_EXPORT_PRIVATE WTF_EXPORT
40#else
41#define WTF_EXPORT_PRIVATE WTF_IMPORT
42#define JS_EXPORT_PRIVATE WTF_IMPORT
43#endif
44
45#define JS_EXPORTDATA JS_EXPORT_PRIVATE
46#define JS_EXPORTCLASS JS_EXPORT_PRIVATE
47
48#if defined(BUILDING_WebCore) || defined(BUILDING_WebKit)
49#define WEBKIT_EXPORTDATA WTF_EXPORT
50#else
51#define WEBKIT_EXPORTDATA WTF_IMPORT
52#endif
53
54#else /* !USE(EXPORT_MACROS) */
55
jamesr@google.comaefdd9a2010-04-23 21:13:32 +000056#if !PLATFORM(CHROMIUM) && OS(WINDOWS) && !defined(BUILDING_WX__) && !COMPILER(GCC)
sfalken@apple.com46fc85a2009-04-20 21:25:37 +000057#if defined(BUILDING_JavaScriptCore) || defined(BUILDING_WTF)
58#define JS_EXPORTDATA __declspec(dllexport)
59#else
60#define JS_EXPORTDATA __declspec(dllimport)
61#endif
62#if defined(BUILDING_WebCore) || defined(BUILDING_WebKit)
63#define WEBKIT_EXPORTDATA __declspec(dllexport)
64#else
65#define WEBKIT_EXPORTDATA __declspec(dllimport)
66#endif
kevino@webkit.org694dcd92011-04-06 23:38:42 +000067#define WTF_EXPORT_PRIVATE
68#define JS_EXPORT_PRIVATE
ap@apple.com1348bdf2010-01-08 00:15:05 +000069#define JS_EXPORTCLASS JS_EXPORTDATA
sfalken@apple.com46fc85a2009-04-20 21:25:37 +000070#else
71#define JS_EXPORTDATA
ap@apple.com1348bdf2010-01-08 00:15:05 +000072#define JS_EXPORTCLASS
sfalken@apple.combcff7fb2009-04-20 21:47:02 +000073#define WEBKIT_EXPORTDATA
kevino@webkit.org531cac32011-03-15 14:59:20 +000074#define WTF_EXPORT_PRIVATE
75#define JS_EXPORT_PRIVATE
sfalken@apple.com46fc85a2009-04-20 21:25:37 +000076#endif
77
kevino@webkit.org531cac32011-03-15 14:59:20 +000078#endif /* USE(EXPORT_MACROS) */
79
mrowe@apple.com4d7e81e2007-11-20 16:06:23 +000080#ifdef __APPLE__
darin71e27492006-01-25 03:35:00 +000081#define HAVE_FUNC_USLEEP 1
weinigf18aae32006-08-03 21:55:57 +000082#endif /* __APPLE__ */
darin71e27492006-01-25 03:35:00 +000083
mjs@apple.comacbcc282010-01-05 08:58:28 +000084#if OS(WINDOWS)
darin707988e2006-01-16 01:29:54 +000085
sfalkenc3cff1c2006-05-26 00:36:30 +000086#ifndef _WIN32_WINNT
hyatt89166da2006-05-21 06:58:12 +000087#define _WIN32_WINNT 0x0500
sfalkenc3cff1c2006-05-26 00:36:30 +000088#endif
89
90#ifndef WINVER
91#define WINVER 0x0500
92#endif
93
aroben@apple.com06d35b92008-03-27 01:43:54 +000094// If we don't define these, they get defined in windef.h.
aroben@apple.com1840f962007-11-12 11:02:47 +000095// We want to use std::min and std::max.
arobenfee2e822007-06-12 21:50:34 +000096#ifndef max
arobena6c43b92006-12-08 22:34:07 +000097#define max max
arobenfee2e822007-06-12 21:50:34 +000098#endif
99#ifndef min
arobena6c43b92006-12-08 22:34:07 +0000100#define min min
arobenfee2e822007-06-12 21:50:34 +0000101#endif
102
kevino@webkit.org79fbef92007-11-24 00:52:18 +0000103// CURL needs winsock, so don't prevent inclusion of it
bfulgham@webkit.org147773f2009-06-12 21:36:08 +0000104#if !USE(CURL)
arobenfee2e822007-06-12 21:50:34 +0000105#ifndef _WINSOCKAPI_
106#define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h
107#endif
bfulgham@webkit.org147773f2009-06-12 21:36:08 +0000108#endif
bdashdb309122006-11-20 12:59:36 +0000109
mjs@apple.comacbcc282010-01-05 08:58:28 +0000110#endif /* OS(WINDOWS) */
weinigf18aae32006-08-03 21:55:57 +0000111
eric@webkit.orgb8ec05a2009-11-20 06:03:15 +0000112#if PLATFORM(ANDROID)
commit-queue@webkit.org807a3eb2010-10-05 15:53:45 +0000113// Android uses a single set of include directories when building WebKit and
114// JavaScriptCore. Since WebCore/ is included before JavaScriptCore/, Android
115// includes JavaScriptCore/config.h explicitly here to make sure it gets picked
116// up.
117#include <JavaScriptCore/config.h>
118
eric@webkit.orgb8ec05a2009-11-20 06:03:15 +0000119#define WEBCORE_NAVIGATOR_VENDOR "Google Inc."
120// This must be defined before we include FastMalloc.h, below.
121#define USE_SYSTEM_MALLOC 1
122#define LOG_DISABLED 1
123#include <wtf/Assertions.h>
124// Central place to set which optional features Android uses.
125#define ENABLE_CHANNEL_MESSAGING 1
126#define ENABLE_DOM_STORAGE 1
127#undef ENABLE_FTPDIR // Enabled by default in Platform.h
128#define ENABLE_FTPDIR 0
129#ifndef ENABLE_SVG
130#define ENABLE_SVG 0
131#endif
132#define ENABLE_VIDEO 1
133#define ENABLE_WORKERS 1
134#define ENABLE_XBL 0
dbates@webkit.orga8f3d6a2010-01-08 06:16:22 +0000135#define ENABLE_XHTMLMP 0
eric@webkit.orgb8ec05a2009-11-20 06:03:15 +0000136#define ENABLE_XPATH 0
137#define ENABLE_XSLT 0
138#define ENABLE_ARCHIVE 0
139#define ENABLE_OFFLINE_WEB_APPLICATIONS 1
140#undef ENABLE_GEOLOCATION // Disabled by default in Platform.h
141#define ENABLE_GEOLOCATION 1
142#undef ENABLE_INSPECTOR // Enabled by default in Platform.h
143#define ENABLE_INSPECTOR 0
144#define ENABLE_EVENT_SOURCE 0
145#endif /* PLATFORM(ANDROID) */
146
darin707988e2006-01-16 01:29:54 +0000147#ifdef __cplusplus
148
149// These undefs match up with defines in WebCorePrefix.h for Mac OS X.
150// Helps us catch if anyone uses new or delete by accident in code and doesn't include "config.h".
151#undef new
152#undef delete
mjsbb863512006-05-09 09:27:55 +0000153#include <wtf/FastMalloc.h>
darin707988e2006-01-16 01:29:54 +0000154
155#endif
eseidel864b4dd2006-02-24 01:11:00 +0000156
kevino@webkit.orgb7dc1ba2009-09-07 17:53:09 +0000157// On MSW, wx headers need to be included before windows.h is.
158// The only way we can always ensure this is if we include wx here.
159#if PLATFORM(WX)
kevino@webkit.orgb7dc1ba2009-09-07 17:53:09 +0000160#include <wx/defs.h>
161#endif
162
kevinob9b68c92007-10-28 19:18:04 +0000163// this breaks compilation of <QFontDatabase>, at least, so turn it off for now
164// Also generates errors on wx on Windows, presumably because these functions
mrobinson@webkit.orge0abb382011-01-12 18:11:44 +0000165// are used from wx headers. On GTK+ for Mac many GTK+ files include <libintl.h>
166// or <glib/gi18n-lib.h>, which in turn include <xlocale/_ctype.h> which uses
167// isacii().
168#if !PLATFORM(QT) && !PLATFORM(WX) && !PLATFORM(CHROMIUM) && !(OS(DARWIN) && PLATFORM(GTK))
darineb0d86d2007-10-16 20:13:24 +0000169#include <wtf/DisallowCType.h>
darin84ee4822007-10-16 22:02:41 +0000170#endif
darineb0d86d2007-10-16 20:13:24 +0000171
mrowe@apple.comfbe724c2008-09-03 23:46:54 +0000172#if COMPILER(MSVC)
173#define SKIP_STATIC_CONSTRUCTORS_ON_MSVC 1
laszlo.1.gombos@nokia.com3c67e742010-04-05 14:28:27 +0000174#elif !COMPILER(WINSCW)
mrowe@apple.comfbe724c2008-09-03 23:46:54 +0000175#define SKIP_STATIC_CONSTRUCTORS_ON_GCC 1
eseidel864b4dd2006-02-24 01:11:00 +0000176#endif
anderscacd71fdd2006-09-14 01:56:44 +0000177
arobenfee2e822007-06-12 21:50:34 +0000178#if PLATFORM(WIN)
bfulgham@webkit.org5742b26b2009-07-13 18:34:44 +0000179#if defined(WIN_CAIRO)
paroga@webkit.orgf226d9f2011-04-17 10:04:48 +0000180#undef WTF_USE_CG
paroga@webkit.org411b4762011-04-16 10:37:01 +0000181#define WTF_USE_CAIRO 1
bfulgham@webkit.org5742b26b2009-07-13 18:34:44 +0000182#define WTF_USE_CURL 1
183#ifndef _WINSOCKAPI_
184#define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h
185#endif
paroga@webkit.org380e9452010-11-23 00:18:47 +0000186#elif !OS(WINCE)
paroga@webkit.orgf226d9f2011-04-17 10:04:48 +0000187#define WTF_USE_CG 1
paroga@webkit.org411b4762011-04-16 10:37:01 +0000188#undef WTF_USE_CAIRO
bfulgham@webkit.org5742b26b2009-07-13 18:34:44 +0000189#undef WTF_USE_CURL
190#endif
anderscacd71fdd2006-09-14 01:56:44 +0000191#endif
bdash880df152006-11-11 02:55:57 +0000192
mitz@apple.comc0b050b2008-09-06 22:39:34 +0000193#if PLATFORM(MAC)
simon.fraser@apple.comccf36902009-03-17 19:24:35 +0000194// New theme
hyatt@apple.com084394f2008-10-17 21:26:46 +0000195#define WTF_USE_NEW_THEME 1
simon.fraser@apple.comccf36902009-03-17 19:24:35 +0000196#endif // PLATFORM(MAC)
mitz@apple.comc0b050b2008-09-06 22:39:34 +0000197
mjs@apple.comacbcc282010-01-05 08:58:28 +0000198#if OS(SYMBIAN)
bdash880df152006-11-11 02:55:57 +0000199#define USE_SYSTEM_MALLOC 1
bdash880df152006-11-11 02:55:57 +0000200#endif
arobenfee2e822007-06-12 21:50:34 +0000201
abarth@webkit.orgca9201f2011-02-12 21:35:25 +0000202#if OS(UNIX) || OS(WINDOWS)
abarth@webkit.orgba712d32011-02-11 08:37:36 +0000203#define WTF_USE_OS_RANDOMNESS 1
204#endif
205
eric@webkit.org3eefe672008-09-04 01:32:26 +0000206#if PLATFORM(CHROMIUM)
eric@webkit.org8b2edd02009-09-09 22:35:57 +0000207
eric@webkit.org8b2edd02009-09-09 22:35:57 +0000208// Chromium uses this file instead of JavaScriptCore/config.h to compile
209// JavaScriptCore/wtf (chromium doesn't compile the rest of JSC). Therefore,
210// this define is required.
211#define WTF_CHANGES 1
212
213#define WTF_USE_GOOGLEURL 1
214
215#if !defined(WTF_USE_V8)
eric@webkit.org3eefe672008-09-04 01:32:26 +0000216#define WTF_USE_V8 1
eric@webkit.org8b2edd02009-09-09 22:35:57 +0000217#endif
218
eric@webkit.org3eefe672008-09-04 01:32:26 +0000219#endif /* PLATFORM(CHROMIUM) */
eric@webkit.org8b2edd02009-09-09 22:35:57 +0000220
221#if !defined(WTF_USE_V8)
222#define WTF_USE_V8 0
eric@webkit.org3eefe672008-09-04 01:32:26 +0000223#endif /* !defined(WTF_USE_V8) */
224
225/* Using V8 implies not using JSC and vice versa */
commit-queue@webkit.org909c9d92010-07-03 03:08:25 +0000226#if !defined(WTF_USE_JSC)
eric@webkit.org3eefe672008-09-04 01:32:26 +0000227#define WTF_USE_JSC !WTF_USE_V8
commit-queue@webkit.org909c9d92010-07-03 03:08:25 +0000228#endif
eric@webkit.org3eefe672008-09-04 01:32:26 +0000229
paroga@webkit.orgf226d9f2011-04-17 10:04:48 +0000230#if USE(CG)
arobenfee2e822007-06-12 21:50:34 +0000231#ifndef CGFLOAT_DEFINED
232#ifdef __LP64__
233typedef double CGFloat;
234#else
235typedef float CGFloat;
236#endif
237#define CGFLOAT_DEFINED 1
238#endif
paroga@webkit.orgf226d9f2011-04-17 10:04:48 +0000239#endif /* USE(CG) */
aroben808a0022007-06-27 04:07:35 +0000240
beidson7a243282007-07-14 22:25:31 +0000241#ifdef BUILDING_ON_TIGER
weinig951fc8d2007-07-14 22:59:57 +0000242#undef ENABLE_FTPDIR
beidson7a243282007-07-14 22:25:31 +0000243#define ENABLE_FTPDIR 0
244#endif
mrowe@apple.com02a10022008-03-05 22:44:12 +0000245
paroga@webkit.orgf226d9f2011-04-17 10:04:48 +0000246#if PLATFORM(WIN) && USE(CG)
mrowe@apple.com02a10022008-03-05 22:44:12 +0000247#define WTF_USE_SAFARI_THEME 1
248#endif
tonikitoo@webkit.org81c027d2010-07-29 13:19:43 +0000249
cmarrin@apple.com14a3dcf2011-01-07 20:00:22 +0000250// CoreAnimation is available to IOS, Mac and Windows if using CG
paroga@webkit.orgf226d9f2011-04-17 10:04:48 +0000251#if PLATFORM(MAC) || PLATFORM(IOS) || (PLATFORM(WIN) && USE(CG))
paroga@webkit.orge0e0b032011-04-17 18:59:57 +0000252#define WTF_USE_CA 1
cmarrin@apple.com14a3dcf2011-01-07 20:00:22 +0000253#endif
254
hausmann@webkit.orgfc184bd2010-09-12 13:33:34 +0000255#if PLATFORM(QT) && USE(V8) && defined(Q_WS_X11)
256/* protect ourselves from evil X11 defines */
257#include <bridge/npruntime_internal.h>
258#endif
259