[geos-commits] r2859 - in trunk: . include/geos

svn_geos at osgeo.org svn_geos at osgeo.org
Sat Jan 16 17:20:06 EST 2010


Author: mloskot
Date: 2010-01-16 17:20:03 -0500 (Sat, 16 Jan 2010)
New Revision: 2859

Modified:
   trunk/CMakeLists.txt
   trunk/include/geos/platform.h.cmake
Log:
Added checks of C/C++ headers and library features like 64-bit integer type (#317)

Modified: trunk/CMakeLists.txt
===================================================================
--- trunk/CMakeLists.txt	2010-01-16 21:45:48 UTC (rev 2858)
+++ trunk/CMakeLists.txt	2010-01-16 22:20:03 UTC (rev 2859)
@@ -52,6 +52,30 @@
 endif()
 
 #################################################################################
+# Setup C/C++ library features
+#################################################################################
+
+# check header files
+include(CheckIncludeFiles)
+check_include_files(stdint.h HAVE_STDINT_H)
+check_include_files(inttypes.h HAVE_INTTYPES_H)
+check_include_files(ieeefp.h HAVE_IEEEFP_H)
+
+# check types and sizes
+include(CheckTypeSize)
+
+
+if(MSVC)
+  check_type_size("__int64" HAVE_INT64_T_64)
+else()
+  if(HAVE_STDINT_H OR HAVE_INTTYPES_H)
+    check_type_size("int64_t" HAVE_INT64_T_64)
+  else()
+    check_type_size("long long int" HAVE_LONG_LONG_INT_64)
+  endif()
+endif()
+
+################################################################################
 # Setup include directories
 #################################################################################
 

Modified: trunk/include/geos/platform.h.cmake
===================================================================
--- trunk/include/geos/platform.h.cmake	2010-01-16 21:45:48 UTC (rev 2858)
+++ trunk/include/geos/platform.h.cmake	2010-01-16 22:20:03 UTC (rev 2859)
@@ -26,6 +26,12 @@
 /* Set to 1 if `long long int' is 64 bits */
 #cmakedefine HAVE_LONG_LONG_INT_64 1
 
+/* Set to 1 if you have stdint.h */
+#cmakedefine HAVE_STDINT_H 1
+
+/* Set to 1 if you have inttypes.h */
+#cmakedefine HAVE_INTTYPES_H 1
+
 /* Set to 1 if you have ieeefp.h */
 #cmakedefine HAVE_IEEEFP_H 1
 
@@ -46,11 +52,14 @@
 }
 #endif
 
-#ifdef HAVE_INT64_T_64
+#ifdef HAVE_INTTYPES_H
 extern "C"
 {
 #include <inttypes.h>
 }
+# ifndef HAVE_INT64_T_64
+#  error Warning: inttypes.h included but HAVE_INT64_T_64 not defined
+# endif
 #endif
 
 /* We need M_PI, but on MSVC you need to define _USE_MATH_DEFINES before
@@ -131,7 +140,6 @@
 #error "Could not find isnan function or macro!"
 #endif
 
-
 #define DoubleNegInfinity -std::numeric_limits<double>::infinity()
 #define DoubleMax std::numeric_limits<double>::max()
 // Defines NaN for Intel platforms
@@ -139,5 +147,4 @@
 // Don't forget to define infinities
 #define DoubleInfinity std::numeric_limits<double>::infinity()
 
-
-#endif
+#endif
\ No newline at end of file



More information about the geos-commits mailing list