| From d56a11beb9b181fd91a70a6d703dfbdfe887122a Mon Sep 17 00:00:00 2001 |
| From: Baruch Siach <baruch@tkos.co.il> |
| Date: Thu, 13 Jan 2022 17:56:10 +0200 |
| Subject: [PATCH] configure.ac: correct the getprotobynumber_r test |
| |
| The AC_TRY_COMPILE test succeeds even when libc does not provide the |
| tested symbol. The compiler produces a warning, but exits successfully. |
| Use AC_TRY_LINK that will only succeeds if libc provides the symbol. |
| |
| This fixes build with musl libc that does not support |
| getprotobynumber_r(). |
| |
| Signed-off-by: Baruch Siach <baruch@tkos.co.il> |
| --- |
| Upstream status: sent to socat@dest-unreach.org |
| |
| configure.ac | 6 +++--- |
| 1 file changed, 3 insertions(+), 3 deletions(-) |
| |
| diff --git a/configure.ac b/configure.ac |
| index d4acc9e7e6f5..973a7f2218c9 100644 |
| --- a/configure.ac |
| +++ b/configure.ac |
| @@ -137,13 +137,13 @@ AC_MSG_RESULT($sc_cv_have_prototype_hstrerror) |
| # getprotobynumber_r() is not standardized |
| AC_MSG_CHECKING(for getprotobynumber_r() variant) |
| AC_CACHE_VAL(sc_cv_getprotobynumber_r, |
| -[AC_TRY_COMPILE([#include <stddef.h> |
| +[AC_TRY_LINK([#include <stddef.h> |
| #include <netdb.h>],[getprotobynumber_r(1,NULL,NULL,1024,NULL);], |
| [sc_cv_getprotobynumber_r=1; tmp_bynum_variant=Linux], |
| - [AC_TRY_COMPILE([#include <stddef.h> |
| + [AC_TRY_LINK([#include <stddef.h> |
| #include <netdb.h>],[getprotobynumber_r(1,NULL,NULL,1024);], |
| [sc_cv_getprotobynumber_r=2; tmp_bynum_variant=Solaris], |
| - [AC_TRY_COMPILE([#include <stddef.h> |
| + [AC_TRY_LINK([#include <stddef.h> |
| #include <netdb.h>],[getprotobynumber_r(1,NULL,NULL);], |
| [sc_cv_getprotobynumber_r=3; tmp_bynum_variant=AIX], |
| |
| -- |
| 2.34.1 |
| |