blob: 824e31efac6c88674c19b3902742f42407dfec58 [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]f61b898b2009-02-09 15:42:0822#elif defined(_WIN32)
[email protected]771b2fd2008-08-04 21:32:5723#define OS_WIN 1
[email protected]4867b182008-08-04 21:16:5024#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]ab8c0b02008-08-05 11:56:3036#define COMPILER_GCC 1
[email protected]4867b182008-08-04 21:16:5037#elif defined(_MSC_VER)
[email protected]ab8c0b02008-08-05 11:56:3038#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]697776a2009-05-01 17:57:0946// or with gcc, run: "echo | gcc -E -dM -"
[email protected]ab8c0b02008-08-05 11:56:3047#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]697776a2009-05-01 17:57:0955#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]95fe3902009-05-04 21:13:4259#define WCHAR_T_IS_UNSIGNED 1
[email protected]ab8c0b02008-08-05 11:56:3060#else
61#error Please add support for your architecture in build/build_config.h
[email protected]4867b182008-08-04 21:16:5062#endif
63
[email protected]39be4242008-08-07 18:31:4064// 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]697776a2009-05-01 17:57:0968 defined(__WCHAR_MAX__) && \
69 (__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff)
[email protected]39be4242008-08-07 18:31:4070#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]4867b182008-08-04 21:16:5075#endif // BUILD_BUILD_CONFIG_H_