michael@0: // Copyright (c) 2012 The Chromium Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: michael@0: // This file adds defines about the platform we're currently building on. michael@0: // Operating System: michael@0: // OS_WIN / OS_MACOSX / OS_LINUX / OS_POSIX (MACOSX or LINUX) michael@0: // Compiler: michael@0: // COMPILER_MSVC / COMPILER_GCC michael@0: // Processor: michael@0: // ARCH_CPU_X86 / ARCH_CPU_X86_64 / ARCH_CPU_X86_FAMILY (X86 or X86_64) michael@0: // ARCH_CPU_32_BITS / ARCH_CPU_64_BITS michael@0: michael@0: #ifndef BUILD_BUILD_CONFIG_H_ michael@0: #define BUILD_BUILD_CONFIG_H_ michael@0: michael@0: #if defined(__APPLE__) michael@0: #include michael@0: #endif michael@0: michael@0: // A set of macros to use for platform detection. michael@0: #if defined(ANDROID) michael@0: #define OS_ANDROID 1 michael@0: #elif defined(__APPLE__) michael@0: #define OS_MACOSX 1 michael@0: #if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE michael@0: #define OS_IOS 1 michael@0: #endif // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE michael@0: #elif defined(__native_client__) michael@0: #define OS_NACL 1 michael@0: #elif defined(__linux__) michael@0: #define OS_LINUX 1 michael@0: // Use TOOLKIT_GTK on linux if TOOLKIT_VIEWS isn't defined. michael@0: #if !defined(TOOLKIT_VIEWS) && defined(USE_X11) michael@0: #define TOOLKIT_GTK michael@0: #endif michael@0: #if defined(__GLIBC__) && !defined(__UCLIBC__) michael@0: // we really are using glibc, not uClibc pretending to be glibc michael@0: #define LIBC_GLIBC michael@0: #endif michael@0: #elif defined(_WIN32) michael@0: #define OS_WIN 1 michael@0: #define TOOLKIT_VIEWS 1 michael@0: #elif defined(__FreeBSD__) michael@0: #define OS_FREEBSD 1 michael@0: #define TOOLKIT_GTK michael@0: #elif defined(__OpenBSD__) michael@0: #define OS_OPENBSD 1 michael@0: #define TOOLKIT_GTK michael@0: #elif defined(__sun) michael@0: #define OS_SOLARIS 1 michael@0: #define TOOLKIT_GTK michael@0: #else michael@0: #error Please add support for your platform in build/build_config.h michael@0: #endif michael@0: michael@0: #if defined(USE_OPENSSL) && defined(USE_NSS) michael@0: #error Cannot use both OpenSSL and NSS michael@0: #endif michael@0: michael@0: // For access to standard BSD features, use OS_BSD instead of a michael@0: // more specific macro. michael@0: #if defined(OS_FREEBSD) || defined(OS_OPENBSD) michael@0: #define OS_BSD 1 michael@0: #endif michael@0: michael@0: // For access to standard POSIXish features, use OS_POSIX instead of a michael@0: // more specific macro. michael@0: #if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FREEBSD) || \ michael@0: defined(OS_OPENBSD) || defined(OS_SOLARIS) || defined(OS_ANDROID) || \ michael@0: defined(OS_NACL) michael@0: #define OS_POSIX 1 michael@0: #endif michael@0: michael@0: // Use tcmalloc michael@0: #if (defined(OS_WIN) || defined(OS_LINUX) || defined(OS_ANDROID)) && \ michael@0: !defined(NO_TCMALLOC) michael@0: #define USE_TCMALLOC 1 michael@0: #endif michael@0: michael@0: // Compiler detection. michael@0: #if defined(__GNUC__) michael@0: #define COMPILER_GCC 1 michael@0: #elif defined(_MSC_VER) michael@0: #define COMPILER_MSVC 1 michael@0: #else michael@0: #error Please add support for your compiler in build/build_config.h michael@0: #endif michael@0: michael@0: // Processor architecture detection. For more info on what's defined, see: michael@0: // http://msdn.microsoft.com/en-us/library/b0084kay.aspx michael@0: // http://www.agner.org/optimize/calling_conventions.pdf michael@0: // or with gcc, run: "echo | gcc -E -dM -" michael@0: #if defined(_M_X64) || defined(__x86_64__) michael@0: #define ARCH_CPU_X86_FAMILY 1 michael@0: #define ARCH_CPU_X86_64 1 michael@0: #define ARCH_CPU_64_BITS 1 michael@0: #define ARCH_CPU_LITTLE_ENDIAN 1 michael@0: #elif defined(_M_IX86) || defined(__i386__) michael@0: #define ARCH_CPU_X86_FAMILY 1 michael@0: #define ARCH_CPU_X86 1 michael@0: #define ARCH_CPU_32_BITS 1 michael@0: #define ARCH_CPU_LITTLE_ENDIAN 1 michael@0: #elif defined(__ARMEL__) michael@0: #define ARCH_CPU_ARM_FAMILY 1 michael@0: #define ARCH_CPU_ARMEL 1 michael@0: #define ARCH_CPU_32_BITS 1 michael@0: #define ARCH_CPU_LITTLE_ENDIAN 1 michael@0: #elif defined(__pnacl__) michael@0: #define ARCH_CPU_32_BITS 1 michael@0: #elif defined(__MIPSEL__) michael@0: #define ARCH_CPU_MIPS_FAMILY 1 michael@0: #define ARCH_CPU_MIPSEL 1 michael@0: #define ARCH_CPU_32_BITS 1 michael@0: #define ARCH_CPU_LITTLE_ENDIAN 1 michael@0: #else michael@0: #error Please add support for your architecture in build/build_config.h michael@0: #endif michael@0: michael@0: // Type detection for wchar_t. michael@0: #if defined(OS_WIN) michael@0: #define WCHAR_T_IS_UTF16 michael@0: #elif defined(OS_POSIX) && defined(COMPILER_GCC) && \ michael@0: defined(__WCHAR_MAX__) && \ michael@0: (__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff) michael@0: #define WCHAR_T_IS_UTF32 michael@0: #elif defined(OS_POSIX) && defined(COMPILER_GCC) && \ michael@0: defined(__WCHAR_MAX__) && \ michael@0: (__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff) michael@0: // On Posix, we'll detect short wchar_t, but projects aren't guaranteed to michael@0: // compile in this mode (in particular, Chrome doesn't). This is intended for michael@0: // other projects using base who manage their own dependencies and make sure michael@0: // short wchar works for them. michael@0: #define WCHAR_T_IS_UTF16 michael@0: #else michael@0: #error Please add support for your compiler in build/build_config.h michael@0: #endif michael@0: michael@0: #if defined(__ARMEL__) && !defined(OS_IOS) michael@0: #define WCHAR_T_IS_UNSIGNED 1 michael@0: #elif defined(__MIPSEL__) michael@0: #define WCHAR_T_IS_UNSIGNED 0 michael@0: #endif michael@0: michael@0: #if defined(OS_ANDROID) michael@0: // The compiler thinks std::string::const_iterator and "const char*" are michael@0: // equivalent types. michael@0: #define STD_STRING_ITERATOR_IS_CHAR_POINTER michael@0: // The compiler thinks base::string16::const_iterator and "char16*" are michael@0: // equivalent types. michael@0: #define BASE_STRING16_ITERATOR_IS_CHAR16_POINTER michael@0: #endif michael@0: michael@0: #endif // BUILD_BUILD_CONFIG_H_