#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER)
#endif
+/* The isfinite macro is only available with C99, but some non-C99
+ systems still provide fpclassify, and there is a `finite' function
+ in BSD. When isfinite is not available, try to use one of the
+ alternatives, or bail out. */
+#if !defined(isfinite)
+static inline int
+isfinite (double x)
+{
+#if defined(fpclassify)
+ return (fpclassify(x) != FP_NAN && fpclassify(x) != FP_INFINITE);
+#elif defined(HAVE_FINITE)
+ return finite (x);
+#else
+#error "libgfortran needs isfinite, fpclassify, or finite"
+#endif
+}
+#endif /* !defined(isfinite) */
+
/* TODO: find the C99 version of these an move into above ifdef. */
#define REALPART(z) (__real__(z))
#define IMAGPART(z) (__imag__(z))
#define size0 prefix(size0)
index_type size0 (const array_t * array);
-#endif
+#endif /* LIBGFOR_H */