[geos-devel] GCC 6 build error

Sandro Santilli strk at keybit.net
Thu Mar 3 00:27:03 PST 2016


On Wed, Mar 02, 2016 at 05:21:33PM +0100, Mateusz Loskot wrote:
> On 2 March 2016 at 17:13, Sandro Santilli <strk at keybit.net> wrote:
> >
> > This is the snippet, in configure.ac, to look for it:
> >
> >   AC_LANG_PUSH([C++])
> >   AC_CACHE_CHECK([for isnan], ac_cv_isnan,
> >    [AC_TRY_LINK([#include <cmath>],
> >    [double x; int y; y = isnan(x);],
> 
> I presume the test fails because it does not look for the function
> inside std [1], but assumes nan is in global namespace.
> I presume, it's especially the case for C++11 compilers.
> 
> [1] http://en.cppreference.com/w/cpp/numeric/math/isnan

I noticed the tests for finite/isfinite include <math.h>
rather than <cmath>, could that also change the namespacing
of isnan ?

Devrim, could you try the following patch ?

--strk;

diff --git a/configure.ac b/configure.ac
index 7fdc579..e64f450 100644
--- a/configure.ac
+++ b/configure.ac
@@ -195,9 +195,9 @@ 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_CACHE_CHECK([for std::isnan], ac_cv_isnan,
+ [AC_TRY_LINK([#include <math.h>],
+ [double x; int y; y = std::isnan(x);],
  ac_cv_isnan=yes,
  ac_cv_isnan=no
 )])


More information about the geos-devel mailing list