From 1a1d5eee3506691a9855a8f9fecd5e619542d128 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Sat, 17 Dec 2016 19:44:34 +0100
Subject: [PATCH] fmodf: Avoid redefinition error on MSVC.

* m4/fmodf.m4 (gl_FUNC_FMODF): Set REPLACE_FMODF to 1 if the function
may be defined as an inline function.
---
 ChangeLog   | 6 ++++++
 m4/fmodf.m4 | 6 +++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index cb25d65c24..093964a603 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-12-17  Bruno Haible  <bruno@clisp.org>
+
+	fmodf: Avoid redefinition error on MSVC.
+	* m4/fmodf.m4 (gl_FUNC_FMODF): Set REPLACE_FMODF to 1 if the function
+	may be defined as an inline function.
+
 2016-12-17  Bruno Haible  <bruno@clisp.org>
 
 	expf: Avoid redefinition error on MSVC.
diff --git a/m4/fmodf.m4 b/m4/fmodf.m4
index b055e738fe..8f5989df5f 100644
--- a/m4/fmodf.m4
+++ b/m4/fmodf.m4
@@ -1,4 +1,4 @@
-# fmodf.m4 serial 5
+# fmodf.m4 serial 6
 dnl Copyright (C) 2011-2016 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -75,6 +75,10 @@ int main (int argc, char *argv[])
     ])
   else
     HAVE_FMODF=0
+    dnl If the function is declared but does not appear to exist, it may be
+    dnl defined as an inline function. In order to avoid a conflict, we have
+    dnl to define rpl_fmodf, not fmodf.
+    AC_CHECK_DECLS([fmodf], [REPLACE_FMODF=1], , [[#include <math.h>]])
   fi
   if test $HAVE_FMODF = 0 || test $REPLACE_FMODF = 1; then
     dnl Find libraries needed to link lib/fmodf.c.
-- 
2.39.5