diff --git a/src/backend/port/isinf.c b/src/backend/port/isinf.c index 1fa31f82634171c45a6fcf5a3821b86b50719864..e21932670736672389bbfe5b3abab2619cf944a8 100644 --- a/src/backend/port/isinf.c +++ b/src/backend/port/isinf.c @@ -1,18 +1,12 @@ -/* $Id: isinf.c,v 1.10 1999/07/18 17:38:23 momjian Exp $ */ +/* $Id: isinf.c,v 1.11 1999/07/18 20:43:12 momjian Exp $ */ #include - #include "config.h" -#ifdef NOT_USED - +#if HAVE_FPCLASS #if HAVE_IEEEFP_H #include #endif -#if HAVE_FP_CLASS_H -#include -#endif - int isinf(double d) { @@ -29,6 +23,12 @@ isinf(double d) return 0; } +#else + +#if defined(HAVE_FP_CLASS) || defined(HAVE_FP_CLASS_D) +#if HAVE_FP_CLASS_H +#include +#endif int isinf(x) double x; @@ -49,3 +49,19 @@ double x; } #endif +#endif + +#if defined(HAVE_CLASS) +int +isinf(double x) +{ + int fpclass = class(x); + + if (fpclass == FP_PLUS_INF) + return 1; + if (fpclass == FP_MINUS_INF) + return -1; + return 0; +} + +#endif diff --git a/src/configure.in b/src/configure.in index 6b05753dbec996a42e500ba865cd476ddd7ec141..1cdb14760675f9f441663b6ccd74976144b84651 100644 --- a/src/configure.in +++ b/src/configure.in @@ -581,6 +581,7 @@ AC_CHECK_HEADERS(crypt.h) AC_CHECK_HEADERS(dld.h) AC_CHECK_HEADERS(endian.h) AC_CHECK_HEADERS(float.h) +AC_CHECK_HEADERS(fp_class.h) AC_CHECK_HEADERS(history.h) AC_CHECK_HEADERS(ieeefp.h) AC_CHECK_HEADERS(limits.h) @@ -665,6 +666,7 @@ AC_TYPE_SIGNAL AC_FUNC_VPRINTF AC_CHECK_FUNCS(memmove sigsetjmp sysconf) AC_CHECK_FUNCS(sigprocmask waitpid setsid fcvt) +AC_CHECK_FUNCS(fpclass fp_class fp_class_d class) dnl We use our snprintf.c emulation if either snprintf() or vsnprintf() dnl is missing. Yes, there are machines that have only one. dnl We may also decide to use snprintf.c if snprintf() is present but does @@ -714,6 +716,11 @@ AC_CHECK_FUNC(inet_aton, AC_DEFINE(HAVE_INET_ATON), INET_ATON='inet_aton.o') AC_SUBST(INET_ATON) +AC_CHECK_FUNC(strerror, + AC_DEFINE(HAVE_STRERROR), + [STRERROR='strerror.o' STRERROR2='../../backend/port/strerror.o']) +AC_SUBST(STRERROR) +AC_SUBST(STRERROR2) AC_CHECK_FUNC(strdup, AC_DEFINE(HAVE_STRDUP), STRDUP='../../utils/strdup.o') diff --git a/src/include/config.h.in b/src/include/config.h.in index eeba1204d2e60290104585ad07fac1633cf1184f..6bb03462c83b0e85b212b634ef112d715d6d6e59 100644 --- a/src/include/config.h.in +++ b/src/include/config.h.in @@ -303,10 +303,21 @@ /* Set to 1 if you have snprintf() */ #undef HAVE_SNPRINTF +/* Set to 1 if you have strerror() */ +#undef HAVE_STRERROR + /* Set to 1 if you have vsnprintf() */ #undef HAVE_VSNPRINTF -/* Set to 1 if you have isinf() */ +/* + * Set to 1 if you have isinf(). + * These are all realated to port/isinf.c + */ +#undef HAVE_FPCLASS +#undef HAVE_FP_CLASS +#undef HAVE_FP_CLASS_H +#undef HAVE_FP_CLASS_D +#undef HAVE_CLASS #undef HAVE_ISINF #ifndef HAVE_ISINF int isinf(double x);