From: Jaco Kroon Date: Wed, 10 May 2023 21:13:17 +0000 (+0200) Subject: configure: fix test code to match gethostbyname_r prototype. X-Git-Tag: 18.19.0-rc1~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a6402ad2db1ef162781820e43dc2509dc58e24c;p=thirdparty%2Fasterisk.git configure: fix test code to match gethostbyname_r prototype. This enables the test to work with CC=clang. Without this the test for 6 args would fail with: utils.c:99:12: error: static declaration of 'gethostbyname_r' follows non-static declaration static int gethostbyname_r (const char *name, struct hostent *ret, char *buf, ^ /usr/include/netdb.h:177:12: note: previous declaration is here extern int gethostbyname_r (const char *__restrict __name, ^ Fixing the expected return type to int sorts this out. Signed-off-by: Jaco Kroon (cherry picked from commit 3067977eac4c9ae7b403ca9f98add23e11adad47) --- diff --git a/configure b/configure index 8f7eadb844..83460d99e5 100755 --- a/configure +++ b/configure @@ -17911,7 +17911,7 @@ $as_echo_n "checking for gethostbyname_r with 6 arguments... " >&6; } int main () { -struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (struct hostent **)NULL, (int *)NULL); +int r = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (struct hostent **)NULL, (int *)NULL); ; return 0; } @@ -17939,7 +17939,7 @@ $as_echo_n "checking for gethostbyname_r with 5 arguments... " >&6; } int main () { -struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (int *)NULL); +int r = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (int *)NULL); ; return 0; } diff --git a/configure.ac b/configure.ac index aa5172adb7..df974b441f 100644 --- a/configure.ac +++ b/configure.ac @@ -970,7 +970,7 @@ if test "x$have_gethostbyname_r_public_declaration" = "xyes"; then AC_LINK_IFELSE( [AC_LANG_PROGRAM([#include #include ], - [struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (struct hostent **)NULL, (int *)NULL);])], + [int r = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (struct hostent **)NULL, (int *)NULL);])], AC_MSG_RESULT(yes) AC_DEFINE([HAVE_GETHOSTBYNAME_R_6], 1, [Define to 1 if your system has gethostbyname_r with 6 arguments.]), AC_MSG_RESULT(no) @@ -980,7 +980,7 @@ if test "x$have_gethostbyname_r_public_declaration" = "xyes"; then AC_LINK_IFELSE( [AC_LANG_PROGRAM([#include #include ], - [struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (int *)NULL);])], + [int r = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (int *)NULL);])], AC_MSG_RESULT(yes) AC_DEFINE([HAVE_GETHOSTBYNAME_R_5], 1, [Define to 1 if your system has gethostbyname_r with 5 arguments.]), AC_MSG_RESULT(no)