1 // -*- C++ -*-
2 // Module:  Log4CPLUS
3 // File:    config-win32.h
4 // Created: 4/2003
5 // Author:  Tad E. Smith
6 //
7 //
8 // Copyright 2003-2010 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 
22 /** @file */
23 
24 #ifndef DCMTK_LOG4CPLUS_CONFIG_WIN32_HEADER_
25 #define DCMTK_LOG4CPLUS_CONFIG_WIN32_HEADER_
26 
27 #if defined (DCMTK_LOG4CPLUS_HAVE_PRAGMA_ONCE)
28 #pragma once
29 #endif
30 
31 #ifdef _WIN32
32 
33 /* This used to be _MSC_VER >= 1400, but MSVC 2005 is broken */
34 #if (defined (_MSC_VER) && _MSC_VER > 1400)
35 #  define DCMTK_LOG4CPLUS_HAVE_INTRIN_H
36 #endif
37 
38 // Time related functions and headers.
39 #define DCMTK_LOG4CPLUS_HAVE_TIME_H
40 #define DCMTK_LOG4CPLUS_HAVE_SYS_TIMEB_H
41 #define DCMTK_LOG4CPLUS_HAVE_FTIME
42 #if defined (_MSC_VER) || defined (__BORLANDC__)
43 #define DCMTK_LOG4CPLUS_HAVE_GMTIME_S
44 #endif
45 
46 // Use Winsock on Windows.
47 #define DCMTK_LOG4CPLUS_USE_WINSOCK
48 
49 // Enable Win32DebugAppender
50 #define DCMTK_LOG4CPLUS_HAVE_OUTPUTDEBUGSTRING
51 
52 // Enable Win32ConsoleAppender.
53 #define DCMTK_LOG4CPLUS_HAVE_WIN32_CONSOLE
54 
55 #define DCMTK_LOG4CPLUS_HAVE_SYS_TYPES_H
56 #define DCMTK_LOG4CPLUS_HAVE_SYS_LOCKING_H
57 #define DCMTK_LOG4CPLUS_HAVE_FCNTL_H
58 #define DCMTK_LOG4CPLUS_HAVE_IO_H
59 #define DCMTK_LOG4CPLUS_HAVE_STDIO_H
60 #define DCMTK_LOG4CPLUS_HAVE_WCHAR_H
61 #define DCMTK_LOG4CPLUS_HAVE_STDARG_H
62 #define DCMTK_LOG4CPLUS_HAVE_STDLIB_H
63 #define DCMTK_LOG4CPLUS_HAVE_ERRNO_H
64 #define DCMTK_LOG4CPLUS_HAVE_SYS_STAT_H
65 #define DCMTK_LOG4CPLUS_HAVE_TIME_H
66 #define DCMTK_LOG4CPLUS_HAVE_STDLIB_H
67 
68 // MSVC has both and so does MinGW.
69 #define DCMTK_LOG4CPLUS_HAVE_VSNPRINTF
70 #define DCMTK_LOG4CPLUS_HAVE__VSNPRINTF
71 #if _MSC_VER <= 1200 /* Additional settings for VC6 and older */
72 #undef DCMTK_LOG4CPLUS_HAVE_VSNPRINTF
73 #endif
74 
75 // MS secure versions of vprintf().
76 #ifdef HAVE_VSPRINTF_S
77 #  define DCMTK_LOG4CPLUS_HAVE_VSPRINTF_S
78 #  define DCMTK_LOG4CPLUS_HAVE_VSWPRINTF_S
79 #endif
80 
81 // MS secure versions of vfprintf().
82 #ifdef HAVE_VFPRINTF_S
83 #  define DCMTK_LOG4CPLUS_HAVE_VFPRINTF_S
84 #  define DCMTK_LOG4CPLUS_HAVE_VFWPRINTF_S
85 #endif
86 
87 // MS secure versions of vsnprintf().
88 #ifdef HAVE_VSNPRINTF_S
89 #  define DCMTK_LOG4CPLUS_HAVE_VSNPRINTF_S
90 #  define DCMTK_LOG4CPLUS_HAVE__VSNPRINTF_S
91 #  define DCMTK_LOG4CPLUS_HAVE__VSNWPRINTF_S
92 #endif
93 
94 #define DCMTK_LOG4CPLUS_DLLMAIN_HINSTANCE HINSTANCE
95 #define DCMTK_LOG4CPLUS_HAVE_NT_EVENT_LOG
96 
97 // log4cplus_EXPORTS is used by the CMake build system.  DLL_EXPORT is
98 // used by the autotools build system.
99 #if (defined (log4cplus_EXPORTS) || defined (log4cplusU_EXPORTS) \
100      || defined (DLL_EXPORT))                                    \
101     && ! defined (DCMTK_LOG4CPLUS_STATIC)
102 #  undef DCMTK_LOG4CPLUS_BUILD_DLL
103 #  define DCMTK_LOG4CPLUS_BUILD_DLL
104 #endif
105 
106 #if ! defined (DCMTK_LOG4CPLUS_BUILD_DLL)
107 #  undef DCMTK_LOG4CPLUS_STATIC
108 #  define DCMTK_LOG4CPLUS_STATIC
109 #endif
110 
111 #if defined (DCMTK_LOG4CPLUS_STATIC) && defined (DCMTK_LOG4CPLUS_BUILD_DLL)
112 #  error DCMTK_LOG4CPLUS_STATIC and DCMTK_LOG4CPLUS_BUILD_DLL cannot be defined both.
113 #endif
114 
115 #if defined (DCMTK_LOG4CPLUS_BUILD_DLL)
116 #  if defined (DCMTK_INSIDE_LOG4CPLUS)
117 #    define DCMTK_LOG4CPLUS_EXPORT __declspec(dllexport)
118 #  else
119 #    define DCMTK_LOG4CPLUS_EXPORT __declspec(dllimport)
120 #  endif
121 #else
122 #  define DCMTK_LOG4CPLUS_EXPORT
123 #endif
124 
125 #ifndef DCMTK_LOG4CPLUS_SINGLE_THREADED
126 #  define DCMTK_LOG4CPLUS_USE_WIN32_THREADS
127 #endif
128 
129 #if defined (_WIN32_WINNT) && _WIN32_WINNT < 0x0600
130 #  define DCMTK_LOG4CPLUS_POOR_MANS_SHAREDMUTEX
131 #endif
132 
133 #if defined(_MSC_VER)
134   // Warning about: identifier was truncated to '255' characters in the debug information
135 #  pragma warning( disable : 4786 )
136   // Warning about: <type1> needs to have dll-interface to be used by clients of class <type2>
137 #  pragma warning( disable : 4251 )
138 
139 #  define DCMTK_LOG4CPLUS_INLINES_ARE_EXPORTED
140 
141 #  if _MSC_VER >= 1400
142 #    define DCMTK_LOG4CPLUS_WORKING_LOCALE
143 #    define DCMTK_LOG4CPLUS_HAVE_FUNCTION_MACRO
144 #    define DCMTK_LOG4CPLUS_HAVE_FUNCSIG_MACRO
145 #    define DCMTK_LOG4CPLUS_HAVE_C99_VARIADIC_MACROS
146 #  endif
147 #endif
148 
149 #if defined (__GNUC__)
150 #  undef DCMTK_LOG4CPLUS_INLINES_ARE_EXPORTED
151 #  if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
152 #    define DCMTK_LOG4CPLUS_INLINES_ARE_EXPORTED
153 #    define DCMTK_LOG4CPLUS_HAVE___SYNC_SUB_AND_FETCH
154 #    define DCMTK_LOG4CPLUS_HAVE___SYNC_ADD_AND_FETCH
155 #  endif
156 #  define DCMTK_LOG4CPLUS_HAVE_FUNCTION_MACRO
157 #  define DCMTK_LOG4CPLUS_HAVE_GNU_VARIADIC_MACROS
158 #  define DCMTK_LOG4CPLUS_HAVE_C99_VARIADIC_MACROS
159 #  if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
160 #    define DCMTK_LOG4CPLUS_HAVE_PRETTY_FUNCTION_MACRO
161 #  endif
162 #  if defined (__MINGW32__)
163 #    define DCMTK_LOG4CPLUS_WORKING_C_LOCALE
164 #  endif
165 #endif
166 
167 
168 #endif // _WIN32
169 #endif // DCMTK_LOG4CPLUS_CONFIG_WIN32_HEADER_
170