diff lib/math.in.h @ 16532:1fcd2cd248a9

hypotl-ieee: Work around test failure on OSF/1 and native Windows. * m4/hypotl-ieee.m4: New file. * m4/hypotl.m4 (gl_FUNC_HYPOTL): If gl_FUNC_HYPOTL_IEEE is present, test whether hypotl works with mixed NaN and Infinity arguments. Replace it if not. * lib/math.in.h (hypotl): Override if REPLACE_HYPOTL is 1. * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize REPLACE_HYPOTL. * modules/math (Makefile.am): Substitute REPLACE_HYPOTL. * modules/hypotl (configure.ac): Consider REPLACE_HYPOTL. (Depends-on): Update conditions. * modules/hypotl-ieee (Files): Add m4/hypotl-ieee.m4. (Depends-on): Add hypot-ieee. (configure.ac): Invoke gl_FUNC_HYPOTL_IEEE. * doc/posix-functions/hypotl.texi: Mention the hypotl-ieee module.
author Bruno Haible <bruno@clisp.org>
date Wed, 29 Feb 2012 20:50:49 +0100
parents 3cae6aa4577f
children d91850ca525f
line wrap: on
line diff
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -855,10 +855,19 @@
 
 /* Return sqrt(x^2+y^2).  */
 #if @GNULIB_HYPOTL@
-# if !@HAVE_HYPOTL@
+# if @REPLACE_HYPOTL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef hypotl
+#   define hypotl rpl_hypotl
+#  endif
+_GL_FUNCDECL_RPL (hypotl, long double, (long double x, long double y));
+_GL_CXXALIAS_RPL (hypotl, long double, (long double x, long double y));
+# else
+#  if !@HAVE_HYPOTL@
 _GL_FUNCDECL_SYS (hypotl, long double, (long double x, long double y));
+#  endif
+_GL_CXXALIAS_SYS (hypotl, long double, (long double x, long double y));
 # endif
-_GL_CXXALIAS_SYS (hypotl, long double, (long double x, long double y));
 _GL_CXXALIASWARN (hypotl);
 #elif defined GNULIB_POSIXCHECK
 # undef hypotl