summaryrefslogtreecommitdiff
path: root/chromium/third_party/WebKit/Source/config.h
blob: e556d5b95dcf054589ae0a25b832be7b5446db50 (plain)
1
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/*
 * Copyright (C) 2004, 2005, 2006, 2013 Apple Inc.
 * Copyright (C) 2009 Google Inc. All rights reserved.
 * Copyright (C) 2007-2009 Torch Mobile, Inc.
 * Copyright (C) 2010, 2011 Research In Motion Limited. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 *
 */

/* Include compiler specific macros */
#include "wtf/Compiler.h"

#if COMPILER(MSVC)
#define _USE_MATH_DEFINES // Make math.h behave like other platforms.
#endif

/* ==== Platform adaptation macros: these describe properties of the target environment. ==== */

/* HAVE() - specific system features (headers, functions or similar) that are present or not */
#define HAVE(WTF_FEATURE) (defined HAVE_##WTF_FEATURE  && HAVE_##WTF_FEATURE)
/* OS() - underlying operating system; only to be used for mandated low-level services like
   virtual memory, not to choose a GUI toolkit */
#define OS(WTF_FEATURE) (defined WTF_OS_##WTF_FEATURE  && WTF_OS_##WTF_FEATURE)

/* ==== Policy decision macros: these define policy choices for a particular port. ==== */

/* USE() - use a particular third-party library or optional OS service */
#define USE(WTF_FEATURE) (defined WTF_USE_##WTF_FEATURE  && WTF_USE_##WTF_FEATURE)
/* ENABLE() - turn on a specific feature of WebKit */
#define ENABLE(WTF_FEATURE) (defined ENABLE_##WTF_FEATURE  && ENABLE_##WTF_FEATURE)

/* ==== OS() - underlying operating system; only to be used for mandated low-level services like
   virtual memory, not to choose a GUI toolkit ==== */

/* OS(ANDROID) - Android */
#ifdef ANDROID
#define WTF_OS_ANDROID 1
/* OS(MACOSX) - Any Darwin-based OS, including Mac OS X and iPhone OS */
#elif defined(__APPLE__)
#define WTF_OS_MACOSX 1
/* OS(FREEBSD) - FreeBSD */
#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
#define WTF_OS_FREEBSD 1
/* OS(LINUX) - Linux */
#elif defined(__linux__)
#define WTF_OS_LINUX 1
/* OS(OPENBSD) - OpenBSD */
#elif defined(__OpenBSD__)
#define WTF_OS_OPENBSD 1
/* OS(WIN) - Any version of Windows */
#elif defined(WIN32) || defined(_WIN32)
#define WTF_OS_WIN 1
#endif

/* OS(POSIX) - Any Unix-like system */
#if OS(ANDROID)          \
    || OS(MACOSX)           \
    || OS(FREEBSD)          \
    || OS(LINUX)            \
    || OS(OPENBSD)          \
    || defined(unix)        \
    || defined(__unix)      \
    || defined(__unix__)
#define WTF_OS_POSIX 1
#endif

/* There is an assumption in the project that either OS(WIN) or OS(POSIX) is set. */
#if !OS(WIN) && !OS(POSIX)
#error Either OS(WIN) or OS(POSIX) needs to be set.
#endif

/* Operating environments */

#if OS(ANDROID)
#define WTF_USE_NATIVE_FULLSCREEN_VIDEO 1
#define WTF_USE_LOW_QUALITY_IMAGE_INTERPOLATION 1
#define WTF_USE_LOW_QUALITY_IMAGE_NO_JPEG_DITHERING 1
#define WTF_USE_LOW_QUALITY_IMAGE_NO_JPEG_FANCY_UPSAMPLING 1
#else
#define WTF_USE_ICCJPEG 1
#define WTF_USE_QCMSLIB 1
#endif

#if OS(MACOSX)
#define WTF_USE_CF 1
#define WTF_USE_RUBBER_BANDING 1

/* We can't override the global operator new and delete on OS(MACOSX) because
 * some object are allocated by WebKit and deallocated by the embedder. */
#else /* !OS(MACOSX) */
/* On non-OS(MACOSX), the "system malloc" is actually TCMalloc anyway, so there's
 * no need to use WebKit's copy of TCMalloc. */
#define WTF_USE_SYSTEM_MALLOC 1
#endif /* OS(MACOSX) */

#if OS(POSIX)
#define HAVE_MMAP 1
#define HAVE_SIGNAL_H 1
#define HAVE_SYS_TIME_H 1
#define WTF_USE_PTHREADS 1
#endif /* OS(POSIX) */

#if !defined(HAVE_VASPRINTF)
#if !COMPILER(MSVC)
#define HAVE_VASPRINTF 1
#endif
#endif

#if !OS(WIN) && !OS(ANDROID)
#define HAVE_TM_GMTOFF 1
#define HAVE_TM_ZONE 1
#define HAVE_TIMEGM 1
#endif

#if OS(MACOSX)
#define HAVE_DISPATCH_H 1
#define HAVE_PTHREAD_SETNAME_NP 1
#define WTF_USE_NEW_THEME 1
#endif /* OS(MACOSX) */

#if OS(WIN)

// If we don't define these, they get defined in windef.h.
// We want to use std::min and std::max.
#ifndef max
#define max max
#endif
#ifndef min
#define min min
#endif

#endif /* OS(WIN) */

#ifdef __cplusplus

// These undefs match up with defines in WebCorePrefixMac.h for Mac OS X.
// Helps us catch if anyone uses new or delete by accident in code and doesn't include "config.h".
#undef new
#undef delete
#include "wtf/FastMalloc.h"

#include <ciso646>

#endif

#if COMPILER(MSVC)
#define SKIP_STATIC_CONSTRUCTORS_ON_MSVC 1
#else
#define SKIP_STATIC_CONSTRUCTORS_ON_GCC 1
#endif

#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS 1
#endif

#if OS(LINUX) || OS(ANDROID) || ENABLE(HARFBUZZ_ON_WINDOWS)
#define WTF_USE_HARFBUZZ 1
#endif