|
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. |
|
4 |
|
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 |
|
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(ANDROID) |
|
19 #define OS_ANDROID 1 |
|
20 #define OS_LINUX 1 |
|
21 #elif defined(__APPLE__) |
|
22 #define OS_MACOSX 1 |
|
23 #elif defined(__linux__) |
|
24 #define OS_LINUX 1 |
|
25 #elif defined(__DragonFly__) |
|
26 #define OS_DRAGONFLY 1 |
|
27 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) |
|
28 #define OS_FREEBSD 1 |
|
29 #elif defined(__NetBSD__) |
|
30 #define OS_NETBSD 1 |
|
31 #elif defined(__OpenBSD__) |
|
32 #define OS_OPENBSD 1 |
|
33 #elif defined(_WIN32) |
|
34 #define OS_WIN 1 |
|
35 #else |
|
36 #error Please add support for your platform in build/build_config.h |
|
37 #endif |
|
38 |
|
39 // For access to standard BSD features, use OS_BSD instead of a |
|
40 // more specific macro. |
|
41 #if defined(OS_DRAGONFLY) || defined(OS_FREEBSD) \ |
|
42 || defined(OS_NETBSD) || defined(OS_OPENBSD) |
|
43 #define OS_BSD 1 |
|
44 #endif |
|
45 |
|
46 // For access to standard POSIX features, use OS_POSIX instead of a more |
|
47 // specific macro. |
|
48 #if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_BSD) |
|
49 #define OS_POSIX 1 |
|
50 #endif |
|
51 |
|
52 // Compiler detection. |
|
53 #if defined(__GNUC__) |
|
54 #define COMPILER_GCC 1 |
|
55 #elif defined(_MSC_VER) |
|
56 #define COMPILER_MSVC 1 |
|
57 #else |
|
58 #error Please add support for your compiler in build/build_config.h |
|
59 #endif |
|
60 |
|
61 // Processor architecture detection. For more info on what's defined, see: |
|
62 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx |
|
63 // http://www.agner.org/optimize/calling_conventions.pdf |
|
64 // or with gcc, run: "echo | gcc -E -dM -" |
|
65 #if defined(_M_X64) || defined(__x86_64__) |
|
66 #define ARCH_CPU_X86_FAMILY 1 |
|
67 #define ARCH_CPU_X86_64 1 |
|
68 #define ARCH_CPU_64_BITS 1 |
|
69 #elif defined(_M_IX86) || defined(__i386__) |
|
70 #define ARCH_CPU_X86_FAMILY 1 |
|
71 #define ARCH_CPU_X86 1 |
|
72 #define ARCH_CPU_32_BITS 1 |
|
73 #elif defined(__ARMEL__) |
|
74 #define ARCH_CPU_ARM_FAMILY 1 |
|
75 #define ARCH_CPU_ARMEL 1 |
|
76 #define ARCH_CPU_32_BITS 1 |
|
77 #define WCHAR_T_IS_UNSIGNED 1 |
|
78 #elif defined(__powerpc64__) |
|
79 #define ARCH_CPU_PPC64 1 |
|
80 #define ARCH_CPU_64_BITS 1 |
|
81 #elif defined(__ppc__) || defined(__powerpc__) |
|
82 #define ARCH_CPU_PPC 1 |
|
83 #define ARCH_CPU_32_BITS 1 |
|
84 #elif defined(__sparc64__) |
|
85 #define ARCH_CPU_SPARC 1 |
|
86 #define ARCH_CPU_64_BITS 1 |
|
87 #elif defined(__sparc__) |
|
88 #define ARCH_CPU_SPARC 1 |
|
89 #define ARCH_CPU_32_BITS 1 |
|
90 #elif defined(__mips__) |
|
91 #define ARCH_CPU_MIPS 1 |
|
92 #define ARCH_CPU_32_BITS 1 |
|
93 #elif defined(__hppa__) |
|
94 #define ARCH_CPU_HPPA 1 |
|
95 #define ARCH_CPU_32_BITS 1 |
|
96 #elif defined(__ia64__) |
|
97 #define ARCH_CPU_IA64 1 |
|
98 #define ARCH_CPU_64_BITS 1 |
|
99 #elif defined(__s390x__) |
|
100 #define ARCH_CPU_S390X 1 |
|
101 #define ARCH_CPU_64_BITS 1 |
|
102 #elif defined(__s390__) |
|
103 #define ARCH_CPU_S390 1 |
|
104 #define ARCH_CPU_32_BITS 1 |
|
105 #elif defined(__alpha__) |
|
106 #define ARCH_CPU_ALPHA 1 |
|
107 #define ARCH_CPU_64_BITS 1 |
|
108 #elif defined(__aarch64__) |
|
109 #define ARCH_CPU_AARCH64 1 |
|
110 #define ARCH_CPU_64_BITS 1 |
|
111 #else |
|
112 #error Please add support for your architecture in build/build_config.h |
|
113 #endif |
|
114 |
|
115 // Type detection for wchar_t. |
|
116 #if defined(OS_WIN) |
|
117 #define WCHAR_T_IS_UTF16 |
|
118 #else |
|
119 #define WCHAR_T_IS_UTF32 |
|
120 #endif |
|
121 |
|
122 #endif // BUILD_BUILD_CONFIG_H_ |