| 1 | /**********************************************************************
|
|---|
| 2 | * $Id: platform.h.cmake 2893 2010-01-29 17:42:07Z mloskot $
|
|---|
| 3 | *
|
|---|
| 4 | * platform.h - generated by CMake from platform.h.cmake
|
|---|
| 5 | *
|
|---|
| 6 | * GEOS - Geometry Engine Open Source
|
|---|
| 7 | * http://geos.refractions.net
|
|---|
| 8 | *
|
|---|
| 9 | * Copyright (C) 2009 Mateusz Loskot
|
|---|
| 10 | * Copyright (C) 2005-2009 Refractions Research Inc.
|
|---|
| 11 | * Copyright (C) 2001-2009 Vivid Solutions Inc.
|
|---|
| 12 | *
|
|---|
| 13 | * This is free software; you can redistribute and/or modify it under
|
|---|
| 14 | * the terms of the GNU Lesser General Public Licence as published
|
|---|
| 15 | * by the Free Software Foundation.
|
|---|
| 16 | * See the COPYING file for more information.
|
|---|
| 17 | *
|
|---|
| 18 | *********************************************************************/
|
|---|
| 19 |
|
|---|
| 20 | #ifndef GEOS_PLATFORM_H_INCLUDED
|
|---|
| 21 | #define GEOS_PLATFORM_H_INCLUDED
|
|---|
| 22 |
|
|---|
| 23 | /* Disable inclusion of platform.h not generated by CMake */
|
|---|
| 24 | #define GEOS_PLATFORM_H 1
|
|---|
| 25 |
|
|---|
| 26 | /* Set to 1 if you have stdint.h */
|
|---|
| 27 | #cmakedefine HAVE_STDINT_H 1
|
|---|
| 28 |
|
|---|
| 29 | /* Set to 1 if you have inttypes.h */
|
|---|
| 30 | #cmakedefine HAVE_INTTYPES_H 1
|
|---|
| 31 |
|
|---|
| 32 | /* Set to 1 if you have ieeefp.h */
|
|---|
| 33 | #cmakedefine HAVE_IEEEFP_H 1
|
|---|
| 34 |
|
|---|
| 35 | /* Set to 1 if you have `int64_t' type */
|
|---|
| 36 | #cmakedefine HAVE_INT64_T_64 1
|
|---|
| 37 |
|
|---|
| 38 | /* Set to 1 if `long int' is 64 bits */
|
|---|
| 39 | #cmakedefine HAVE_LONG_INT_64 1
|
|---|
| 40 |
|
|---|
| 41 | /* Set to 1 if `long long int' is 64 bits */
|
|---|
| 42 | #cmakedefine HAVE_LONG_LONG_INT_64 1
|
|---|
| 43 |
|
|---|
| 44 | /* Set to 1 if C++/C99 std::isnan is defined */
|
|---|
| 45 | #cmakedefine HAVE_STD_ISNAN 1
|
|---|
| 46 |
|
|---|
| 47 | /* Set to 1 if C99 isnan is defined */
|
|---|
| 48 | #cmakedefine HAVE_ISNAN 1
|
|---|
| 49 |
|
|---|
| 50 | /* Set to 1 if XCode __isnand is defined */
|
|---|
| 51 | #cmakedefine HAVE_ISNAND_XCODE 1
|
|---|
| 52 |
|
|---|
| 53 | /* Set to 1 if XCode __inline_isnand is defined */
|
|---|
| 54 | #cmakedefine HAVE_INLINE_ISNAND_XCODE 1
|
|---|
| 55 |
|
|---|
| 56 | /* Set to 1 if C++/C99 std::isfinite is defined */
|
|---|
| 57 | #cmakedefine HAVE_STD_ISFINITE 1
|
|---|
| 58 |
|
|---|
| 59 | /* Set to 1 if C99 isfinite is defined */
|
|---|
| 60 | #cmakedefine HAVE_ISFINITE 1
|
|---|
| 61 |
|
|---|
| 62 | /* Set to 1 if Visual C++ finite is defined */
|
|---|
| 63 | #cmakedefine HAVE_FINITE 1
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 | #ifdef HAVE_IEEEFP_H
|
|---|
| 67 | extern "C"
|
|---|
| 68 | {
|
|---|
| 69 | #include <ieeefp.h>
|
|---|
| 70 | }
|
|---|
| 71 | #endif
|
|---|
| 72 |
|
|---|
| 73 | #ifdef HAVE_INTTYPES_H
|
|---|
| 74 | extern "C"
|
|---|
| 75 | {
|
|---|
| 76 | #include <inttypes.h>
|
|---|
| 77 | }
|
|---|
| 78 | # ifndef HAVE_INT64_T_64
|
|---|
| 79 | # error Warning: inttypes.h included but HAVE_INT64_T_64 not defined
|
|---|
| 80 | # endif
|
|---|
| 81 | #endif
|
|---|
| 82 |
|
|---|
| 83 | /* We need M_PI, but on MSVC you need to define _USE_MATH_DEFINES before
|
|---|
| 84 | * including math.h to get it. If we are too late (math.h already included)
|
|---|
| 85 | * we will define it manually.
|
|---|
| 86 | */
|
|---|
| 87 | #ifdef _MSC_VER
|
|---|
| 88 | #define _USE_MATH_DEFINES
|
|---|
| 89 | #include <cmath>
|
|---|
| 90 | #include <float.h>
|
|---|
| 91 | #else
|
|---|
| 92 | #include <cmath>
|
|---|
| 93 | #endif
|
|---|
| 94 | #include <limits>
|
|---|
| 95 |
|
|---|
| 96 | #ifndef M_PI
|
|---|
| 97 | #define M_PI 3.14159265358979323846
|
|---|
| 98 | #endif
|
|---|
| 99 |
|
|---|
| 100 | /* For MingW the appropriate definitions are included in math.h
|
|---|
| 101 | * and float.h but the definitions in math.h are only included
|
|---|
| 102 | * if __STRICT_ANSI__ is not defined. Since GEOS is compiled
|
|---|
| 103 | * with -ansi that means those definitions are not available.
|
|---|
| 104 | */
|
|---|
| 105 | #if defined(__GNUC__) && defined(_WIN32)
|
|---|
| 106 | #include <float.h>
|
|---|
| 107 | #endif
|
|---|
| 108 |
|
|---|
| 109 | #ifdef HAVE_INT64_T_64
|
|---|
| 110 | # ifdef _MSC_VER
|
|---|
| 111 | typedef __int64 int64;
|
|---|
| 112 | # else
|
|---|
| 113 | typedef int64_t int64;
|
|---|
| 114 | # endif
|
|---|
| 115 | #else
|
|---|
| 116 | # ifdef HAVE_LONG_LONG_INT_64
|
|---|
| 117 | typedef long long int int64;
|
|---|
| 118 | # else
|
|---|
| 119 | typedef long int int64;
|
|---|
| 120 | # ifndef HAVE_LONG_INT_64
|
|---|
| 121 | # define INT64_IS_REALLY32 1
|
|---|
| 122 | # warning "Could not find 64bit integer definition!"
|
|---|
| 123 | # endif
|
|---|
| 124 | # endif
|
|---|
| 125 | #endif
|
|---|
| 126 |
|
|---|
| 127 | #if defined(HAVE_STD_ISNAN)
|
|---|
| 128 | # define ISNAN(x) (std::isnan)(x)
|
|---|
| 129 | #elif defined(HAVE_INLINE_ISNAND_XCODE)
|
|---|
| 130 | # define ISNAN(x) __inline_isnand(static_cast<double>(x))
|
|---|
| 131 | #elif defined(HAVE_ISNAND_XCODE)
|
|---|
| 132 | # define ISNAN(x) __isnand(static_cast<double>(x))
|
|---|
| 133 | #elif defined(HAVE_ISNAN)
|
|---|
| 134 | # if defined(_MSC_VER)
|
|---|
| 135 | # define ISNAN(x) _isnan(static_cast<double>(x))
|
|---|
| 136 | # else
|
|---|
| 137 | # define ISNAN(x) isnan(x)
|
|---|
| 138 | # endif
|
|---|
| 139 | #else
|
|---|
| 140 | # error "Could not find isnan function or macro!"
|
|---|
| 141 | #endif
|
|---|
| 142 |
|
|---|
| 143 | #if defined(HAVE_STD_ISFINITE)
|
|---|
| 144 | # define FINITE(x) (std::isfinite)(x)
|
|---|
| 145 | #elif defined(HAVE_ISFINITE)
|
|---|
| 146 | # define FINITE(x) isfinite(x)
|
|---|
| 147 | #elif defined(HAVE_FINITE)
|
|---|
| 148 | # define FINITE(x) _finite(static_cast<double>(x))
|
|---|
| 149 | #else
|
|---|
| 150 | # error "Could not find finite or isfinite function or macro!"
|
|---|
| 151 | #endif
|
|---|
| 152 |
|
|---|
| 153 | #define DoubleNegInfinity (-(std::numeric_limits<double>::infinity)())
|
|---|
| 154 | #define DoubleMax (std::numeric_limits<double>::max)()
|
|---|
| 155 | // Defines NaN for Intel platforms
|
|---|
| 156 | #define DoubleNotANumber std::numeric_limits<double>::quiet_NaN()
|
|---|
| 157 | // Don't forget to define infinities
|
|---|
| 158 | #define DoubleInfinity (std::numeric_limits<double>::infinity)()
|
|---|
| 159 |
|
|---|
| 160 | #endif // GEOS_PLATFORM_H_INCLUDED
|
|---|