1 /**********************************************************************
3 * platform.h - generated by CMake from platform.h.cmake
5 * GEOS - Geometry Engine Open Source
6 * http://geos.osgeo.org
8 * Copyright (C) 2009 Mateusz Loskot
9 * Copyright (C) 2005-2009 Refractions Research Inc.
10 * Copyright (C) 2001-2009 Vivid Solutions Inc.
12 * This is free software; you can redistribute and/or modify it under
13 * the terms of the GNU Lesser General Public Licence as published
14 * by the Free Software Foundation.
15 * See the COPYING file for more information.
17 *********************************************************************/
19 #ifndef GEOS_PLATFORM_H_INCLUDED
20 #define GEOS_PLATFORM_H_INCLUDED
22 /* Disable inclusion of platform.h not generated by CMake */
23 #define GEOS_PLATFORM_H 1
25 /* Set to 1 if you have stdint.h */
26 #cmakedefine HAVE_STDINT_H 1
28 /* Set to 1 if you have inttypes.h */
29 #cmakedefine HAVE_INTTYPES_H 1
31 /* Set to 1 if you have ieeefp.h */
32 #cmakedefine HAVE_IEEEFP_H 1
34 /* Set to 1 if you have `int64_t' type */
35 #cmakedefine HAVE_INT64_T_64 1
37 /* Set to 1 if `long int' is 64 bits */
38 #cmakedefine HAVE_LONG_INT_64 1
40 /* Set to 1 if `long long int' is 64 bits */
41 #cmakedefine HAVE_LONG_LONG_INT_64 1
43 /* Set to 1 if C++/C99 std::isnan is defined */
44 #cmakedefine HAVE_STD_ISNAN 1
46 /* Set to 1 if C99 isnan is defined */
47 #cmakedefine HAVE_ISNAN 1
49 /* Set to 1 if XCode __isnand is defined */
50 #cmakedefine HAVE_ISNAND_XCODE 1
52 /* Set to 1 if XCode __inline_isnand is defined */
53 #cmakedefine HAVE_INLINE_ISNAND_XCODE 1
55 /* Set to 1 if C++/C99 std::isfinite is defined */
56 #cmakedefine HAVE_STD_ISFINITE 1
58 /* Set to 1 if C99 isfinite is defined */
59 #cmakedefine HAVE_ISFINITE 1
61 /* Set to 1 if Visual C++ finite is defined */
62 #cmakedefine HAVE_FINITE 1
72 #ifdef HAVE_INTTYPES_H
77 # ifndef HAVE_INT64_T_64
78 # error Warning: inttypes.h included but HAVE_INT64_T_64 not defined
82 /* We need M_PI, but on MSVC you need to define _USE_MATH_DEFINES before
83 * including math.h to get it. If we are too late (math.h already included)
84 * we will define it manually.
87 #define _USE_MATH_DEFINES
96 #define M_PI 3.14159265358979323846
99 /* For MingW the appropriate definitions are included in math.h
100 * and float.h but the definitions in math.h are only included
101 * if __STRICT_ANSI__ is not defined. Since GEOS is compiled
102 * with -ansi that means those definitions are not available.
104 #if defined(__GNUC__) && defined(_WIN32)
108 #ifdef HAVE_INT64_T_64
110 typedef __int64 int64;
112 typedef int64_t int64;
115 # ifdef HAVE_LONG_LONG_INT_64
116 typedef long long int int64;
118 typedef long int int64;
119 # ifndef HAVE_LONG_INT_64
120 # define INT64_IS_REALLY32 1
121 # warning "Could not find 64bit integer definition!"
126 #if defined(HAVE_STD_ISNAN)
127 # define ISNAN(x) (std::isnan)(x)
128 #elif defined(HAVE_INLINE_ISNAND_XCODE)
129 # define ISNAN(x) __inline_isnand(static_cast<double>(x))
130 #elif defined(HAVE_ISNAND_XCODE)
131 # define ISNAN(x) __isnand(static_cast<double>(x))
132 #elif defined(HAVE_ISNAN)
133 # if defined(_MSC_VER)
134 # define ISNAN(x) _isnan(static_cast<double>(x))
136 # define ISNAN(x) isnan(x)
139 # error "Could not find isnan function or macro!"
142 #if defined(HAVE_STD_ISFINITE)
143 # define FINITE(x) (std::isfinite)(x)
144 #elif defined(HAVE_ISFINITE)
145 # define FINITE(x) isfinite(x)
146 #elif defined(HAVE_FINITE)
147 # define FINITE(x) _finite(static_cast<double>(x))
149 # error "Could not find finite or isfinite function or macro!"
152 #define DoubleNegInfinity (-(std::numeric_limits<double>::infinity)())
153 #define DoubleMax (std::numeric_limits<double>::max)()
154 // Defines NaN for Intel platforms
155 #define DoubleNotANumber std::numeric_limits<double>::quiet_NaN()
156 // Don't forget to define infinities
157 #define DoubleInfinity (std::numeric_limits<double>::infinity)()
159 #endif // GEOS_PLATFORM_H_INCLUDED