shishi-commit
[Top][All Lists]
Advanced

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

CVS shishi/gl/m4


From: shishi-commit
Subject: CVS shishi/gl/m4
Date: Thu, 19 Jan 2006 11:36:10 +0100

Update of /home/cvs/shishi/gl/m4
In directory dopio:/tmp/cvs-serv697/gl/m4

Modified Files:
        getaddrinfo.m4 gnulib-comp.m4 
Added Files:
        sys_socket_h.m4 
Log Message:
Update.

--- /home/cvs/shishi/gl/m4/getaddrinfo.m4       2006/01/12 17:17:53     1.8
+++ /home/cvs/shishi/gl/m4/getaddrinfo.m4       2006/01/19 10:36:10     1.9
@@ -6,9 +6,28 @@
 
 AC_DEFUN([gl_GETADDRINFO],
 [
-  AC_SEARCH_LIBS(getaddrinfo, [nsl socket ws2_32])
-  AC_SEARCH_LIBS(gethostbyname, [inet nsl wsock32])
+  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
+      LIBS="$LIBS -lws2_32"
+    fi
+  fi
+
   AC_REPLACE_FUNCS(getaddrinfo gai_strerror)
   gl_PREREQ_GETADDRINFO
 ])
@@ -19,18 +38,32 @@
   AC_REQUIRE([gl_SOCKET_FAMILIES])
   AC_REQUIRE([AC_C_INLINE])
   AC_REQUIRE([AC_GNU_SOURCE])
-  AC_CHECK_HEADERS_ONCE(netinet/in.h)
+  AC_CHECK_HEADERS_ONCE(netinet/in.h sys/socket.h netdb.h ws2tcpip.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>
-#include <sys/socket.h>
-#include <netdb.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
 ])
   AC_CHECK_TYPES([struct addrinfo],,,[
 #include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.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
 ])
 ])
--- /home/cvs/shishi/gl/m4/gnulib-comp.m4       2006/01/12 17:17:53     1.8
+++ /home/cvs/shishi/gl/m4/gnulib-comp.m4       2006/01/19 10:36:10     1.9
@@ -72,6 +72,7 @@
   gl_FUNC_STRNDUP
   gl_FUNC_STRNLEN
   gl_FUNC_STRTOK_R
+  gl_HEADER_SYS_SOCKET
   gl_TIME_R
   gl_FUNC_TIMEGM
   gl_TIMESPEC
@@ -158,6 +159,7 @@
   lib/sha1.c
   lib/sha1.h
   lib/size_max.h
+  lib/socket_.h
   lib/stdbool_.h
   lib/stdint_.h
   lib/strcase.h
@@ -268,6 +270,7 @@
   m4/strndup.m4
   m4/strnlen.m4
   m4/strtok_r.m4
+  m4/sys_socket_h.m4
   m4/time_r.m4
   m4/timegm.m4
   m4/timespec.m4

--- /home/cvs/shishi/gl/m4/sys_socket_h.m4      2006/01/19 10:36:11     NONE
+++ /home/cvs/shishi/gl/m4/sys_socket_h.m4      2006/01/19 10:36:11     1.1
# sys_socket_h.m4 serial 1
dnl Copyright (C) 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,
dnl with or without modifications, as long as this notice is preserved.

dnl From Simon Josefsson.

AC_DEFUN([gl_HEADER_SYS_SOCKET],
[
  AC_CHECK_HEADERS_ONCE([sys/socket.h])
  if test $ac_cv_header_sys_socket_h = yes; then
    SYS_SOCKET_H=''
  else
    AC_CHECK_HEADERS_ONCE([winsock2.h ws2tcpip.h])
    SYS_SOCKET_H='sys/socket.h'
  fi
  AC_SUBST(SYS_SOCKET_H)
])




reply via email to

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