GEOS  3.6.2
platform.h
00001 /**********************************************************************
00002  *
00003  * platform.h - generated by CMake from platform.h.cmake
00004  *
00005  * GEOS - Geometry Engine Open Source
00006  * http://geos.osgeo.org
00007  *
00008  * Copyright (C) 2009 Mateusz Loskot
00009  * Copyright (C) 2005-2009 Refractions Research Inc.
00010  * Copyright (C) 2001-2009 Vivid Solutions Inc.
00011  *
00012  * This is free software; you can redistribute and/or modify it under
00013  * the terms of the GNU Lesser General Public Licence as published
00014  * by the Free Software Foundation. 
00015  * See the COPYING file for more information.
00016  *
00017  *********************************************************************/
00018 
00019 #ifndef GEOS_PLATFORM_H_INCLUDED
00020 #define GEOS_PLATFORM_H_INCLUDED
00021 
00022 #ifdef _MSC_VER
00023 #ifndef NOMINMAX
00024 #define NOMINMAX 1
00025 #endif
00026 #endif
00027 
00028 /* Disable inclusion of platform.h not generated by CMake */
00029 #define GEOS_PLATFORM_H 1
00030 
00031 /* Set to 1 if you have stdint.h */
00032 #define HAVE_STDINT_H 1
00033 
00034 /* Set to 1 if you have inttypes.h */
00035 #define HAVE_INTTYPES_H 1
00036 
00037 /* Set to 1 if you have ieeefp.h */
00038 /* #undef HAVE_IEEEFP_H */
00039 
00040 /* Set to 1 if you have `int64_t' type */
00041 #define HAVE_INT64_T_64 1
00042 
00043 /* Set to 1 if `long int' is 64 bits */
00044 /* #undef HAVE_LONG_INT_64 */
00045 
00046 /* Set to 1 if `long long int' is 64 bits */
00047 /* #undef HAVE_LONG_LONG_INT_64 */
00048 
00049 /* Set to 1 if C++/C99 std::isnan is defined */
00050 #define HAVE_STD_ISNAN 1
00051 
00052 /* Set to 1 if C99 isnan is defined */
00053 /* #undef HAVE_ISNAN */
00054 
00055 /* Set to 1 if XCode __isnand is defined */
00056 /* #undef HAVE_ISNAND_XCODE */
00057 
00058 /* Set to 1 if XCode __inline_isnand is defined */
00059 /* #undef HAVE_INLINE_ISNAND_XCODE */
00060 
00061 /* Set to 1 if C++/C99 std::isfinite is defined */
00062 /* #undef HAVE_STD_ISFINITE */
00063 
00064 /* Set to 1 if C99 isfinite is defined */
00065 #define HAVE_ISFINITE 1
00066 
00067 /* Set to 1 if Visual C++ finite is defined */
00068 /* #undef HAVE_FINITE */
00069 
00070 
00071 #ifdef HAVE_IEEEFP_H
00072 extern "C"
00073 {
00074 #include <ieeefp.h>
00075 }
00076 #endif
00077 
00078 #ifdef HAVE_INTTYPES_H
00079 extern "C"
00080 {
00081 #include <inttypes.h>
00082 }
00083 # ifndef HAVE_INT64_T_64
00084 #  error Warning: inttypes.h included but HAVE_INT64_T_64 not defined
00085 # endif
00086 #endif
00087 
00088 /* We need M_PI, but on MSVC you need to define _USE_MATH_DEFINES before
00089  * including math.h to get it.  If we are too late (math.h already included)
00090  * we will define it manually.
00091  */
00092 #ifdef _MSC_VER
00093 #define _USE_MATH_DEFINES
00094 #include <cmath>
00095 #include <float.h>
00096 #else
00097 #include <cmath>
00098 #endif
00099 #include <limits>
00100 
00101 #ifndef M_PI
00102 #define M_PI 3.14159265358979323846
00103 #endif
00104 
00105 /* For MingW the appropriate definitions are included in math.h
00106  * and float.h but the definitions in math.h are only included
00107  * if __STRICT_ANSI__ is not defined. Since GEOS is compiled
00108  * with -ansi that means those definitions are not available.
00109  */
00110 #if defined(__GNUC__) && defined(_WIN32)
00111 #include <float.h>
00112 #endif
00113 
00114 #ifdef HAVE_INT64_T_64
00115 # ifdef _MSC_VER
00116    typedef __int64 int64;
00117 # else
00118    typedef int64_t int64;
00119 # endif
00120 #else
00121 # ifdef HAVE_LONG_LONG_INT_64
00122    typedef long long int int64;
00123 # else
00124    typedef long int int64;
00125 #  ifndef HAVE_LONG_INT_64
00126 #   define INT64_IS_REALLY32 1
00127 #   warning "Could not find 64bit integer definition!"
00128 #  endif
00129 # endif
00130 #endif
00131 
00132 #if defined(HAVE_STD_ISNAN)
00133 # define ISNAN(x) (std::isnan)(x)
00134 #elif defined(HAVE_INLINE_ISNAND_XCODE)
00135 # define ISNAN(x) __inline_isnand(static_cast<double>(x))
00136 #elif defined(HAVE_ISNAND_XCODE)
00137 # define ISNAN(x) __isnand(static_cast<double>(x))
00138 #elif defined(HAVE_ISNAN)
00139 # if defined(_MSC_VER)
00140 #  define ISNAN(x) _isnan(static_cast<double>(x))
00141 # else
00142 #  define ISNAN(x) isnan(x)
00143 # endif
00144 #else
00145 # error "Could not find isnan function or macro!"
00146 #endif
00147 
00148 #if defined(HAVE_STD_ISFINITE)
00149 # define FINITE(x) (std::isfinite)(x)
00150 #elif defined(HAVE_ISFINITE)
00151 # define FINITE(x) isfinite(x)
00152 #elif defined(HAVE_FINITE)
00153 # define FINITE(x) _finite(static_cast<double>(x))
00154 #else
00155 # error "Could not find finite or isfinite function or macro!"
00156 #endif
00157 
00158 #define DoubleNegInfinity (-(std::numeric_limits<double>::infinity)())
00159 #define DoubleMax (std::numeric_limits<double>::max)()
00160 // Defines NaN for Intel platforms
00161 #define DoubleNotANumber std::numeric_limits<double>::quiet_NaN()
00162 // Don't forget to define infinities
00163 #define DoubleInfinity (std::numeric_limits<double>::infinity)()
00164 
00165 #endif // GEOS_PLATFORM_H_INCLUDED