blob: e2d26cbad97b8024b4f0b7e84e2a4c4eee51677b [file] [log] [blame]
license.botbf09a502008-08-24 00:55:551// 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]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]1020d2f2008-08-14 11:21:2820#elif defined(__linux__)
[email protected]4867b182008-08-04 21:16:5021#define OS_LINUX 1
[email protected]0ae186f2009-05-07 23:41:2922// Use TOOLKIT_GTK on linux if TOOLKIT_VIEWS isn't defined.
23#if !defined(TOOLKIT_VIEWS)
24#define TOOLKIT_GTK
25#endif
[email protected]f61b898b2009-02-09 15:42:0826#elif defined(_WIN32)
[email protected]771b2fd2008-08-04 21:32:5727#define OS_WIN 1
[email protected]321792e2009-05-13 23:21:4528#define TOOLKIT_VIEWS 1
[email protected]fb66f9d2009-09-07 16:39:4629#elif defined(__FreeBSD__)
30#define OS_FREEBSD 1
31#define TOOLKIT_GTK
[email protected]c51e8d52009-12-11 20:04:0632#elif defined(__OpenBSD__)
33#define OS_OPENBSD 1
34#define TOOLKIT_GTK
[email protected]93f21e42010-04-01 00:35:1535#elif defined(__sun)
[email protected]b5c72b822010-02-18 16:11:3736#define OS_SOLARIS 1
37#define TOOLKIT_GTK
[email protected]4867b182008-08-04 21:16:5038#else
39#error Please add support for your platform in build/build_config.h
40#endif
41
[email protected]10a6e77b2009-12-31 01:03:5242// A flag derived from the above flags, used to cover GTK code in
43// both TOOLKIT_GTK and TOOLKIT_VIEWS.
44#if defined(TOOLKIT_GTK) || (defined(TOOLKIT_VIEWS) && !defined(OS_WIN))
45#define TOOLKIT_USES_GTK 1
46#endif
47
[email protected]b5c72b822010-02-18 16:11:3748#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || \
49 defined(OS_SOLARIS)
[email protected]70372d42010-10-22 13:12:3450#if !defined(USE_OPENSSL)
51#define USE_NSS 1 // Default to use NSS for crypto, unless OpenSSL is chosen.
52#endif
[email protected]c51e8d52009-12-11 20:04:0653#define USE_X11 1 // Use X for graphics.
54#endif
55
[email protected]70372d42010-10-22 13:12:3456#if defined(USE_OPENSSL) && defined(USE_NSS)
57#error Cannot use both OpenSSL and NSS
58#endif
59
[email protected]fb66f9d2009-09-07 16:39:4660// For access to standard POSIXish features, use OS_POSIX instead of a
61// more specific macro.
[email protected]c2a4c3d92010-01-28 00:32:1062#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FREEBSD) || \
[email protected]b5c72b822010-02-18 16:11:3763 defined(OS_OPENBSD) || defined(OS_SOLARIS)
[email protected]4867b182008-08-04 21:16:5064#define OS_POSIX 1
[email protected]fb66f9d2009-09-07 16:39:4665// Use base::DataPack for name/value pairs.
[email protected]fb66f9d2009-09-07 16:39:4666#define USE_BASE_DATA_PACK 1
67#endif
68
[email protected]833b88a2009-09-22 16:16:3969// Use tcmalloc
[email protected]61a9b2d82010-02-26 00:31:0870#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(NO_TCMALLOC)
[email protected]833b88a2009-09-22 16:16:3971#define USE_TCMALLOC 1
72#endif
73
[email protected]d8b60602010-03-26 09:41:2274// Use heapchecker.
[email protected]4956af102010-10-15 20:15:0475#if defined(OS_LINUX) && !defined(NO_HEAPCHECKER)
[email protected]d8b60602010-03-26 09:41:2276#define USE_HEAPCHECKER 1
77#endif
78
[email protected]4867b182008-08-04 21:16:5079// Compiler detection.
80#if defined(__GNUC__)
[email protected]ab8c0b02008-08-05 11:56:3081#define COMPILER_GCC 1
[email protected]4867b182008-08-04 21:16:5082#elif defined(_MSC_VER)
[email protected]ab8c0b02008-08-05 11:56:3083#define COMPILER_MSVC 1
84#else
85#error Please add support for your compiler in build/build_config.h
86#endif
87
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
[email protected]697776a2009-05-01 17:57:0991// or with gcc, run: "echo | gcc -E -dM -"
[email protected]ab8c0b02008-08-05 11:56:3092#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#elif defined(_M_IX86) || defined(__i386__)
97#define ARCH_CPU_X86_FAMILY 1
98#define ARCH_CPU_X86 1
99#define ARCH_CPU_32_BITS 1
[email protected]697776a2009-05-01 17:57:09100#elif defined(__ARMEL__)
101#define ARCH_CPU_ARM_FAMILY 1
102#define ARCH_CPU_ARMEL 1
103#define ARCH_CPU_32_BITS 1
[email protected]95fe3902009-05-04 21:13:42104#define WCHAR_T_IS_UNSIGNED 1
[email protected]ab8c0b02008-08-05 11:56:30105#else
106#error Please add support for your architecture in build/build_config.h
[email protected]4867b182008-08-04 21:16:50107#endif
108
[email protected]39be4242008-08-07 18:31:40109// Type detection for wchar_t.
110#if defined(OS_WIN)
111#define WCHAR_T_IS_UTF16
112#elif defined(OS_POSIX) && defined(COMPILER_GCC) && \
[email protected]697776a2009-05-01 17:57:09113 defined(__WCHAR_MAX__) && \
114 (__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff)
[email protected]39be4242008-08-07 18:31:40115#define WCHAR_T_IS_UTF32
[email protected]d9a30d92009-10-22 18:04:17116#elif defined(OS_POSIX) && defined(COMPILER_GCC) && \
117 defined(__WCHAR_MAX__) && \
118 (__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff)
119// On Posix, we'll detect short wchar_t, but projects aren't guaranteed to
120// compile in this mode (in particular, Chrome doesn't). This is intended for
121// other projects using base who manage their own dependencies and make sure
122// short wchar works for them.
123#define WCHAR_T_IS_UTF16
[email protected]39be4242008-08-07 18:31:40124#else
125#error Please add support for your compiler in build/build_config.h
126#endif
127
[email protected]4867b182008-08-04 21:16:50128#endif // BUILD_BUILD_CONFIG_H_