From a774152f1ad87db57787102620722384dcf9c329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Tue, 24 May 2011 21:05:28 +0200 Subject: [PATCH] port: Add isinf and isnan implementations for Visual Studio. --- configure | 2 ++ configure.ac | 2 ++ include/config.h.in | 6 ++++++ libs/port/isinf.c | 8 ++++++++ libs/port/isnan.c | 8 ++++++++ 5 files changed, 26 insertions(+) diff --git a/configure b/configure index efb2b1fb4ff..ea832b5dc42 100755 --- a/configure +++ b/configure @@ -12803,6 +12803,8 @@ esac ac_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $BUILTINFLAG" for ac_func in \ + _finite \ + _isnan \ _pclose \ _popen \ _snprintf \ diff --git a/configure.ac b/configure.ac index ae44609c3cd..683bae9e31d 100644 --- a/configure.ac +++ b/configure.ac @@ -1939,6 +1939,8 @@ dnl **** Check for functions **** ac_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $BUILTINFLAG" AC_CHECK_FUNCS(\ + _finite \ + _isnan \ _pclose \ _popen \ _snprintf \ diff --git a/include/config.h.in b/include/config.h.in index 4bdbc38ddd4..04507e06f96 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -1151,6 +1151,12 @@ /* Define to 1 if you have the header file. */ #undef HAVE_ZLIB_H +/* Define to 1 if you have the `_finite' function. */ +#undef HAVE__FINITE + +/* Define to 1 if you have the `_isnan' function. */ +#undef HAVE__ISNAN + /* Define to 1 if you have the `_pclose' function. */ #undef HAVE__PCLOSE diff --git a/libs/port/isinf.c b/libs/port/isinf.c index e0c35ad1771..fff24aadb4f 100644 --- a/libs/port/isinf.c +++ b/libs/port/isinf.c @@ -31,6 +31,14 @@ int isinf(double x) return (!(finite(x) || isnand(x))); } +#elif defined(HAVE_FLOAT_H) && defined(HAVE__ISNAN) && defined(HAVE__FINITE) +#include + +int isinf(double x) +{ + return (!(_finite(x) || _isnan(x))); +} + #else #error No isinf() implementation available. #endif diff --git a/libs/port/isnan.c b/libs/port/isnan.c index b2a1be65429..c48dd41e607 100644 --- a/libs/port/isnan.c +++ b/libs/port/isnan.c @@ -31,6 +31,14 @@ int isnan(double x) return isnand(x); } +#elif defined(HAVE_FLOAT_H) && defined(HAVE__ISNAN) +#include + +int isnan(double x) +{ + return _isnan(x); +} + #else #error No isnan() implementation available. #endif