Getting rid of GetDefaultProfile(), clean up of ProfileManager (which was in a seriou...
[chromium-blink-merge.git] / build / build_config.h
blob143cf3e5b45d8678e23d57c854ff8037e56e6070
1 // Copyright (c) 2012 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.
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
14 #ifndef BUILD_BUILD_CONFIG_H_
15 #define BUILD_BUILD_CONFIG_H_
17 #if defined(__APPLE__)
18 #include <TargetConditionals.h>
19 #endif
21 // A set of macros to use for platform detection.
22 #if defined(ANDROID)
23 #define OS_ANDROID 1
24 #elif defined(__APPLE__)
25 #define OS_MACOSX 1
26 #if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
27 #define OS_IOS 1
28 #endif // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
29 #elif defined(__native_client__)
30 #define OS_NACL 1
31 #elif defined(__linux__)
32 #define OS_LINUX 1
33 // Use TOOLKIT_GTK on linux if TOOLKIT_VIEWS isn't defined.
34 #if !defined(TOOLKIT_VIEWS) && defined(USE_X11) && !defined(USE_AURA)
35 #define TOOLKIT_GTK
36 #endif
37 #if defined(__GLIBC__) && !defined(__UCLIBC__)
38 // we really are using glibc, not uClibc pretending to be glibc
39 #define LIBC_GLIBC
40 #endif
41 #elif defined(_WIN32)
42 #define OS_WIN 1
43 #define TOOLKIT_VIEWS 1
44 #elif defined(__FreeBSD__)
45 #define OS_FREEBSD 1
46 #define TOOLKIT_GTK
47 #elif defined(__OpenBSD__)
48 #define OS_OPENBSD 1
49 #define TOOLKIT_GTK
50 #elif defined(__sun)
51 #define OS_SOLARIS 1
52 #define TOOLKIT_GTK
53 #else
54 #error Please add support for your platform in build/build_config.h
55 #endif
57 #if defined(USE_OPENSSL) && defined(USE_NSS)
58 #error Cannot use both OpenSSL and NSS
59 #endif
61 // For access to standard BSD features, use OS_BSD instead of a
62 // more specific macro.
63 #if defined(OS_FREEBSD) || defined(OS_OPENBSD)
64 #define OS_BSD 1
65 #endif
67 // For access to standard POSIXish features, use OS_POSIX instead of a
68 // more specific macro.
69 #if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FREEBSD) || \
70 defined(OS_OPENBSD) || defined(OS_SOLARIS) || defined(OS_ANDROID) || \
71 defined(OS_NACL)
72 #define OS_POSIX 1
73 #endif
75 // Use tcmalloc
76 #if (defined(OS_WIN) || defined(OS_LINUX) || defined(OS_ANDROID)) && \
77 !defined(NO_TCMALLOC)
78 #define USE_TCMALLOC 1
79 #endif
81 // Compiler detection.
82 #if defined(__GNUC__)
83 #define COMPILER_GCC 1
84 #elif defined(_MSC_VER)
85 #define COMPILER_MSVC 1
86 #else
87 #error Please add support for your compiler in build/build_config.h
88 #endif
90 // Processor architecture detection. For more info on what's defined, see:
91 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx
92 // http://www.agner.org/optimize/calling_conventions.pdf
93 // or with gcc, run: "echo | gcc -E -dM -"
94 #if defined(_M_X64) || defined(__x86_64__)
95 #define ARCH_CPU_X86_FAMILY 1
96 #define ARCH_CPU_X86_64 1
97 #define ARCH_CPU_64_BITS 1
98 #define ARCH_CPU_LITTLE_ENDIAN 1
99 #elif defined(_M_IX86) || defined(__i386__)
100 #define ARCH_CPU_X86_FAMILY 1
101 #define ARCH_CPU_X86 1
102 #define ARCH_CPU_32_BITS 1
103 #define ARCH_CPU_LITTLE_ENDIAN 1
104 #elif defined(__ARMEL__)
105 #define ARCH_CPU_ARM_FAMILY 1
106 #define ARCH_CPU_ARMEL 1
107 #define ARCH_CPU_32_BITS 1
108 #define ARCH_CPU_LITTLE_ENDIAN 1
109 #elif defined(__pnacl__)
110 #define ARCH_CPU_32_BITS 1
111 #define ARCH_CPU_LITTLE_ENDIAN 1
112 #elif defined(__MIPSEL__)
113 #define ARCH_CPU_MIPS_FAMILY 1
114 #define ARCH_CPU_MIPSEL 1
115 #define ARCH_CPU_32_BITS 1
116 #define ARCH_CPU_LITTLE_ENDIAN 1
117 #else
118 #error Please add support for your architecture in build/build_config.h
119 #endif
121 // Type detection for wchar_t.
122 #if defined(OS_WIN)
123 #define WCHAR_T_IS_UTF16
124 #elif defined(OS_POSIX) && defined(COMPILER_GCC) && \
125 defined(__WCHAR_MAX__) && \
126 (__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff)
127 #define WCHAR_T_IS_UTF32
128 #elif defined(OS_POSIX) && defined(COMPILER_GCC) && \
129 defined(__WCHAR_MAX__) && \
130 (__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff)
131 // On Posix, we'll detect short wchar_t, but projects aren't guaranteed to
132 // compile in this mode (in particular, Chrome doesn't). This is intended for
133 // other projects using base who manage their own dependencies and make sure
134 // short wchar works for them.
135 #define WCHAR_T_IS_UTF16
136 #else
137 #error Please add support for your compiler in build/build_config.h
138 #endif
140 #if defined(__ARMEL__) && !defined(OS_IOS)
141 #define WCHAR_T_IS_UNSIGNED 1
142 #elif defined(__MIPSEL__)
143 #define WCHAR_T_IS_UNSIGNED 0
144 #endif
146 #if defined(OS_ANDROID)
147 // The compiler thinks std::string::const_iterator and "const char*" are
148 // equivalent types.
149 #define STD_STRING_ITERATOR_IS_CHAR_POINTER
150 // The compiler thinks base::string16::const_iterator and "char16*" are
151 // equivalent types.
152 #define BASE_STRING16_ITERATOR_IS_CHAR16_POINTER
153 #endif
155 #endif // BUILD_BUILD_CONFIG_H_