apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject cvs commit: apr/network_io/unix sockaddr.c
Date Mon, 29 Sep 2003 11:31:59 GMT
jorton      2003/09/29 04:31:59

  Modified:    .        configure.in
               build    apr_network.m4
               network_io/unix sockaddr.c
  Log:
  Make use of the AI_ADDRCONFIG flag conditional (some versions of
  glibc 2.1 don't either support it or fail correctly):
  
  * build/apr_network.m4 (APR_CHECK_GETADDRINFO_ADDRCONFIG):
  New macro.
  
  * configure.in: Use APR_CHECK_GETADDRINFO_ADDRCONFIG.
  
  * network_io/unix/sockaddr.c (call_resolver): Only use the
  AI_ADDRCONFIG flag if HAVE_GAI_ADDRCONFIG is defined.
  
  Revision  Changes    Path
  1.536     +1 -0      apr/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /home/cvs/apr/configure.in,v
  retrieving revision 1.535
  retrieving revision 1.536
  diff -u -u -r1.535 -r1.536
  --- configure.in	2 Sep 2003 08:42:54 -0000	1.535
  +++ configure.in	29 Sep 2003 11:31:59 -0000	1.536
  @@ -1817,6 +1817,7 @@
               if test "x$ac_cv_working_getaddrinfo" = "xyes"; then
                   if test "x$ac_cv_working_getnameinfo" = "xyes"; then
                       APR_CHECK_GETNAMEINFO_IPV4_MAPPED
  +                    APR_CHECK_GETADDRINFO_ADDRCONFIG
                       have_ipv6="1"
                       ipv6_result="yes"
                   else
  
  
  
  1.25      +34 -0     apr/build/apr_network.m4
  
  Index: apr_network.m4
  ===================================================================
  RCS file: /home/cvs/apr/build/apr_network.m4,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -u -r1.24 -r1.25
  --- apr_network.m4	11 Sep 2003 07:38:08 -0000	1.24
  +++ apr_network.m4	29 Sep 2003 11:31:59 -0000	1.25
  @@ -57,6 +57,40 @@
   fi
   ])
   
  +dnl Check whether the AI_ADDRCONFIG flag can be used with getaddrinfo
  +AC_DEFUN(APR_CHECK_GETADDRINFO_ADDRCONFIG, [
  +  AC_CACHE_CHECK(for working AI_ADDRCONFIG, apr_cv_gai_addrconfig, [
  +  AC_TRY_RUN([
  +#ifdef HAVE_NETDB_H
  +#include <netdb.h>
  +#endif
  +#ifdef HAVE_STRING_H
  +#include <string.h>
  +#endif
  +#ifdef HAVE_SYS_TYPES_H
  +#include <sys/types.h>
  +#endif
  +#ifdef HAVE_SYS_SOCKET_H
  +#include <sys/socket.h>
  +#endif
  +
  +int main(int argc, char **argv) {
  +    struct addrinfo hints, *ai;
  +
  +    memset(&hints, 0, sizeof(hints));
  +    hints.ai_family = AF_UNSPEC;
  +    hints.ai_socktype = SOCK_STREAM;
  +    hints.ai_flags = AI_ADDRCONFIG;
  +    return getaddrinfo("localhost", NULL, &hints, &ai) != 0;
  +}], [apr_cv_gai_addrconfig=yes], 
  +    [apr_cv_gai_addrconfig=no],
  +    [apr_cv_gai_addrconfig=no])])
  +
  +if test $apr_cv_gai_addrconfig = yes; then
  +   AC_DEFINE(HAVE_GAI_ADDRCONFIG, 1, [Define if getaddrinfo accepts the AI_ADDRCONFIG flag])
  +fi
  +])
  +
   dnl
   dnl check for working getnameinfo()
   dnl
  
  
  
  1.45      +2 -2      apr/network_io/unix/sockaddr.c
  
  Index: sockaddr.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/unix/sockaddr.c,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -u -r1.44 -r1.45
  --- sockaddr.c	9 Sep 2003 18:37:12 -0000	1.44
  +++ sockaddr.c	29 Sep 2003 11:31:59 -0000	1.45
  @@ -374,7 +374,7 @@
       memset(&hints, 0, sizeof(hints));
       hints.ai_family = family;
       hints.ai_socktype = SOCK_STREAM;
  -#ifdef AI_ADDRCONFIG
  +#ifdef HAVE_GAI_ADDRCONFIG
       if (family == AF_UNSPEC) {
           /* By default, only look up addresses using address types for
            * which a local interface is configured, i.e. no IPv6 if no
  @@ -404,7 +404,7 @@
           servname = apr_itoa(p, port);
       }
       error = getaddrinfo(hostname, servname, &hints, &ai_list);
  -#ifdef AI_ADDRCONFIG
  +#ifdef HAVE_GAI_ADDRCONFIG
       if (error == EAI_BADFLAGS && family == AF_UNSPEC) {
           /* Retry with no flags if AI_ADDRCONFIG was rejected. */
           hints.ai_flags = 0;
  
  
  

Mime
View raw message