-# fmaf.m4 serial 1
-dnl Copyright (C) 2011-2012 Free Software Foundation, Inc.
+# fmaf.m4 serial 3
+dnl Copyright (C) 2011-2013 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
[
AC_REQUIRE([gl_MATH_H_DEFAULTS])
+ dnl Persuade glibc <math.h> to declare fmaf().
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
dnl Determine FMAF_LIBM.
- gl_MATHFUNC([fmaf], [float], [(float, float, float)])
+ gl_MATHFUNC([fmaf], [float], [(float, float, float)],
+ [extern
+ #ifdef __cplusplus
+ "C"
+ #endif
+ float fmaf (float, float, float);
+ ])
if test $gl_cv_func_fmaf_no_libm = yes \
|| test $gl_cv_func_fmaf_in_libm = yes; then
- gl_FUNC_FMAF_WORKS
- case "$gl_cv_func_fmaf_works" in
- *no) REPLACE_FMAF=1 ;;
- esac
+ dnl Also check whether it's declared.
+ dnl IRIX 6.5 has fmaf() in libm but doesn't declare it in <math.h>,
+ dnl and the function is likely buggy.
+ AC_CHECK_DECL([fmaf], , [REPLACE_FMAF=1], [[#include <math.h>]])
+ if test $REPLACE_FMAF = 0; then
+ gl_FUNC_FMAF_WORKS
+ case "$gl_cv_func_fmaf_works" in
+ *no) REPLACE_FMAF=1 ;;
+ esac
+ fi
else
HAVE_FMAF=0
fi