cartobase  5.0.5
cartobase_config.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 #ifndef CARTOBASE_CONFIG_CARTOBASE_CONFIG_H
35 #define CARTOBASE_CONFIG_CARTOBASE_CONFIG_H
36 
37 // define this to issue compiler warnings when using obsolete headers
38 #define CARTO_ATTRIBUTED_OBSOLETE_WARNING
39 
40 #if defined( _WIN32 ) && !defined( __GNUC__ )
41 #ifdef CARTOBASE_EXPORTS
42 #define CARTOBASE_API __declspec(dllexport)
43 #else
44 #define CARTOBASE_API __declspec(dllimport)
45 #endif
46 #else // _WIN32
47 #define CARTOBASE_API
48 #endif // _WIN32
49 
50 #if defined(_MSC_VER)
51 # define CARTO_NO_PARTIAL_TEMPLATE_SPECIALIZATION 1
52 #elif defined(__BORLANDC__)
53 # define CARTO_NO_MEMBER_TEMPLATE_FRIENDS 1
54 # define CARTO_BROKEN_FRIEND_TEMPLATE_FUNCTION 1
55 #elif defined (__GNUC__)
56 # if ( __GNUC__-0 == 2 )
57 # define CARTO_USE_PRE_ISO_HEADERS
58 # if ( __GNUC_MINOR__-0 == 95 )
59 # define CARTO_NO_MEMBER_TEMPLATE_FRIENDS 1
60 # endif
61 # endif
62 #endif
63 
64 // useful macro which is not always provided in the system
65 #ifndef __GLIBC_PREREQ
66 #if defined( __GLIBC__ ) && defined( __GLIBC_MINOR__ )
67 // taken from /usr/include/features.h in case it's not defined
68 #define __GLIBC_PREREQ(maj, min) \
69  ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min))
70 #else
71 #define __GLIBC_PREREQ(maj, min) 1
72 #endif
73 #endif
74 
75 // allow large files
76 #undef _FILE_OFFSET_BITS
77 #define _FILE_OFFSET_BITS 64
78 #ifndef _LARGEFILE_SOURCE
79 #define _LARGEFILE_SOURCE
80 #endif
81 #ifndef _LARGE_FILES
82 #define _LARGE_FILES
83 #endif
84 
85 #if ( defined(_WIN32) && !defined( __GNUC__ ) ) || defined(__osf__)
86 typedef signed char int8_t;
87 typedef unsigned char uint8_t;
88 typedef short int16_t;
89 typedef unsigned short uint16_t;
90 typedef int int32_t;
91 typedef unsigned int uint32_t;
92 #ifndef INT8_MIN
93 #define INT8_MIN (-128)
94 #endif
95 #ifndef INT8_MAX
96 #define INT8_MAX (127)
97 #endif
98 #ifndef UINT8_MAX
99 #define UINT8_MAX (255)
100 #endif
101 #ifndef INT16_MIN
102 #define INT16_MIN (-32768)
103 #endif
104 #ifndef INT16_MAX
105 #define INT16_MAX (32767)
106 #endif
107 #ifndef UINT16_MAX
108 #define UINT16_MAX (65535)
109 #endif
110 #ifndef INT32_MIN
111 #define INT32_MIN (-2147483648)
112 #endif
113 #ifndef INT32_MAX
114 #define INT32_MAX (2147483647)
115 #endif
116 #ifndef UINT32_MAX
117 #define UINT32_MAX (4294967295U)
118 #endif
119 #elif defined(__sun) || defined(__sgi)
120 #include <inttypes.h>
121 #else
122 #ifndef __STDC_LIMIT_MACROS
123 #define __STDC_LIMIT_MACROS
124 #endif
125 #include <stdint.h>
126 #endif
127 
128 // isnan() portablility function or macro
129 #if defined( _WIN32 ) && !defined( isnan )
130 # ifdef __MINGW32__
131 # include <math.h>
132 # else
133 # include <float.h>
134 # define rint(x) floor(x+0.5)
135 # define isnan(x) _isnan(x)
136 # endif
137 #elif defined( __APPLE__ ) && (__GNUC__==3) && (__GNUC_MINOR__<=3)
138  // BUG On MacOS 10.2 / 10.3
139 # include <cmath>
140 # define isnan( x ) ( ( sizeof ( x ) == sizeof(double) ) ? \
141  __isnand ( x ) : \
142  ( sizeof ( x ) == sizeof( float) ) ? \
143  __isnanf ( x ) : \
144  __isnan ( x ) )
145 #else
146 // Standards-compliant compiler
147 # include <cmath>
148 #endif
149 
150 #ifdef __MINGW32__
151 #define CARTO_BROKEN_EXTERN_TEMPLATES
152 #endif
153 
154 // test if long is a different type from both int32_t and int64_t
155 #if !defined( __LP64__ ) || defined( __APPLE__ )
156 #define CARTO_LONG_IS_DISTINCT
157 #endif
158 
159 // Compatibility with clang feature checks for non-clang compilers.
160 #ifndef __has_feature
161  #define __has_feature(x) 0
162 #endif
163 #ifndef __has_extension
164  #define __has_extension __has_feature // Compatibility with pre-3.0 compilers.
165 #endif
166 
167 // Ignore __attribute__ on non-GCC compilers
168 #if !(defined(__GNUC__) || defined(__attribute__))
169 #define __attribute__(a) /* nothing */
170 #endif
171 
172 // GCC < 4.5 does not support the argument to the __deprecated__ attribute
173 #if ((__GNUC__-0 < 4) || (__GNUC_MINOR__-0 < 5)) && !__has_extension(attribute_deprecated_with_message)
174 #define __deprecated__(msg) __deprecated__
175 #endif
176 
187 #if __cplusplus >= 201103L
188 #define CARTO_OVERRIDE override
189 #else
190 #define CARTO_OVERRIDE
191 #define static_assert(expr, msg)
192 // in non-c++11 mode, replace unique_ptr with auto_ptr
193 #include <memory>
194 #define unique_ptr auto_ptr
195 #endif
196 
197 #include <cartobase/config/config.h>
198 
199 #endif // CARTOBASE_CONFIG_CARTOBASE_CONFIG_H