From efa7685701e216cc943708163e63d546bc7c2abd Mon Sep 17 00:00:00 2001 From: David Neary Date: Wed, 20 Jun 2001 10:59:57 +0000 Subject: [PATCH] ted 2001-06-20 David Neary * configure.in * libgimp/gimpmath.h: Imported fix from bug #51822 into 1.3 branch. Fix is courtesy of . --- ChangeLog | 6 ++++++ configure.in | 16 ++++++++++++++++ libgimpmath/gimpmath.h | 21 ++++++++++++++++----- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0c4718797e..26b6eee35c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2001-06-20 David Neary + + * configure.in + * libgimp/gimpmath.h: Imported fix from bug #51822 into 1.3 + branch. Fix is courtesy of . + 2001-06-18 Austin Donnelly * plug-ins/common/newsprint.c: Fix from diff --git a/configure.in b/configure.in index 1b7bb78d09..fc6b67090a 100644 --- a/configure.in +++ b/configure.in @@ -142,6 +142,8 @@ fi changequote([,])dnl +AC_CHECK_HEADERS(math.h ieeefp.h) + dnl DU4 native cc currently needs -std1 for ANSI mode (instead of K&R) AC_MSG_CHECKING([for extra flags to get ANSI library prototypes]) gimp_save_LIBS=$LIBS @@ -417,6 +419,20 @@ AC_FUNC_VPRINTF AC_FUNC_ALLOCA +dnl Check for finite or isfinite +AC_CHECK_FUNCS(finite, , [ + AC_MSG_CHECKING(for finite in ) + AC_TRY_LINK([#include ], [double f = 0.0; finite (f)], [ + AC_DEFINE(HAVE_FINITE) + AC_MSG_RESULT(yes)], [ + AC_MSG_RESULT(no) + AC_MSG_CHECKING(for isfinite in ) + AC_TRY_LINK([#include ], [float f = 0.0; isfinite(f)], [ + AC_DEFINE(HAVE_ISFINITE) + AC_MSG_RESULT(yes)], AC_MSG_RESULT(no))])]) +AC_SUBST(HAVE_FINITE) +AC_SUBST(HAVE_ISFINITE) + dnl Check for sys/select.h AC_MSG_CHECKING([fd_set and sys/select]) diff --git a/libgimpmath/gimpmath.h b/libgimpmath/gimpmath.h index 6068418cf2..e26760503f 100644 --- a/libgimpmath/gimpmath.h +++ b/libgimpmath/gimpmath.h @@ -22,7 +22,13 @@ #ifndef __GIMP_MATH_H__ #define __GIMP_MATH_H__ +#ifdef HAVE_MATH_H #include +#endif + +#ifdef HAVE_IEEEFP_H +#include +#endif #ifdef G_OS_WIN32 #include @@ -86,16 +92,21 @@ extern "C" { #define gimp_deg_to_rad(angle) ((angle) * (2.0 * G_PI) / 360.0) #define gimp_rad_to_deg(angle) ((angle) * 360.0 / (2.0 * G_PI)) +#ifdef HAVE_FINITE +#define FINITE(x) finite(x) +#else +#ifdef HAVE_ISFINITE +#define FINITE(x) isfinite(x) +#else #ifdef G_OS_WIN32 #define FINITE(x) _finite(x) #else #ifdef __EMX__ #define FINITE(x) isfinite(x) -#else -#define FINITE(x) finite(x) -#endif -#endif - +#endif /* __EMX__ */ +#endif /* G_OS_WIN32 */ +#endif /* HAVE_ISFINITE */ +#endif /* HAVE_FINITE */ #ifdef __cplusplus }