Home | History | Annotate | Download | only in WebCore
      1 /*
      2  * Copyright (C) 2004, 2005, 2006 Apple Inc.
      3  * Copyright (C) 2009 Google Inc. All rights reserved.
      4  *
      5  * 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
     17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     18  * Boston, MA 02110-1301, USA.
     19  *
     20  */
     21 
     22 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
     23 #ifdef BUILDING_WITH_CMAKE
     24 #include "cmakeconfig.h"
     25 #else
     26 #include "autotoolsconfig.h"
     27 #endif
     28 #endif
     29 
     30 #include <wtf/Platform.h>
     31 
     32 /* 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 
     56 #if !PLATFORM(CHROMIUM) && OS(WINDOWS) && !defined(BUILDING_WX__) && !COMPILER(GCC)
     57 #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
     67 #define WTF_EXPORT_PRIVATE
     68 #define JS_EXPORT_PRIVATE
     69 #define JS_EXPORTCLASS JS_EXPORTDATA
     70 #else
     71 #define JS_EXPORTDATA
     72 #define JS_EXPORTCLASS
     73 #define WEBKIT_EXPORTDATA
     74 #define WTF_EXPORT_PRIVATE
     75 #define JS_EXPORT_PRIVATE
     76 #endif
     77 
     78 #endif /* USE(EXPORT_MACROS) */
     79 
     80 #ifdef __APPLE__
     81 #define HAVE_FUNC_USLEEP 1
     82 #endif /* __APPLE__ */
     83 
     84 #if OS(WINDOWS)
     85 
     86 #ifndef _WIN32_WINNT
     87 #define _WIN32_WINNT 0x0500
     88 #endif
     89 
     90 #ifndef WINVER
     91 #define WINVER 0x0500
     92 #endif
     93 
     94 // If we don't define these, they get defined in windef.h.
     95 // We want to use std::min and std::max.
     96 #ifndef max
     97 #define max max
     98 #endif
     99 #ifndef min
    100 #define min min
    101 #endif
    102 
    103 // CURL needs winsock, so don't prevent inclusion of it
    104 #if !USE(CURL)
    105 #ifndef _WINSOCKAPI_
    106 #define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h
    107 #endif
    108 #endif
    109 
    110 #endif /* OS(WINDOWS) */
    111 
    112 #ifdef __cplusplus
    113 
    114 // These undefs match up with defines in WebCorePrefix.h for Mac OS X.
    115 // Helps us catch if anyone uses new or delete by accident in code and doesn't include "config.h".
    116 #undef new
    117 #undef delete
    118 #include <wtf/FastMalloc.h>
    119 
    120 #endif
    121 
    122 // On MSW, wx headers need to be included before windows.h is.
    123 // The only way we can always ensure this is if we include wx here.
    124 #if PLATFORM(WX)
    125 #include <wx/defs.h>
    126 #endif
    127 
    128 // this breaks compilation of <QFontDatabase>, at least, so turn it off for now
    129 // Also generates errors on wx on Windows, presumably because these functions
    130 // are used from wx headers. On GTK+ for Mac many GTK+ files include <libintl.h>
    131 // or <glib/gi18n-lib.h>, which in turn include <xlocale/_ctype.h> which uses
    132 // isacii().
    133 #if !PLATFORM(QT) && !PLATFORM(WX) && !PLATFORM(CHROMIUM) && !(OS(DARWIN) && PLATFORM(GTK))
    134 #include <wtf/DisallowCType.h>
    135 #endif
    136 
    137 #if COMPILER(MSVC)
    138 #define SKIP_STATIC_CONSTRUCTORS_ON_MSVC 1
    139 #elif !COMPILER(WINSCW)
    140 #define SKIP_STATIC_CONSTRUCTORS_ON_GCC 1
    141 #endif
    142 
    143 #if PLATFORM(WIN)
    144 #if defined(WIN_CAIRO)
    145 #undef WTF_USE_CG
    146 #define WTF_USE_CAIRO 1
    147 #define WTF_USE_CURL 1
    148 #ifndef _WINSOCKAPI_
    149 #define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h
    150 #endif
    151 #elif !OS(WINCE)
    152 #define WTF_USE_CG 1
    153 #undef WTF_USE_CAIRO
    154 #undef WTF_USE_CURL
    155 #endif
    156 #endif
    157 
    158 #if PLATFORM(MAC)
    159 // New theme
    160 #define WTF_USE_NEW_THEME 1
    161 #endif // PLATFORM(MAC)
    162 
    163 #if OS(SYMBIAN)
    164 #define USE_SYSTEM_MALLOC 1
    165 #endif
    166 
    167 #if OS(UNIX) || OS(WINDOWS)
    168 #define WTF_USE_OS_RANDOMNESS 1
    169 #endif
    170 
    171 #if PLATFORM(CHROMIUM)
    172 
    173 // Chromium uses this file instead of JavaScriptCore/config.h to compile
    174 // JavaScriptCore/wtf (chromium doesn't compile the rest of JSC). Therefore,
    175 // this define is required.
    176 #define WTF_CHANGES 1
    177 
    178 #define WTF_USE_GOOGLEURL 1
    179 
    180 #if !defined(WTF_USE_V8)
    181 #define WTF_USE_V8 1
    182 #endif
    183 
    184 #endif /* PLATFORM(CHROMIUM) */
    185 
    186 #if !defined(WTF_USE_V8)
    187 #define WTF_USE_V8 0
    188 #endif /* !defined(WTF_USE_V8) */
    189 
    190 /* Using V8 implies not using JSC and vice versa */
    191 #if !defined(WTF_USE_JSC)
    192 #define WTF_USE_JSC !WTF_USE_V8
    193 #endif
    194 
    195 #if USE(CG)
    196 #ifndef CGFLOAT_DEFINED
    197 #ifdef __LP64__
    198 typedef double CGFloat;
    199 #else
    200 typedef float CGFloat;
    201 #endif
    202 #define CGFLOAT_DEFINED 1
    203 #endif
    204 #endif /* USE(CG) */
    205 
    206 #ifdef BUILDING_ON_TIGER
    207 #undef ENABLE_FTPDIR
    208 #define ENABLE_FTPDIR 0
    209 #endif
    210 
    211 #if PLATFORM(WIN) && USE(CG)
    212 #define WTF_USE_SAFARI_THEME 1
    213 #endif
    214 
    215 // CoreAnimation is available to IOS, Mac and Windows if using CG
    216 #if PLATFORM(MAC) || PLATFORM(IOS) || (PLATFORM(WIN) && USE(CG))
    217 #define WTF_USE_CA 1
    218 #endif
    219 
    220 #if PLATFORM(QT) && USE(V8) && defined(Q_WS_X11)
    221 /* protect ourselves from evil X11 defines */
    222 #include <bridge/npruntime_internal.h>
    223 #endif
    224 
    225