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.
5 // This file adds defines about the platform we're currently building on.
7 // OS_WIN / OS_MACOSX / OS_LINUX / OS_POSIX (MACOSX or LINUX)
9 // COMPILER_MSVC / COMPILER_GCC
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
14 #ifndef BUILD_BUILD_CONFIG_H_
15 #define BUILD_BUILD_CONFIG_H_
17 // A set of macros to use for platform detection.
18 #if defined(__APPLE__)
20 #elif defined(ANDROID)
22 #elif defined(__native_client__)
24 #elif defined(__linux__)
26 // Use TOOLKIT_GTK on linux if TOOLKIT_VIEWS isn't defined.
27 #if !defined(TOOLKIT_VIEWS)
32 #define TOOLKIT_VIEWS 1
33 #elif defined(__FreeBSD__)
36 #elif defined(__OpenBSD__)
43 #error Please add support for your platform in build/build_config.h
46 #if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || \
47 defined(OS_SOLARIS) || defined(OS_ANDROID)
48 #if !defined(USE_OPENSSL)
49 #define USE_NSS 1 // Default to use NSS for crypto, unless OpenSSL is chosen.
52 #define USE_X11 1 // Use X for graphics.
56 #if defined(USE_OPENSSL) && defined(USE_NSS)
57 #error Cannot use both OpenSSL and NSS
60 // For access to standard POSIXish features, use OS_POSIX instead of a
61 // more specific macro.
62 #if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FREEBSD) || \
63 defined(OS_OPENBSD) || defined(OS_SOLARIS) || defined(OS_ANDROID) || \
69 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(NO_TCMALLOC)
70 #define USE_TCMALLOC 1
74 #if defined(OS_LINUX) && !defined(NO_HEAPCHECKER)
75 #define USE_HEAPCHECKER 1
78 // Compiler detection.
80 #define COMPILER_GCC 1
81 #elif defined(_MSC_VER)
82 #define COMPILER_MSVC 1
84 #error Please add support for your compiler in build/build_config.h
87 // Processor architecture detection. For more info on what's defined, see:
88 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx
89 // http://www.agner.org/optimize/calling_conventions.pdf
90 // or with gcc, run: "echo | gcc -E -dM -"
91 #if defined(_M_X64) || defined(__x86_64__)
92 #define ARCH_CPU_X86_FAMILY 1
93 #define ARCH_CPU_X86_64 1
94 #define ARCH_CPU_64_BITS 1
95 #define ARCH_CPU_LITTLE_ENDIAN 1
96 #elif defined(_M_IX86) || defined(__i386__)
97 #define ARCH_CPU_X86_FAMILY 1
98 #define ARCH_CPU_X86 1
99 #define ARCH_CPU_32_BITS 1
100 #define ARCH_CPU_LITTLE_ENDIAN 1
101 #elif defined(__ARMEL__)
102 #define ARCH_CPU_ARM_FAMILY 1
103 #define ARCH_CPU_ARMEL 1
104 #define ARCH_CPU_32_BITS 1
105 #define ARCH_CPU_LITTLE_ENDIAN 1
106 #define WCHAR_T_IS_UNSIGNED 1
107 #elif defined(__pnacl__)
108 #define ARCH_CPU_32_BITS 1
110 #error Please add support for your architecture in build/build_config.h
113 // Type detection for wchar_t.
115 #define WCHAR_T_IS_UTF16
116 #elif defined(OS_POSIX) && defined(COMPILER_GCC) && \
117 defined(__WCHAR_MAX__) && \
118 (__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff)
119 #define WCHAR_T_IS_UTF32
120 #elif defined(OS_POSIX) && defined(COMPILER_GCC) && \
121 defined(__WCHAR_MAX__) && \
122 (__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff)
123 // On Posix, we'll detect short wchar_t, but projects aren't guaranteed to
124 // compile in this mode (in particular, Chrome doesn't). This is intended for
125 // other projects using base who manage their own dependencies and make sure
126 // short wchar works for them.
127 #define WCHAR_T_IS_UTF16
129 #error Please add support for your compiler in build/build_config.h
132 #if defined(OS_CHROMEOS)
133 // Single define to trigger whether CrOS fonts have BCI on.
134 // In that case font sizes/deltas should be adjusted.
135 //define CROS_FONTS_USING_BCI
138 #if defined(OS_ANDROID)
139 // The compiler thinks std::string::const_iterator and "const char*" are
141 #define STD_STRING_ITERATOR_IS_CHAR_POINTER
142 // The compiler thinks base::string16::const_iterator and "char16*" are
144 #define BASE_STRING16_ITERATOR_IS_CHAR16_POINTER
147 #endif // BUILD_BUILD_CONFIG_H_