1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
diff -urp geos-3.5.0-old/configure geos-3.5.0/configure
--- geos-3.5.0-old/configure 2015-08-16 18:22:07.000000000 -0400
+++ geos-3.5.0/configure 2016-04-18 09:03:56.912678918 -0400
@@ -17822,6 +17822,39 @@ if test x"$ac_cv_isnan" = x"yes"; then
$as_echo "#define HAVE_ISNAN 1" >>confdefs.h
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for std::isnan" >&5
+$as_echo_n "checking for std::isnan... " >&6; }
+if ${ac_cv_std_isnan+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <cmath>
+int
+main ()
+{
+double x; int y; y = std::isnan(x);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+ ac_cv_std_isnan=yes
+else
+ ac_cv_std_isnan=no
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_std_isnan" >&5
+$as_echo "$ac_cv_std_isnan" >&6; }
+ if test x"$ac_cv_std_isnan" = x"yes"; then
+
+$as_echo "#define HAVE_STD_ISNAN 1" >>confdefs.h
+
+ fi
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
diff -urp geos-3.5.0-old/configure.ac geos-3.5.0/configure.ac
--- geos-3.5.0-old/configure.ac 2015-08-14 14:31:26.000000000 -0400
+++ geos-3.5.0/configure.ac 2016-04-18 09:03:37.064679323 -0400
@@ -192,7 +192,7 @@ 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().
+dnl of isnan(). A number of other systems appear to do the same thing.
AC_LANG_PUSH([C++])
AC_CACHE_CHECK([for isnan], ac_cv_isnan,
@@ -203,6 +203,16 @@ AC_CACHE_CHECK([for isnan], ac_cv_isnan,
)])
if test x"$ac_cv_isnan" = x"yes"; then
AC_DEFINE(HAVE_ISNAN, [1], [Has isnan])
+else
+ AC_CACHE_CHECK([for std::isnan], ac_cv_std_isnan,
+ [AC_TRY_LINK([#include <cmath>],
+ [double x; int y; y = std::isnan(x);],
+ ac_cv_std_isnan=yes,
+ ac_cv_std_isnan=no
+ )])
+ if test x"$ac_cv_std_isnan" = x"yes"; then
+ AC_DEFINE(HAVE_STD_ISNAN, [1], [Has std::isnan])
+ fi
fi
AC_LANG_POP([C++])
diff -urp geos-3.5.0-old/include/geos/platform.h.in geos-3.5.0/include/geos/platform.h.in
--- geos-3.5.0-old/include/geos/platform.h.in 2015-08-14 14:23:18.000000000 -0400
+++ geos-3.5.0/include/geos/platform.h.in 2016-04-18 08:52:50.480692517 -0400
@@ -22,6 +22,9 @@
/* Has isnan */
#undef HAVE_ISNAN
+/* Has std::isnan */
+#undef HAVE_STD_ISNAN
+
#ifdef HAVE_IEEEFP_H
extern "C"
{
@@ -87,18 +90,16 @@ extern "C"
#if defined(HAVE_ISNAN)
# define ISNAN(x) (isnan(x))
+#elif defined(HAVE_STD_ISNAN)
+ // Hack for OS/X <cmath> incorrectly re-defining isnan() into oblivion.
+ // It does leave a version in std.
+# define ISNAN(x) (std::isnan(x))
#else
# if defined(_MSC_VER)
# define ISNAN(x) _isnan(x)
# elif defined(__MINGW32__) || defined(__CYGWIN__)
// sandro furieri: sanitizing MinGW32
# define ISNAN(x) (std::isnan(x))
-# elif defined(__OSX__) || defined(__APPLE__) || \
- defined(__NetBSD__) || defined(__DragonFly__) || defined (__OpenBSD__) || \
- (defined(__sun) && defined(__GNUC__))
- // Hack for OS/X <cmath> incorrectly re-defining isnan() into oblivion.
- // It does leave a version in std.
-# define ISNAN(x) (std::isnan(x))
# elif (defined(__sun) || defined(__sun__)) && defined(__SUNPRO_CC)
# include <math.h>
# define ISNAN(x) (::isnan(x))
|