[geos-commits] r2601 - in trunk: . source/headers/geos
svn_geos at osgeo.org
svn_geos at osgeo.org
Wed Jun 24 17:19:53 EDT 2009
Author: pramsey
Date: 2009-06-24 17:19:53 -0400 (Wed, 24 Jun 2009)
New Revision: 2601
Modified:
trunk/configure.in
trunk/source/headers/geos/platform.h.in
Log:
Fix for #270, bad definition of isnan() in OS/X <cmath>. This needs to be tested on other operating systems to make sure it doesn't break them instead.
Modified: trunk/configure.in
===================================================================
--- trunk/configure.in 2009-06-23 22:21:03 UTC (rev 2600)
+++ trunk/configure.in 2009-06-24 21:19:53 UTC (rev 2601)
@@ -166,6 +166,26 @@
if test x"$ac_cv_isfinite" = x"yes"; then
AC_DEFINE(HAVE_ISFINITE, [1], [Has isfinite])
fi
+
+dnl --------------------------------------------------------------------
+dnl Test for presence of isnan function when using C++ and <cmath>
+dnl This is for a particular bug in OS/X where <cmath> drops the definition
+dnl of isnan().
+
+AC_LANG_PUSH([C++])
+AC_CACHE_CHECK([for isnan], ac_cv_isnan,
+ [AC_TRY_LINK([#include <cmath>],
+ [double x; int y; y = isnan(x);],
+ ac_cv_isnan=yes,
+ ac_cv_isnan=no
+)])
+if test x"$ac_cv_isnan" = x"yes"; then
+ AC_DEFINE(HAVE_ISNAN, [1], [Has isnan])
+fi
+AC_LANG_POP([C++])
+
+dnl --------------------------------------------------------------------
+
LIBS=$save_LIBS
dnl --------------------------------------------------------------------
Modified: trunk/source/headers/geos/platform.h.in
===================================================================
--- trunk/source/headers/geos/platform.h.in 2009-06-23 22:21:03 UTC (rev 2600)
+++ trunk/source/headers/geos/platform.h.in 2009-06-24 21:19:53 UTC (rev 2601)
@@ -70,7 +70,13 @@
}
#define FINITE(x) ( isFinite(x) )
+#ifdef HAVE_ISNAN
#define ISNAN(x) ( isnan(x) )
+#else
+// Hack for OS/X <cmath> incorrectly re-defining isnan() into
+// oblivion. It does leave a version in std.
+#define ISNAN(c) ( std::isnan(x) )
+#endif
#ifdef HAVE_INT64_T_64
typedef int64_t int64;
More information about the geos-commits
mailing list