From 3daeff2786ce1d6d8e58f0ad15e693f2c48c94f9 Mon Sep 17 00:00:00 2001 From: malosek Date: Mon, 5 Oct 2009 15:06:40 +0200 Subject: mingw port --- configure.in | 13 ++++++++----- src/fd.hpp | 4 ++-- src/platform.hpp.in | 3 +++ src/uuid.hpp | 7 ++++++- src/windows.hpp | 6 ++++++ 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/configure.in b/configure.in index 7f192d1..6577478 100644 --- a/configure.in +++ b/configure.in @@ -54,14 +54,16 @@ case "${host_os}" in 's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" "/' mv libtool-2 libtool chmod 755 libtool - AC_CHECK_LIB(uuid, main, , [AC_MSG_ERROR([Could not link with libuuid, install develop version.])]) + AC_CHECK_LIB(uuid, main, , + [AC_MSG_ERROR([Could not link with libuuid, install develop version.])]) ;; *solaris*) AC_DEFINE(ZMQ_HAVE_SOLARIS, 1, [Have Solaris OS]) AC_CHECK_LIB(socket, main) AC_CHECK_LIB(nsl, main) AC_CHECK_LIB(rt, main) - AC_CHECK_LIB(uuid, main) + AC_CHECK_LIB(uuid, main, , + [AC_MSG_ERROR([Could not link with libuuid, install develop version.])]) CPPFLAGS="-D_REENTRANT -D_PTHREADS $CPPFLAGS" AC_MSG_CHECKING([wheter atomic operations can be used]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM( @@ -118,12 +120,13 @@ case "${host_os}" in chmod 755 libtool ;; *mingw32*) - pedantic="no" AC_DEFINE(ZMQ_HAVE_WINDOWS, 1, [Have Windows OS]) AC_DEFINE(ZMQ_HAVE_MINGW32, 1, [Have MinGW32]) AC_CHECK_HEADERS(windows.h) - LIBS="-lwsock32 -lws2_32 -no-undefined" - CFLAGS="-std=c99" + AC_CHECK_LIB(Rpcrt4, main, , + [AC_MSG_ERROR([Could not link with Rpcrt4.dll.])]) + LIBS="${LIBS} -lwsock32 -lws2_32" + CFLAGS="${CFLAGS} -std=c99" ;; *) AC_MSG_ERROR([Not supported os: $host.]) diff --git a/src/fd.hpp b/src/fd.hpp index b7b2391..92cabf6 100644 --- a/src/fd.hpp +++ b/src/fd.hpp @@ -28,8 +28,8 @@ namespace zmq { -#ifdef _MSC_VER -#if (_MSC_VER <= 1400) +#ifdef ZMQ_HAVE_WINDOWS +#if defined _MSC_VER &&_MSC_VER <= 1400 typedef UINT_PTR fd_t; enum {retired_fd = (fd_t)(~0)} #else diff --git a/src/platform.hpp.in b/src/platform.hpp.in index 6f352fb..1197b57 100644 --- a/src/platform.hpp.in +++ b/src/platform.hpp.in @@ -30,6 +30,9 @@ /* Define to 1 if you have the `pthread' library (-lpthread). */ #undef HAVE_LIBPTHREAD +/* Define to 1 if you have the `Rpcrt4' library (-lRpcrt4). */ +#undef HAVE_LIBRPCRT4 + /* Define to 1 if you have the `rt' library (-lrt). */ #undef HAVE_LIBRT diff --git a/src/uuid.hpp b/src/uuid.hpp index 81e41a3..e4716de 100644 --- a/src/uuid.hpp +++ b/src/uuid.hpp @@ -27,6 +27,8 @@ #include #elif defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OSX #include +#elif defined ZMQ_HAVE_WINDOWS +#include #endif namespace zmq @@ -53,7 +55,10 @@ namespace zmq enum { uuid_string_len = 36 }; #if defined ZMQ_HAVE_WINDOWS - ::UUID uuid; +#ifdef ZMQ_HAVE_MINGW32 + typedef unsigned char* RPC_CSTR; +#endif + ::UUID uuid; RPC_CSTR uuid_str; #elif defined ZMQ_HAVE_FREEBSD ::uuid_t uuid; diff --git a/src/windows.hpp b/src/windows.hpp index e9dc30d..71ecd4f 100644 --- a/src/windows.hpp +++ b/src/windows.hpp @@ -39,6 +39,12 @@ #define NOSOUND #endif +#ifdef ZMQ_HAVE_MINGW32 +#ifndef WINVER +#define WINVER 0x0501 +#endif +#endif + #include // Enable winsock (not included when WIN32_LEAN_AND_MEAN is defined). -- cgit v1.2.3