[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] implement full-blown select(2) for winsock
From: |
Bruno Haible |
Subject: |
Re: [PATCH v2] implement full-blown select(2) for winsock |
Date: |
Sun, 28 Sep 2008 17:41:23 +0200 |
User-agent: |
KMail/1.5.4 |
Hi Paolo,
> 2008-09-23 Paolo Bonzini <address@hidden>
>
> * m4/sys_select_h.m4: Compile lib/winsock-select.c if WinSock is used.
> Require gl_HEADER_SYS_SOCKET.
On HP-UX, which has <sys/socket.h> but no <sys/select.h>, I get a syntax
error because the generated sys/select.h file has a lone #if, because
HAVE_WINSOCK2_H expands to empty (rather than to 0).
A bit of refactoring is necessary. This should fix it.
2008-09-28 Bruno Haible <address@hidden>
* m4/sys_socket_h.m4 (gl_PREREQ_SYS_H_WINSOCK2): New macro, extracted
from gl_HEADER_SYS_SOCKET.
(gl_HEADER_SYS_SOCKET): Invoke it.
* m4/sys_select_h.m4 (gl_HEADER_SYS_SELECT): Likewise.
*** m4/sys_socket_h.m4.orig 2008-09-28 17:33:51.000000000 +0200
--- m4/sys_socket_h.m4 2008-09-28 17:31:57.000000000 +0200
***************
*** 1,4 ****
! # sys_socket_h.m4 serial 6
dnl Copyright (C) 2005-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # sys_socket_h.m4 serial 7
dnl Copyright (C) 2005-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
***************
*** 44,50 ****
gl_CHECK_NEXT_HEADERS([sys/socket.h])
if test $ac_cv_header_sys_socket_h = yes; then
HAVE_SYS_SOCKET_H=1
- HAVE_WINSOCK2_H=0
HAVE_WS2TCPIP_H=0
else
HAVE_SYS_SOCKET_H=0
--- 44,49 ----
***************
*** 52,75 ****
dnl the check for those headers unconditional; yet cygwin reports
dnl that the headers are present but cannot be compiled (since on
dnl cygwin, all socket information should come from sys/socket.h).
! AC_CHECK_HEADERS([winsock2.h ws2tcpip.h])
! if test $ac_cv_header_winsock2_h = yes; then
! HAVE_WINSOCK2_H=1
! else
! HAVE_WINSOCK2_H=0
! fi
if test $ac_cv_header_ws2tcpip_h = yes; then
HAVE_WS2TCPIP_H=1
else
HAVE_WS2TCPIP_H=0
fi
fi
if test x$ac_cv_header_winsock2_h = xyes; then
AC_LIBOBJ(winsock)
fi
AC_SUBST([HAVE_SYS_SOCKET_H])
- AC_SUBST([HAVE_WINSOCK2_H])
AC_SUBST([HAVE_WS2TCPIP_H])
fi
AC_SUBST([SYS_SOCKET_H])
])
--- 51,90 ----
dnl the check for those headers unconditional; yet cygwin reports
dnl that the headers are present but cannot be compiled (since on
dnl cygwin, all socket information should come from sys/socket.h).
! AC_CHECK_HEADERS([ws2tcpip.h])
if test $ac_cv_header_ws2tcpip_h = yes; then
HAVE_WS2TCPIP_H=1
else
HAVE_WS2TCPIP_H=0
fi
fi
+ gl_PREREQ_SYS_H_WINSOCK2
if test x$ac_cv_header_winsock2_h = xyes; then
AC_LIBOBJ(winsock)
fi
AC_SUBST([HAVE_SYS_SOCKET_H])
AC_SUBST([HAVE_WS2TCPIP_H])
fi
AC_SUBST([SYS_SOCKET_H])
])
+
+ # Common prerequisites of of the <sys/socket.h> replacement and of the
+ # <sys/select.h> replacement.
+ # Sets and substitutes HAVE_WINSOCK2_H.
+ AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2],
+ [
+ AC_CHECK_HEADERS_ONCE([sys/socket.h])
+ if test $ac_cv_header_sys_socket_h != yes; then
+ dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
+ dnl the check for those headers unconditional; yet cygwin reports
+ dnl that the headers are present but cannot be compiled (since on
+ dnl cygwin, all socket information should come from sys/socket.h).
+ AC_CHECK_HEADERS([winsock2.h])
+ fi
+ if test "$ac_cv_header_winsock2_h" = yes; then
+ HAVE_WINSOCK2_H=1
+ else
+ HAVE_WINSOCK2_H=0
+ fi
+ AC_SUBST([HAVE_WINSOCK2_H])
+ ])
*** m4/sys_select_h.m4.orig 2008-09-28 17:33:51.000000000 +0200
--- m4/sys_select_h.m4 2008-09-28 17:29:58.000000000 +0200
***************
*** 1,4 ****
! # sys_select_h.m4 serial 4
dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # sys_select_h.m4 serial 5
dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
***************
*** 25,30 ****
--- 25,31 ----
HAVE_SYS_SELECT_H=0
fi
AC_SUBST([HAVE_SYS_SELECT_H])
+ gl_PREREQ_SYS_H_WINSOCK2
fi
AC_SUBST([SYS_SELECT_H])
if test x$ac_cv_header_winsock2_h = xyes; then
Re: [PATCH v2] implement full-blown select(2) for winsock,
Bruno Haible <=
Re: [PATCH v2] implement full-blown select(2) for winsock, Bruno Haible, 2008/09/29
Re: [PATCH v2] implement full-blown select(2) for winsock, Bruno Haible, 2008/09/29