mirror of
https://github.com/libssh2/libssh2.git
synced 2025-08-07 08:02:56 +03:00
Carlo Bramini fixed the build for msys+mingw. Bug #1943976.
This commit is contained in:
2
NEWS
2
NEWS
@@ -1,6 +1,8 @@
|
|||||||
Version 0.19 ( )
|
Version 0.19 ( )
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
|
||||||
|
- Carlo Bramini fixed the build for msys+mingw. Bug #1943976.
|
||||||
|
|
||||||
- Neil Gierman provided improved Visual Studio 2008 code in bug #1946268
|
- Neil Gierman provided improved Visual Studio 2008 code in bug #1946268
|
||||||
|
|
||||||
- Bug #1862727 fixed libssh2_poll() to work on windows (by defining
|
- Bug #1862727 fixed libssh2_poll() to work on windows (by defining
|
||||||
|
27
configure.in
27
configure.in
@@ -28,6 +28,10 @@ AB_INIT
|
|||||||
# get this removed.
|
# get this removed.
|
||||||
AC_CANONICAL_HOST
|
AC_CANONICAL_HOST
|
||||||
case "$host" in
|
case "$host" in
|
||||||
|
*-mingw*)
|
||||||
|
CFLAGS="$CFLAGS -DLIBSSH2_WIN32 -DWINSOCK_VERSION=0x0200"
|
||||||
|
LIBS="$LIBS -lws2_32"
|
||||||
|
;;
|
||||||
*-cygwin)
|
*-cygwin)
|
||||||
CFLAGS="$CFLAGS -DLIBSSH2_WIN32"
|
CFLAGS="$CFLAGS -DLIBSSH2_WIN32"
|
||||||
;;
|
;;
|
||||||
@@ -254,8 +258,31 @@ AC_HELP_STRING([--disable-debug],[Disable debug options]),
|
|||||||
AC_CHECK_HEADERS([errno.h fcntl.h stdio.h stdlib.h unistd.h sys/uio.h])
|
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([sys/select.h sys/socket.h sys/ioctl.h sys/time.h])
|
||||||
AC_CHECK_HEADERS([arpa/inet.h netinet/in.h])
|
AC_CHECK_HEADERS([arpa/inet.h netinet/in.h])
|
||||||
|
AC_CHECK_HEADERS([windows.h winsock2.h ws2tcpip.h])
|
||||||
AC_CHECK_FUNCS(poll gettimeofday select strtoll)
|
AC_CHECK_FUNCS(poll gettimeofday select strtoll)
|
||||||
|
|
||||||
|
dnl Check for select() into ws2_32 for Msys/Mingw
|
||||||
|
if test "$ac_cv_func_select" != "yes"; then
|
||||||
|
AC_MSG_CHECKING([for select in ws2_32])
|
||||||
|
AC_TRY_LINK([
|
||||||
|
#ifdef HAVE_WINSOCK2_H
|
||||||
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
|
#include <winsock2.h>
|
||||||
|
#endif
|
||||||
|
],[
|
||||||
|
select(0,(fd_set *)NULL,(fd_set *)NULL,(fd_set *)NULL,(struct timeval *)NULL);
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
HAVE_SELECT="1"
|
||||||
|
AC_DEFINE_UNQUOTED(HAVE_SELECT, 1,
|
||||||
|
[Define to 1 if you have the select function.])
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
])
|
||||||
|
fi
|
||||||
|
|
||||||
AC_FUNC_ALLOCA
|
AC_FUNC_ALLOCA
|
||||||
|
|
||||||
# Checks for typedefs, structures, and compiler characteristics.
|
# Checks for typedefs, structures, and compiler characteristics.
|
||||||
|
@@ -91,6 +91,41 @@
|
|||||||
#include "openssl.h"
|
#include "openssl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_WINSOCK2_H
|
||||||
|
|
||||||
|
#include <winsock2.h>
|
||||||
|
#include <mswsock.h>
|
||||||
|
#include <ws2tcpip.h>
|
||||||
|
|
||||||
|
/* same as WSABUF */
|
||||||
|
struct iovec {
|
||||||
|
u_long iov_len;
|
||||||
|
char *iov_base;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
/* "inline" keyword is valid only with C++ engine! */
|
||||||
|
#define inline __inline
|
||||||
|
#endif
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* not really usleep, but safe for the way we use it in this lib */
|
||||||
|
static inline int usleep(int udelay)
|
||||||
|
{
|
||||||
|
Sleep(udelay / 1000);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/* RFC4253 section 6.1 Maximum Packet Length says:
|
/* RFC4253 section 6.1 Maximum Packet Length says:
|
||||||
*
|
*
|
||||||
* "All implementations MUST be able to process packets with
|
* "All implementations MUST be able to process packets with
|
||||||
|
@@ -12,36 +12,16 @@
|
|||||||
#define HAVE_UNISTD_H
|
#define HAVE_UNISTD_H
|
||||||
#define HAVE_INTTYPES_H
|
#define HAVE_INTTYPES_H
|
||||||
#define HAVE_SYS_TIME_H
|
#define HAVE_SYS_TIME_H
|
||||||
|
|
||||||
|
/* defined into MS PSDK but not into Mingw w32api */
|
||||||
|
#define WINSOCK_VERSION MAKEWORD(2,0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define HAVE_WINSOCK2_H
|
#define HAVE_WINSOCK2_H
|
||||||
#define HAVE_IOCTLSOCKET
|
#define HAVE_IOCTLSOCKET
|
||||||
#define HAVE_SELECT
|
#define HAVE_SELECT
|
||||||
|
|
||||||
/* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* not really usleep, but safe for the way we use it in this lib */
|
|
||||||
static inline int usleep(int udelay)
|
|
||||||
{
|
|
||||||
Sleep(udelay / 1000);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#if _MSC_VER < 1500
|
#if _MSC_VER < 1500
|
||||||
@@ -53,12 +33,8 @@ static inline int usleep(int udelay)
|
|||||||
#define strncasecmp _strnicmp
|
#define strncasecmp _strnicmp
|
||||||
#define strcasecmp _stricmp
|
#define strcasecmp _stricmp
|
||||||
#else
|
#else
|
||||||
#ifdef __MINGW32__
|
|
||||||
#define WINSOCK_VERSION MAKEWORD(2,0)
|
|
||||||
#else
|
|
||||||
#define strncasecmp strnicmp
|
#define strncasecmp strnicmp
|
||||||
#define strcasecmp stricmp
|
#define strcasecmp stricmp
|
||||||
#endif /* __MINGW32__ */
|
|
||||||
#endif /* _MSC_VER */
|
#endif /* _MSC_VER */
|
||||||
|
|
||||||
/* Compile in zlib support */
|
/* Compile in zlib support */
|
||||||
|
Reference in New Issue
Block a user