]> Savannah Git Hosting - gnulib.git/commitdiff
getpayload*: Do use glibc's implementation when it works.
authorBruno Haible <bruno@clisp.org>
Sat, 20 Jul 2024 14:38:11 +0000 (16:38 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 21 Jul 2024 01:20:56 +0000 (03:20 +0200)
Reported by Andreas K. Huettel <dilfridge@gentoo.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-07/msg00206.html>.

* m4/getpayload.m4 (gl_FUNC_GETPAYLOADF, gl_FUNC_GETPAYLOAD,
gl_FUNC_GETPAYLOADL): Link the test program with -lm if needed.

ChangeLog
m4/getpayload.m4

index fe57fda441f13394d7557c8476f905733600e449..35c9b72f0ca10a13a36364269ceaac5c5634a85c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-07-20  Bruno Haible  <bruno@clisp.org>
+
+       getpayload*: Do use glibc's implementation when it works.
+       Reported by Andreas K. Huettel <dilfridge@gentoo.org> in
+       <https://lists.gnu.org/archive/html/bug-gnulib/2024-07/msg00206.html>.
+       * 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  <eggert@cs.ucla.edu>
 
        strnlen: port to Android 5.0 (API 21)
index c41f0c25d8b54d1639f2d15b3b4fdc2bedbc0e2e..383004580b148eb481126449a45bbc33cb636756 100644 (file)
@@ -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 <https://sourceware.org/bugzilla/show_bug.cgi?id=26073>.
     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 <math.h>
             ]],
@@ -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 <https://sourceware.org/bugzilla/show_bug.cgi?id=26073>.
     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 <math.h>
             ]],
@@ -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 <https://sourceware.org/bugzilla/show_bug.cgi?id=26073>.
     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 <math.h>
             ]],
@@ -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) ;;