From 62e1cbd0c03839e0623da962feee356cb9b633d9 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Mon, 3 Mar 2008 15:41:58 +0000 Subject: [PATCH] 2008-03-04 Tatsuhiro Tsujikawa Merged Ross's mingw patch. * src/DHTRoutingTableDeserializer.cc * src/DHTRoutingTableSerializer.cc * src/Platform.{h, cc} * src/timegm.h * src/gettimeofday.h * src/getaddrinfo.h * src/SocketCore.h * src/common.h * src/inet_aton.h * src/DownloadEngine.h * src/gai_strerror.h * src/a2netcompat.h * configure.ac * configure * aclocal.m4 --- ChangeLog | 19 +++++++++++++++++++ aclocal.m4 | 6 +++--- configure | 10 +++++----- configure.ac | 2 +- src/DHTRoutingTableDeserializer.cc | 2 +- src/DHTRoutingTableSerializer.cc | 2 +- src/DownloadEngine.h | 2 +- src/Platform.cc | 4 ++++ src/Platform.h | 4 ++++ src/SocketCore.h | 2 +- src/a2netcompat.h | 21 +++++++++++++++++++++ src/common.h | 4 ++++ src/gai_strerror.h | 4 ++++ src/getaddrinfo.h | 4 ++++ src/gettimeofday.h | 4 ++++ src/inet_aton.h | 4 ++++ src/timegm.h | 4 ++++ 17 files changed, 85 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2f75260d..b54b70b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2008-03-04 Tatsuhiro Tsujikawa + + Merged Ross's mingw patch. + * src/DHTRoutingTableDeserializer.cc + * src/DHTRoutingTableSerializer.cc + * src/Platform.{h, cc} + * src/timegm.h + * src/gettimeofday.h + * src/getaddrinfo.h + * src/SocketCore.h + * src/common.h + * src/inet_aton.h + * src/DownloadEngine.h + * src/gai_strerror.h + * src/a2netcompat.h + * configure.ac + * configure + * aclocal.m4 + 2008-03-03 Tatsuhiro Tsujikawa Included missing iostream. diff --git a/aclocal.m4 b/aclocal.m4 index 6ca63f2b..914ac071 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -180,7 +180,7 @@ AC_DEFUN([AM_PATH_LIBGCRYPT], fi fi if test $ok = yes; then - AC_MSG_RESULT(yes) + AC_MSG_RESULT([yes ($libgcrypt_config_version)]) else AC_MSG_RESULT(no) fi @@ -192,10 +192,10 @@ AC_DEFUN([AM_PATH_LIBGCRYPT], if test "$tmp" -gt 0 ; then AC_MSG_CHECKING([LIBGCRYPT API version]) if test "$req_libgcrypt_api" -eq "$tmp" ; then - AC_MSG_RESULT(okay) + AC_MSG_RESULT([okay]) else ok=no - AC_MSG_RESULT([does not match (want=$req_libgcrypt_api got=$tmp)]) + AC_MSG_RESULT([does not match. want=$req_libgcrypt_api got=$tmp]) fi fi fi diff --git a/configure b/configure index 5f1b2a2d..f7fc506f 100755 --- a/configure +++ b/configure @@ -2633,7 +2633,7 @@ ac_config_headers="$ac_config_headers config.h" case "$target" in *mingw*|*cygwin*) - WINSOCK_LIBS="-lws2_32" + WINSOCK_LIBS="-lws2_32 -lpthread" ;; esac @@ -6220,8 +6220,8 @@ echo $ECHO_N "checking for LIBGCRYPT - version >= $min_libgcrypt_version... $ECH fi fi if test $ok = yes; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } + { echo "$as_me:$LINENO: result: yes ($libgcrypt_config_version)" >&5 +echo "${ECHO_T}yes ($libgcrypt_config_version)" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } @@ -6239,8 +6239,8 @@ echo $ECHO_N "checking LIBGCRYPT API version... $ECHO_C" >&6; } echo "${ECHO_T}okay" >&6; } else ok=no - { echo "$as_me:$LINENO: result: does not match (want=$req_libgcrypt_api got=$tmp)" >&5 -echo "${ECHO_T}does not match (want=$req_libgcrypt_api got=$tmp)" >&6; } + { echo "$as_me:$LINENO: result: does not match. want=$req_libgcrypt_api got=$tmp" >&5 +echo "${ECHO_T}does not match. want=$req_libgcrypt_api got=$tmp" >&6; } fi fi fi diff --git a/configure.ac b/configure.ac index 9e5002ee..ae8b651d 100644 --- a/configure.ac +++ b/configure.ac @@ -12,7 +12,7 @@ AC_CONFIG_HEADERS([config.h]) case "$target" in *mingw*|*cygwin*) - WINSOCK_LIBS="-lws2_32" + WINSOCK_LIBS="-lws2_32 -lpthread" AC_SUBST(WINSOCK_LIBS) ;; esac diff --git a/src/DHTRoutingTableDeserializer.cc b/src/DHTRoutingTableDeserializer.cc index fd84b0aa..65392451 100644 --- a/src/DHTRoutingTableDeserializer.cc +++ b/src/DHTRoutingTableDeserializer.cc @@ -38,7 +38,7 @@ #include "PeerMessageUtil.h" #include "DlAbortEx.h" #include "Logger.h" -#include +#include "a2netcompat.h" #include #include #include diff --git a/src/DHTRoutingTableSerializer.cc b/src/DHTRoutingTableSerializer.cc index 0ff64e8b..19772a8c 100644 --- a/src/DHTRoutingTableSerializer.cc +++ b/src/DHTRoutingTableSerializer.cc @@ -38,7 +38,7 @@ #include "DHTConstants.h" #include "PeerMessageUtil.h" #include "Logger.h" -#include +#include "a2netcompat.h" #include #include #include diff --git a/src/DownloadEngine.h b/src/DownloadEngine.h index fc3c074a..7ba80c42 100644 --- a/src/DownloadEngine.h +++ b/src/DownloadEngine.h @@ -39,7 +39,7 @@ #include "SharedHandle.h" #include "Command.h" #include -#include +#include "a2netcompat.h" namespace aria2 { diff --git a/src/Platform.cc b/src/Platform.cc index fec2d9b5..5b6ff6ff 100644 --- a/src/Platform.cc +++ b/src/Platform.cc @@ -49,6 +49,8 @@ #include /* _fmode */ #include /* _O_BINARY */ +namespace aria2 { + Platform::Platform() { unsigned int _CRT_fmode = _O_BINARY; WSADATA wsaData; @@ -62,4 +64,6 @@ Platform::~Platform() { WSACleanup(); } +} // namespace aria2 + #endif // HAVE_WINSOCK2_H diff --git a/src/Platform.h b/src/Platform.h index b53385e5..5d55061a 100644 --- a/src/Platform.h +++ b/src/Platform.h @@ -37,6 +37,8 @@ #include "common.h" +namespace aria2 { + #ifdef HAVE_WINSOCK2_H class Platform { @@ -48,4 +50,6 @@ public: #endif // HAVE_WINSOCK2_H +} // namespace aria2 + #endif // _D_PLATFORM_H_ diff --git a/src/SocketCore.h b/src/SocketCore.h index 774ccab3..d0431472 100644 --- a/src/SocketCore.h +++ b/src/SocketCore.h @@ -36,7 +36,7 @@ #define _D_SOCKET_CORE_H_ #include "common.h" -#include +#include "a2netcompat.h" #include #include diff --git a/src/a2netcompat.h b/src/a2netcompat.h index f7915436..f811b1d7 100644 --- a/src/a2netcompat.h +++ b/src/a2netcompat.h @@ -91,4 +91,25 @@ # include "gai_strerror.h" #endif // HAVE_GAI_STRERROR +#ifdef __MINGW32__ +# ifndef AI_PASSIVE +# define AI_PASSIVE 0x0020 +# endif // AI_PASSIVE +# ifndef AI_NUMERICHOST +# define AI_NUMERICHOST 0x0008 +# endif // AI_NUMERICHOST +# ifndef NI_NUMERICHOST +# define NI_NUMERICHOST 0x0008 +# endif // NI_NUMERICHOST +# ifndef NI_NUMERICSERV +# define NI_NUMERICSERV 0x0020 +# endif // NI_NUMERICSERV +# ifndef NI_MAXHOST +# define NI_MAXHOST 1025 +# endif // NI_MAXHOST +# ifndef NI_MAXSERV +# define NI_MAXSERV 32 +# endif // NI_MAXSERV +#endif // __MINGW32__ + #endif // _D_A2NETCOMPAT_H_ diff --git a/src/common.h b/src/common.h index b24e3adc..56a7346c 100644 --- a/src/common.h +++ b/src/common.h @@ -35,6 +35,10 @@ #ifndef _D_COMMON_H_ #define _D_COMMON_H_ +#ifdef __MINGW32__ +# undef SIZE_MAX +#endif // __MINGW32__ + #ifdef HAVE_CONFIG_H # include "config.h" #endif diff --git a/src/gai_strerror.h b/src/gai_strerror.h index 5272ae57..8723f722 100644 --- a/src/gai_strerror.h +++ b/src/gai_strerror.h @@ -33,6 +33,10 @@ extern "C" { #endif /* __cplusplus */ +#ifdef __MINGW32__ +# undef SIZE_MAX +#endif // __MINGW32__ + #ifdef HAVE_CONFIG_H # include "config.h" #endif // HAVE_CONFIG_H diff --git a/src/getaddrinfo.h b/src/getaddrinfo.h index 12a2eee5..5a48c8e8 100644 --- a/src/getaddrinfo.h +++ b/src/getaddrinfo.h @@ -33,6 +33,10 @@ extern "C" { #endif /* __cplusplus */ +#ifdef __MINGW32__ +# undef SIZE_MAX +#endif // __MINGW32__ + #ifdef HAVE_CONFIG_H # include "config.h" #endif // HAVE_CONFIG_H diff --git a/src/gettimeofday.h b/src/gettimeofday.h index a503b3c8..3ce51bd9 100644 --- a/src/gettimeofday.h +++ b/src/gettimeofday.h @@ -36,6 +36,10 @@ #ifndef _D_GETTIMEOFDAY_H #define _D_GETTIMEOFDAY_H 1 +#ifdef __MINGW32__ +# undef SIZE_MAX +#endif // __MINGW32__ + #ifdef HAVE_CONFIG_H # include "config.h" #endif // HAVE_CONFIG_H diff --git a/src/inet_aton.h b/src/inet_aton.h index 5a22e815..68a0065f 100644 --- a/src/inet_aton.h +++ b/src/inet_aton.h @@ -40,6 +40,10 @@ extern "C" { #endif /* __cplusplus */ +#ifdef __MINGW32__ +# undef SIZE_MAX +#endif // __MINGW32__ + #ifdef HAVE_CONFIG_H # include "config.h" #endif // HAVE_CONFIG_H diff --git a/src/timegm.h b/src/timegm.h index c2ac28c9..1c0ecd35 100644 --- a/src/timegm.h +++ b/src/timegm.h @@ -34,6 +34,10 @@ #ifndef _D_TIMEGM_H_ #define _D_TIMEGM_H_ +#ifdef __MINGW32__ +# undef SIZE_MAX +#endif // __MINGW32__ + #ifdef HAVE_CONFIG_H # include "config.h" #endif // HAVE_CONFIG_H