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

config.hxx VIGRA

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 "config_version.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_NO_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__) && !defined(__clang__)
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 "-Wshadow"
163 
164  #if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
165  #if defined(__APPLE__)
166  #define VIGRA_NO_UNIQUE_PTR
167  #endif
168  #else
169  // C++98 mode. No native unique_ptr support
170  #define VIGRA_NO_UNIQUE_PTR
171  #define VIGRA_SHARED_PTR_IN_TR1
172  #endif
173 #endif // __GNUC__
174 
175 ///////////////////////////////////////////////////////////
176 // //
177 // clang //
178 // //
179 ///////////////////////////////////////////////////////////
180 #if defined(__clang__)
181  // In Apple builds of clang, __clang_major__ and __clang_minor__
182  // have totally different values than in other builds of clang.
183  #if defined(__apple_build_version__)
184  // (For Apple builds of clang, __clang_major__ tracks the XCode version.)
185  // For Apple builds, C++11 only works well with libc++, not stdlibc++
186  #define VIGRA_NO_UNIQUE_PTR
187  #if __cplusplus >= 201103L
188  // Must have at least XCode 4 and use libc++ to use std::shared_ptr, etc.
189  // Otherwise, use tr1.
190  #if !((__clang_major__ >= 4) && defined(_LIBCPP_VERSION))
191  #define VIGRA_SHARED_PTR_IN_TR1
192  #endif
193  #else
194  // C++98 mode. No native unique_ptr support
195  #define VIGRA_NO_UNIQUE_PTR
196  #if !defined(_LIBCPP_VERSION)
197  #define VIGRA_SHARED_PTR_IN_TR1
198  #endif
199  #endif
200  #else
201  // This is a conservative constraint:
202  // Full C++11 support was achieved in clang-3.3,
203  // but most support was available in 3.1 and 3.2
204  #if __cplusplus >= 201103L
205  #if (__clang_major__ < 3) || ((__clang_major__ == 3) && (__clang_minor__ < 3))
206  #define VIGRA_SHARED_PTR_IN_TR1
207  #define VIGRA_NO_UNIQUE_PTR
208  #endif
209  #else
210  // C++98 mode. No native shared_ptr/unique_ptr support
211  #define VIGRA_NO_UNIQUE_PTR
212  #define VIGRA_SHARED_PTR_IN_TR1
213  #endif
214  #endif
215 #endif // __clang__
216 
217 ///////////////////////////////////////////////////////////
218 // //
219 // MingW //
220 // //
221 ///////////////////////////////////////////////////////////
222 
223 #if defined(__MINGW32__)
224  #define VIGRA_NEED_BIN_STREAMS
225 
226  #ifdef VIGRA_DLL
227  #define VIGRA_EXPORT __declspec(dllexport)
228  #elif defined(VIGRA_STATIC_LIB)
229  #define VIGRA_EXPORT
230  #else
231  #define VIGRA_EXPORT __declspec(dllimport)
232  #endif
233 #endif // __MINGW32__
234 
235 ///////////////////////////////////////////////////////////
236 // //
237 // SGI C++ 7.2 //
238 // //
239 ///////////////////////////////////////////////////////////
240 
241 #if defined(__sgi) && !defined(__GNUC__)
242  #if _COMPILER_VERSION < 720
243  #error "Need SGI C++ 7.2 or later"
244  #endif
245  #if (_COMPILER_VERSION == 720) || (_COMPILER_VERSION == 721)
246  #define SPECIAL_STDEXCEPTION_DEFINITION_NEEDED
247 
248  namespace vigra {
249  typedef std::exception StdException; // must be above next #define !!
250  }
251  #define std
252  #define NO_NAMESPACE_STD
253  #endif // _COMPILER_VERSION
254  #define HAS_HASH_CONTAINERS
255 #endif // __sgi
256 
257 ///////////////////////////////////////////////////////////
258 // //
259 // Sun C++ ??? //
260 // //
261 ///////////////////////////////////////////////////////////
262 
263 #if defined(__sun) && !defined(__GNUC__)
264  #define VIGRA_HAS_ERF
265 #endif // __sun
266 
267 ///////////////////////////////////////////////////////////
268 // //
269 // general //
270 // //
271 ///////////////////////////////////////////////////////////
272 
273 #ifdef CMATH_NOT_IN_STD
274  #define VIGRA_CSTD
275 #else
276  #define VIGRA_CSTD std
277 #endif
278 
279 #ifdef NO_TYPENAME
280  #define typename
281 #endif
282 
283 #ifdef NO_EXPLICIT
284  #define explicit
285 #endif
286 
287 #ifndef VIGRA_EXPORT
288  #define VIGRA_EXPORT
289 #endif
290 
291 #ifdef VIGRA_NO_UNIQUE_PTR
292 # define VIGRA_UNIQUE_PTR std::auto_ptr
293 #else
294 # ifdef _GLIBCXX_INCLUDE_AS_TR1
295 # define VIGRA_UNIQUE_PTR std::tr1::unique_ptr
296 # else
297 # define VIGRA_UNIQUE_PTR std::unique_ptr
298 # endif
299 #endif
300 
301 #ifdef VIGRA_SHARED_PTR_IN_TR1
302 # define VIGRA_SHARED_PTR std::tr1::shared_ptr
303 #else
304 # define VIGRA_SHARED_PTR std::shared_ptr
305 #endif
306 
307 #ifndef VIGRA_NO_THREADSAFE_STATIC_INIT
308  // usage:
309  // static int * p = VIGRA_SAFE_STATIC(p, new int(42));
310  //
311  #define VIGRA_SAFE_STATIC(p, v) v
312 #endif
313 
314 namespace vigra {
315 
316 #ifndef SPECIAL_STDEXCEPTION_DEFINITION_NEEDED
317  typedef std::exception StdException;
318 #endif
319 
320 } // namespace vigra
321 
322 #ifdef DOXYGEN
323 # define doxygen_overloaded_function(fun) fun(...);
324 #else
325 # define doxygen_overloaded_function(fun)
326 #endif
327 
328 
329 #endif // VIGRA_CONFIG_HXX
Definition: array_vector.hxx:954
Definition: accessor.hxx:43
FFTWComplex< R >::NormType abs(const FFTWComplex< R > &a)
absolute value (= magnitude)
Definition: fftw3.hxx:1002

© 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