GNU/Hurd support

parent 6d491a42
...@@ -138,6 +138,7 @@ libzmq_on_mingw32="no" ...@@ -138,6 +138,7 @@ libzmq_on_mingw32="no"
libzmq_on_cygwin="no" libzmq_on_cygwin="no"
libzmq_on_android="no" libzmq_on_android="no"
libzmq_on_linux="no" libzmq_on_linux="no"
libzmq_on_gnu="no"
# Set some default features required by 0MQ code. # Set some default features required by 0MQ code.
CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE $CPPFLAGS" CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE $CPPFLAGS"
...@@ -145,6 +146,20 @@ CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE $CPPFLAGS" ...@@ -145,6 +146,20 @@ CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE $CPPFLAGS"
# For host type checks # For host type checks
AC_CANONICAL_HOST AC_CANONICAL_HOST
#For a working getsockopt() optname=SO_ERROR
dnl AC_MSG_CHECKING([for getsockopt optname SO_ERROR)])
dnl AC_TRY_COMPILE([
dnl #include <sys/types.h>
dnl #include <sys/socket.h>
dnl ], [socklen_t t;], ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no)
dnl if test "x$ac_cv_type_socklen_t" = "xyes"; then
dnl AC_MSG_RESULT([yes])
dnl AC_DEFINE(HAVE_SOCKLEN_T,1,
dnl [Define if socklen_t is available])
dnl else
dnl AC_MSG_RESULT([no])
dnl fi
# OS-specific tests # OS-specific tests
case "${host_os}" in case "${host_os}" in
*linux*) *linux*)
...@@ -281,6 +296,17 @@ case "${host_os}" in ...@@ -281,6 +296,17 @@ case "${host_os}" in
AC_MSG_ERROR([Building static libraries is not supported under Cygwin]) AC_MSG_ERROR([Building static libraries is not supported under Cygwin])
fi fi
;; ;;
gnu*)
# Define on GNU/Hurd to enable all library features. Define if using a gnu compiler
if test "x$GXX" = "xyes"; then
CPPFLAGS="-D_GNU_SOURCE $CPPFLAGS"
fi
AC_DEFINE(ZMQ_HAVE_GNU, 1, [Have GNU/Hurd OS])
libzmq_on_gnu="yes"
AC_CHECK_LIB(rt, sem_init)
dnl AC_CHECK_LIB(uuid, uuid_generate, ,
dnl [AC_MSG_ERROR([cannot link with -luuid, install uuid-dev.])])
;;
*) *)
AC_MSG_ERROR([unsupported system: ${host_os}.]) AC_MSG_ERROR([unsupported system: ${host_os}.])
;; ;;
...@@ -530,6 +556,7 @@ AM_CONDITIONAL(ON_MINGW, test "x$libzmq_on_mingw32" = "xyes") ...@@ -530,6 +556,7 @@ AM_CONDITIONAL(ON_MINGW, test "x$libzmq_on_mingw32" = "xyes")
AM_CONDITIONAL(ON_CYGWIN, test "x$libzmq_on_cygwin" = "xyes") AM_CONDITIONAL(ON_CYGWIN, test "x$libzmq_on_cygwin" = "xyes")
AM_CONDITIONAL(ON_ANDROID, test "x$libzmq_on_android" = "xyes") AM_CONDITIONAL(ON_ANDROID, test "x$libzmq_on_android" = "xyes")
AM_CONDITIONAL(ON_LINUX, test "x$libzmq_on_linux" = "xyes") AM_CONDITIONAL(ON_LINUX, test "x$libzmq_on_linux" = "xyes")
AM_CONDITIONAL(ON_GNU, test "x$libzmq_on_gnu" = "xyes")
# Check for __atomic_Xxx compiler intrinsics # Check for __atomic_Xxx compiler intrinsics
AC_LANG_PUSH([C++]) AC_LANG_PUSH([C++])
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
#define ZMQ_ATOMIC_COUNTER_ARM #define ZMQ_ATOMIC_COUNTER_ARM
#elif defined ZMQ_HAVE_WINDOWS #elif defined ZMQ_HAVE_WINDOWS
#define ZMQ_ATOMIC_COUNTER_WINDOWS #define ZMQ_ATOMIC_COUNTER_WINDOWS
#elif (defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_NETBSD) #elif (defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_NETBSD || defined ZMQ_HAVE_GNU)
#define ZMQ_ATOMIC_COUNTER_ATOMIC_H #define ZMQ_ATOMIC_COUNTER_ATOMIC_H
#elif defined __tile__ #elif defined __tile__
#define ZMQ_ATOMIC_COUNTER_TILE #define ZMQ_ATOMIC_COUNTER_TILE
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
#define ZMQ_ATOMIC_PTR_TILE #define ZMQ_ATOMIC_PTR_TILE
#elif defined ZMQ_HAVE_WINDOWS #elif defined ZMQ_HAVE_WINDOWS
#define ZMQ_ATOMIC_PTR_WINDOWS #define ZMQ_ATOMIC_PTR_WINDOWS
#elif (defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_NETBSD) #elif (defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_NETBSD || defined ZMQ_HAVE_GNU)
#define ZMQ_ATOMIC_PTR_ATOMIC_H #define ZMQ_ATOMIC_PTR_ATOMIC_H
#else #else
#define ZMQ_ATOMIC_PTR_MUTEX #define ZMQ_ATOMIC_PTR_MUTEX
......
...@@ -252,8 +252,11 @@ zmq::fd_t zmq::ipc_connecter_t::connect () ...@@ -252,8 +252,11 @@ zmq::fd_t zmq::ipc_connecter_t::connect ()
socklen_t len = sizeof (err); socklen_t len = sizeof (err);
#endif #endif
int rc = getsockopt (s, SOL_SOCKET, SO_ERROR, (char*) &err, &len); int rc = getsockopt (s, SOL_SOCKET, SO_ERROR, (char*) &err, &len);
if (rc == -1) if (rc == -1) {
if (errno == ENOPROTOOPT)
errno = 0;
err = errno; err = errno;
}
if (err != 0) { if (err != 0) {
// Assert if the error was caused by 0MQ bug. // Assert if the error was caused by 0MQ bug.
......
...@@ -48,6 +48,13 @@ ...@@ -48,6 +48,13 @@
#include "poll.hpp" #include "poll.hpp"
#elif defined ZMQ_USE_SELECT #elif defined ZMQ_USE_SELECT
#include "select.hpp" #include "select.hpp"
#elif defined ZMQ_HAVE_GNU
#define ZMQ_USE_SELECT
#include "select.hpp"
#if 0
#define ZMQ_USE_POLL
#include "poll.hpp"
#endif
#else #else
#error None of the ZMQ_USE_* macros defined #error None of the ZMQ_USE_* macros defined
#endif #endif
......
...@@ -158,7 +158,7 @@ int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv6_, bool is_ ...@@ -158,7 +158,7 @@ int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv6_, bool is_
#elif ((defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\ #elif ((defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\
defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_OPENBSD ||\ defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_OPENBSD ||\
defined ZMQ_HAVE_QNXNTO || defined ZMQ_HAVE_NETBSD ||\ defined ZMQ_HAVE_QNXNTO || defined ZMQ_HAVE_NETBSD ||\
defined ZMQ_HAVE_DRAGONFLY)\ defined ZMQ_HAVE_DRAGONFLY || defined ZMQ_HAVE_GNU)\
&& defined ZMQ_HAVE_IFADDRS) && defined ZMQ_HAVE_IFADDRS)
#include <ifaddrs.h> #include <ifaddrs.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment