]> granicus.if.org Git - postgis/commitdiff
Keep isfinite() but downgrade for platforms that lack it.
authorPaul Ramsey <pramsey@cleverelephant.ca>
Fri, 1 Aug 2014 22:55:34 +0000 (22:55 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Fri, 1 Aug 2014 22:55:34 +0000 (22:55 +0000)
Centos 5 has it with _GNU_SOURCE
Older Solaris doesn't have it

git-svn-id: http://svn.osgeo.org/postgis/trunk@12854 b70326c6-7e19-0410-871a-916f4a2858ee

configure.ac
liblwgeom/g_box.c
postgis/gserialized_gist_2d.c
postgis/gserialized_gist_nd.c
postgis_config.h.in

index c3d6015d50363630d4bf012ef5888dcd6b98a15d..a63adee57e6411d57ecad0ccc3e475b08b375189 100644 (file)
@@ -112,14 +112,23 @@ AC_DEFINE_UNQUOTED([HAVE_TERMIOS_H], [$HAVE_TERMIOS_H], [termios.h header])
 dnl
 dnl Check for platform-specific functions
 dnl
-AC_CHECK_FUNC(vasprintf, [HAVE_VASPRINTF=1], [HAVE_VASPRINTF=0])
-AC_DEFINE([HAVE_VASPRINTF])
-AC_CHECK_FUNC(asprintf, [HAVE_ASPRINTF=1], [HAVE_ASPRINTF=0])
-AC_DEFINE([HAVE_ASPRINTF])
+AC_CHECK_FUNC(vasprintf, AC_DEFINE([HAVE_VASPRINTF]))
+AC_CHECK_FUNC(asprintf, AC_DEFINE([HAVE_ASPRINTF]))
 AC_FUNC_FSEEKO()
-AC_CHECK_FUNC(isfinite, [HAVE_ISFINITE=1], [HAVE_ISFINITE=0])
-AC_DEFINE([HAVE_ISFINITE])
 
+dnl 
+dnl First see if we have isfinite in basic header
+dnl then check to see if it's a GNU extension
+dnl
+AC_CHECK_DECL(isfinite, 
+  [AC_DEFINE([HAVE_ISFINITE])], 
+  [],
+  [#include <math.h>])
+
+AC_CHECK_DECL(isfinite,
+  AC_DEFINE([HAVE_GNU_ISFINITE]),
+  [],
+  [[#define _GNU_SOURCE],[#include <math.h>]])
 
 dnl 
 dnl MingW requires use of pwd -W to give proper Windows (not MingW) paths 
index dd4d21aa2979430903d132f0b3a4ffb6627766e8..239fd8b0b1a09417d7bbd7299d738572431970cd 100644 (file)
@@ -10,9 +10,6 @@
  **********************************************************************/
 
 #if !HAVE_ISFINITE
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
 #endif
 
 #include "liblwgeom_internal.h"
 #include <stdlib.h>
 #include <math.h>
 
+/* Fall back to older finite() if necessary */
+#ifndef HAVE_ISFINITE
+# ifdef HAVE_GNU_ISFINITE
+#  define _GNU_SOURCE
+# else
+#  define isfinite finite
+# endif
+#endif
+
 GBOX* gbox_new(uint8_t flags)
 {
        GBOX *g = (GBOX*)lwalloc(sizeof(GBOX));
index 345791706f0429129363fc23a43ff0f44ade1206..5c1ef85c275534de136d3d01abcad4f072550370 100644 (file)
 #include "gserialized_gist.h"       /* For utility functions. */
 #include "liblwgeom_internal.h"  /* For MAXFLOAT */
 
+/* Fall back to older finite() if necessary */
+#ifndef HAVE_ISFINITE
+# ifdef HAVE_GNU_ISFINITE
+#  define _GNU_SOURCE
+# else
+#  define isfinite finite
+# endif
+#endif
+
+
 /*
 ** When is a node split not so good? If more than 90% of the entries
 ** end up in one of the children.
index 727ed9da684d5e431d0310f136a023a76f9302ff..641c94bf5ea3ac38426734c623281f26432c1c9d 100644 (file)
 #include "gserialized_gist.h"       /* For utility functions. */
 #include "geography.h"
 
+/* Fall back to older finite() if necessary */
+#ifndef HAVE_ISFINITE
+# ifdef HAVE_GNU_ISFINITE
+#  define _GNU_SOURCE
+# else
+#  define isfinite finite
+# endif
+#endif
+
 /*
 ** When is a node split not so good? If more than 90% of the entries
 ** end up in one of the children.
index c1f056994236e361f7f770469db74570b586c5bb..2fe598ae657231377fd3a26ad657ea135cd69502 100644 (file)
@@ -25,8 +25,9 @@
 /* Define for some functions we are interested in */
 #undef HAVE_VASPRINTF
 #undef HAVE_ASPRINTF
-#undef HAVE_FSEEKO
 #undef HAVE_ISFINITE
+#undef HAVE_GNU_ISFINITE
+#undef HAVE_FSEEKO
 
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H