[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

config.hxx |

1 /************************************************************************/
2 /* */
3 /* Copyright 1998-2002 by Ullrich Koethe */
4 /* */
5 /* This file is part of the VIGRA computer vision library. */
6 /* The VIGRA Website is */
7 /* http://hci.iwr.uni-heidelberg.de/vigra/ */
8 /* Please direct questions, bug reports, and contributions to */
9 /* ullrich.koethe@iwr.uni-heidelberg.de or */
10 /* vigra@informatik.uni-hamburg.de */
11 /* */
12 /* Permission is hereby granted, free of charge, to any person */
13 /* obtaining a copy of this software and associated documentation */
14 /* files (the "Software"), to deal in the Software without */
15 /* restriction, including without limitation the rights to use, */
16 /* copy, modify, merge, publish, distribute, sublicense, and/or */
17 /* sell copies of the Software, and to permit persons to whom the */
18 /* Software is furnished to do so, subject to the following */
19 /* conditions: */
20 /* */
21 /* The above copyright notice and this permission notice shall be */
22 /* included in all copies or substantial portions of the */
23 /* Software. */
24 /* */
25 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND */
26 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES */
27 /* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */
28 /* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */
29 /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
30 /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
31 /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
32 /* OTHER DEALINGS IN THE SOFTWARE. */
33 /* */
34 /************************************************************************/
35
36
37 #ifndef VIGRA_CONFIG_HXX
38 #define VIGRA_CONFIG_HXX
39
40 #include "configVersion.hxx"
41 #include <stdexcept>
42
43 ///////////////////////////////////////////////////////////
44 // //
45 // VisualC++ //
46 // //
47 ///////////////////////////////////////////////////////////
48
49 #ifdef _MSC_VER
50 // make sure that we use vigra/windows.h so that incompatibilities are fixed
51 #include "windows.h"
52
53 #if(_MSC_VER < 1100) // before VisualC++ 5.0
54 #error "Need VisualC++ 5.0, Service Pack 2, or later"
55 #endif // _MSC_VER < 1100
56
57 #if (_MSC_VER < 1300)
58 #define NO_TYPENAME // no 'typename' keyword
59 #define TEMPLATE_COPY_CONSTRUCTOR_BUG
60 #define NO_STL_MEMBER_TEMPLATES
61 #define NO_INLINE_STATIC_CONST_DEFINITION
62 #define CMATH_NOT_IN_STD
63 #define NO_COVARIANT_RETURN_TYPES
64
65 #ifdef VIGRA_NO_STD_MINMAX // activate if necessary
66 namespace std {
67
68 template<class T>
69 const T& min(const T& x, const T& y)
70 {
71 return (y < x)
72 ? y
73 : x;
74 }
75
76 template<class T>
77 const T& max(const T& x, const T& y)
78 {
79 return (x < y)
80 ? y
81 : x;
82 }
83 }
84 #endif // VIGRA_NO_STD_MINMAX
85 #endif // (_MSC_VER < 1300)
86
87 #if _MSC_VER < 1310
88 #pragma warning( disable : 4786 4250 4244 4305)
89
90 #define NO_PARTIAL_TEMPLATE_SPECIALIZATION
91 #define NO_OUT_OF_LINE_MEMBER_TEMPLATES
92 #include <cmath>
93
94 #ifdef _MSC_EXTENSIONS
95 #ifndef CMATH_NOT_IN_STD
96 namespace std {
97 #endif // CMATH_NOT_IN_STD
98 inline double abs(double v) { return fabs(v); }
99 inline float abs(float v) { return fabs(v); }
100 #ifndef CMATH_NOT_IN_STD
101 }
102 #endif // CMATH_NOT_IN_STD
103 #endif // _MSC_EXTENSIONS
104 #endif // _MSC_VER < 1310
105
106 #if _MSC_VER < 1400
107 #define VIGRA_NO_WORKING_STRINGSTREAM
108 #endif
109
110 #if _MSC_VER >= 1600
111 #define VIGRA_HAS_UNIQUE_PTR
112 #endif
113
114 #define VIGRA_NEED_BIN_STREAMS
115
116 #define VIGRA_NO_THREADSAFE_STATIC_INIT // at least up to _MSC_VER <= 1600, probably higher
117
118 // usage:
119 // static int * p = VIGRA_SAFE_STATIC(p, new int(42));
120 //
121 #define VIGRA_SAFE_STATIC(p, v) \
122 0; while(p == 0) ::vigra::detail::safeStaticInit(&p, v)
123
124 namespace vigra { namespace detail {
125 template <class T>
126 inline void safeStaticInit(T ** p, T * v)
127 {
128 if (InterlockedCompareExchangePointer((PVOID *)p, v, 0) != 0)
129 delete v;
130 }
131 }} // namespace vigra::detail
132
133 #ifndef VIGRA_ENABLE_ANNOYING_WARNINGS
134 #pragma warning ( disable: 4244 4267) // implicit integer conversion warnings
135 #endif
136
137 #ifdef VIGRA_DLL
138 #define VIGRA_EXPORT __declspec(dllexport)
139 #elif defined(VIGRA_STATIC_LIB)
140 #define VIGRA_EXPORT
141 #else
142 #define VIGRA_EXPORT __declspec(dllimport)
143 #endif
144 #endif // _MSC_VER
145
146 ///////////////////////////////////////////////////////////
147 // //
148 // gcc //
149 // //
150 ///////////////////////////////////////////////////////////
151
152 #if defined(__GNUC__)
153 #if __GNUC__ < 2 || ((__GNUC__ == 2) && (__GNUC_MINOR__ <= 8))
154 #error "Need at least g++ 2.95"
155 #endif
156 #if __GNUC__ < 3
157 #define VIGRA_NO_WORKING_STRINGSTREAM
158 #endif
159 #define HAS_HASH_CONTAINERS
160
161 // these warnings produce too many false positives to be useful
162 #pragma GCC diagnostic ignored "-Wstrict-aliasing"
163 #pragma GCC diagnostic ignored "-Wshadow"
164
165 #if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
166 #define VIGRA_HAS_UNIQUE_PTR
167 #endif
168
169 #endif // __GNUC__
170
171 ///////////////////////////////////////////////////////////
172 // //
173 // MingW //
174 // //
175 ///////////////////////////////////////////////////////////
176
177 #if defined(__MINGW32__)
178 #define VIGRA_NEED_BIN_STREAMS
179
180 #ifdef VIGRA_DLL
181 #define VIGRA_EXPORT __declspec(dllexport)
182 #elif defined(VIGRA_STATIC_LIB)
183 #define VIGRA_EXPORT
184 #else
185 #define VIGRA_EXPORT __declspec(dllimport)
186 #endif
187 #endif // __MINGW32__
188
189 ///////////////////////////////////////////////////////////
190 // //
191 // SGI C++ 7.2 //
192 // //
193 ///////////////////////////////////////////////////////////
194
195 #if defined(__sgi) && !defined(__GNUC__)
196 #if _COMPILER_VERSION < 720
197 #error "Need SGI C++ 7.2 or later"
198 #endif
199 #if (_COMPILER_VERSION == 720) || (_COMPILER_VERSION == 721)
200 #define SPECIAL_STDEXCEPTION_DEFINITION_NEEDED
201
202 namespace vigra {
203 typedef std::exception StdException; // must be above next #define !!
204 }
205 #define std
206 #define NO_NAMESPACE_STD
207 #endif // _COMPILER_VERSION
208 #define HAS_HASH_CONTAINERS
209 #endif // __sgi
210
211 ///////////////////////////////////////////////////////////
212 // //
213 // Sun C++ ??? //
214 // //
215 ///////////////////////////////////////////////////////////
216
217 #if defined(__sun) && !defined(__GNUC__)
218 #define VIGRA_HAS_ERF
219 #endif // __sun
220
221 ///////////////////////////////////////////////////////////
222 // //
223 // general //
224 // //
225 ///////////////////////////////////////////////////////////
226
227 #ifdef CMATH_NOT_IN_STD
228 #define VIGRA_CSTD
229 #else
230 #define VIGRA_CSTD std
231 #endif
232
233 #ifdef NO_TYPENAME
234 #define typename
235 #endif
236
237 #ifdef NO_EXPLICIT
238 #define explicit
239 #endif
240
241 #ifndef VIGRA_EXPORT
242 #define VIGRA_EXPORT
243 #endif
244
245 #ifdef VIGRA_HAS_UNIQUE_PTR
246 # define VIGRA_UNIQUE_PTR std::unique_ptr
247 #else
248 # define VIGRA_UNIQUE_PTR std::auto_ptr
249 #endif
250
251 #ifndef VIGRA_NO_THREADSAFE_STATIC_INIT
252 // usage:
253 // static int * p = VIGRA_SAFE_STATIC(p, new int(42));
254 //
255 #define VIGRA_SAFE_STATIC(p, v) v
256 #endif
257
258 namespace vigra {
259
260 #ifndef SPECIAL_STDEXCEPTION_DEFINITION_NEEDED
261 typedef std::exception StdException;
262 #endif
263
264 } // namespace vigra
265
266 #ifdef DOXYGEN
267 # define doxygen_overloaded_function(fun) fun(...);
268 #else
269 # define doxygen_overloaded_function(fun)
270 #endif
271
272
273 #endif // VIGRA_CONFIG_HXX

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany | html generated using doxygen and Python vigra 1.10.0 (Mon Nov 18 2013)