• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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(__APPLE__)
19 #define OS_MACOSX 1
20 #elif defined(__linux__)
21 #define OS_LINUX 1
22 // Use TOOLKIT_GTK on linux if TOOLKIT_VIEWS isn't defined.
23 #if !defined(TOOLKIT_VIEWS)
24 #define TOOLKIT_GTK
25 #endif
26 #elif defined(_WIN32)
27 #define OS_WIN 1
28 #define TOOLKIT_VIEWS 1
29 #elif defined(__FreeBSD__)
30 #define OS_FREEBSD 1
31 #define TOOLKIT_GTK
32 #elif defined(__OpenBSD__)
33 #define OS_OPENBSD 1
34 #define TOOLKIT_GTK
35 #else
36 #error Please add support for your platform in build/build_config.h
37 #endif
38 
39 // A flag derived from the above flags, used to cover GTK code in
40 // both TOOLKIT_GTK and TOOLKIT_VIEWS.
41 #if defined(TOOLKIT_GTK) || (defined(TOOLKIT_VIEWS) && !defined(OS_WIN))
42 #define TOOLKIT_USES_GTK 1
43 #endif
44 
45 #if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_OPENBSD)
46 #define USE_NSS 1  // Use NSS for crypto.
47 #define USE_X11 1  // Use X for graphics.
48 #endif
49 
50 // For access to standard POSIXish features, use OS_POSIX instead of a
51 // more specific macro.
52 #if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FREEBSD) || \
53     defined(OS_OPENBSD)
54 #define OS_POSIX 1
55 // Use base::DataPack for name/value pairs.
56 #define USE_BASE_DATA_PACK 1
57 #endif
58 
59 // Use tcmalloc
60 #if defined(OS_WIN) && !defined(NO_TCMALLOC)
61 #define USE_TCMALLOC 1
62 #endif
63 
64 // Compiler detection.
65 #if defined(__GNUC__)
66 #define COMPILER_GCC 1
67 #elif defined(_MSC_VER)
68 #define COMPILER_MSVC 1
69 #else
70 #error Please add support for your compiler in build/build_config.h
71 #endif
72 
73 // Processor architecture detection.  For more info on what's defined, see:
74 //   http://msdn.microsoft.com/en-us/library/b0084kay.aspx
75 //   http://www.agner.org/optimize/calling_conventions.pdf
76 //   or with gcc, run: "echo | gcc -E -dM -"
77 #if defined(_M_X64) || defined(__x86_64__)
78 #define ARCH_CPU_X86_FAMILY 1
79 #define ARCH_CPU_X86_64 1
80 #define ARCH_CPU_64_BITS 1
81 #elif defined(_M_IX86) || defined(__i386__)
82 #define ARCH_CPU_X86_FAMILY 1
83 #define ARCH_CPU_X86 1
84 #define ARCH_CPU_32_BITS 1
85 #elif defined(__ARMEL__)
86 #define ARCH_CPU_ARM_FAMILY 1
87 #define ARCH_CPU_ARMEL 1
88 #define ARCH_CPU_32_BITS 1
89 #define WCHAR_T_IS_UNSIGNED 1
90 #else
91 #error Please add support for your architecture in build/build_config.h
92 #endif
93 
94 // Type detection for wchar_t.
95 #if defined(OS_WIN)
96 #define WCHAR_T_IS_UTF16
97 #elif defined(OS_POSIX) && defined(COMPILER_GCC) && \
98     defined(__WCHAR_MAX__) && \
99     (__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff)
100 #define WCHAR_T_IS_UTF32
101 #elif defined(OS_POSIX) && defined(COMPILER_GCC) && \
102     defined(__WCHAR_MAX__) && \
103     (__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff)
104 // On Posix, we'll detect short wchar_t, but projects aren't guaranteed to
105 // compile in this mode (in particular, Chrome doesn't). This is intended for
106 // other projects using base who manage their own dependencies and make sure
107 // short wchar works for them.
108 #define WCHAR_T_IS_UTF16
109 #else
110 #error Please add support for your compiler in build/build_config.h
111 #endif
112 
113 #endif  // BUILD_BUILD_CONFIG_H_
114