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] | 1020d2f | 2008-08-14 11:21:28 | [diff] [blame] | 20 | #elif defined(__linux__) |
[email protected] | 4867b18 | 2008-08-04 21:16:50 | [diff] [blame] | 21 | #define OS_LINUX 1 |
[email protected] | f61b898b | 2009-02-09 15:42:08 | [diff] [blame] | 22 | #elif defined(_WIN32) |
[email protected] | 771b2fd | 2008-08-04 21:32:57 | [diff] [blame] | 23 | #define OS_WIN 1 |
[email protected] | 4867b18 | 2008-08-04 21:16:50 | [diff] [blame] | 24 | #else |
25 | #error Please add support for your platform in build/build_config.h | ||||
26 | #endif | ||||
27 | |||||
28 | // For access to standard POSIX features, use OS_POSIX instead of a more | ||||
29 | // specific macro. | ||||
30 | #if defined(OS_MACOSX) || defined(OS_LINUX) | ||||
31 | #define OS_POSIX 1 | ||||
32 | #endif | ||||
33 | |||||
34 | // Compiler detection. | ||||
35 | #if defined(__GNUC__) | ||||
[email protected] | ab8c0b0 | 2008-08-05 11:56:30 | [diff] [blame] | 36 | #define COMPILER_GCC 1 |
[email protected] | 4867b18 | 2008-08-04 21:16:50 | [diff] [blame] | 37 | #elif defined(_MSC_VER) |
[email protected] | ab8c0b0 | 2008-08-05 11:56:30 | [diff] [blame] | 38 | #define COMPILER_MSVC 1 |
39 | #else | ||||
40 | #error Please add support for your compiler in build/build_config.h | ||||
41 | #endif | ||||
42 | |||||
43 | // Processor architecture detection. For more info on what's defined, see: | ||||
44 | // http://msdn.microsoft.com/en-us/library/b0084kay.aspx | ||||
45 | // http://www.agner.org/optimize/calling_conventions.pdf | ||||
[email protected] | 697776a | 2009-05-01 17:57:09 | [diff] [blame] | 46 | // or with gcc, run: "echo | gcc -E -dM -" |
[email protected] | ab8c0b0 | 2008-08-05 11:56:30 | [diff] [blame] | 47 | #if defined(_M_X64) || defined(__x86_64__) |
48 | #define ARCH_CPU_X86_FAMILY 1 | ||||
49 | #define ARCH_CPU_X86_64 1 | ||||
50 | #define ARCH_CPU_64_BITS 1 | ||||
51 | #elif defined(_M_IX86) || defined(__i386__) | ||||
52 | #define ARCH_CPU_X86_FAMILY 1 | ||||
53 | #define ARCH_CPU_X86 1 | ||||
54 | #define ARCH_CPU_32_BITS 1 | ||||
[email protected] | 697776a | 2009-05-01 17:57:09 | [diff] [blame] | 55 | #elif defined(__ARMEL__) |
56 | #define ARCH_CPU_ARM_FAMILY 1 | ||||
57 | #define ARCH_CPU_ARMEL 1 | ||||
58 | #define ARCH_CPU_32_BITS 1 | ||||
[email protected] | 95fe390 | 2009-05-04 21:13:42 | [diff] [blame^] | 59 | #define WCHAR_T_IS_UNSIGNED 1 |
[email protected] | ab8c0b0 | 2008-08-05 11:56:30 | [diff] [blame] | 60 | #else |
61 | #error Please add support for your architecture in build/build_config.h | ||||
[email protected] | 4867b18 | 2008-08-04 21:16:50 | [diff] [blame] | 62 | #endif |
63 | |||||
[email protected] | 39be424 | 2008-08-07 18:31:40 | [diff] [blame] | 64 | // Type detection for wchar_t. |
65 | #if defined(OS_WIN) | ||||
66 | #define WCHAR_T_IS_UTF16 | ||||
67 | #elif defined(OS_POSIX) && defined(COMPILER_GCC) && \ | ||||
[email protected] | 697776a | 2009-05-01 17:57:09 | [diff] [blame] | 68 | defined(__WCHAR_MAX__) && \ |
69 | (__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff) | ||||
[email protected] | 39be424 | 2008-08-07 18:31:40 | [diff] [blame] | 70 | #define WCHAR_T_IS_UTF32 |
71 | #else | ||||
72 | #error Please add support for your compiler in build/build_config.h | ||||
73 | #endif | ||||
74 | |||||
[email protected] | 4867b18 | 2008-08-04 21:16:50 | [diff] [blame] | 75 | #endif // BUILD_BUILD_CONFIG_H_ |