license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 1 | // Copyright (c) 2006-2008 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. | ||||
[email protected] | 4867b18 | 2008-08-04 21:16:50 | [diff] [blame] | 4 | |
[email protected] | ab8c0b0 | 2008-08-05 11:56:30 | [diff] [blame] | 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 | |||||
[email protected] | 4867b18 | 2008-08-04 21:16:50 | [diff] [blame] | 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 | ||||
[email protected] | 19ea84ca | 2010-11-12 08:37:08 | [diff] [blame^] | 20 | #elif defined(__native_client__) |
21 | #define OS_NACL 1 | ||||
[email protected] | 1020d2f | 2008-08-14 11:21:28 | [diff] [blame] | 22 | #elif defined(__linux__) |
[email protected] | 4867b18 | 2008-08-04 21:16:50 | [diff] [blame] | 23 | #define OS_LINUX 1 |
[email protected] | 0ae186f | 2009-05-07 23:41:29 | [diff] [blame] | 24 | // Use TOOLKIT_GTK on linux if TOOLKIT_VIEWS isn't defined. |
25 | #if !defined(TOOLKIT_VIEWS) | ||||
26 | #define TOOLKIT_GTK | ||||
27 | #endif | ||||
[email protected] | f61b898b | 2009-02-09 15:42:08 | [diff] [blame] | 28 | #elif defined(_WIN32) |
[email protected] | 771b2fd | 2008-08-04 21:32:57 | [diff] [blame] | 29 | #define OS_WIN 1 |
[email protected] | 321792e | 2009-05-13 23:21:45 | [diff] [blame] | 30 | #define TOOLKIT_VIEWS 1 |
[email protected] | fb66f9d | 2009-09-07 16:39:46 | [diff] [blame] | 31 | #elif defined(__FreeBSD__) |
32 | #define OS_FREEBSD 1 | ||||
33 | #define TOOLKIT_GTK | ||||
[email protected] | c51e8d5 | 2009-12-11 20:04:06 | [diff] [blame] | 34 | #elif defined(__OpenBSD__) |
35 | #define OS_OPENBSD 1 | ||||
36 | #define TOOLKIT_GTK | ||||
[email protected] | 93f21e4 | 2010-04-01 00:35:15 | [diff] [blame] | 37 | #elif defined(__sun) |
[email protected] | b5c72b82 | 2010-02-18 16:11:37 | [diff] [blame] | 38 | #define OS_SOLARIS 1 |
39 | #define TOOLKIT_GTK | ||||
[email protected] | 4867b18 | 2008-08-04 21:16:50 | [diff] [blame] | 40 | #else |
41 | #error Please add support for your platform in build/build_config.h | ||||
42 | #endif | ||||
43 | |||||
[email protected] | 10a6e77b | 2009-12-31 01:03:52 | [diff] [blame] | 44 | // A flag derived from the above flags, used to cover GTK code in |
45 | // both TOOLKIT_GTK and TOOLKIT_VIEWS. | ||||
46 | #if defined(TOOLKIT_GTK) || (defined(TOOLKIT_VIEWS) && !defined(OS_WIN)) | ||||
47 | #define TOOLKIT_USES_GTK 1 | ||||
48 | #endif | ||||
49 | |||||
[email protected] | b5c72b82 | 2010-02-18 16:11:37 | [diff] [blame] | 50 | #if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || \ |
51 | defined(OS_SOLARIS) | ||||
[email protected] | 70372d4 | 2010-10-22 13:12:34 | [diff] [blame] | 52 | #if !defined(USE_OPENSSL) |
53 | #define USE_NSS 1 // Default to use NSS for crypto, unless OpenSSL is chosen. | ||||
54 | #endif | ||||
[email protected] | c51e8d5 | 2009-12-11 20:04:06 | [diff] [blame] | 55 | #define USE_X11 1 // Use X for graphics. |
56 | #endif | ||||
57 | |||||
[email protected] | 70372d4 | 2010-10-22 13:12:34 | [diff] [blame] | 58 | #if defined(USE_OPENSSL) && defined(USE_NSS) |
59 | #error Cannot use both OpenSSL and NSS | ||||
60 | #endif | ||||
61 | |||||
[email protected] | fb66f9d | 2009-09-07 16:39:46 | [diff] [blame] | 62 | // For access to standard POSIXish features, use OS_POSIX instead of a |
63 | // more specific macro. | ||||
[email protected] | c2a4c3d9 | 2010-01-28 00:32:10 | [diff] [blame] | 64 | #if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FREEBSD) || \ |
[email protected] | 19ea84ca | 2010-11-12 08:37:08 | [diff] [blame^] | 65 | defined(OS_OPENBSD) || defined(OS_SOLARIS) || defined(OS_NACL) |
[email protected] | 4867b18 | 2008-08-04 21:16:50 | [diff] [blame] | 66 | #define OS_POSIX 1 |
[email protected] | fb66f9d | 2009-09-07 16:39:46 | [diff] [blame] | 67 | // Use base::DataPack for name/value pairs. |
[email protected] | fb66f9d | 2009-09-07 16:39:46 | [diff] [blame] | 68 | #define USE_BASE_DATA_PACK 1 |
69 | #endif | ||||
70 | |||||
[email protected] | 833b88a | 2009-09-22 16:16:39 | [diff] [blame] | 71 | // Use tcmalloc |
[email protected] | 61a9b2d8 | 2010-02-26 00:31:08 | [diff] [blame] | 72 | #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(NO_TCMALLOC) |
[email protected] | 833b88a | 2009-09-22 16:16:39 | [diff] [blame] | 73 | #define USE_TCMALLOC 1 |
74 | #endif | ||||
75 | |||||
[email protected] | d8b6060 | 2010-03-26 09:41:22 | [diff] [blame] | 76 | // Use heapchecker. |
[email protected] | 4956af10 | 2010-10-15 20:15:04 | [diff] [blame] | 77 | #if defined(OS_LINUX) && !defined(NO_HEAPCHECKER) |
[email protected] | d8b6060 | 2010-03-26 09:41:22 | [diff] [blame] | 78 | #define USE_HEAPCHECKER 1 |
79 | #endif | ||||
80 | |||||
[email protected] | 4867b18 | 2008-08-04 21:16:50 | [diff] [blame] | 81 | // Compiler detection. |
82 | #if defined(__GNUC__) | ||||
[email protected] | ab8c0b0 | 2008-08-05 11:56:30 | [diff] [blame] | 83 | #define COMPILER_GCC 1 |
[email protected] | 4867b18 | 2008-08-04 21:16:50 | [diff] [blame] | 84 | #elif defined(_MSC_VER) |
[email protected] | ab8c0b0 | 2008-08-05 11:56:30 | [diff] [blame] | 85 | #define COMPILER_MSVC 1 |
86 | #else | ||||
87 | #error Please add support for your compiler in build/build_config.h | ||||
88 | #endif | ||||
89 | |||||
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 | ||||
[email protected] | 697776a | 2009-05-01 17:57:09 | [diff] [blame] | 93 | // or with gcc, run: "echo | gcc -E -dM -" |
[email protected] | ab8c0b0 | 2008-08-05 11:56:30 | [diff] [blame] | 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 | #elif defined(_M_IX86) || defined(__i386__) | ||||
99 | #define ARCH_CPU_X86_FAMILY 1 | ||||
100 | #define ARCH_CPU_X86 1 | ||||
101 | #define ARCH_CPU_32_BITS 1 | ||||
[email protected] | 697776a | 2009-05-01 17:57:09 | [diff] [blame] | 102 | #elif defined(__ARMEL__) |
103 | #define ARCH_CPU_ARM_FAMILY 1 | ||||
104 | #define ARCH_CPU_ARMEL 1 | ||||
105 | #define ARCH_CPU_32_BITS 1 | ||||
[email protected] | 95fe390 | 2009-05-04 21:13:42 | [diff] [blame] | 106 | #define WCHAR_T_IS_UNSIGNED 1 |
[email protected] | ab8c0b0 | 2008-08-05 11:56:30 | [diff] [blame] | 107 | #else |
108 | #error Please add support for your architecture in build/build_config.h | ||||
[email protected] | 4867b18 | 2008-08-04 21:16:50 | [diff] [blame] | 109 | #endif |
110 | |||||
[email protected] | 39be424 | 2008-08-07 18:31:40 | [diff] [blame] | 111 | // Type detection for wchar_t. |
112 | #if defined(OS_WIN) | ||||
113 | #define WCHAR_T_IS_UTF16 | ||||
114 | #elif defined(OS_POSIX) && defined(COMPILER_GCC) && \ | ||||
[email protected] | 697776a | 2009-05-01 17:57:09 | [diff] [blame] | 115 | defined(__WCHAR_MAX__) && \ |
116 | (__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff) | ||||
[email protected] | 39be424 | 2008-08-07 18:31:40 | [diff] [blame] | 117 | #define WCHAR_T_IS_UTF32 |
[email protected] | d9a30d9 | 2009-10-22 18:04:17 | [diff] [blame] | 118 | #elif defined(OS_POSIX) && defined(COMPILER_GCC) && \ |
119 | defined(__WCHAR_MAX__) && \ | ||||
120 | (__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff) | ||||
121 | // On Posix, we'll detect short wchar_t, but projects aren't guaranteed to | ||||
122 | // compile in this mode (in particular, Chrome doesn't). This is intended for | ||||
123 | // other projects using base who manage their own dependencies and make sure | ||||
124 | // short wchar works for them. | ||||
125 | #define WCHAR_T_IS_UTF16 | ||||
[email protected] | 39be424 | 2008-08-07 18:31:40 | [diff] [blame] | 126 | #else |
127 | #error Please add support for your compiler in build/build_config.h | ||||
128 | #endif | ||||
129 | |||||
[email protected] | 4867b18 | 2008-08-04 21:16:50 | [diff] [blame] | 130 | #endif // BUILD_BUILD_CONFIG_H_ |