]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
configure: fix test code to match gethostbyname_r prototype. (#75)
authorJaco Kroon <jaco@uls.co.za>
Mon, 15 May 2023 12:50:36 +0000 (14:50 +0200)
committerGitHub <noreply@github.com>
Mon, 15 May 2023 12:50:36 +0000 (06:50 -0600)
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 <jaco@uls.co.za>
configure
configure.ac

index 979cf7fbd2086b4a39ae93d3e50fd8cdf6083f70..439bba2cdcd68d0b4b3787f782e1dd8e8cc9e40f 100755 (executable)
--- a/configure
+++ b/configure
@@ -17518,7 +17518,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;
 }
@@ -17546,7 +17546,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;
 }
index 5d4187a552c97483b5aa653ef73a4d89a3c26686..db76aad6c686095aa18757c29741c3417c3f2869 100644 (file)
@@ -961,7 +961,7 @@ if test "x$have_gethostbyname_r_public_declaration" = "xyes"; then
         AC_LINK_IFELSE(
                 [AC_LANG_PROGRAM([#include <stdlib.h>
                                  #include <netdb.h>],
-                                [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)
@@ -971,7 +971,7 @@ if test "x$have_gethostbyname_r_public_declaration" = "xyes"; then
         AC_LINK_IFELSE(
                 [AC_LANG_PROGRAM([#include <stdlib.h>
                                 #include <netdb.h>],
-                                [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)