Initialize Tizen 2.3
[external/chromium.git] / build / build_config.h
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // This file adds defines about the platform we're currently building on.
6 //  Operating System:
7 //    OS_WIN / OS_MACOSX / OS_LINUX / OS_POSIX (MACOSX or LINUX)
8 //  Compiler:
9 //    COMPILER_MSVC / COMPILER_GCC
10 //  Processor:
11 //    ARCH_CPU_X86 / ARCH_CPU_X86_64 / ARCH_CPU_X86_FAMILY (X86 or X86_64)
12 //    ARCH_CPU_32_BITS / ARCH_CPU_64_BITS
13
14 #ifndef BUILD_BUILD_CONFIG_H_
15 #define BUILD_BUILD_CONFIG_H_
16
17 // A set of macros to use for platform detection.
18 #if defined(__APPLE__)
19 #define OS_MACOSX 1
20 #elif defined(ANDROID)
21 #define OS_ANDROID 1
22 #elif defined(__native_client__)
23 #define OS_NACL 1
24 #elif defined(__linux__)
25 #define OS_LINUX 1
26 // Use TOOLKIT_GTK on linux if TOOLKIT_VIEWS isn't defined.
27 #if !defined(TOOLKIT_VIEWS)
28 #define TOOLKIT_GTK
29 #endif
30 #elif defined(_WIN32)
31 #define OS_WIN 1
32 #define TOOLKIT_VIEWS 1
33 #elif defined(__FreeBSD__)
34 #define OS_FREEBSD 1
35 #define TOOLKIT_GTK
36 #elif defined(__OpenBSD__)
37 #define OS_OPENBSD 1
38 #define TOOLKIT_GTK
39 #elif defined(__sun)
40 #define OS_SOLARIS 1
41 #define TOOLKIT_GTK
42 #else
43 #error Please add support for your platform in build/build_config.h
44 #endif
45
46 // A flag derived from the above flags, used to cover GTK code in
47 // both TOOLKIT_GTK and TOOLKIT_VIEWS.
48 #if defined(TOOLKIT_GTK) || (defined(TOOLKIT_VIEWS) && !defined(OS_WIN))
49 #define TOOLKIT_USES_GTK 1
50 #endif
51
52 #if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || \
53     defined(OS_SOLARIS) || defined(OS_ANDROID)
54 #if !defined(USE_OPENSSL)
55 #define USE_NSS 1  // Default to use NSS for crypto, unless OpenSSL is chosen.
56 #endif
57 #ifndef OS_ANDROID
58 #define USE_X11 1  // Use X for graphics.
59 #endif
60 #endif
61
62 #if defined(USE_OPENSSL) && defined(USE_NSS)
63 #error Cannot use both OpenSSL and NSS
64 #endif
65
66 // For access to standard POSIXish features, use OS_POSIX instead of a
67 // more specific macro.
68 #if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FREEBSD) ||     \
69     defined(OS_OPENBSD) || defined(OS_SOLARIS) || defined(OS_ANDROID) ||  \
70     defined(OS_NACL)
71 #define OS_POSIX 1
72 #endif
73
74 // Use tcmalloc
75 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(NO_TCMALLOC)
76 #define USE_TCMALLOC 1
77 #endif
78
79 // Use heapchecker.
80 #if defined(OS_LINUX) && !defined(NO_HEAPCHECKER)
81 #define USE_HEAPCHECKER 1
82 #endif
83
84 // Compiler detection.
85 #if defined(__GNUC__)
86 #define COMPILER_GCC 1
87 #elif defined(_MSC_VER)
88 #define COMPILER_MSVC 1
89 #else
90 #error Please add support for your compiler in build/build_config.h
91 #endif
92
93 // Processor architecture detection.  For more info on what's defined, see:
94 //   http://msdn.microsoft.com/en-us/library/b0084kay.aspx
95 //   http://www.agner.org/optimize/calling_conventions.pdf
96 //   or with gcc, run: "echo | gcc -E -dM -"
97 #if defined(_M_X64) || defined(__x86_64__)
98 #define ARCH_CPU_X86_FAMILY 1
99 #define ARCH_CPU_X86_64 1
100 #define ARCH_CPU_64_BITS 1
101 #define ARCH_CPU_LITTLE_ENDIAN 1
102 #elif defined(_M_IX86) || defined(__i386__)
103 #define ARCH_CPU_X86_FAMILY 1
104 #define ARCH_CPU_X86 1
105 #define ARCH_CPU_32_BITS 1
106 #define ARCH_CPU_LITTLE_ENDIAN 1
107 #elif defined(__ARMEL__)
108 #define ARCH_CPU_ARM_FAMILY 1
109 #define ARCH_CPU_ARMEL 1
110 #define ARCH_CPU_32_BITS 1
111 #define ARCH_CPU_LITTLE_ENDIAN 1
112 #define WCHAR_T_IS_UNSIGNED 1
113 #else
114 #error Please add support for your architecture in build/build_config.h
115 #endif
116
117 // Type detection for wchar_t.
118 #if defined(OS_WIN)
119 #define WCHAR_T_IS_UTF16
120 #elif defined(OS_POSIX) && defined(COMPILER_GCC) && \
121     defined(__WCHAR_MAX__) && \
122     (__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff)
123 #define WCHAR_T_IS_UTF32
124 #elif defined(OS_POSIX) && defined(COMPILER_GCC) && \
125     defined(__WCHAR_MAX__) && \
126     (__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff)
127 // On Posix, we'll detect short wchar_t, but projects aren't guaranteed to
128 // compile in this mode (in particular, Chrome doesn't). This is intended for
129 // other projects using base who manage their own dependencies and make sure
130 // short wchar works for them.
131 #define WCHAR_T_IS_UTF16
132 #else
133 #error Please add support for your compiler in build/build_config.h
134 #endif
135
136 #if defined(OS_CHROMEOS)
137 // Single define to trigger whether CrOS fonts have BCI on.
138 // In that case font sizes/deltas should be adjusted.
139 //define CROS_FONTS_USING_BCI
140 #endif
141
142 #if defined(OS_ANDROID)
143 // The compiler thinks std::string::const_iterator and "const char*" are
144 // equivalent types.
145 #define STD_STRING_ITERATOR_IS_CHAR_POINTER
146 // The compiler thinks base::string16::const_iterator and "char16*" are
147 // equivalent types.
148 #define BASE_STRING16_ITERATOR_IS_CHAR16_POINTER
149 #endif
150
151 #endif  // BUILD_BUILD_CONFIG_H_