From 4d73c647b55977d23c4295073945bd8aeb91ff83 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Thu, 14 Nov 2013 17:03:40 +0100 Subject: Use isfinite() instead of finite() when available OS X Mavericks builds result in a number of warnings about finite() being deprecated, like these: beam/erl_arith.c:451:7: warning: 'finite' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations] ERTS_FP_ERROR(p, f1.fd, goto badarith); ^ sys/unix/erl_unix_sys.h:319:33: note: expanded from macro 'ERTS_FP_ERROR' ^ sys/unix/erl_unix_sys.h:244:51: note: expanded from macro '__ERTS_FP_ERROR' ^ /usr/include/math.h:718:12: note: 'finite' has been explicitly marked deprecated here extern int finite(double) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_9, __IPHONE_NA, __IPHONE_NA); Add checks to use isfinite() instead of finite() where available. Verified on OS X Mavericks 10.9.5 and Ubuntu 12.04. --- erts/configure.in | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'erts/configure.in') diff --git a/erts/configure.in b/erts/configure.in index 766e35fb2b..9864d03cde 100644 --- a/erts/configure.in +++ b/erts/configure.in @@ -2109,6 +2109,17 @@ AC_CHECK_FUNCS([ieee_handler fpsetmask finite isnan isinf res_gethostbyname dlop flockfile fstat strlcpy strlcat setsid posix2time time2posix \ setlocale nl_langinfo poll mlockall]) +AC_MSG_CHECKING([for isfinite]) +AC_TRY_LINK([#include ], + [isfinite(0);], have_isfinite=yes, have_isfinite=no), + +if test $have_isfinite = yes; then + AC_DEFINE(HAVE_ISFINITE,[1], + [Define to 1 if you have the `isfinite' function.]) + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi case X$erl_xcomp_posix_memalign in Xno) ;; @@ -4817,7 +4828,7 @@ AH_BOTTOM([ #define HAVE_GETHRVTIME #endif -#ifndef HAVE_FINITE +#if !defined(HAVE_ISFINITE) && !defined(HAVE_FINITE) # if defined(HAVE_ISINF) && defined(HAVE_ISNAN) # define USE_ISINF_ISNAN # endif -- cgit v1.2.3