libssh2 package.
[fedora-mingw.git] / libssh2 / libssh2-02-libssh_priv-headers.patch
diff --git a/libssh2/libssh2-02-libssh_priv-headers.patch b/libssh2/libssh2-02-libssh_priv-headers.patch
new file mode 100644 (file)
index 0000000..b480ba8
--- /dev/null
@@ -0,0 +1,58 @@
+diff -urN libssh2-0.18.orig/configure.in libssh2-0.18.mingw/configure.in
+--- libssh2-0.18.orig/configure.in     2007-07-31 10:55:29.000000000 +0100
++++ libssh2-0.18.mingw/configure.in    2008-11-10 14:12:07.000000000 +0000
+@@ -249,6 +250,7 @@
+ AC_CHECK_HEADERS([errno.h fcntl.h stdio.h stdlib.h unistd.h sys/uio.h])
+ AC_CHECK_HEADERS([sys/select.h sys/socket.h sys/ioctl.h sys/time.h])
+ AC_CHECK_HEADERS([arpa/inet.h netinet/in.h])
++AC_CHECK_HEADERS([windows.h ws2tcpip.h winsock2.h])
+ AC_CHECK_FUNCS(poll gettimeofday select)
+ AC_FUNC_ALLOCA
+diff -urN libssh2-0.18.orig/src/libssh2_priv.h libssh2-0.18.mingw/src/libssh2_priv.h
+--- libssh2-0.18.orig/src/libssh2_priv.h       2007-08-10 23:30:30.000000000 +0100
++++ libssh2-0.18.mingw/src/libssh2_priv.h      2008-11-10 13:57:49.000000000 +0000
+@@ -41,6 +41,14 @@
+ #define LIBSSH2_LIBRARY
+ #include "libssh2_config.h"
++#ifdef HAVE_WINDOWS_H
++#include <windows.h>
++#endif
++
++#ifdef HAVE_WS2TCPIP_H
++#include <ws2tcpip.h>
++#endif
++
+ /* The following CPP block should really only be in session.c and
+    packet.c.  However, AIX have #define's for 'events' and 'revents'
+    and we are using those names in libssh2.h, so we need to include
+@@ -70,6 +78,28 @@
+ #include "libssh2_publickey.h"
+ #include "libssh2_sftp.h"
++/* Provide iovec / writev on WIN32 platform. */
++#ifdef WIN32
++
++/* same as WSABUF */
++struct iovec {
++      u_long iov_len;
++      char *iov_base;
++};
++
++#define inline __inline
++
++static inline int writev(int sock, struct iovec *iov, int nvecs)
++{
++      DWORD ret;
++      if (WSASend(sock, (LPWSABUF)iov, nvecs, &ret, 0, NULL, NULL) == 0) {
++              return ret;
++      }
++      return -1;
++}
++
++#endif /* WIN32 */
++
+ /* Needed for struct iovec on some platforms */
+ #ifdef HAVE_SYS_UIO_H
+ #include <sys/uio.h>