| /* |
| * Copyright (C) 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved. |
| * Copyright (C) 2007-2009 Torch Mobile, Inc. |
| * Copyright (C) 2010, 2011 Research In Motion Limited. All rights reserved. |
| * |
| * Redistribution and use in source and binary forms, with or without |
| * modification, are permitted provided that the following conditions |
| * are met: |
| * 1. Redistributions of source code must retain the above copyright |
| * notice, this list of conditions and the following disclaimer. |
| * 2. 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. |
| * |
| * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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 WTF_Platform_h |
| #define WTF_Platform_h |
| |
| /* Include compiler specific macros */ |
| #include <wtf/Compiler.h> |
| |
| /* ==== Platform adaptation macros: these describe properties of the target environment. ==== */ |
| |
| /* HAVE() - specific system features (headers, functions or similar) that are present or not */ |
| #define HAVE(WTF_FEATURE) (defined HAVE_##WTF_FEATURE && HAVE_##WTF_FEATURE) |
| /* OS() - underlying operating system; only to be used for mandated low-level services like |
| virtual memory, not to choose a GUI toolkit */ |
| #define OS(WTF_FEATURE) (defined WTF_OS_##WTF_FEATURE && WTF_OS_##WTF_FEATURE) |
| |
| /* ==== Policy decision macros: these define policy choices for a particular port. ==== */ |
| |
| /* USE() - use a particular third-party library or optional OS service */ |
| #define USE(WTF_FEATURE) (defined WTF_USE_##WTF_FEATURE && WTF_USE_##WTF_FEATURE) |
| /* ENABLE() - turn on a specific feature of WebKit */ |
| #define ENABLE(WTF_FEATURE) (defined ENABLE_##WTF_FEATURE && ENABLE_##WTF_FEATURE) |
| |
| /* ==== OS() - underlying operating system; only to be used for mandated low-level services like |
| virtual memory, not to choose a GUI toolkit ==== */ |
| |
| /* OS(ANDROID) - Android */ |
| #ifdef ANDROID |
| #define WTF_OS_ANDROID 1 |
| #endif |
| |
| /* OS(DARWIN) - Any Darwin-based OS, including Mac OS X and iPhone OS */ |
| #ifdef __APPLE__ |
| #define WTF_OS_DARWIN 1 |
| |
| #include <AvailabilityMacros.h> |
| #endif |
| |
| /* OS(FREEBSD) - FreeBSD */ |
| #if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) |
| #define WTF_OS_FREEBSD 1 |
| #endif |
| |
| /* OS(HURD) - GNU/Hurd */ |
| #ifdef __GNU__ |
| #define WTF_OS_HURD 1 |
| #endif |
| |
| /* OS(LINUX) - Linux */ |
| #ifdef __linux__ |
| #define WTF_OS_LINUX 1 |
| #endif |
| |
| /* OS(NETBSD) - NetBSD */ |
| #if defined(__NetBSD__) |
| #define WTF_OS_NETBSD 1 |
| #endif |
| |
| /* OS(OPENBSD) - OpenBSD */ |
| #ifdef __OpenBSD__ |
| #define WTF_OS_OPENBSD 1 |
| #endif |
| |
| /* OS(SOLARIS) - Solaris */ |
| #if defined(sun) || defined(__sun) |
| #define WTF_OS_SOLARIS 1 |
| #endif |
| |
| /* OS(WINDOWS) - Any version of Windows */ |
| #if defined(WIN32) || defined(_WIN32) |
| #define WTF_OS_WINDOWS 1 |
| #endif |
| |
| /* OS(UNIX) - Any Unix-like system */ |
| #if OS(ANDROID) \ |
| || OS(DARWIN) \ |
| || OS(FREEBSD) \ |
| || OS(HURD) \ |
| || OS(LINUX) \ |
| || OS(NETBSD) \ |
| || OS(OPENBSD) \ |
| || OS(SOLARIS) \ |
| || defined(unix) \ |
| || defined(__unix) \ |
| || defined(__unix__) |
| #define WTF_OS_UNIX 1 |
| #endif |
| |
| /* Operating environments */ |
| |
| #if OS(ANDROID) |
| #define WTF_USE_LOW_QUALITY_IMAGE_INTERPOLATION 1 |
| #define WTF_USE_LOW_QUALITY_IMAGE_NO_JPEG_DITHERING 1 |
| #define WTF_USE_LOW_QUALITY_IMAGE_NO_JPEG_FANCY_UPSAMPLING 1 |
| #else |
| #define WTF_USE_ICCJPEG 1 |
| #define WTF_USE_QCMSLIB 1 |
| #endif |
| |
| #if OS(DARWIN) |
| #define WTF_USE_CF 1 |
| |
| /* We can't override the global operator new and delete on OS(DARWIN) because |
| * some object are allocated by WebKit and deallocated by the embedder. */ |
| #else /* !OS(DARWIN) */ |
| /* On non-OS(DARWIN), the "system malloc" is actually TCMalloc anyway, so there's |
| * no need to use WebKit's copy of TCMalloc. */ |
| #define WTF_USE_SYSTEM_MALLOC 1 |
| #endif /* OS(DARWIN) */ |
| |
| #if OS(DARWIN) |
| #define ENABLE_PURGEABLE_MEMORY 1 |
| #endif /* OS(DARWIN) */ |
| |
| #if !defined(HAVE_ACCESSIBILITY) |
| #if !OS(ANDROID) |
| #define HAVE_ACCESSIBILITY 1 |
| #endif |
| #endif /* !defined(HAVE_ACCESSIBILITY) */ |
| |
| #if OS(UNIX) |
| #define HAVE_ERRNO_H 1 |
| #define HAVE_MMAP 1 |
| #define HAVE_SIGNAL_H 1 |
| #define HAVE_STRINGS_H 1 |
| #define HAVE_SYS_TIME_H 1 |
| #define WTF_USE_PTHREADS 1 |
| #endif /* OS(UNIX) */ |
| |
| #if (OS(FREEBSD) || OS(OPENBSD)) && !defined(__GLIBC__) |
| #define HAVE_PTHREAD_NP_H 1 |
| #endif |
| |
| #if !defined(HAVE_VASPRINTF) |
| #if !COMPILER(MSVC) && !COMPILER(MINGW) |
| #define HAVE_VASPRINTF 1 |
| #endif |
| #endif |
| |
| #if !defined(HAVE_STRNSTR) |
| #if OS(DARWIN) || (OS(FREEBSD) && !defined(__GLIBC__)) |
| #define HAVE_STRNSTR 1 |
| #endif |
| #endif |
| |
| #if !OS(WINDOWS) && !OS(SOLARIS) && !OS(ANDROID) |
| #define HAVE_TM_GMTOFF 1 |
| #define HAVE_TM_ZONE 1 |
| #define HAVE_TIMEGM 1 |
| #endif |
| |
| #if OS(DARWIN) |
| #define HAVE_SYS_TIMEB_H 1 |
| #define HAVE_DISPATCH_H 1 |
| #define HAVE_MADV_FREE 1 |
| #define HAVE_PTHREAD_SETNAME_NP 1 |
| #define HAVE_MADV_FREE_REUSE 1 |
| #endif /* OS(DARWIN) */ |
| |
| #if OS(WINDOWS) |
| #define HAVE_SYS_TIMEB_H 1 |
| #define HAVE_ALIGNED_MALLOC 1 |
| #define HAVE_ISDEBUGGERPRESENT 1 |
| #define HAVE_VIRTUALALLOC 1 |
| #endif |
| |
| #endif /* WTF_Platform_h */ |