blob: 5c09d4548787b0cecb12b6d5f274777f57527190 [file] [log] [blame]
[email protected]947f3a72011-08-02 18:53:531// Copyright (c) 2011 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
[email protected]4867b182008-08-04 21:16:504
[email protected]ab8c0b02008-08-05 11:56:305// 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]4867b182008-08-04 21:16:5014#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]be16cf22011-06-27 19:13:1020#elif defined(ANDROID)
21#define OS_ANDROID 1
[email protected]19ea84ca2010-11-12 08:37:0822#elif defined(__native_client__)
23#define OS_NACL 1
[email protected]1020d2f2008-08-14 11:21:2824#elif defined(__linux__)
[email protected]4867b182008-08-04 21:16:5025#define OS_LINUX 1
[email protected]0ae186f2009-05-07 23:41:2926// Use TOOLKIT_GTK on linux if TOOLKIT_VIEWS isn't defined.
27#if !defined(TOOLKIT_VIEWS)
28#define TOOLKIT_GTK
29#endif
[email protected]f61b898b2009-02-09 15:42:0830#elif defined(_WIN32)
[email protected]771b2fd2008-08-04 21:32:5731#define OS_WIN 1
[email protected]321792e2009-05-13 23:21:4532#define TOOLKIT_VIEWS 1
[email protected]fb66f9d2009-09-07 16:39:4633#elif defined(__FreeBSD__)
34#define OS_FREEBSD 1
35#define TOOLKIT_GTK
[email protected]c51e8d52009-12-11 20:04:0636#elif defined(__OpenBSD__)
37#define OS_OPENBSD 1
38#define TOOLKIT_GTK
[email protected]93f21e42010-04-01 00:35:1539#elif defined(__sun)
[email protected]b5c72b822010-02-18 16:11:3740#define OS_SOLARIS 1
41#define TOOLKIT_GTK
[email protected]4867b182008-08-04 21:16:5042#else
43#error Please add support for your platform in build/build_config.h
44#endif
45
[email protected]10a6e77b2009-12-31 01:03:5246// 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
[email protected]b5c72b822010-02-18 16:11:3752#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || \
[email protected]be16cf22011-06-27 19:13:1053 defined(OS_SOLARIS) || defined(OS_ANDROID)
[email protected]70372d42010-10-22 13:12:3454#if !defined(USE_OPENSSL)
55#define USE_NSS 1 // Default to use NSS for crypto, unless OpenSSL is chosen.
56#endif
[email protected]be16cf22011-06-27 19:13:1057#ifndef OS_ANDROID
[email protected]c51e8d52009-12-11 20:04:0658#define USE_X11 1 // Use X for graphics.
59#endif
[email protected]be16cf22011-06-27 19:13:1060#endif
[email protected]c51e8d52009-12-11 20:04:0661
[email protected]70372d42010-10-22 13:12:3462#if defined(USE_OPENSSL) && defined(USE_NSS)
63#error Cannot use both OpenSSL and NSS
64#endif
65
[email protected]fb66f9d2009-09-07 16:39:4666// For access to standard POSIXish features, use OS_POSIX instead of a
67// more specific macro.
[email protected]be16cf22011-06-27 19:13:1068#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FREEBSD) || \
69 defined(OS_OPENBSD) || defined(OS_SOLARIS) || defined(OS_ANDROID) || \
70 defined(OS_NACL)
[email protected]4867b182008-08-04 21:16:5071#define OS_POSIX 1
[email protected]fb66f9d2009-09-07 16:39:4672#endif
73
[email protected]833b88a2009-09-22 16:16:3974// Use tcmalloc
[email protected]61a9b2d82010-02-26 00:31:0875#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(NO_TCMALLOC)
[email protected]833b88a2009-09-22 16:16:3976#define USE_TCMALLOC 1
77#endif
78
[email protected]d8b60602010-03-26 09:41:2279// Use heapchecker.
[email protected]4956af102010-10-15 20:15:0480#if defined(OS_LINUX) && !defined(NO_HEAPCHECKER)
[email protected]d8b60602010-03-26 09:41:2281#define USE_HEAPCHECKER 1
82#endif
83
[email protected]4867b182008-08-04 21:16:5084// Compiler detection.
85#if defined(__GNUC__)
[email protected]ab8c0b02008-08-05 11:56:3086#define COMPILER_GCC 1
[email protected]4867b182008-08-04 21:16:5087#elif defined(_MSC_VER)
[email protected]ab8c0b02008-08-05 11:56:3088#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
[email protected]697776a2009-05-01 17:57:0996// or with gcc, run: "echo | gcc -E -dM -"
[email protected]ab8c0b02008-08-05 11:56:3097#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
[email protected]2377cdee2011-06-24 20:46:06101#define ARCH_CPU_LITTLE_ENDIAN 1
[email protected]ab8c0b02008-08-05 11:56:30102#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
[email protected]2377cdee2011-06-24 20:46:06106#define ARCH_CPU_LITTLE_ENDIAN 1
[email protected]697776a2009-05-01 17:57:09107#elif defined(__ARMEL__)
108#define ARCH_CPU_ARM_FAMILY 1
109#define ARCH_CPU_ARMEL 1
110#define ARCH_CPU_32_BITS 1
[email protected]2377cdee2011-06-24 20:46:06111#define ARCH_CPU_LITTLE_ENDIAN 1
[email protected]95fe3902009-05-04 21:13:42112#define WCHAR_T_IS_UNSIGNED 1
[email protected]814127c2011-08-26 19:03:20113#elif defined(__pnacl__)
114#define ARCH_CPU_32_BITS 1
[email protected]ab8c0b02008-08-05 11:56:30115#else
116#error Please add support for your architecture in build/build_config.h
[email protected]4867b182008-08-04 21:16:50117#endif
118
[email protected]39be4242008-08-07 18:31:40119// Type detection for wchar_t.
120#if defined(OS_WIN)
121#define WCHAR_T_IS_UTF16
122#elif defined(OS_POSIX) && defined(COMPILER_GCC) && \
[email protected]697776a2009-05-01 17:57:09123 defined(__WCHAR_MAX__) && \
124 (__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff)
[email protected]39be4242008-08-07 18:31:40125#define WCHAR_T_IS_UTF32
[email protected]d9a30d92009-10-22 18:04:17126#elif defined(OS_POSIX) && defined(COMPILER_GCC) && \
127 defined(__WCHAR_MAX__) && \
128 (__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff)
129// On Posix, we'll detect short wchar_t, but projects aren't guaranteed to
130// compile in this mode (in particular, Chrome doesn't). This is intended for
131// other projects using base who manage their own dependencies and make sure
132// short wchar works for them.
133#define WCHAR_T_IS_UTF16
[email protected]39be4242008-08-07 18:31:40134#else
135#error Please add support for your compiler in build/build_config.h
136#endif
137
[email protected]068ea4c2010-11-22 20:57:18138#if defined(OS_CHROMEOS)
139// Single define to trigger whether CrOS fonts have BCI on.
140// In that case font sizes/deltas should be adjusted.
141//define CROS_FONTS_USING_BCI
142#endif
143
[email protected]be16cf22011-06-27 19:13:10144#if defined(OS_ANDROID)
145// The compiler thinks std::string::const_iterator and "const char*" are
146// equivalent types.
147#define STD_STRING_ITERATOR_IS_CHAR_POINTER
148// The compiler thinks base::string16::const_iterator and "char16*" are
149// equivalent types.
150#define BASE_STRING16_ITERATOR_IS_CHAR16_POINTER
151#endif
152
[email protected]4867b182008-08-04 21:16:50153#endif // BUILD_BUILD_CONFIG_H_