diff options
author | mmentovai@google.com <mmentovai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-04 21:16:50 +0000 |
---|---|---|
committer | mmentovai@google.com <mmentovai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-04 21:16:50 +0000 |
commit | 4867b181a0409933ecbc581aeacafeee7cf92ab8 (patch) | |
tree | 4b7ecb9b261b352937e3b846a69aa7c471cd0109 | |
parent | 719ead5027772e9be7708cb2414a95df5499595f (diff) | |
download | chromium_src-4867b181a0409933ecbc581aeacafeee7cf92ab8.zip chromium_src-4867b181a0409933ecbc581aeacafeee7cf92ab8.tar.gz chromium_src-4867b181a0409933ecbc581aeacafeee7cf92ab8.tar.bz2 |
Provide OS_ and COMPILER_ macros for OS and compiler differentiation
Review URL: http://chrome-reviews.prom.corp.google.com/1108
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@338 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/port.h | 4 | ||||
-rw-r--r-- | build/build_config.h | 57 |
2 files changed, 60 insertions, 1 deletions
diff --git a/base/port.h b/base/port.h index db688dc..12b2a90 100644 --- a/base/port.h +++ b/base/port.h @@ -30,7 +30,9 @@ #ifndef BASE_PORT_H__ #define BASE_PORT_H__ -#ifdef MSC_VER +#include "build/build_config.h" + +#ifdef COMPILER_MSVC #define GG_LONGLONG(x) x##I64 #define GG_ULONGLONG(x) x##UI64 #else diff --git a/build/build_config.h b/build/build_config.h new file mode 100644 index 0000000..af9a5076 --- /dev/null +++ b/build/build_config.h @@ -0,0 +1,57 @@ +// Copyright 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef BUILD_BUILD_CONFIG_H_ +#define BUILD_BUILD_CONFIG_H_ + +// A set of macros to use for platform detection. +#if defined(__APPLE__) +#define OS_MACOSX 1 +#elif defined(linux) +#define OS_LINUX 1 +#elif defined(WIN32) +#define OS_WINDOWS 1 +#else +#error Please add support for your platform in build/build_config.h +#endif + +// For access to standard POSIX features, use OS_POSIX instead of a more +// specific macro. +#if defined(OS_MACOSX) || defined(OS_LINUX) +#define OS_POSIX 1 +#endif + +// Compiler detection. +#if defined(__GNUC__) +#define COMPILER_GCC +#elif defined(_MSC_VER) +#define COMPILER_MSVC +#endif + +#endif // BUILD_BUILD_CONFIG_H_ |