config.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*
  2. * Copyright (C) 2010 Apple Inc. All rights reserved.
  3. * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions
  7. * are met:
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in the
  12. * documentation and/or other materials provided with the distribution.
  13. *
  14. * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
  15. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  16. * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  17. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
  18. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  19. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  20. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  21. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  22. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  23. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  24. * THE POSSIBILITY OF SUCH DAMAGE.
  25. */
  26. #if defined(BUILDING_WITH_CMAKE)
  27. #include "cmakeconfig.h"
  28. #elif defined(BUILDING_GTK__)
  29. #include "autotoolsconfig.h"
  30. #endif
  31. #include <runtime/JSExportMacros.h>
  32. #include <wtf/DisallowCType.h>
  33. #include <wtf/Platform.h>
  34. #include <wtf/ExportMacros.h>
  35. #ifdef __cplusplus
  36. #ifndef EXTERN_C_BEGIN
  37. #define EXTERN_C_BEGIN extern "C" {
  38. #endif
  39. #ifndef EXTERN_C_END
  40. #define EXTERN_C_END }
  41. #endif
  42. #else
  43. #define EXTERN_C_BEGIN
  44. #define EXTERN_C_END
  45. #endif
  46. // For defining getters to a static value, where the getters have internal linkage
  47. #define DEFINE_STATIC_GETTER(type, name, arguments) \
  48. static const type& name() \
  49. { \
  50. DEFINE_STATIC_LOCAL(type, name##Value, arguments); \
  51. return name##Value; \
  52. }
  53. #if defined(WIN32) || defined(_WIN32)
  54. #ifndef _WIN32_WINNT
  55. #define _WIN32_WINNT 0x0502
  56. #endif
  57. #ifndef WINVER
  58. #define WINVER 0x0502
  59. #endif
  60. /* If we don't define these, they get defined in windef.h. */
  61. /* We want to use std::min and std::max. */
  62. #ifndef max
  63. #define max max
  64. #endif
  65. #ifndef min
  66. #define min min
  67. #endif
  68. #ifndef _WINSOCKAPI_
  69. #define _WINSOCKAPI_ /* Prevent inclusion of winsock.h in windows.h */
  70. #endif
  71. #if !PLATFORM(QT)
  72. #include <WebCore/config.h>
  73. #endif
  74. #include <windows.h>
  75. #if USE(CG)
  76. #include <CoreGraphics/CoreGraphics.h>
  77. #endif
  78. #endif /* defined(WIN32) || defined(_WIN32) */
  79. #ifdef __cplusplus
  80. // These undefs match up with defines in WebKit2Prefix.h for Mac OS X.
  81. // Helps us catch if anyone uses new or delete by accident in code and doesn't include "config.h".
  82. #undef new
  83. #undef delete
  84. #include <wtf/FastMalloc.h>
  85. #endif
  86. #ifndef PLUGIN_ARCHITECTURE_UNSUPPORTED
  87. #if PLATFORM(MAC)
  88. #define PLUGIN_ARCHITECTURE_MAC 1
  89. #elif (PLATFORM(GTK) || PLATFORM(EFL)) && (OS(UNIX) && !OS(MAC_OS_X))
  90. #define PLUGIN_ARCHITECTURE_X11 1
  91. #elif PLATFORM(QT)
  92. // Qt handles this features.prf
  93. #else
  94. #define PLUGIN_ARCHITECTURE_UNSUPPORTED 1
  95. #endif
  96. #endif
  97. #define PLUGIN_ARCHITECTURE(ARCH) (defined PLUGIN_ARCHITECTURE_##ARCH && PLUGIN_ARCHITECTURE_##ARCH)
  98. #ifndef ENABLE_INSPECTOR_SERVER
  99. #if ENABLE(INSPECTOR) && (PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL) || PLATFORM(MANX))
  100. #define ENABLE_INSPECTOR_SERVER 1
  101. #endif
  102. #endif
  103. #if PLATFORM(MANX)
  104. #include <manx/util.h>
  105. #define PUSH_CPU_MARKER(label, color) pa_push_marker(label, color)
  106. #define POP_CPU_MARKER() pa_pop_marker()
  107. #define CPU_SYNC() pa_sync()
  108. #ifdef __cplusplus
  109. class ScopedMarker
  110. {
  111. public:
  112. ScopedMarker(const char* label, unsigned int color) { PUSH_CPU_MARKER(label, color); }
  113. ~ScopedMarker() { POP_CPU_MARKER(); }
  114. };
  115. #define TOKENPASTE(x, y) x ## y
  116. #define TOKENPASTE2(x, y) TOKENPASTE(x, y)
  117. #define SCOPED_MARKER(label, color) ScopedMarker TOKENPASTE2(marker, __LINE__)(label, color)
  118. #define FUNCTION_MARKER SCOPED_MARKER(__PRETTY_FUNCTION__, PA_COLOR_GREEN)
  119. #endif // __cplusplus
  120. #endif