blob: d8c3db6ed781791bd8f37dc9cb28511fe5f553c4 [file] [log] [blame]
[email protected]cea4aec2012-01-24 12:26:401// Copyright (c) 2012 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:
hidehikof7295f22014-10-28 11:57:217// OS_WIN / OS_MACOSX / OS_LINUX / OS_POSIX (MACOSX or LINUX) /
8// OS_NACL (NACL_SFI or NACL_NONSFI) / OS_NACL_SFI / OS_NACL_NONSFI
[email protected]ab8c0b02008-08-05 11:56:309// Compiler:
10// COMPILER_MSVC / COMPILER_GCC
11// Processor:
12// ARCH_CPU_X86 / ARCH_CPU_X86_64 / ARCH_CPU_X86_FAMILY (X86 or X86_64)
13// ARCH_CPU_32_BITS / ARCH_CPU_64_BITS
14
[email protected]4867b182008-08-04 21:16:5015#ifndef BUILD_BUILD_CONFIG_H_
16#define BUILD_BUILD_CONFIG_H_
17
18// A set of macros to use for platform detection.
[email protected]d33d2222014-06-04 15:39:5819#if defined(__native_client__)
20// __native_client__ must be first, so that other OS_ defines are not set.
21#define OS_NACL 1
hidehikof7295f22014-10-28 11:57:2122// OS_NACL comes in two sandboxing technology flavors, SFI or Non-SFI.
23// PNaCl toolchain defines __native_client_nonsfi__ macro in Non-SFI build
24// mode, while it does not in SFI build mode.
25#if defined(__native_client_nonsfi__)
26#define OS_NACL_NONSFI
27#else
28#define OS_NACL_SFI
29#endif
[email protected]d33d2222014-06-04 15:39:5830#elif defined(ANDROID)
[email protected]c57a3702013-04-04 11:51:2731#define OS_ANDROID 1
32#elif defined(__APPLE__)
torneecb23482014-09-05 10:33:0733// only include TargetConditions after testing ANDROID as some android builds
34// on mac don't have this header available and it's not needed unless the target
35// is really mac/ios.
36#include <TargetConditionals.h>
[email protected]4867b182008-08-04 21:16:5037#define OS_MACOSX 1
[email protected]3777ee72012-07-04 15:23:3938#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
[email protected]1e013672012-06-29 22:12:2039#define OS_IOS 1
[email protected]3777ee72012-07-04 15:23:3940#endif // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
[email protected]1020d2f2008-08-14 11:21:2841#elif defined(__linux__)
[email protected]4867b182008-08-04 21:16:5042#define OS_LINUX 1
[email protected]145c7052014-04-18 23:40:1643// include a system header to pull in features.h for glibc/uclibc macros.
44#include <unistd.h>
[email protected]292633f02013-05-23 12:00:1045#if defined(__GLIBC__) && !defined(__UCLIBC__)
46// we really are using glibc, not uClibc pretending to be glibc
[email protected]99f352872014-04-07 23:51:4547#define LIBC_GLIBC 1
[email protected]292633f02013-05-23 12:00:1048#endif
[email protected]f61b898b2009-02-09 15:42:0849#elif defined(_WIN32)
[email protected]771b2fd2008-08-04 21:32:5750#define OS_WIN 1
[email protected]321792e2009-05-13 23:21:4551#define TOOLKIT_VIEWS 1
[email protected]fb66f9d2009-09-07 16:39:4652#elif defined(__FreeBSD__)
53#define OS_FREEBSD 1
[email protected]c51e8d52009-12-11 20:04:0654#elif defined(__OpenBSD__)
55#define OS_OPENBSD 1
[email protected]93f21e42010-04-01 00:35:1556#elif defined(__sun)
[email protected]b5c72b822010-02-18 16:11:3757#define OS_SOLARIS 1
[email protected]eda7afa12014-02-06 12:27:3758#elif defined(__QNXNTO__)
59#define OS_QNX 1
[email protected]4867b182008-08-04 21:16:5060#else
61#error Please add support for your platform in build/build_config.h
62#endif
63
davidben2bcbc6bc2015-04-22 02:36:4164#if defined(USE_OPENSSL_CERTS) && defined(USE_NSS_CERTS)
65#error Cannot use both OpenSSL and NSS for certificates
[email protected]70372d42010-10-22 13:12:3466#endif
67
[email protected]e37e88a02011-11-15 00:06:1668// For access to standard BSD features, use OS_BSD instead of a
69// more specific macro.
70#if defined(OS_FREEBSD) || defined(OS_OPENBSD)
71#define OS_BSD 1
72#endif
73
[email protected]fb66f9d2009-09-07 16:39:4674// For access to standard POSIXish features, use OS_POSIX instead of a
75// more specific macro.
[email protected]be16cf22011-06-27 19:13:1076#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FREEBSD) || \
77 defined(OS_OPENBSD) || defined(OS_SOLARIS) || defined(OS_ANDROID) || \
[email protected]eda7afa12014-02-06 12:27:3778 defined(OS_NACL) || defined(OS_QNX)
[email protected]4867b182008-08-04 21:16:5079#define OS_POSIX 1
[email protected]fb66f9d2009-09-07 16:39:4680#endif
81
[email protected]833b88a2009-09-22 16:16:3982// Use tcmalloc
[email protected]3c8fe5482013-05-22 15:17:0383#if (defined(OS_WIN) || defined(OS_LINUX) || defined(OS_ANDROID)) && \
84 !defined(NO_TCMALLOC)
[email protected]833b88a2009-09-22 16:16:3985#define USE_TCMALLOC 1
86#endif
87
[email protected]4867b182008-08-04 21:16:5088// Compiler detection.
89#if defined(__GNUC__)
[email protected]ab8c0b02008-08-05 11:56:3090#define COMPILER_GCC 1
[email protected]4867b182008-08-04 21:16:5091#elif defined(_MSC_VER)
[email protected]ab8c0b02008-08-05 11:56:3092#define COMPILER_MSVC 1
93#else
94#error Please add support for your compiler in build/build_config.h
95#endif
96
97// Processor architecture detection. For more info on what's defined, see:
98// http://msdn.microsoft.com/en-us/library/b0084kay.aspx
99// http://www.agner.org/optimize/calling_conventions.pdf
[email protected]697776a2009-05-01 17:57:09100// or with gcc, run: "echo | gcc -E -dM -"
[email protected]ab8c0b02008-08-05 11:56:30101#if defined(_M_X64) || defined(__x86_64__)
102#define ARCH_CPU_X86_FAMILY 1
103#define ARCH_CPU_X86_64 1
104#define ARCH_CPU_64_BITS 1
[email protected]2377cdee2011-06-24 20:46:06105#define ARCH_CPU_LITTLE_ENDIAN 1
[email protected]ab8c0b02008-08-05 11:56:30106#elif defined(_M_IX86) || defined(__i386__)
107#define ARCH_CPU_X86_FAMILY 1
108#define ARCH_CPU_X86 1
109#define ARCH_CPU_32_BITS 1
[email protected]2377cdee2011-06-24 20:46:06110#define ARCH_CPU_LITTLE_ENDIAN 1
[email protected]697776a2009-05-01 17:57:09111#elif defined(__ARMEL__)
112#define ARCH_CPU_ARM_FAMILY 1
113#define ARCH_CPU_ARMEL 1
114#define ARCH_CPU_32_BITS 1
[email protected]2377cdee2011-06-24 20:46:06115#define ARCH_CPU_LITTLE_ENDIAN 1
[email protected]e1992782014-03-31 22:10:30116#elif defined(__aarch64__)
[email protected]70d36252014-02-06 02:51:01117#define ARCH_CPU_ARM_FAMILY 1
118#define ARCH_CPU_ARM64 1
119#define ARCH_CPU_64_BITS 1
120#define ARCH_CPU_LITTLE_ENDIAN 1
[email protected]814127c2011-08-26 19:03:20121#elif defined(__pnacl__)
122#define ARCH_CPU_32_BITS 1
[email protected]61e881cd2013-12-03 02:33:06123#define ARCH_CPU_LITTLE_ENDIAN 1
[email protected]f7d2fbd2012-06-18 02:47:05124#elif defined(__MIPSEL__)
[email protected]5614f2852014-08-14 17:14:05125#if defined(__LP64__)
126#define ARCH_CPU_MIPS64_FAMILY 1
127#define ARCH_CPU_MIPS64EL 1
128#define ARCH_CPU_64_BITS 1
129#define ARCH_CPU_LITTLE_ENDIAN 1
130#else
[email protected]f7d2fbd2012-06-18 02:47:05131#define ARCH_CPU_MIPS_FAMILY 1
132#define ARCH_CPU_MIPSEL 1
133#define ARCH_CPU_32_BITS 1
134#define ARCH_CPU_LITTLE_ENDIAN 1
[email protected]5614f2852014-08-14 17:14:05135#endif
[email protected]ab8c0b02008-08-05 11:56:30136#else
137#error Please add support for your architecture in build/build_config.h
[email protected]4867b182008-08-04 21:16:50138#endif
139
[email protected]39be4242008-08-07 18:31:40140// Type detection for wchar_t.
141#if defined(OS_WIN)
142#define WCHAR_T_IS_UTF16
143#elif defined(OS_POSIX) && defined(COMPILER_GCC) && \
[email protected]697776a2009-05-01 17:57:09144 defined(__WCHAR_MAX__) && \
145 (__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff)
[email protected]39be4242008-08-07 18:31:40146#define WCHAR_T_IS_UTF32
[email protected]d9a30d92009-10-22 18:04:17147#elif defined(OS_POSIX) && defined(COMPILER_GCC) && \
148 defined(__WCHAR_MAX__) && \
149 (__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff)
150// On Posix, we'll detect short wchar_t, but projects aren't guaranteed to
151// compile in this mode (in particular, Chrome doesn't). This is intended for
152// other projects using base who manage their own dependencies and make sure
153// short wchar works for them.
154#define WCHAR_T_IS_UTF16
[email protected]39be4242008-08-07 18:31:40155#else
156#error Please add support for your compiler in build/build_config.h
157#endif
158
[email protected]be16cf22011-06-27 19:13:10159#if defined(OS_ANDROID)
160// The compiler thinks std::string::const_iterator and "const char*" are
161// equivalent types.
162#define STD_STRING_ITERATOR_IS_CHAR_POINTER
163// The compiler thinks base::string16::const_iterator and "char16*" are
164// equivalent types.
165#define BASE_STRING16_ITERATOR_IS_CHAR16_POINTER
166#endif
167
[email protected]4867b182008-08-04 21:16:50168#endif // BUILD_BUILD_CONFIG_H_