From 829aec1e2f23504b12cd982e6d13dd6eef52e8b1 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 5 Apr 2024 16:04:59 +0200 Subject: [PATCH] roundl: Fix a link error on Linux/powerpc64le. * m4/check-math-lib.m4 (gl_CHECK_MATH_LIB): Accept an additional TYPE argument. * m4/isfinite.m4 (gl_ISFINITE): Use the type 'double'. * m4/isinf.m4 (gl_ISINF): Likewise. * m4/round.m4 (gl_FUNC_ROUND): Likewise. * m4/roundf.m4 (gl_FUNC_ROUNDF): Use the type 'float'. * m4/roundl.m4 (gl_FUNC_ROUNDL): Use the type 'long double'. --- ChangeLog | 11 +++++++++++ m4/check-math-lib.m4 | 20 ++++++++++---------- m4/isfinite.m4 | 8 ++++---- m4/isinf.m4 | 7 ++++--- m4/round.m4 | 6 +++--- m4/roundf.m4 | 6 +++--- m4/roundl.m4 | 6 +++--- 7 files changed, 38 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index d4d3831cac..42c86b1cda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2024-04-05 Bruno Haible + + roundl: Fix a link error on Linux/powerpc64le. + * m4/check-math-lib.m4 (gl_CHECK_MATH_LIB): Accept an additional TYPE + argument. + * m4/isfinite.m4 (gl_ISFINITE): Use the type 'double'. + * m4/isinf.m4 (gl_ISINF): Likewise. + * m4/round.m4 (gl_FUNC_ROUND): Likewise. + * m4/roundf.m4 (gl_FUNC_ROUNDF): Use the type 'float'. + * m4/roundl.m4 (gl_FUNC_ROUNDL): Use the type 'long double'. + 2024-04-05 Bruno Haible expl tests: Avoid test failure on NetBSD 10.0/i386. diff --git a/m4/check-math-lib.m4 b/m4/check-math-lib.m4 index 4c300e2c52..dbfab2a349 100644 --- a/m4/check-math-lib.m4 +++ b/m4/check-math-lib.m4 @@ -1,17 +1,17 @@ -# check-math-lib.m4 serial 4 -dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. +# check-math-lib.m4 serial 4.1 +dnl Copyright (C) 2007, 2009-2024 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. dnl -dnl gl_CHECK_MATH_LIB (VARIABLE, EXPRESSION [, EXTRA-CODE]) +dnl gl_CHECK_MATH_LIB (VARIABLE, TYPE, EXPRESSION [, EXTRA-CODE]) dnl dnl Sets the shell VARIABLE according to the libraries needed by EXPRESSION -dnl to compile and link: to the empty string if no extra libraries are needed, -dnl to "-lm" if -lm is needed, or to "missing" if it does not compile and -dnl link either way. +dnl (that operates on a variable x of type TYPE) to compile and link: to the +dnl empty string if no extra libraries are needed, to "-lm" if -lm is needed, +dnl or to "missing" if it does not compile and link either way. dnl -dnl Example: gl_CHECK_MATH_LIB([ROUNDF_LIBM], [x = roundf (x);]) +dnl Example: gl_CHECK_MATH_LIB([ROUNDF_LIBM], [float], [x = roundf (x);]) AC_DEFUN([gl_CHECK_MATH_LIB], [ save_LIBS=$LIBS $1=missing @@ -22,9 +22,9 @@ AC_DEFUN([gl_CHECK_MATH_LIB], [ # define __NO_MATH_INLINES 1 /* for glibc */ #endif #include - $3 - double x;]], - [$2])], + $4 + $2 x;]], + [$3])], [$1=$libm break]) done diff --git a/m4/isfinite.m4 b/m4/isfinite.m4 index f70181e778..8db9b66dd8 100644 --- a/m4/isfinite.m4 +++ b/m4/isfinite.m4 @@ -1,5 +1,5 @@ -# isfinite.m4 serial 17.1 -dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. +# isfinite.m4 serial 17.2 +dnl Copyright (C) 2007-2024 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. @@ -12,8 +12,8 @@ AC_DEFUN([gl_ISFINITE], AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_CHECK_DECLS([isfinite], , , [[#include ]]) if test "$ac_cv_have_decl_isfinite" = yes; then - gl_CHECK_MATH_LIB([ISFINITE_LIBM], - [x = isfinite (x) + isfinite ((float) x);]) + gl_CHECK_MATH_LIB([ISFINITE_LIBM], [double], + [x = isfinite (x) + isfinite ((float) x);]) if test "$ISFINITE_LIBM" != missing; then dnl Test whether isfinite() on 'long double' works. gl_ISFINITEL_WORKS diff --git a/m4/isinf.m4 b/m4/isinf.m4 index 2b5ebdf9d4..dd82b0678b 100644 --- a/m4/isinf.m4 +++ b/m4/isinf.m4 @@ -1,5 +1,5 @@ -# isinf.m4 serial 13 -dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. +# isinf.m4 serial 13.1 +dnl Copyright (C) 2007-2024 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. @@ -17,7 +17,8 @@ AC_DEFUN([gl_ISINF], #endif ]]) if test "$ac_cv_have_decl_isinf" = yes; then - gl_CHECK_MATH_LIB([ISINF_LIBM], [x = isinf (x) + isinf ((float) x);]) + gl_CHECK_MATH_LIB([ISINF_LIBM], [double], + [x = isinf (x) + isinf ((float) x);]) if test "$ISINF_LIBM" != missing; then dnl Test whether isinf() on 'long double' works. gl_ISINFL_WORKS diff --git a/m4/round.m4 b/m4/round.m4 index febc098ef9..f2e1263854 100644 --- a/m4/round.m4 +++ b/m4/round.m4 @@ -1,5 +1,5 @@ -# round.m4 serial 24 -dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. +# round.m4 serial 24.1 +dnl Copyright (C) 2007, 2009-2024 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. @@ -12,7 +12,7 @@ AC_DEFUN([gl_FUNC_ROUND], dnl Persuade glibc to declare round(). AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - gl_CHECK_MATH_LIB([ROUND_LIBM], [x = round (x);], + gl_CHECK_MATH_LIB([ROUND_LIBM], [double], [x = round (x);], [extern #ifdef __cplusplus "C" diff --git a/m4/roundf.m4 b/m4/roundf.m4 index ca8f6398b4..24fb38a250 100644 --- a/m4/roundf.m4 +++ b/m4/roundf.m4 @@ -1,5 +1,5 @@ -# roundf.m4 serial 25 -dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. +# roundf.m4 serial 25.1 +dnl Copyright (C) 2007-2024 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. @@ -12,7 +12,7 @@ AC_DEFUN([gl_FUNC_ROUNDF], dnl Persuade glibc to declare roundf(). AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - gl_CHECK_MATH_LIB([ROUNDF_LIBM], [x = roundf (x);], + gl_CHECK_MATH_LIB([ROUNDF_LIBM], [float], [x = roundf (x);], [extern #ifdef __cplusplus "C" diff --git a/m4/roundl.m4 b/m4/roundl.m4 index f23378cfb5..16105e2f85 100644 --- a/m4/roundl.m4 +++ b/m4/roundl.m4 @@ -1,5 +1,5 @@ -# roundl.m4 serial 21 -dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. +# roundl.m4 serial 21.1 +dnl Copyright (C) 2007, 2009-2024 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. @@ -13,7 +13,7 @@ AC_DEFUN([gl_FUNC_ROUNDL], dnl Persuade glibc to declare roundl(). AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - gl_CHECK_MATH_LIB([ROUNDL_LIBM], [x = roundl (x);], + gl_CHECK_MATH_LIB([ROUNDL_LIBM], [long double], [x = roundl (x);], [extern #ifdef __cplusplus "C" -- 2.39.5