]> Savannah Git Hosting - gnulib.git/commitdiff
hypotf: Avoid redefinition error on MSVC.
authorBruno Haible <bruno@clisp.org>
Sat, 17 Dec 2016 18:49:31 +0000 (19:49 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 17 Dec 2016 22:09:09 +0000 (23:09 +0100)
* m4/hypotf.m4 (gl_FUNC_HYPOTF): Set REPLACE_HYPOTF to 1 if the function
may be defined as an inline function.

ChangeLog
m4/hypotf.m4

index 0fdce80032617f65d09ff969cf0c1e2f534a5fa7..bc16945b0d54fef8a5397afb63ccccfee5038844 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-12-17  Bruno Haible  <bruno@clisp.org>
+
+       hypotf: Avoid redefinition error on MSVC.
+       * m4/hypotf.m4 (gl_FUNC_HYPOTF): Set REPLACE_HYPOTF to 1 if the function
+       may be defined as an inline function.
+
 2016-12-17  Bruno Haible  <bruno@clisp.org>
 
        fmodl: Avoid redefinition error on MSVC.
index a7c7f402234060d7f92909fe280ee80b98d7ce61..ebee6d906859b964234d699f323669185dd69918 100644 (file)
@@ -1,4 +1,4 @@
-# hypotf.m4 serial 4
+# hypotf.m4 serial 5
 dnl Copyright (C) 2012-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,
@@ -21,6 +21,7 @@ AC_DEFUN([gl_FUNC_HYPOTF],
   LIBS="$save_LIBS"
   if test $ac_cv_func_hypotf = yes; then
     HYPOTF_LIBM="$HYPOT_LIBM"
+
     save_LIBS="$LIBS"
     LIBS="$LIBS $HYPOTF_LIBM"
     gl_FUNC_HYPOTF_WORKS
@@ -29,6 +30,7 @@ AC_DEFUN([gl_FUNC_HYPOTF],
       *yes) ;;
       *) REPLACE_HYPOTF=1 ;;
     esac
+
     m4_ifdef([gl_FUNC_HYPOTF_IEEE], [
       if test $gl_hypotf_required = ieee && test $REPLACE_HYPOTF = 0; then
         AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
@@ -85,6 +87,10 @@ int main (int argc, char *argv[])
     ])
   else
     HAVE_HYPOTF=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_hypotf, not hypotf.
+    AC_CHECK_DECLS([hypotf], [REPLACE_HYPOTF=1], , [[#include <math.h>]])
   fi
   if test $HAVE_HYPOTF = 0 || test $REPLACE_HYPOTF = 1; then
     dnl Find libraries needed to link lib/hypotf.c.