From bdf69b19ec779959e7d00d54069b0fbfd2bace4f Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 20 Jul 2024 16:38:11 +0200 Subject: [PATCH] getpayload*: Do use glibc's implementation when it works. Reported by Andreas K. Huettel in . * m4/getpayload.m4 (gl_FUNC_GETPAYLOADF, gl_FUNC_GETPAYLOAD, gl_FUNC_GETPAYLOADL): Link the test program with -lm if needed. --- ChangeLog | 8 ++++++++ m4/getpayload.m4 | 26 ++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index fe57fda441..35c9b72f0c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2024-07-20 Bruno Haible + + getpayload*: Do use glibc's implementation when it works. + Reported by Andreas K. Huettel in + . + * m4/getpayload.m4 (gl_FUNC_GETPAYLOADF, gl_FUNC_GETPAYLOAD, + gl_FUNC_GETPAYLOADL): Link the test program with -lm if needed. + 2024-07-15 Paul Eggert strnlen: port to Android 5.0 (API 21) diff --git a/m4/getpayload.m4 b/m4/getpayload.m4 index c41f0c25d8..383004580b 100644 --- a/m4/getpayload.m4 +++ b/m4/getpayload.m4 @@ -1,5 +1,5 @@ # getpayload.m4 -# serial 1 +# serial 2 dnl Copyright 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, @@ -20,7 +20,12 @@ AC_DEFUN([gl_FUNC_GETPAYLOADF], dnl see . AC_CACHE_CHECK([whether getpayloadf works], [gl_cv_func_getpayloadf_works], - [AC_RUN_IFELSE( + [ + saved_LIBS="$LIBS" + if test $gl_cv_func_getpayloadf_no_libm != yes; then + LIBS="$LIBS -lm" + fi + AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include ]], @@ -49,6 +54,7 @@ AC_DEFUN([gl_FUNC_GETPAYLOADF], *) gl_cv_func_getpayloadf_works="guessing yes" ;; esac ]) + LIBS="$saved_LIBS" ]) case "$gl_cv_func_getpayloadf_works" in *yes) ;; @@ -76,7 +82,12 @@ AC_DEFUN_ONCE([gl_FUNC_GETPAYLOAD], dnl see . AC_CACHE_CHECK([whether getpayload works], [gl_cv_func_getpayload_works], - [AC_RUN_IFELSE( + [ + saved_LIBS="$LIBS" + if test $gl_cv_func_getpayload_no_libm != yes; then + LIBS="$LIBS -lm" + fi + AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include ]], @@ -105,6 +116,7 @@ AC_DEFUN_ONCE([gl_FUNC_GETPAYLOAD], *) gl_cv_func_getpayload_works="guessing yes" ;; esac ]) + LIBS="$saved_LIBS" ]) case "$gl_cv_func_getpayload_works" in *yes) ;; @@ -133,7 +145,12 @@ AC_DEFUN([gl_FUNC_GETPAYLOADL], dnl see . AC_CACHE_CHECK([whether getpayloadl works], [gl_cv_func_getpayloadl_works], - [AC_RUN_IFELSE( + [ + saved_LIBS="$LIBS" + if test $gl_cv_func_getpayloadl_no_libm != yes; then + LIBS="$LIBS -lm" + fi + AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include ]], @@ -162,6 +179,7 @@ AC_DEFUN([gl_FUNC_GETPAYLOADL], *) gl_cv_func_getpayloadl_works="guessing yes" ;; esac ]) + LIBS="$saved_LIBS" ]) case "$gl_cv_func_getpayloadl_works" in *yes) ;; -- 2.39.5