From b04abee685f38db9d1be15f8406ca79dabde7ee1 Mon Sep 17 00:00:00 2001 From: Charles Karney Date: Fri, 23 Mar 2018 06:34:48 -0400 Subject: If HAVE_C99_MATH, define pj_is_nan as isnan. Extend HAVE_C99_MATH checks in CMakeLists.txt and configure.ac to include test for C99 function isnan. --- src/pj_internal.c | 4 ++++ src/proj_internal.h | 8 ++++++++ 2 files changed, 12 insertions(+) (limited to 'src') diff --git a/src/pj_internal.c b/src/pj_internal.c index 9cbbf20a..4da47051 100644 --- a/src/pj_internal.c +++ b/src/pj_internal.c @@ -445,6 +445,9 @@ void proj_log_func (PJ_CONTEXT *ctx, void *app_data, PJ_LOG_FUNCTION logf) { } +#if HAVE_C99_MATH +/* proj_internal.h defines pj_is_nan as isnan */ +#else /*****************************************************************************/ int pj_is_nan (double val) { /****************************************************************************** @@ -455,3 +458,4 @@ int pj_is_nan (double val) { /* cppcheck-suppress duplicateExpression */ return val != val; } +#endif diff --git a/src/proj_internal.h b/src/proj_internal.h index b3843a59..3f6ccde0 100644 --- a/src/proj_internal.h +++ b/src/proj_internal.h @@ -50,6 +50,10 @@ extern "C" { #define STATIC_ASSERT(COND) ((void)sizeof(char[(COND) ? 1 : -1])) +#if !defined(HAVE_C99_MATH) +#define HAVE_C99_MATH 0 +#endif + #ifndef PJ_TODEG #define PJ_TODEG(rad) ((rad)*180.0/M_PI) #endif @@ -130,7 +134,11 @@ void proj_fileapi_set (PJ *P, void *fileapi); const char * const *proj_get_searchpath(void); int proj_get_path_count(void); +#if HAVE_C99_MATH +#define pj_is_nan isnan +#else int pj_is_nan (double val); +#endif #ifdef __cplusplus } -- cgit v1.2.3