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.

202 lines
5.9 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. #if defined (_MSC_VER) \
  65. || (defined (__MINGW64_VERSION_MAJOR) && __MINGW64_VERSION_MAJOR >= 3)
  66. // MS secure versions of vprintf().
  67. # define LOG4CPLUS_HAVE_VSPRINTF_S
  68. # define LOG4CPLUS_HAVE_VSWPRINTF_S
  69. // MS secure versions of vfprintf().
  70. # define LOG4CPLUS_HAVE_VFPRINTF_S
  71. # define LOG4CPLUS_HAVE_VFWPRINTF_S
  72. // MS secure versions of vsnprintf().
  73. # define LOG4CPLUS_HAVE_VSNPRINTF_S
  74. # define LOG4CPLUS_HAVE__VSNPRINTF_S
  75. # define LOG4CPLUS_HAVE__VSNWPRINTF_S
  76. // MS printf-like functions supporting positional parameters.
  77. # define LOG4CPLUS_HAVE__VSPRINTF_P
  78. # define LOG4CPLUS_HAVE__VSWPRINTF_P
  79. // MS secure version of _tsopen().
  80. # define LOG4CPLUS_HAVE__TSOPEN_S
  81. #endif
  82. #define LOG4CPLUS_HAVE__TSOPEN
  83. #define LOG4CPLUS_DLLMAIN_HINSTANCE HINSTANCE
  84. #define LOG4CPLUS_HAVE_NT_EVENT_LOG
  85. // log4cplus_EXPORTS is used by the CMake build system. DLL_EXPORT is
  86. // used by the autotools build system.
  87. #if (defined (log4cplus_EXPORTS) || defined (log4cplusU_EXPORTS) \
  88. || defined (DLL_EXPORT)) \
  89. && ! defined (LOG4CPLUS_STATIC)
  90. # undef LOG4CPLUS_BUILD_DLL
  91. # define LOG4CPLUS_BUILD_DLL
  92. #endif
  93. #if ! defined (LOG4CPLUS_BUILD_DLL)
  94. # undef LOG4CPLUS_STATIC
  95. # define LOG4CPLUS_STATIC
  96. #endif
  97. #if defined (LOG4CPLUS_STATIC) && defined (LOG4CPLUS_BUILD_DLL)
  98. # error LOG4CPLUS_STATIC and LOG4CPLUS_BUILD_DLL cannot be defined both.
  99. #endif
  100. #if defined (LOG4CPLUS_BUILD_DLL)
  101. # if defined (INSIDE_LOG4CPLUS)
  102. # define LOG4CPLUS_EXPORT __declspec(dllexport)
  103. # else
  104. # define LOG4CPLUS_EXPORT __declspec(dllimport)
  105. # endif
  106. #else
  107. # define LOG4CPLUS_EXPORT
  108. #endif
  109. #ifndef LOG4CPLUS_SINGLE_THREADED
  110. # define LOG4CPLUS_USE_WIN32_THREADS
  111. #endif
  112. #if defined (_WIN32_WINNT) && _WIN32_WINNT < 0x0600
  113. # define LOG4CPLUS_POOR_MANS_SHAREDMUTEX
  114. #endif
  115. #if defined(_MSC_VER)
  116. // Warning about: identifier was truncated to '255' characters in the debug information
  117. # pragma warning( disable : 4786 )
  118. // Warning about: <type1> needs to have dll-interface to be used by clients of class <type2>
  119. # pragma warning( disable : 4251 )
  120. # define LOG4CPLUS_INLINES_ARE_EXPORTED
  121. # if _MSC_VER >= 1400
  122. # define LOG4CPLUS_WORKING_LOCALE
  123. # define LOG4CPLUS_HAVE_FUNCTION_MACRO
  124. # define LOG4CPLUS_HAVE_FUNCSIG_MACRO
  125. # define LOG4CPLUS_HAVE_C99_VARIADIC_MACROS
  126. # define LOG4CPLUS_ATTRIBUTE_NORETURN __declspec(noreturn)
  127. # endif
  128. # if _MSC_VER >= 1700
  129. # define LOG4CPLUS_HAVE_CXX11_ATOMICS
  130. # endif
  131. #endif
  132. #if defined (__GNUC__)
  133. # undef LOG4CPLUS_INLINES_ARE_EXPORTED
  134. # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
  135. # define LOG4CPLUS_HAVE_PRETTY_FUNCTION_MACRO
  136. # define LOG4CPLUS_HAVE_FUNC_SYMBOL
  137. # endif
  138. # if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
  139. # if defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
  140. # define LOG4CPLUS_HAVE___SYNC_SUB_AND_FETCH
  141. # define LOG4CPLUS_HAVE___SYNC_ADD_AND_FETCH
  142. # endif
  143. # endif
  144. # if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
  145. # if defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
  146. # define LOG4CPLUS_HAVE___ATOMIC_ADD_FETCH
  147. # define LOG4CPLUS_HAVE___ATOMIC_SUB_FETCH
  148. # endif
  149. # define LOG4CPLUS_INLINES_ARE_EXPORTED
  150. # endif
  151. # define LOG4CPLUS_HAVE_FUNCTION_MACRO
  152. # define LOG4CPLUS_HAVE_GNU_VARIADIC_MACROS
  153. # define LOG4CPLUS_HAVE_C99_VARIADIC_MACROS
  154. # if defined (__MINGW32__)
  155. # define LOG4CPLUS_WORKING_C_LOCALE
  156. # endif
  157. #endif
  158. #if defined (__BORLANDC__) && __BORLANDC__ >= 0x0650
  159. # define LOG4CPLUS_HAVE_FUNCTION_MACRO
  160. # define LOG4CPLUS_HAVE_C99_VARIADIC_MACROS
  161. #endif // __BORLANDC__
  162. #if ! defined (LOG4CPLUS_DISABLE_DLL_RUNTIME_WARNING)
  163. # if defined (LOG4CPLUS_STATIC) && defined (_MSC_VER) && ! defined (_DLL)
  164. # pragma message("You are not using DLL C run time library. " \
  165. "You must call log4cplus::initialize() once before " \
  166. "you use any other log4cplus API.")
  167. # endif
  168. #endif
  169. #endif // _WIN32
  170. #endif // LOG4CPLUS_CONFIG_WIN32_HEADER_