File indexing completed on 2024-05-12 15:43:39

0001 /*
0002  * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
0003  *
0004  * Redistribution and use in source and binary forms, with or without
0005  * modification, are permitted provided that the following conditions
0006  * are met:
0007  * 1. Redistributions of source code must retain the above copyright
0008  *    notice, this list of conditions and the following disclaimer.
0009  * 2. Redistributions in binary form must reproduce the above copyright
0010  *    notice, this list of conditions and the following disclaimer in the
0011  *    documentation and/or other materials provided with the distribution.
0012  *
0013  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
0014  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0015  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
0016  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
0017  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
0018  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
0019  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
0020  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
0021  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0022  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0023  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0024  */
0025 
0026 #ifndef WTF_Platform_h
0027 #define WTF_Platform_h
0028 
0029 /* Force KDE build here in our tree... */
0030 #ifndef BUILDING_KDE__
0031 #define BUILDING_KDE__ 1
0032 #endif
0033 
0034 /* PLATFORM handles OS, operating environment, graphics API, and CPU */
0035 #ifndef _MSC_VER
0036 #define PLATFORM(WTF_FEATURE) (defined(WTF_PLATFORM_##WTF_FEATURE) && WTF_PLATFORM_##WTF_FEATURE)
0037 #define COMPILER(WTF_FEATURE) (defined(WTF_COMPILER_##WTF_FEATURE) && WTF_COMPILER_##WTF_FEATURE)
0038 #define HAVE(WTF_FEATURE) (defined(HAVE_##WTF_FEATURE) && HAVE_##WTF_FEATURE)
0039 #define USE(WTF_FEATURE) (defined(WTF_USE_##WTF_FEATURE) && WTF_USE_##WTF_FEATURE)
0040 #define ENABLE(WTF_FEATURE) (defined(ENABLE_##WTF_FEATURE) && ENABLE_##WTF_FEATURE)
0041 #else
0042 /* MSVC does not handle defined() inside macro expansion, just fall back to
0043  * #if WTF_... and ignore the not defined warnings */
0044 #define PLATFORM(WTF_FEATURE) WTF_PLATFORM_##WTF_FEATURE
0045 #define COMPILER(WTF_FEATURE) WTF_COMPILER_##WTF_FEATURE
0046 #define HAVE(WTF_FEATURE) HAVE_##WTF_FEATURE
0047 #define USE(WTF_FEATURE) WTF_USE_##WTF_FEATURE
0048 #define ENABLE(WTF_FEATURE) ENABLE_##WTF_FEATURE
0049 #endif
0050 
0051 /* Operating systems - low-level dependencies */
0052 
0053 /* PLATFORM(DARWIN) */
0054 /* Operating system level dependencies for Mac OS X / Darwin that should */
0055 /* be used regardless of operating environment */
0056 #ifdef __APPLE__
0057 #define WTF_PLATFORM_DARWIN 1
0058 #endif
0059 
0060 /* PLATFORM(WIN_OS) */
0061 /* Operating system level dependencies for Windows that should be used */
0062 /* regardless of operating environment */
0063 #if defined(WIN32) || defined(_WIN32)
0064 #define WTF_PLATFORM_WIN_OS 1
0065 #endif
0066 
0067 /* PLATFORM(UNIX) */
0068 /* Operating system level dependencies for Unix-like systems that */
0069 /* should be used regardless of operating environment */
0070 /* (includes PLATFORM(DARWIN)) */
0071 #if   defined(__APPLE__)   \
0072    || defined(unix)        \
0073    || defined(__unix)      \
0074    || defined(__unix__)    \
0075    || defined (__NetBSD__) \
0076    || defined(_AIX)
0077 #define WTF_PLATFORM_UNIX 1
0078 #endif
0079 
0080 /* PLATFORM(SOLARIS_OS) */
0081 /* Operating system level dependencies for Sun (Open)Solaris 10. */
0082 /* Studio 12 on Solaris defines __SunOS; gcc defines __sun__; */
0083 /* Both compilers define __sun and sun. */
0084 #if defined(__sun) || defined(sun)
0085 #define WTF_PLATFORM_SOLARIS_OS 1
0086 #endif
0087 
0088 /* Operating environments */
0089 
0090 /* I made the BUILDING_KDE__ macro up for the KDE build system to define */
0091 
0092 /* PLATFORM(KDE) */
0093 /* PLATFORM(MAC) */
0094 /* PLATFORM(WIN) */
0095 #if BUILDING_KDE__
0096 #define WTF_PLATFORM_KDE 1
0097 #elif PLATFORM(DARWIN)
0098 #define WTF_PLATFORM_MAC 1
0099 #elif PLATFORM(WIN_OS)
0100 #define WTF_PLATFORM_WIN 1
0101 #endif
0102 #if defined(BUILDING_GDK__)
0103 #define WTF_PLATFORM_GDK 1
0104 #endif
0105 
0106 /* CPU */
0107 
0108 /* PLATFORM(PPC) */
0109 #if   defined(__ppc__)     \
0110    || defined(__PPC__)     \
0111    || defined(__powerpc__) \
0112    || defined(__powerpc)   \
0113    || defined(__POWERPC__) \
0114    || defined(_M_PPC)      \
0115    || defined(__PPC)
0116 #define WTF_PLATFORM_PPC 1
0117 #define WTF_PLATFORM_BIG_ENDIAN 1
0118 #endif
0119 
0120 /* PLATFORM(PPC64) */
0121 #if   defined(__ppc64__) \
0122    || defined(__PPC64__)
0123 #define WTF_PLATFORM_PPC64 1
0124 #define WTF_PLATFORM_BIG_ENDIAN 1
0125 #endif
0126 
0127 #if defined(arm)
0128 #define WTF_PLATFORM_ARM 1
0129 #if defined(__ARMEB__)
0130 #define WTF_PLATFORM_BIG_ENDIAN 1
0131 #elif !defined(__ARM_EABI__) && !defined(__ARMEB__)
0132 #define WTF_PLATFORM_MIDDLE_ENDIAN 1
0133 #endif
0134 #if !defined(__ARM_EABI__)
0135 #define WTF_PLATFORM_FORCE_PACK 1
0136 #endif
0137 #endif
0138 
0139 /* PLATFORM(X86) */
0140 #if   defined(__i386__) \
0141    || defined(i386)     \
0142    || defined(_M_IX86)  \
0143    || defined(_X86_)    \
0144    || defined(__THW_INTEL)
0145 #define WTF_PLATFORM_X86 1
0146 #endif
0147 
0148 /* PLATFORM(X86_64) */
0149 #if   defined(__x86_64__) \
0150    || defined(__ia64__)
0151 #define WTF_PLATFORM_X86_64 1
0152 #endif
0153 
0154 /* PLATFORM(SPARC) */
0155 #if defined(sparc)
0156 #define WTF_PLATFORM_SPARC 1
0157 #endif
0158 
0159 /* Compiler */
0160 
0161 /* CWP */
0162 #if defined(__MWERKS__)
0163 #define WTF_COMPILER_CWP 1
0164 #endif
0165 
0166 /* MSVC */
0167 #if defined(_MSC_VER)
0168 #define WTF_COMPILER_MSVC 1
0169 #endif
0170 
0171 /* GCC */
0172 #if defined(__GNUC__)
0173 #define WTF_COMPILER_GCC 1
0174 #endif
0175 
0176 /* SUNPRO */
0177 #if defined(__SUNPRO_CC)
0178 #define WTF_COMPILER_SUNPRO 1
0179 #endif
0180 
0181 /* BORLAND */
0182 /* not really fully supported - is this relevant any more? */
0183 #if defined(__BORLANDC__)
0184 #define WTF_COMPILER_BORLAND 1
0185 #endif
0186 
0187 /* CYGWIN */
0188 /* not really fully supported - is this relevant any more? */
0189 #if defined(__CYGWIN__)
0190 #define WTF_COMPILER_CYGWIN 1
0191 #endif
0192 
0193 /* multiple threads only supported on Mac for now */
0194 #if PLATFORM(MAC)
0195 #ifndef WTF_USE_MULTIPLE_THREADS
0196 #define WTF_USE_MULTIPLE_THREADS 1
0197 #endif
0198 #ifndef WTF_USE_BINDINGS
0199 #define WTF_USE_BINDINGS 1
0200 #endif
0201 #endif
0202 
0203 /* for Unicode, KDE uses Qt, everything else uses ICU */
0204 #if PLATFORM(KDE) || PLATFORM(QT)
0205 #define WTF_USE_QT4_UNICODE 1
0206 #elif PLATFORM(SYMBIAN)
0207 #define WTF_USE_SYMBIAN_UNICODE 1
0208 #else
0209 #define WTF_USE_ICU_UNICODE 1
0210 #endif
0211 
0212 #if PLATFORM(MAC)
0213 #define WTF_PLATFORM_CF 1
0214 #endif
0215 
0216 #if PLATFORM(WIN)
0217 #define WTF_USE_WININET 1
0218 #endif
0219 
0220 #if PLATFORM(GDK)
0221 #define WTF_USE_CURL 1
0222 #endif
0223 
0224 /* ENABLE macro defaults */
0225 
0226 #endif /* WTF_Platform_h */