Sean,

> I'd love to be able to build 2.2.0 on this slightly out of date compiler,
> but if 2.2.0 will require C++11, I'll get with the program.

2.2.0 doesn't rquire C++11

It seems that this compiler undefines the C99 isnan() macro in all cases as 
soon as <cmath> is 
included.

Can you revert all the changes of your tree and apply the attached patch ?

--without-cpp11 will probably still be needed.

If that doesn't work, can you send the output of the following:

gcc -dM -E - < /dev/null

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
Index: configure.ac
===================================================================
--- configure.ac	(révision 38115)
+++ configure.ac	(copie de travail)
@@ -183,6 +183,20 @@
   AC_MSG_ERROR("You don't have a working C++ compiler.")
 fi
 
+AC_MSG_CHECKING([for std::isnan])
+AC_LANG_PUSH([C++])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+  [[#include <cmath>
+    int CPLIsNan(float f) { return std::isnan(f); }]])],
+  [
+    AC_MSG_RESULT([yes])
+    AC_DEFINE_UNQUOTED(HAVE_STD_IS_NAN, 1,
+          [Define to 1 if you have the `std::isnan' function.])
+  ], [
+    AC_MSG_RESULT([no])
+  ])
+AC_LANG_POP([C++])
+
 dnl switch between libtool and native build system
 AC_ARG_WITH(libtool, [  --without-libtool     Don't use libtool to build the library],,)
 
Index: configure
===================================================================
--- configure	(révision 38115)
+++ configure	(copie de travail)
@@ -17954,7 +17954,51 @@
   as_fn_error $? "\"You don't have a working C++ compiler.\"" "$LINENO" 5
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for std::isnan" >&5
+$as_echo_n "checking for std::isnan... " >&6; }
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <cmath>
+    int CPLIsNan(float f) { return std::isnan(f); }
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STD_IS_NAN 1
+_ACEOF
+
+
+else
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
 # Check whether --with-libtool was given.
 if test "${with_libtool+set}" = set; then :
   withval=$with_libtool;
Index: port/cpl_config.h.in
===================================================================
--- port/cpl_config.h.in	(révision 38115)
+++ port/cpl_config.h.in	(copie de travail)
@@ -258,3 +258,6 @@
 
 /* Define to 1 if you have the `uselocale' function. */
 #undef HAVE_USELOCALE
+
+/* Define to 1 if you have the `std::isnan' function. */
+#undef HAVE_STD_IS_NAN
Index: port/cpl_port.h
===================================================================
--- port/cpl_port.h	(révision 38115)
+++ port/cpl_port.h	(copie de travail)
@@ -653,8 +653,7 @@
 #  define CPLIsNan(x) _isnan(x)
 #  define CPLIsInf(x) (!_isnan(x) && !_finite(x))
 #  define CPLIsFinite(x) _finite(x)
-#elif defined(__cplusplus) && defined(__MINGW32__) &&  __GNUC__ == 4 && __GNUC_MINOR__ == 2
-/* Hack for compatibility with ancient i586-mingw32msvc toolchain */
+#elif defined(__cplusplus) && defined(HAVE_STD_IS_NAN) && HAVE_STD_IS_NAN
 extern "C++" {
 #include <cmath>
 static inline int CPLIsNan(float f) { return std::isnan(f); }
_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to