Roll src/third_party/skia 26fc1bf:f559de4
[chromium-blink-merge.git] / third_party / cld / base / build_config.h
blobef6d40b96677656188910fd4015a4be53feae98b
1 // Copyright (c) 2012 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.
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
14 #ifndef BUILD_BUILD_CONFIG_H_
15 #define BUILD_BUILD_CONFIG_H_
17 // A set of macros to use for platform detection.
18 #if defined(__APPLE__)
19 #define OS_MACOSX 1
20 #elif defined(ANDROID)
21 #define OS_ANDROID 1
22 #elif defined(__linux__)
23 #define OS_LINUX 1
24 // Use TOOLKIT_GTK on linux if TOOLKIT_VIEWS isn't defined.
25 #if !defined(TOOLKIT_VIEWS)
26 #define TOOLKIT_GTK
27 #endif
28 #elif defined(_WIN32)
29 #define OS_WIN 1
30 #define TOOLKIT_VIEWS 1
31 #elif defined(__FreeBSD__)
32 #define OS_FREEBSD 1
33 #define TOOLKIT_GTK
34 #elif defined(__OpenBSD__)
35 #define OS_OPENBSD 1
36 #define TOOLKIT_GTK
37 #elif defined(__sun)
38 #define OS_SOLARIS 1
39 #define TOOLKIT_GTK
40 #else
41 #error Please add support for your platform in build/build_config.h
42 #endif
44 #if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || \
45 defined(OS_ANDROID)
46 #define USE_NSS 1 // Use NSS for crypto.
47 #ifndef OS_ANDROID
48 #define USE_X11 1 // Use X for graphics.
49 #endif
50 #endif
52 // For access to standard POSIXish features, use OS_POSIX instead of a
53 // more specific macro.
54 #if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FREEBSD) || \
55 defined(OS_OPENBSD) || defined(OS_SOLARIS) || defined(OS_ANDROID)
56 #define OS_POSIX 1
57 // Use base::DataPack for name/value pairs.
58 #define USE_BASE_DATA_PACK 1
59 #endif
61 // Use tcmalloc
62 #if defined(OS_WIN) && ! defined(NO_TCMALLOC)
63 #define USE_TCMALLOC 1
64 #endif
66 // Compiler detection.
67 #if defined(__GNUC__)
68 #define COMPILER_GCC 1
69 #elif defined(_MSC_VER)
70 #define COMPILER_MSVC 1
71 #else
72 #error Please add support for your compiler in build/build_config.h
73 #endif
75 // Processor architecture detection. For more info on what's defined, see:
76 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx
77 // http://www.agner.org/optimize/calling_conventions.pdf
78 // or with gcc, run: "echo | gcc -E -dM -"
79 #if defined(_M_X64) || defined(__x86_64__)
80 #define ARCH_CPU_X86_FAMILY 1
81 #define ARCH_CPU_X86_64 1
82 #define ARCH_CPU_64_BITS 1
83 #elif defined(_M_IX86) || defined(__i386__)
84 #define ARCH_CPU_X86_FAMILY 1
85 #define ARCH_CPU_X86 1
86 #define ARCH_CPU_32_BITS 1
87 #elif defined(__ARMEL__)
88 #define ARCH_CPU_ARM_FAMILY 1
89 #define ARCH_CPU_ARMEL 1
90 #define ARCH_CPU_32_BITS 1
91 #define WCHAR_T_IS_UNSIGNED 1
92 #elif defined(__aarch64__)
93 #define ARCH_CPU_ARM_FAMILY 1
94 #define ARCH_CPU_ARM64 1
95 #define ARCH_CPU_64_BITS 1
96 #define WCHAR_T_IS_UNSIGNED 1
97 #elif defined(__MIPSEL__)
98 #define ARCH_CPU_MIPS_FAMILY 1
99 #define ARCH_CPU_MIPSEL 1
100 #define ARCH_CPU_32_BITS 1
101 #define WCHAR_T_IS_UNSIGNED 0
102 #else
103 #error Please add support for your architecture in build/build_config.h
104 #endif
106 // Type detection for wchar_t.
107 #if defined(OS_WIN)
108 #define WCHAR_T_IS_UTF16
109 #elif defined(OS_POSIX) && defined(COMPILER_GCC) && \
110 defined(__WCHAR_MAX__) && \
111 (__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff)
112 #define WCHAR_T_IS_UTF32
113 #elif defined(OS_POSIX) && defined(COMPILER_GCC) && \
114 defined(__WCHAR_MAX__) && \
115 (__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff)
116 // On Posix, we'll detect short wchar_t, but projects aren't guaranteed to
117 // compile in this mode (in particular, Chrome doesn't). This is intended for
118 // other projects using base who manage their own dependencies and make sure
119 // short wchar works for them.
120 #define WCHAR_T_IS_UTF16
121 #else
122 #error Please add support for your compiler in build/build_config.h
123 #endif
125 #endif // BUILD_BUILD_CONFIG_H_