diff --git a/configure.ac b/configure.ac index 7c8a9738..589f90df 100644 --- a/configure.ac +++ b/configure.ac @@ -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 +dnl #include +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++]) diff --git a/src/atomic_counter.hpp b/src/atomic_counter.hpp index 457bd20e..789091b8 100644 --- a/src/atomic_counter.hpp +++ b/src/atomic_counter.hpp @@ -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 diff --git a/src/atomic_ptr.hpp b/src/atomic_ptr.hpp index aed139d2..4fd783c3 100644 --- a/src/atomic_ptr.hpp +++ b/src/atomic_ptr.hpp @@ -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 diff --git a/src/ipc_connecter.cpp b/src/ipc_connecter.cpp index d9262e05..71efc9b0 100644 --- a/src/ipc_connecter.cpp +++ b/src/ipc_connecter.cpp @@ -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. diff --git a/src/poller.hpp b/src/poller.hpp index b91e551c..f3d8d676 100644 --- a/src/poller.hpp +++ b/src/poller.hpp @@ -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 diff --git a/src/tcp_address.cpp b/src/tcp_address.cpp index 74dbe998..5f2664d4 100644 --- a/src/tcp_address.cpp +++ b/src/tcp_address.cpp @@ -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