Hi, Andreas K. Huettel wrote: > while testing glibc (master) against the gnulib (master) testsuite, I found > new object files being > built (compared to my glibc testing 6 months ago... but it's not a change in > glibc, I checked that): > > getpayload.o > getpayloadf.o > getpayloadl.o > > A look into config.log uncovered this snippet: > > > configure:72327: checking whether getpayloadf can be used with libm > > configure:72359: gcc -o conftest -g -O2 -Wall conftest.c -lm >&5 > > configure:72359: $? = 0 > > configure:72370: result: yes > > configure:72385: checking whether getpayloadf works > > configure:72437: gcc -o conftest -g -O2 -Wall conftest.c >&5 > > /usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/ > > bin/ld: /tmp/ccaNe9gy.o: in function `main': > > /tmp/testdir/conftest.c:572:(.text.startup+0x26): undefined > > reference to `getpayloadf' collect2: error: ld returned 1 exit > > status > > configure:72437: $? = 1 > > configure: program exited with status 1 > > This makes no sense to me. If libm is needed, shouldnt the functionality > test link it in?
Yes, absolutely. Thanks for the report and the investigation. Fixed as follows: 2024-07-20 Bruno Haible <br...@clisp.org> getpayload*: Do use glibc's implementation when it works. Reported by Andreas K. Huettel <dilfri...@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. 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 <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) ;;