config.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /*
  2. * Copyright (C) 2004, 2005, 2006, 2013 Apple Inc.
  3. * Copyright (C) 2009 Google Inc. All rights reserved.
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Library General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Library General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Library General Public License
  16. * along with this library; see the file COPYING.LIB. If not, write to
  17. * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  18. * Boston, MA 02110-1301, USA.
  19. *
  20. */
  21. #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
  22. #ifdef BUILDING_WITH_CMAKE
  23. #include "cmakeconfig.h"
  24. #else
  25. #include "autotoolsconfig.h"
  26. #endif
  27. #endif
  28. #include <wtf/Platform.h>
  29. #if PLATFORM(MAC) || PLATFORM(IOS)
  30. #define WTF_USE_FILE_LOCK 1
  31. #endif
  32. #if PLATFORM(WIN) && !USE(WINGDI)
  33. #include <WebCore/WebCoreHeaderDetection.h>
  34. #endif
  35. #include <wtf/ExportMacros.h>
  36. #include "PlatformExportMacros.h"
  37. #include <runtime/JSExportMacros.h>
  38. #ifdef __APPLE__
  39. #define HAVE_FUNC_USLEEP 1
  40. #endif /* __APPLE__ */
  41. #if OS(WINDOWS)
  42. #ifndef _WIN32_WINNT
  43. #define _WIN32_WINNT 0x0502
  44. #endif
  45. #ifndef WINVER
  46. #define WINVER 0x0502
  47. #endif
  48. // If we don't define these, they get defined in windef.h.
  49. // We want to use std::min and std::max.
  50. #ifndef max
  51. #define max max
  52. #endif
  53. #ifndef min
  54. #define min min
  55. #endif
  56. // CURL needs winsock, so don't prevent inclusion of it
  57. #if !USE(CURL)
  58. #ifndef _WINSOCKAPI_
  59. #define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h
  60. #endif
  61. #endif
  62. #endif /* OS(WINDOWS) */
  63. #ifdef __cplusplus
  64. // These undefs match up with defines in WebCorePrefix.h for Mac OS X.
  65. // Helps us catch if anyone uses new or delete by accident in code and doesn't include "config.h".
  66. #undef new
  67. #undef delete
  68. #include <wtf/FastMalloc.h>
  69. #include <ciso646>
  70. #endif
  71. #include <wtf/DisallowCType.h>
  72. #if COMPILER(MSVC)
  73. #define SKIP_STATIC_CONSTRUCTORS_ON_MSVC 1
  74. #else
  75. #define SKIP_STATIC_CONSTRUCTORS_ON_GCC 1
  76. #endif
  77. #if PLATFORM(WIN)
  78. #if PLATFORM(WIN_CAIRO)
  79. #undef WTF_USE_CG
  80. #define WTF_USE_CAIRO 1
  81. #define WTF_USE_CURL 1
  82. #ifndef _WINSOCKAPI_
  83. #define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h
  84. #endif
  85. #elif !USE(WINGDI)
  86. #define WTF_USE_CG 1
  87. #undef WTF_USE_CAIRO
  88. #undef WTF_USE_CURL
  89. #endif
  90. #endif
  91. #if PLATFORM(MANX) && OS(WINDOWS)
  92. #ifndef _WINSOCKAPI_
  93. #define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h
  94. #endif
  95. #endif
  96. #if PLATFORM(MAC)
  97. // New theme
  98. #define WTF_USE_NEW_THEME 1
  99. #endif // PLATFORM(MAC)
  100. #if USE(CG)
  101. #ifndef CGFLOAT_DEFINED
  102. #ifdef __LP64__
  103. typedef double CGFloat;
  104. #else
  105. typedef float CGFloat;
  106. #endif
  107. #define CGFLOAT_DEFINED 1
  108. #endif
  109. #endif /* USE(CG) */
  110. #if PLATFORM(WIN) && USE(CG)
  111. #define WTF_USE_SAFARI_THEME 1
  112. #endif
  113. // CoreAnimation is available to IOS, Mac and Windows if using CG
  114. #if PLATFORM(MAC) || PLATFORM(IOS) || (PLATFORM(WIN) && USE(CG))
  115. #define WTF_USE_CA 1
  116. #endif
  117. // FIXME: Move this to JavaScriptCore/wtf/Platform.h, which is where we define WTF_USE_AVFOUNDATION on the Mac.
  118. // https://bugs.webkit.org/show_bug.cgi?id=67334
  119. #if PLATFORM(WIN)
  120. #define WTF_USE_AVFOUNDATION 1
  121. #if HAVE(AVCF_LEGIBLE_OUTPUT)
  122. #define WTF_USE_AVFOUNDATION 1
  123. #define HAVE_AVFOUNDATION_MEDIA_SELECTION_GROUP 1
  124. #define HAVE_AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT 1
  125. #define HAVE_MEDIA_ACCESSIBILITY_FRAMEWORK 1
  126. #endif
  127. #endif
  128. #if OS(PSP2)
  129. #include <time.h>
  130. #include <unistd.h>
  131. #endif
  132. #if PLATFORM(MANX)
  133. #include <manx/util.h>
  134. #define PUSH_CPU_MARKER(label, color) pa_push_marker(label, color)
  135. #define POP_CPU_MARKER() pa_pop_marker()
  136. #define CPU_SYNC() pa_sync()
  137. #ifdef __cplusplus
  138. class ScopedMarker
  139. {
  140. public:
  141. ScopedMarker(const char* label, unsigned int color) { PUSH_CPU_MARKER(label, color); }
  142. ~ScopedMarker() { POP_CPU_MARKER(); }
  143. };
  144. #define TOKENPASTE(x, y) x ## y
  145. #define TOKENPASTE2(x, y) TOKENPASTE(x, y)
  146. #define SCOPED_MARKER(label, color) ScopedMarker TOKENPASTE2(marker, __LINE__)(label, color)
  147. #define FUNCTION_MARKER SCOPED_MARKER(__PRETTY_FUNCTION__, PA_COLOR_GREEN)
  148. #endif // __cplusplus
  149. #define GP_TRACE(label, number) gp_trace(label, number)
  150. #else // PLATFORM(MANX)
  151. #define PUSH_CPU_MARKER(label, color, flags)
  152. #define POP_CPU_MARKER()
  153. #define CPU_SYNC()
  154. #ifdef __cplusplus
  155. #define LABELED_MARKER(label) pa_cpu_marker marker ## __LINE__(label)
  156. #define FUNCTION_MARKER LABELED_MARKER(__FUNCTION__)
  157. #endif // __cplusplus
  158. #define GP_TRACE(label, number)
  159. #endif // PLATFORM(MANX)
  160. #if OS(PSP2) && defined(NDEBUG)
  161. #define QUOTE(a) #a
  162. #define OVERWRITE_OPTIMIZATION_LEVEL_PSP2(x) _Pragma( QUOTE(control O=##x) )
  163. #else
  164. #define OVERWRITE_OPTIMIZATION_LEVEL_PSP2(x)
  165. #endif