build_config.h revision 2f7cea8af61f1126d50e0749f4ced7844b14f5b4
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#if defined(ANDROID) 51#define USE_OPENSSL 1 52#undef USE_NSS 53#define USE_SYSTEM_ZLIB 1 54#endif 55 56// For access to standard POSIXish features, use OS_POSIX instead of a 57// more specific macro. 58#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FREEBSD) || \ 59 defined(OS_OPENBSD) 60#define OS_POSIX 1 61// Use base::DataPack for name/value pairs. 62#define USE_BASE_DATA_PACK 1 63#endif 64 65// Use tcmalloc 66#if defined(OS_WIN) && !defined(NO_TCMALLOC) 67#define USE_TCMALLOC 1 68#endif 69 70// Compiler detection. 71#if defined(__GNUC__) 72#define COMPILER_GCC 1 73#elif defined(_MSC_VER) 74#define COMPILER_MSVC 1 75#else 76#error Please add support for your compiler in build/build_config.h 77#endif 78 79// Processor architecture detection. For more info on what's defined, see: 80// http://msdn.microsoft.com/en-us/library/b0084kay.aspx 81// http://www.agner.org/optimize/calling_conventions.pdf 82// or with gcc, run: "echo | gcc -E -dM -" 83#if defined(_M_X64) || defined(__x86_64__) 84#define ARCH_CPU_X86_FAMILY 1 85#define ARCH_CPU_X86_64 1 86#define ARCH_CPU_64_BITS 1 87#elif defined(_M_IX86) || defined(__i386__) 88#define ARCH_CPU_X86_FAMILY 1 89#define ARCH_CPU_X86 1 90#define ARCH_CPU_32_BITS 1 91#elif defined(__ARMEL__) 92#define ARCH_CPU_ARM_FAMILY 1 93#define ARCH_CPU_ARMEL 1 94#define ARCH_CPU_32_BITS 1 95#define WCHAR_T_IS_UNSIGNED 1 96#else 97#error Please add support for your architecture in build/build_config.h 98#endif 99 100// Type detection for wchar_t. 101#if defined(OS_WIN) 102#define WCHAR_T_IS_UTF16 103#elif defined(OS_POSIX) && defined(COMPILER_GCC) && \ 104 defined(__WCHAR_MAX__) && \ 105 (__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff) 106#define WCHAR_T_IS_UTF32 107#elif defined(OS_POSIX) && defined(COMPILER_GCC) && \ 108 defined(__WCHAR_MAX__) && \ 109 (__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff) 110// On Posix, we'll detect short wchar_t, but projects aren't guaranteed to 111// compile in this mode (in particular, Chrome doesn't). This is intended for 112// other projects using base who manage their own dependencies and make sure 113// short wchar works for them. 114#define WCHAR_T_IS_UTF16 115#else 116#error Please add support for your compiler in build/build_config.h 117#endif 118 119#endif // BUILD_BUILD_CONFIG_H_ 120