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
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
**********************************************************************/
#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));
#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.
#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.
/* 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