summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.in12
-rw-r--r--src/Makefile.am53
-rw-r--r--src/pgm_receiver.cpp5
-rw-r--r--src/pgm_receiver.hpp8
-rw-r--r--src/pgm_sender.cpp6
-rw-r--r--src/pgm_sender.hpp4
-rw-r--r--src/pgm_socket.cpp23
-rw-r--r--src/pgm_socket.hpp13
-rw-r--r--src/platform.hpp.in3
9 files changed, 86 insertions, 41 deletions
diff --git a/configure.in b/configure.in
index 6577478..2a718c2 100644
--- a/configure.in
+++ b/configure.in
@@ -43,6 +43,9 @@ pedantic="yes"
#By default compiling with -Werror except OSX.
werror="yes"
+#Whether we are on mingw or not.
+on_mingw32="no"
+
# Host speciffic checks
AC_CANONICAL_HOST
@@ -125,8 +128,11 @@ case "${host_os}" in
AC_CHECK_HEADERS(windows.h)
AC_CHECK_LIB(Rpcrt4, main, ,
[AC_MSG_ERROR([Could not link with Rpcrt4.dll.])])
+ AC_CHECK_LIB(Iphlpapi, main, ,
+ [AC_MSG_ERROR([Could not link with Iphlpapi.dll.])])
LIBS="${LIBS} -lwsock32 -lws2_32"
CFLAGS="${CFLAGS} -std=c99"
+ on_mingw32="yes"
;;
*)
AC_MSG_ERROR([Not supported os: $host.])
@@ -393,8 +399,6 @@ if test "x$with_pgm1_ext" != "xno"; then
*linux*)
LIBZMQ_EXTRA_CXXFLAGS="${LIBZMQ_EXTRA_CXXFLAGS} -Wno-variadic-macros -Wno-long-long "
;;
- *solaris*)
- ;;
*)
AC_MSG_ERROR([PGM extesion is not supported on this platform $host.])
;;
@@ -487,7 +491,8 @@ if test "x$with_pgm2_ext" != "xno"; then
*linux*)
LIBZMQ_EXTRA_CXXFLAGS="${LIBZMQ_EXTRA_CXXFLAGS} -Wno-variadic-macros -Wno-long-long "
;;
- *solaris*)
+ *mingw32*)
+ LIBZMQ_EXTRA_CXXFLAGS="${LIBZMQ_EXTRA_CXXFLAGS} -Wno-variadic-macros -Wno-long-long "
;;
*)
AC_MSG_ERROR([PGM extesion is not supported on this platform $host.])
@@ -570,6 +575,7 @@ AM_CONDITIONAL(BUILD_PGM2, test "x$pgm2_ext" = "xyes")
AM_CONDITIONAL(BUILD_NO_PGM, test "x$pgm2_ext" = "xno" -a "x$pgm1_ext" = "xno")
AM_CONDITIONAL(BUILD_FORWARDER, test "x$forwarder" = "xyes")
AM_CONDITIONAL(BUILD_PERF, test "x$perf" = "xyes")
+AM_CONDITIONAL(ON_MINGW, test "x$on_mingw32" = "xyes")
AC_SUBST(stdint)
AC_SUBST(inttypes)
diff --git a/src/Makefile.am b/src/Makefile.am
index 807a9c8..c13441b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -217,6 +217,39 @@ endif
if BUILD_PGM2
libzmq_la_CXXFLAGS = -I$(top_srcdir)/foreign/openpgm/@pgm_basename@/openpgm/pgm/include/ -Wall @LIBZMQ_EXTRA_CXXFLAGS@
+
+if ON_MINGW
+libpgm_diff_flags = \
+ -D_WIN32_WINNT=0x0501 \
+ -DCONFIG_HAVE_IFR_NETMASK \
+ -DCONFIG_BIND_INADDR_ANY \
+ -DCONFIG_GALOIS_MUL_LUT \
+ -DGETTEXT_PACKAGE='"pgm"' \
+ -DG_LOG_DOMAIN='"Pgm"'
+
+else
+libpgm_diff_flags = \
+ -D__need_IOV_MAX \
+ -DCONFIG_HAVE_PSELECT \
+ -DCONFIG_HAVE_POLL \
+ -DCONFIG_HAVE_PPOLL \
+ -DCONFIG_HAVE_EPOLL \
+ -DCONFIG_HAVE_CLOCK_GETTIME \
+ -DCONFIG_HAVE_CLOCK_NANOSLEEP \
+ -DCONFIG_HAVE_NANOSLEEP \
+ -DCONFIG_HAVE_USLEEP \
+ -DCONFIG_HAVE_RTC \
+ -DCONFIG_HAVE_TSC \
+ -DCONFIG_HAVE_IFR_NETMASK \
+ -DCONFIG_HAVE_GETIFADDRS \
+ -DCONFIG_HAVE_GETHOSTBYNAME2 \
+ -DCONFIG_HAVE_GETPROTOBYNAME_R \
+ -DCONFIG_BIND_INADDR_ANY \
+ -DCONFIG_GALOIS_MUL_LUT \
+ -DGETTEXT_PACKAGE='"pgm"' \
+ -DG_LOG_DOMAIN='"Pgm"'
+endif
+
libzmq_la_CFLAGS = -I$(top_srcdir)/foreign/openpgm/@pgm_basename@/openpgm/pgm/include/ @LIBZMQ_EXTRA_CXXFLAGS@ \
-pipe \
-Wall \
@@ -244,25 +277,7 @@ libzmq_la_CFLAGS = -I$(top_srcdir)/foreign/openpgm/@pgm_basename@/openpgm/pgm/in
--param max-inline-insns-single=600 \
-D_REENTRANT \
-D_GNU_SOURCE \
- -D__need_IOV_MAX \
- -DCONFIG_HAVE_PSELECT \
- -DCONFIG_HAVE_POLL \
- -DCONFIG_HAVE_PPOLL \
- -DCONFIG_HAVE_EPOLL \
- -DCONFIG_HAVE_CLOCK_GETTIME \
- -DCONFIG_HAVE_CLOCK_NANOSLEEP \
- -DCONFIG_HAVE_NANOSLEEP \
- -DCONFIG_HAVE_USLEEP \
- -DCONFIG_HAVE_RTC \
- -DCONFIG_HAVE_TSC \
- -DCONFIG_HAVE_IFR_NETMASK \
- -DCONFIG_HAVE_GETIFADDRS \
- -DCONFIG_HAVE_GETHOSTBYNAME2 \
- -DCONFIG_HAVE_GETPROTOBYNAME_R \
- -DCONFIG_BIND_INADDR_ANY \
- -DCONFIG_GALOIS_MUL_LUT \
- -DGETTEXT_PACKAGE='"pgm"' \
- -DG_LOG_DOMAIN='"Pgm"'
+ ${libpgm_diff_flags}
endif
if BUILD_NO_PGM
diff --git a/src/pgm_receiver.cpp b/src/pgm_receiver.cpp
index 2ffb9ab..aa7bab0 100644
--- a/src/pgm_receiver.cpp
+++ b/src/pgm_receiver.cpp
@@ -21,6 +21,11 @@
#if defined ZMQ_HAVE_OPENPGM
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#endif
+
+#include <pgm/pgm.h>
#include <iostream>
#include "pgm_receiver.hpp"
diff --git a/src/pgm_receiver.hpp b/src/pgm_receiver.hpp
index b573081..f92f1c5 100644
--- a/src/pgm_receiver.hpp
+++ b/src/pgm_receiver.hpp
@@ -24,13 +24,19 @@
#if defined ZMQ_HAVE_OPENPGM
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#endif
+
+#include <map>
+#include <pgm/pgm.h>
+
#include "io_object.hpp"
#include "i_engine.hpp"
#include "options.hpp"
#include "zmq_decoder.hpp"
#include "pgm_socket.hpp"
-#include <map>
namespace zmq
{
diff --git a/src/pgm_sender.cpp b/src/pgm_sender.cpp
index 51dfbf1..4fb6d2b 100644
--- a/src/pgm_sender.cpp
+++ b/src/pgm_sender.cpp
@@ -21,6 +21,10 @@
#if defined ZMQ_HAVE_OPENPGM
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#endif
+
#include <iostream>
#include "io_thread.hpp"
@@ -42,7 +46,6 @@
{ printf (__VA_ARGS__);}} while (0)
#endif
-#ifdef ZMQ_HAVE_LINUX
zmq::pgm_sender_t::pgm_sender_t (io_thread_t *parent_,
const options_t &options_, const char *session_name_) :
io_object_t (parent_),
@@ -213,4 +216,3 @@ size_t zmq::pgm_sender_t::write_one_pkt_with_offset (unsigned char *data_,
}
#endif
-#endif
diff --git a/src/pgm_sender.hpp b/src/pgm_sender.hpp
index 380e80b..1cebaa8 100644
--- a/src/pgm_sender.hpp
+++ b/src/pgm_sender.hpp
@@ -24,6 +24,10 @@
#if defined ZMQ_HAVE_OPENPGM
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#endif
+
#include "stdint.hpp"
#include "io_object.hpp"
#include "i_engine.hpp"
diff --git a/src/pgm_socket.cpp b/src/pgm_socket.cpp
index b4f79e6..da8da3b 100644
--- a/src/pgm_socket.cpp
+++ b/src/pgm_socket.cpp
@@ -21,13 +21,17 @@
#ifdef ZMQ_HAVE_OPENPGM
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#endif
+
#ifdef ZMQ_HAVE_LINUX
-// TODO: needed for pgm - add this into platform.hpp?
+#include <poll.h>
+// Has to be defined befiore including pgm/pgm.h
#define CONFIG_HAVE_POLL
-
-#include <pgm/pgm.h>
#endif
+#include <pgm/pgm.h>
#include <string>
#include <iostream>
@@ -51,8 +55,6 @@
{ printf (__VA_ARGS__);}} while (0)
#endif
-#ifdef ZMQ_HAVE_LINUX
-
zmq::pgm_socket_t::pgm_socket_t (bool receiver_, const options_t &options_) :
g_transport (NULL),
options (options_),
@@ -480,7 +482,9 @@ void zmq::pgm_socket_t::close_transport (void)
int zmq::pgm_socket_t::get_receiver_fds (int *recv_fd_,
int *waiting_pipe_fd_)
{
-
+#ifdef ZMQ_HAVE_WINDOWS
+ zmq_assert (false);
+#else
// For POLLIN there are 2 pollfds in pgm_transport.
int fds_array_size = pgm_receiver_fd_count;
pollfd *fds = new pollfd [fds_array_size];
@@ -500,7 +504,7 @@ int zmq::pgm_socket_t::get_receiver_fds (int *recv_fd_,
*waiting_pipe_fd_ = fds [1].fd;
delete [] fds;
-
+#endif
return pgm_receiver_fd_count;
}
@@ -520,6 +524,9 @@ int zmq::pgm_socket_t::get_sender_fds (int *send_fd_, int *receive_fd_,
zmq_assert (rdata_notify_fd_);
#endif
+#ifdef ZMQ_HAVE_WINDOWS
+ zmq_assert (false);
+#else
// Preallocate pollfds array.
int fds_array_size = pgm_sender_fd_count;
pollfd *fds = new pollfd [fds_array_size];
@@ -546,6 +553,7 @@ int zmq::pgm_socket_t::get_sender_fds (int *send_fd_, int *receive_fd_,
#endif
delete [] fds;
+#endif
return pgm_sender_fd_count;
}
@@ -855,4 +863,3 @@ void zmq::pgm_socket_t::process_upstream (void)
#endif
-#endif
diff --git a/src/pgm_socket.hpp b/src/pgm_socket.hpp
index c9d03bd..9b9ae45 100644
--- a/src/pgm_socket.hpp
+++ b/src/pgm_socket.hpp
@@ -24,13 +24,12 @@
#if defined ZMQ_HAVE_OPENPGM
-#ifdef ZMQ_HAVE_LINUX
-#include <glib.h>
-#include <pgm/pgm.h>
-#else
-#include <Winsock2.h>
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
#endif
+#include <pgm/pgm.h>
+
#include "stdint.hpp"
#include "options.hpp"
@@ -40,8 +39,6 @@ namespace zmq
class pgm_socket_t
{
-#ifdef ZMQ_HAVE_LINUX
-
public:
// If receiver_ is true PGM transport is not generating SPM packets.
// interface format: iface;mcast_group:port for raw PGM socket
@@ -148,9 +145,9 @@ namespace zmq
// Receiver transport uses 2 fd.
enum {pgm_receiver_fd_count = 2};
-#endif
};
}
#endif
#endif
+
diff --git a/src/platform.hpp.in b/src/platform.hpp.in
index 1197b57..2cae818 100644
--- a/src/platform.hpp.in
+++ b/src/platform.hpp.in
@@ -24,6 +24,9 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
+/* Define to 1 if you have the `Iphlpapi' library (-lIphlpapi). */
+#undef HAVE_LIBIPHLPAPI
+
/* Define to 1 if you have the `nsl' library (-lnsl). */
#undef HAVE_LIBNSL