doc: use ASCII in .texi files where UTF-8 isn't needed
[gnulib.git] / m4 / fmaf.m4
index 9d6eb37..9e25014 100644 (file)
@@ -1,5 +1,5 @@
-# fmaf.m4 serial 1
-dnl Copyright (C) 2011 Free Software Foundation, Inc.
+# fmaf.m4 serial 3
+dnl Copyright (C) 2011-2014 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.
@@ -8,14 +8,29 @@ AC_DEFUN([gl_FUNC_FMAF],
 [
   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