Rename and refactor DownloadCurrentBuild and related functions.
[chromium-blink-merge.git] / build / build_config.h
blob553484605a857baa66d252ba5df4286ce89b53c7
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) / OS_NACL
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 // A set of macros to use for platform detection.
18 #if defined(__native_client__)
19 // __native_client__ must be first, so that other OS_ defines are not set.
20 #define OS_NACL 1
21 #elif defined(ANDROID)
22 #define OS_ANDROID 1
23 #elif defined(__APPLE__)
24 // only include TargetConditions after testing ANDROID as some android builds
25 // on mac don't have this header available and it's not needed unless the target
26 // is really mac/ios.
27 #include <TargetConditionals.h>
28 #define OS_MACOSX 1
29 #if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
30 #define OS_IOS 1
31 #endif // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
32 #elif defined(__linux__)
33 #define OS_LINUX 1
34 // include a system header to pull in features.h for glibc/uclibc macros.
35 #include <unistd.h>
36 #if defined(__GLIBC__) && !defined(__UCLIBC__)
37 // we really are using glibc, not uClibc pretending to be glibc
38 #define LIBC_GLIBC 1
39 #endif
40 #elif defined(_WIN32)
41 #define OS_WIN 1
42 #define TOOLKIT_VIEWS 1
43 #elif defined(__FreeBSD__)
44 #define OS_FREEBSD 1
45 #elif defined(__OpenBSD__)
46 #define OS_OPENBSD 1
47 #elif defined(__sun)
48 #define OS_SOLARIS 1
49 #elif defined(__QNXNTO__)
50 #define OS_QNX 1
51 #else
52 #error Please add support for your platform in build/build_config.h
53 #endif
55 #if defined(USE_OPENSSL) && defined(USE_NSS)
56 #error Cannot use both OpenSSL and NSS
57 #endif
59 // For access to standard BSD features, use OS_BSD instead of a
60 // more specific macro.
61 #if defined(OS_FREEBSD) || defined(OS_OPENBSD)
62 #define OS_BSD 1
63 #endif
65 // For access to standard POSIXish features, use OS_POSIX instead of a
66 // more specific macro.
67 #if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FREEBSD) || \
68 defined(OS_OPENBSD) || defined(OS_SOLARIS) || defined(OS_ANDROID) || \
69 defined(OS_NACL) || defined(OS_QNX)
70 #define OS_POSIX 1
71 #endif
73 // Use tcmalloc
74 #if (defined(OS_WIN) || defined(OS_LINUX) || defined(OS_ANDROID)) && \
75 !defined(NO_TCMALLOC)
76 #define USE_TCMALLOC 1
77 #endif
79 // Compiler detection.
80 #if defined(__GNUC__)
81 #define COMPILER_GCC 1
82 #elif defined(_MSC_VER)
83 #define COMPILER_MSVC 1
84 #else
85 #error Please add support for your compiler in build/build_config.h
86 #endif
88 // Processor architecture detection. For more info on what's defined, see:
89 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx
90 // http://www.agner.org/optimize/calling_conventions.pdf
91 // or with gcc, run: "echo | gcc -E -dM -"
92 #if defined(_M_X64) || defined(__x86_64__)
93 #define ARCH_CPU_X86_FAMILY 1
94 #define ARCH_CPU_X86_64 1
95 #define ARCH_CPU_64_BITS 1
96 #define ARCH_CPU_LITTLE_ENDIAN 1
97 #elif defined(_M_IX86) || defined(__i386__)
98 #define ARCH_CPU_X86_FAMILY 1
99 #define ARCH_CPU_X86 1
100 #define ARCH_CPU_32_BITS 1
101 #define ARCH_CPU_LITTLE_ENDIAN 1
102 #elif defined(__ARMEL__)
103 #define ARCH_CPU_ARM_FAMILY 1
104 #define ARCH_CPU_ARMEL 1
105 #define ARCH_CPU_32_BITS 1
106 #define ARCH_CPU_LITTLE_ENDIAN 1
107 #elif defined(__aarch64__)
108 #define ARCH_CPU_ARM_FAMILY 1
109 #define ARCH_CPU_ARM64 1
110 #define ARCH_CPU_64_BITS 1
111 #define ARCH_CPU_LITTLE_ENDIAN 1
112 #elif defined(__pnacl__)
113 #define ARCH_CPU_32_BITS 1
114 #define ARCH_CPU_LITTLE_ENDIAN 1
115 #elif defined(__MIPSEL__)
116 #if defined(__LP64__)
117 #define ARCH_CPU_MIPS64_FAMILY 1
118 #define ARCH_CPU_MIPS64EL 1
119 #define ARCH_CPU_64_BITS 1
120 #define ARCH_CPU_LITTLE_ENDIAN 1
121 #else
122 #define ARCH_CPU_MIPS_FAMILY 1
123 #define ARCH_CPU_MIPSEL 1
124 #define ARCH_CPU_32_BITS 1
125 #define ARCH_CPU_LITTLE_ENDIAN 1
126 #endif
127 #else
128 #error Please add support for your architecture in build/build_config.h
129 #endif
131 // Type detection for wchar_t.
132 #if defined(OS_WIN)
133 #define WCHAR_T_IS_UTF16
134 #elif defined(OS_POSIX) && defined(COMPILER_GCC) && \
135 defined(__WCHAR_MAX__) && \
136 (__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff)
137 #define WCHAR_T_IS_UTF32
138 #elif defined(OS_POSIX) && defined(COMPILER_GCC) && \
139 defined(__WCHAR_MAX__) && \
140 (__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff)
141 // On Posix, we'll detect short wchar_t, but projects aren't guaranteed to
142 // compile in this mode (in particular, Chrome doesn't). This is intended for
143 // other projects using base who manage their own dependencies and make sure
144 // short wchar works for them.
145 #define WCHAR_T_IS_UTF16
146 #else
147 #error Please add support for your compiler in build/build_config.h
148 #endif
150 #if defined(OS_ANDROID)
151 // The compiler thinks std::string::const_iterator and "const char*" are
152 // equivalent types.
153 #define STD_STRING_ITERATOR_IS_CHAR_POINTER
154 // The compiler thinks base::string16::const_iterator and "char16*" are
155 // equivalent types.
156 #define BASE_STRING16_ITERATOR_IS_CHAR16_POINTER
157 #endif
159 #endif // BUILD_BUILD_CONFIG_H_