1 /* 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 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 #else /* !USE(EXPORT_MACROS) */ 49 50 #if !PLATFORM(CHROMIUM) && OS(WINDOWS) && !defined(BUILDING_WX__) && !COMPILER(GCC) 51 #if defined(BUILDING_JavaScriptCore) || defined(BUILDING_WTF) 52 #define JS_EXPORTDATA __declspec(dllexport) 53 #else 54 #define JS_EXPORTDATA __declspec(dllimport) 55 #endif 56 #define JS_EXPORTCLASS JS_EXPORTDATA 57 #else 58 #define JS_EXPORTDATA 59 #define JS_EXPORTCLASS 60 #endif 61 62 #define WTF_EXPORT_PRIVATE 63 #define JS_EXPORT_PRIVATE 64 65 #endif /* USE(EXPORT_MACROS) */ 66 67 #if OS(WINDOWS) 68 69 // If we don't define these, they get defined in windef.h. 70 // We want to use std::min and std::max 71 #define max max 72 #define min min 73 74 #if !COMPILER(MSVC7_OR_LOWER) && !OS(WINCE) 75 // We need to define this before the first #include of stdlib.h or it won't contain rand_s. 76 #ifndef _CRT_RAND_S 77 #define _CRT_RAND_S 78 #endif 79 #endif 80 81 #endif 82 83 #if OS(UNIX) || OS(WINDOWS) 84 #define WTF_USE_OS_RANDOMNESS 1 85 #endif 86 87 #if OS(FREEBSD) || OS(OPENBSD) 88 #define HAVE_PTHREAD_NP_H 1 89 #endif 90 91 /* FIXME: if all platforms have these, do they really need #defines? */ 92 #define HAVE_STDINT_H 1 93 94 #define WTF_CHANGES 1 95 96 #ifdef __cplusplus 97 #undef new 98 #undef delete 99 #include <wtf/FastMalloc.h> 100 #endif 101 102 // this breaks compilation of <QFontDatabase>, at least, so turn it off for now 103 // Also generates errors on wx on Windows, because these functions 104 // are used from wx headers. 105 #if !PLATFORM(QT) && !PLATFORM(WX) 106 #include <wtf/DisallowCType.h> 107 #endif 108 109 #if COMPILER(MSVC) 110 #define SKIP_STATIC_CONSTRUCTORS_ON_MSVC 1 111 #else 112 #define SKIP_STATIC_CONSTRUCTORS_ON_GCC 1 113 #endif 114 115 #if PLATFORM(CHROMIUM) 116 #if !defined(WTF_USE_V8) 117 #define WTF_USE_V8 1 118 #endif 119 #endif /* PLATFORM(CHROMIUM) */ 120 121 #if !defined(WTF_USE_V8) 122 #define WTF_USE_V8 0 123 #endif /* !defined(WTF_USE_V8) */ 124 125 /* Using V8 implies not using JSC and vice versa */ 126 #define WTF_USE_JSC !WTF_USE_V8 127