gsasl-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CVS gsasl/gl/m4


From: gsasl-commit
Subject: CVS gsasl/gl/m4
Date: Thu, 19 Jan 2006 15:47:17 +0100

Update of /home/cvs/gsasl/gl/m4
In directory dopio:/tmp/cvs-serv4387/gl/m4

Modified Files:
        getaddrinfo.m4 socklen.m4 
Log Message:
Update.

--- /home/cvs/gsasl/gl/m4/getaddrinfo.m4        2006/01/18 16:42:07     1.19
+++ /home/cvs/gsasl/gl/m4/getaddrinfo.m4        2006/01/19 14:47:17     1.20
@@ -1,4 +1,4 @@
-# getaddrinfo.m4 serial 8
+# getaddrinfo.m4 serial 7
 dnl Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -6,64 +6,53 @@
 
 AC_DEFUN([gl_GETADDRINFO],
 [
-  AC_MSG_NOTICE([checking how to do getaddrinfo])
-
   AC_SEARCH_LIBS(getaddrinfo, [nsl socket])
-  AC_SEARCH_LIBS(gethostbyname, [inet nsl])
-  AC_SEARCH_LIBS(getservbyname, [inet nsl socket xnet])
 
-  if test "$ac_cv_search_gethostbyname" = "no"; then
-    save_LIBS="$LIBS"
-    LIBS="$LIBS -lws2_32"
-    AC_MSG_CHECKING([whether we need -lws2_32 for gethostbyname])
-    AC_LINK_IFELSE([
-      AC_LANG_PROGRAM([[
-#include <winsock2.h>
-]], [gethostbyname (0);])],
-      need_ws2=yes, need_ws2=no)
-    AC_MSG_RESULT($need_ws2)
-    LIBS="$save_LIBS"
-    if test "$need_ws2" = "yes"; then
+  if test "$ac_cv_search_getaddrinfo" = "no"; then
+    AC_CACHE_CHECK(for getaddrinfo in ws2tcpip.h and -lws2_32,
+                   gl_cv_getaddrinfo, [
+      gl_cv_getaddrinfo=no
+      am_save_LIBS="$LIBS"
       LIBS="$LIBS -lws2_32"
-    fi
+      AC_TRY_LINK([
+#define WINVER 0x0501
+if HAVE_WS2TCPIP_H
+# include <ws2tcpip.h>
+#endif
+], [getaddrinfo(0, 0, 0, 0);], gl_cv_getaddrinfo=yes)
+      LIBS="$am_save_LIBS"
+      if test "$gl_cv_getaddrinfo" = "yes"; then
+        LIBS="$LIBS -lws2_32"
+      fi
+    ])
   fi
 
-  AC_REPLACE_FUNCS(getaddrinfo gai_strerror)
-  gl_PREREQ_GETADDRINFO
+  if test "$gl_cv_getaddrinfo" = "no"; then
+    AC_REPLACE_FUNCS(getaddrinfo gai_strerror)
+    gl_PREREQ_GETADDRINFO
+  fi
 ])
 
 # Prerequisites of lib/getaddrinfo.h and lib/getaddrinfo.c.
 AC_DEFUN([gl_PREREQ_GETADDRINFO], [
+  AC_SEARCH_LIBS(gethostbyname, [inet nsl])
+  AC_SEARCH_LIBS(getservbyname, [inet nsl socket xnet])
   AC_REQUIRE([gl_C_RESTRICT])
   AC_REQUIRE([gl_SOCKET_FAMILIES])
   AC_REQUIRE([AC_C_INLINE])
   AC_REQUIRE([AC_GNU_SOURCE])
-  AC_CHECK_HEADERS_ONCE(netinet/in.h sys/socket.h netdb.h ws2tcpip.h)
+  AC_CHECK_HEADERS_ONCE(netinet/in.h)
   AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror],,,[
   /* sys/types.h is not needed according to POSIX, but the
      sys/socket.h in i386-unknown-freebsd4.10 and
      powerpc-apple-darwin5.5 required it. */
 #include <sys/types.h>
-#if HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
-#if HAVE_NETDB_H
-# include <netdb.h>
-#endif
-#if HAVE_WS2TCPIP_H
-# include <ws2tcpip.h>
-#endif
+#include <sys/socket.h>
+#include <netdb.h>
 ])
   AC_CHECK_TYPES([struct addrinfo],,,[
 #include <sys/types.h>
-#if HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
-#if HAVE_NETDB_H
-# include <netdb.h>
-#endif
-#if HAVE_WS2TCPIP_H
-# include <ws2tcpip.h>
-#endif
+#include <sys/socket.h>
+#include <netdb.h>
 ])
 ])
--- /home/cvs/gsasl/gl/m4/socklen.m4    2006/01/18 14:32:53     1.6
+++ /home/cvs/gsasl/gl/m4/socklen.m4    2006/01/19 14:47:17     1.7
@@ -10,6 +10,10 @@
 dnl POSIX 1g it is a type of its own, but some platforms use different
 dnl types for the argument to getsockopt, getpeername, etc.  So we
 dnl have to test to find something that will work.
+
+dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find
+dnl it there first.  That file is included by gnulib's socket_.h, which
+dnl all users of this module should include.
 AC_DEFUN([gl_TYPE_SOCKLEN_T],
   [AC_CHECK_HEADERS_ONCE([sys/socket.h ws2tcpip.h])
    AC_CHECK_TYPE([socklen_t], ,
@@ -22,12 +26,7 @@
           for t in int size_t "unsigned int" "long int" "unsigned long int"; do
             AC_TRY_COMPILE(
               [#include <sys/types.h>
-               #if HAVE_SYS_SOCKET_H
-                # include <sys/socket.h>
-                #endif
-               #if HAVE_WS2TCPIP_H
-                # include <ws2tcpip.h>
-                #endif
+                #include <sys/socket.h>
 
                int getpeername (int, $arg2 *, $t *);],
                [$t len;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]