GNU/Hurd support

This commit is contained in:
Laszlo Boszormenyi (GCS) 2016-01-16 02:26:20 +01:00
parent 6d491a4289
commit be5ab6d5c9
6 changed files with 41 additions and 4 deletions

View File

@ -138,6 +138,7 @@ libzmq_on_mingw32="no"
libzmq_on_cygwin="no"
libzmq_on_android="no"
libzmq_on_linux="no"
libzmq_on_gnu="no"
# Set some default features required by 0MQ code.
CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE $CPPFLAGS"
@ -145,6 +146,20 @@ CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE $CPPFLAGS"
# For host type checks
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
case "${host_os}" in
*linux*)
@ -281,6 +296,17 @@ case "${host_os}" in
AC_MSG_ERROR([Building static libraries is not supported under Cygwin])
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}.])
;;
@ -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_ANDROID, test "x$libzmq_on_android" = "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
AC_LANG_PUSH([C++])

View File

@ -45,7 +45,7 @@
#define ZMQ_ATOMIC_COUNTER_ARM
#elif defined ZMQ_HAVE_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
#elif defined __tile__
#define ZMQ_ATOMIC_COUNTER_TILE

View File

@ -46,7 +46,7 @@
#define ZMQ_ATOMIC_PTR_TILE
#elif defined ZMQ_HAVE_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
#else
#define ZMQ_ATOMIC_PTR_MUTEX

View File

@ -252,8 +252,11 @@ zmq::fd_t zmq::ipc_connecter_t::connect ()
socklen_t len = sizeof (err);
#endif
int rc = getsockopt (s, SOL_SOCKET, SO_ERROR, (char*) &err, &len);
if (rc == -1)
if (rc == -1) {
if (errno == ENOPROTOOPT)
errno = 0;
err = errno;
}
if (err != 0) {
// Assert if the error was caused by 0MQ bug.

View File

@ -48,6 +48,13 @@
#include "poll.hpp"
#elif defined ZMQ_USE_SELECT
#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
#error None of the ZMQ_USE_* macros defined
#endif

View File

@ -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 ||\
defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_OPENBSD ||\
defined ZMQ_HAVE_QNXNTO || defined ZMQ_HAVE_NETBSD ||\
defined ZMQ_HAVE_DRAGONFLY)\
defined ZMQ_HAVE_DRAGONFLY || defined ZMQ_HAVE_GNU)\
&& defined ZMQ_HAVE_IFADDRS)
#include <ifaddrs.h>