log4cplus  2.0.0
win32.h
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // Module:  Log4CPLUS
00003 // File:    config-win32.h
00004 // Created: 4/2003
00005 // Author:  Tad E. Smith
00006 //
00007 //
00008 // Copyright 2003-2015 Tad E. Smith
00009 //
00010 // Licensed under the Apache License, Version 2.0 (the "License");
00011 // you may not use this file except in compliance with the License.
00012 // You may obtain a copy of the License at
00013 //
00014 //     http://www.apache.org/licenses/LICENSE-2.0
00015 //
00016 // Unless required by applicable law or agreed to in writing, software
00017 // distributed under the License is distributed on an "AS IS" BASIS,
00018 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00019 // See the License for the specific language governing permissions and
00020 // limitations under the License.
00021 
00024 #ifndef LOG4CPLUS_CONFIG_WIN32_HEADER_
00025 #define LOG4CPLUS_CONFIG_WIN32_HEADER_
00026 
00027 #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
00028 #pragma once
00029 #endif
00030 
00031 #if defined (__MINGW32__)  || defined (__MINGW64__)
00032 #  include <_mingw.h>
00033 #endif
00034 
00035 #ifdef _WIN32
00036 
00037 #if (defined (_MSC_VER) && _MSC_VER > 1400) \
00038     || (defined (__MINGW64_VERSION_MAJOR) && __MINGW64_VERSION_MAJOR >= 3)
00039 #  define LOG4CPLUS_HAVE_INTRIN_H
00040 #endif
00041 
00042 // Time related functions and headers.
00043 #define LOG4CPLUS_HAVE_TIME_H
00044 #define LOG4CPLUS_HAVE_SYS_TIMEB_H
00045 #define LOG4CPLUS_HAVE_FTIME
00046 #if defined (_MSC_VER) || defined (__BORLANDC__)
00047 #define LOG4CPLUS_HAVE_GMTIME_S
00048 #endif
00049 
00050 // Use Winsock on Windows.
00051 #define LOG4CPLUS_USE_WINSOCK
00052 
00053 // Enable Win32DebugAppender
00054 #define LOG4CPLUS_HAVE_OUTPUTDEBUGSTRING
00055 
00056 // Enable Win32ConsoleAppender.
00057 #define LOG4CPLUS_HAVE_WIN32_CONSOLE
00058 
00059 #define LOG4CPLUS_HAVE_SYS_TYPES_H
00060 #define LOG4CPLUS_HAVE_SYS_LOCKING_H
00061 #define LOG4CPLUS_HAVE_FCNTL_H
00062 #define LOG4CPLUS_HAVE_IO_H
00063 #define LOG4CPLUS_HAVE_STDIO_H
00064 #define LOG4CPLUS_HAVE_WCHAR_H
00065 #define LOG4CPLUS_HAVE_STDARG_H
00066 #define LOG4CPLUS_HAVE_STDLIB_H
00067 #define LOG4CPLUS_HAVE_ERRNO_H
00068 #define LOG4CPLUS_HAVE_SYS_STAT_H
00069 #define LOG4CPLUS_HAVE_TIME_H
00070 #define LOG4CPLUS_HAVE_STDLIB_H
00071 #define LOG4CPLUS_HAVE_DIRECT_H
00072 
00073 // MSVC has both and so does MinGW.
00074 #define LOG4CPLUS_HAVE_VSNPRINTF
00075 #define LOG4CPLUS_HAVE__VSNPRINTF
00076 #define LOG4CPLUS_HAVE__VSNWPRINTF
00077 
00078 // Limit the use of foo_s() functions to builds using Visual Studio
00079 // 2005 and its run time library. In MinGW land, limit the foo_s()
00080 // functions to MinGw-w64 toolchain and __MSVCRT_VERSION__ >= 0x0900.
00081 #if (defined (_MSC_VER) && _MSC_VER >= 1400)                         \
00082     || (defined (__MSVCRT_VERSION__) && __MSVCRT_VERSION__ >= 0x0900 \
00083         && defined (__MINGW64_VERSION_MAJOR) && __MINGW64_VERSION_MAJOR >= 2)
00084 // MS secure versions of vprintf().
00085 #  define LOG4CPLUS_HAVE_VSPRINTF_S
00086 #  define LOG4CPLUS_HAVE_VSWPRINTF_S
00087 
00088 // MS secure versions of vfprintf().
00089 #  define LOG4CPLUS_HAVE_VFPRINTF_S
00090 #  define LOG4CPLUS_HAVE_VFWPRINTF_S
00091 
00092 // MS secure versions of vsnprintf().
00093 #  define LOG4CPLUS_HAVE_VSNPRINTF_S
00094 #  define LOG4CPLUS_HAVE__VSNPRINTF_S
00095 #  define LOG4CPLUS_HAVE__VSNWPRINTF_S
00096 
00097 // MS secure version of _tsopen().
00098 #  define LOG4CPLUS_HAVE__TSOPEN_S
00099 #endif
00100 
00101 #if defined (_MSC_VER) && _MSC_VER >= 1400
00102 // MS printf-like functions supporting positional parameters.
00103 #  define LOG4CPLUS_HAVE__VSPRINTF_P
00104 #  define LOG4CPLUS_HAVE__VSWPRINTF_P
00105 #endif
00106 
00107 #define LOG4CPLUS_HAVE__TSOPEN
00108 
00109 #define LOG4CPLUS_DLLMAIN_HINSTANCE HINSTANCE
00110 #define LOG4CPLUS_HAVE_NT_EVENT_LOG
00111 
00112 // log4cplus_EXPORTS is used by the CMake build system.  DLL_EXPORT is
00113 // used by the autotools build system.
00114 #if (defined (log4cplus_EXPORTS) || defined (log4cplusU_EXPORTS) \
00115      || defined (DLL_EXPORT))                                    \
00116     && ! defined (LOG4CPLUS_STATIC)
00117 #  undef LOG4CPLUS_BUILD_DLL
00118 #  define LOG4CPLUS_BUILD_DLL
00119 #endif
00120 
00121 #if ! defined (LOG4CPLUS_BUILD_DLL)
00122 #  undef LOG4CPLUS_STATIC
00123 #  define LOG4CPLUS_STATIC
00124 #endif
00125 
00126 #if defined (LOG4CPLUS_STATIC) && defined (LOG4CPLUS_BUILD_DLL)
00127 #  error LOG4CPLUS_STATIC and LOG4CPLUS_BUILD_DLL cannot be defined both.
00128 #endif
00129 
00130 #if defined (LOG4CPLUS_BUILD_DLL)
00131 #  if defined (INSIDE_LOG4CPLUS)
00132 #    define LOG4CPLUS_EXPORT __declspec(dllexport)
00133 #  else
00134 #    define LOG4CPLUS_EXPORT __declspec(dllimport)
00135 #  endif
00136 #else
00137 #  define LOG4CPLUS_EXPORT
00138 #endif
00139 
00140 #ifndef LOG4CPLUS_SINGLE_THREADED
00141 #  define LOG4CPLUS_USE_WIN32_THREADS
00142 #endif
00143 
00144 #if defined(_MSC_VER)
00145   // Warning about: identifier was truncated to '255' characters in the debug information
00146 #  pragma warning( disable : 4786 )
00147   // Warning about: <type1> needs to have dll-interface to be used by clients of class <type2>
00148 #  pragma warning( disable : 4251 )
00149 
00150 #  define LOG4CPLUS_INLINES_ARE_EXPORTED
00151 
00152 #  if _MSC_VER >= 1400
00153 #    define LOG4CPLUS_WORKING_LOCALE
00154 #    define LOG4CPLUS_HAVE_FUNCTION_MACRO
00155 #    define LOG4CPLUS_HAVE_FUNCSIG_MACRO
00156 #    define LOG4CPLUS_ATTRIBUTE_NORETURN __declspec(noreturn)
00157 #  endif
00158 #endif
00159 
00160 #if defined (__GNUC__)
00161 #  undef LOG4CPLUS_INLINES_ARE_EXPORTED
00162 #  if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
00163 #    define LOG4CPLUS_HAVE_PRETTY_FUNCTION_MACRO
00164 #    define LOG4CPLUS_HAVE_FUNC_SYMBOL
00165 #  endif
00166 // This has worked for some versions of MinGW with GCC 4.7+ but it
00167 // appears to be broken again in 4.8.x. Thus, we disable this for GCC
00168 // completely forever.
00169 //
00170 //#  define LOG4CPLUS_INLINES_ARE_EXPORTED
00171 #  define LOG4CPLUS_HAVE_FUNCTION_MACRO
00172 #  if defined (__MINGW32__)
00173 #    define LOG4CPLUS_WORKING_C_LOCALE
00174 #  endif
00175 #endif
00176 
00177 #if defined (__BORLANDC__) && __BORLANDC__ >= 0x0650
00178 #  define LOG4CPLUS_HAVE_FUNCTION_MACRO
00179 #endif // __BORLANDC__
00180 
00181 #if ! defined (LOG4CPLUS_DISABLE_DLL_RUNTIME_WARNING)
00182 #  if defined (LOG4CPLUS_STATIC) && defined (_MSC_VER) && ! defined (_DLL)
00183 #    pragma message("You are not using DLL C run time library. " \
00184     "You must call log4cplus::initialize() once before " \
00185     "you use any other log4cplus API.")
00186 #  endif
00187 #endif
00188 
00189 #endif // _WIN32
00190 #endif // LOG4CPLUS_CONFIG_WIN32_HEADER_