You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

210 lines
6.3 KiB

  1. // -*- C++ -*-
  2. // Module: Log4CPLUS
  3. // File: config-win32.h
  4. // Created: 4/2003
  5. // Author: Tad E. Smith
  6. //
  7. //
  8. // Copyright 2003-2013 Tad E. Smith
  9. //
  10. // Licensed under the Apache License, Version 2.0 (the "License");
  11. // you may not use this file except in compliance with the License.
  12. // You may obtain a copy of the License at
  13. //
  14. // http://www.apache.org/licenses/LICENSE-2.0
  15. //
  16. // Unless required by applicable law or agreed to in writing, software
  17. // distributed under the License is distributed on an "AS IS" BASIS,
  18. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  19. // See the License for the specific language governing permissions and
  20. // limitations under the License.
  21. /** @file */
  22. #ifndef LOG4CPLUS_CONFIG_WIN32_HEADER_
  23. #define LOG4CPLUS_CONFIG_WIN32_HEADER_
  24. #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
  25. #pragma once
  26. #endif
  27. #if defined (__MINGW32__) || defined (__MINGW64__)
  28. # include <_mingw.h>
  29. #endif
  30. #ifdef _WIN32
  31. #if (defined (_MSC_VER) && _MSC_VER > 1400) \
  32. || (defined (__MINGW64_VERSION_MAJOR) && __MINGW64_VERSION_MAJOR >= 3)
  33. # define LOG4CPLUS_HAVE_INTRIN_H
  34. #endif
  35. // Time related functions and headers.
  36. #define LOG4CPLUS_HAVE_TIME_H
  37. #define LOG4CPLUS_HAVE_SYS_TIMEB_H
  38. #define LOG4CPLUS_HAVE_FTIME
  39. #if defined (_MSC_VER) || defined (__BORLANDC__)
  40. #define LOG4CPLUS_HAVE_GMTIME_S
  41. #endif
  42. // Use Winsock on Windows.
  43. #define LOG4CPLUS_USE_WINSOCK
  44. // Enable Win32DebugAppender
  45. #define LOG4CPLUS_HAVE_OUTPUTDEBUGSTRING
  46. // Enable Win32ConsoleAppender.
  47. #define LOG4CPLUS_HAVE_WIN32_CONSOLE
  48. #define LOG4CPLUS_HAVE_SYS_TYPES_H
  49. #define LOG4CPLUS_HAVE_SYS_LOCKING_H
  50. #define LOG4CPLUS_HAVE_FCNTL_H
  51. #define LOG4CPLUS_HAVE_IO_H
  52. #define LOG4CPLUS_HAVE_STDIO_H
  53. #define LOG4CPLUS_HAVE_WCHAR_H
  54. #define LOG4CPLUS_HAVE_STDARG_H
  55. #define LOG4CPLUS_HAVE_STDLIB_H
  56. #define LOG4CPLUS_HAVE_ERRNO_H
  57. #define LOG4CPLUS_HAVE_SYS_STAT_H
  58. #define LOG4CPLUS_HAVE_TIME_H
  59. #define LOG4CPLUS_HAVE_STDLIB_H
  60. // MSVC has both and so does MinGW.
  61. #define LOG4CPLUS_HAVE_VSNPRINTF
  62. #define LOG4CPLUS_HAVE__VSNPRINTF
  63. #define LOG4CPLUS_HAVE__VSNWPRINTF
  64. // Limit the use of foo_s() functions to builds using Visual Studio
  65. // 2005 and its run time library. In MinGW land, limit the foo_s()
  66. // functions to MinGw-w64 toolchain and __MSVCRT_VERSION__ >= 0x0900.
  67. #if (defined (_MSC_VER) && _MSC_VER >= 1400) \
  68. || (defined (__MSVCRT_VERSION__) && __MSVCRT_VERSION__ >= 0x0900 \
  69. && defined (__MINGW64_VERSION_MAJOR) && __MINGW64_VERSION_MAJOR >= 2)
  70. // MS secure versions of vprintf().
  71. # define LOG4CPLUS_HAVE_VSPRINTF_S
  72. # define LOG4CPLUS_HAVE_VSWPRINTF_S
  73. // MS secure versions of vfprintf().
  74. # define LOG4CPLUS_HAVE_VFPRINTF_S
  75. # define LOG4CPLUS_HAVE_VFWPRINTF_S
  76. // MS secure versions of vsnprintf().
  77. # define LOG4CPLUS_HAVE_VSNPRINTF_S
  78. # define LOG4CPLUS_HAVE__VSNPRINTF_S
  79. # define LOG4CPLUS_HAVE__VSNWPRINTF_S
  80. // MS printf-like functions supporting positional parameters.
  81. # define LOG4CPLUS_HAVE__VSPRINTF_P
  82. # define LOG4CPLUS_HAVE__VSWPRINTF_P
  83. // MS secure version of _tsopen().
  84. # define LOG4CPLUS_HAVE__TSOPEN_S
  85. #endif
  86. #define LOG4CPLUS_HAVE__TSOPEN
  87. #define LOG4CPLUS_DLLMAIN_HINSTANCE HINSTANCE
  88. #define LOG4CPLUS_HAVE_NT_EVENT_LOG
  89. // log4cplus_EXPORTS is used by the CMake build system. DLL_EXPORT is
  90. // used by the autotools build system.
  91. #if (defined (log4cplus_EXPORTS) || defined (log4cplusU_EXPORTS) \
  92. || defined (DLL_EXPORT)) \
  93. && ! defined (LOG4CPLUS_STATIC)
  94. # undef LOG4CPLUS_BUILD_DLL
  95. # define LOG4CPLUS_BUILD_DLL
  96. #endif
  97. #if ! defined (LOG4CPLUS_BUILD_DLL)
  98. # undef LOG4CPLUS_STATIC
  99. # define LOG4CPLUS_STATIC
  100. #endif
  101. #if defined (LOG4CPLUS_STATIC) && defined (LOG4CPLUS_BUILD_DLL)
  102. # error LOG4CPLUS_STATIC and LOG4CPLUS_BUILD_DLL cannot be defined both.
  103. #endif
  104. #if defined (LOG4CPLUS_BUILD_DLL)
  105. # if defined (INSIDE_LOG4CPLUS)
  106. # define LOG4CPLUS_EXPORT __declspec(dllexport)
  107. # else
  108. # define LOG4CPLUS_EXPORT __declspec(dllimport)
  109. # endif
  110. #else
  111. # define LOG4CPLUS_EXPORT
  112. #endif
  113. #ifndef LOG4CPLUS_SINGLE_THREADED
  114. # define LOG4CPLUS_USE_WIN32_THREADS
  115. #endif
  116. #if defined (_WIN32_WINNT) && _WIN32_WINNT < 0x0600
  117. # define LOG4CPLUS_POOR_MANS_SHAREDMUTEX
  118. #endif
  119. #if defined(_MSC_VER)
  120. // Warning about: identifier was truncated to '255' characters in the debug information
  121. # pragma warning( disable : 4786 )
  122. // Warning about: <type1> needs to have dll-interface to be used by clients of class <type2>
  123. # pragma warning( disable : 4251 )
  124. # define LOG4CPLUS_INLINES_ARE_EXPORTED
  125. # if _MSC_VER >= 1400
  126. # define LOG4CPLUS_WORKING_LOCALE
  127. # define LOG4CPLUS_HAVE_FUNCTION_MACRO
  128. # define LOG4CPLUS_HAVE_FUNCSIG_MACRO
  129. # define LOG4CPLUS_HAVE_C99_VARIADIC_MACROS
  130. # define LOG4CPLUS_ATTRIBUTE_NORETURN __declspec(noreturn)
  131. # endif
  132. # if _MSC_VER >= 1700
  133. # define LOG4CPLUS_HAVE_CXX11_ATOMICS
  134. # endif
  135. #endif
  136. #if defined (__GNUC__)
  137. # undef LOG4CPLUS_INLINES_ARE_EXPORTED
  138. # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
  139. # define LOG4CPLUS_HAVE_PRETTY_FUNCTION_MACRO
  140. # define LOG4CPLUS_HAVE_FUNC_SYMBOL
  141. # endif
  142. # if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
  143. # if defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
  144. # define LOG4CPLUS_HAVE___SYNC_SUB_AND_FETCH
  145. # define LOG4CPLUS_HAVE___SYNC_ADD_AND_FETCH
  146. # endif
  147. # endif
  148. # if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
  149. # if defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
  150. # define LOG4CPLUS_HAVE___ATOMIC_ADD_FETCH
  151. # define LOG4CPLUS_HAVE___ATOMIC_SUB_FETCH
  152. # endif
  153. // This has worked for some versions of MinGW with GCC 4.7+ but it
  154. // appears to be broken again in 4.8.x. Thus, we disable this for GCC
  155. // completely forever.
  156. //
  157. //# define LOG4CPLUS_INLINES_ARE_EXPORTED
  158. # endif
  159. # define LOG4CPLUS_HAVE_FUNCTION_MACRO
  160. # define LOG4CPLUS_HAVE_GNU_VARIADIC_MACROS
  161. # define LOG4CPLUS_HAVE_C99_VARIADIC_MACROS
  162. # if defined (__MINGW32__)
  163. # define LOG4CPLUS_WORKING_C_LOCALE
  164. # endif
  165. #endif
  166. #if defined (__BORLANDC__) && __BORLANDC__ >= 0x0650
  167. # define LOG4CPLUS_HAVE_FUNCTION_MACRO
  168. # define LOG4CPLUS_HAVE_C99_VARIADIC_MACROS
  169. #endif // __BORLANDC__
  170. #if ! defined (LOG4CPLUS_DISABLE_DLL_RUNTIME_WARNING)
  171. # if defined (LOG4CPLUS_STATIC) && defined (_MSC_VER) && ! defined (_DLL)
  172. # pragma message("You are not using DLL C run time library. " \
  173. "You must call log4cplus::initialize() once before " \
  174. "you use any other log4cplus API.")
  175. # endif
  176. #endif
  177. #endif // _WIN32
  178. #endif // LOG4CPLUS_CONFIG_WIN32_HEADER_