blob: 87dd25986493fc58a1bc62f2cb895558319b7fcb [file] [log] [blame]
[email protected]4867b182008-08-04 21:16:501// Copyright 2008, Google Inc.
2// All rights reserved.
3//
4// Redistribution and use in source and binary forms, with or without
5// modification, are permitted provided that the following conditions are
6// met:
7//
8// * Redistributions of source code must retain the above copyright
9// notice, this list of conditions and the following disclaimer.
10// * Redistributions in binary form must reproduce the above
11// copyright notice, this list of conditions and the following disclaimer
12// in the documentation and/or other materials provided with the
13// distribution.
14// * Neither the name of Google Inc. nor the names of its
15// contributors may be used to endorse or promote products derived from
16// this software without specific prior written permission.
17//
18// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
[email protected]ab8c0b02008-08-05 11:56:3030// This file adds defines about the platform we're currently building on.
31// Operating System:
32// OS_WIN / OS_MACOSX / OS_LINUX / OS_POSIX (MACOSX or LINUX)
33// Compiler:
34// COMPILER_MSVC / COMPILER_GCC
35// Processor:
36// ARCH_CPU_X86 / ARCH_CPU_X86_64 / ARCH_CPU_X86_FAMILY (X86 or X86_64)
37// ARCH_CPU_32_BITS / ARCH_CPU_64_BITS
38
[email protected]4867b182008-08-04 21:16:5039#ifndef BUILD_BUILD_CONFIG_H_
40#define BUILD_BUILD_CONFIG_H_
41
42// A set of macros to use for platform detection.
43#if defined(__APPLE__)
44#define OS_MACOSX 1
45#elif defined(linux)
46#define OS_LINUX 1
47#elif defined(WIN32)
[email protected]771b2fd2008-08-04 21:32:5748#define OS_WIN 1
[email protected]4867b182008-08-04 21:16:5049#else
50#error Please add support for your platform in build/build_config.h
51#endif
52
53// For access to standard POSIX features, use OS_POSIX instead of a more
54// specific macro.
55#if defined(OS_MACOSX) || defined(OS_LINUX)
56#define OS_POSIX 1
57#endif
58
59// Compiler detection.
60#if defined(__GNUC__)
[email protected]ab8c0b02008-08-05 11:56:3061#define COMPILER_GCC 1
[email protected]4867b182008-08-04 21:16:5062#elif defined(_MSC_VER)
[email protected]ab8c0b02008-08-05 11:56:3063#define COMPILER_MSVC 1
64#else
65#error Please add support for your compiler in build/build_config.h
66#endif
67
68// Processor architecture detection. For more info on what's defined, see:
69// http://msdn.microsoft.com/en-us/library/b0084kay.aspx
70// http://www.agner.org/optimize/calling_conventions.pdf
71#if defined(_M_X64) || defined(__x86_64__)
72#define ARCH_CPU_X86_FAMILY 1
73#define ARCH_CPU_X86_64 1
74#define ARCH_CPU_64_BITS 1
75#elif defined(_M_IX86) || defined(__i386__)
76#define ARCH_CPU_X86_FAMILY 1
77#define ARCH_CPU_X86 1
78#define ARCH_CPU_32_BITS 1
79#else
80#error Please add support for your architecture in build/build_config.h
[email protected]4867b182008-08-04 21:16:5081#endif
82
83#endif // BUILD_BUILD_CONFIG_H_