From c6a360138a5a97e0353ce5e2e5b437369d74dfd9 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Fri, 25 Oct 2019 14:34:07 +0200 Subject: [PATCH 1/2] assets/configure.ac: Check for zmq.hpp header We do require the header for compilation but do currently not check for it. The code snippet ensures that we get a recent version with zmq::socket_t::disconnect method. This snipped is copied from cppTango/6402affe (Use feature tests for checking if we have zmq::socket::disconnect, 2019-10-23). Saving and restoring CXXFLAGS allows us to honour a custom zmq-prefix which makes it possible to have libzmq and cppzmq in different locations. So the following now works: git clone https://github.com/zeromq/libzmq cd libzmq mkdir build cd build cmake -DCMAKE_INSTALL_PREFIX=$HOME/libzmq -DENABLE_DRAFTS=OFF .. make make install git clone https://github.com/zeromq/cppzmq cd cppzmq mkdir build cd build export CMAKE_PREFIX_PATH=$HOME/libzmq/share/cmake/ZeroMQ cmake -DCMAKE_INSTALL_PREFIX=$HOME/cppzmq -DENABLE_DRAFTS=OFF -DCPPZMQ_BUILD_TESTS=OFF .. make make install ./configure --with-zmq=$HOME/libzmq CXXFLAGS="-I $HOME/cppzmq/include" make --- assets/configure.ac | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/assets/configure.ac b/assets/configure.ac index 729330cd3..198fbb701 100644 --- a/assets/configure.ac +++ b/assets/configure.ac @@ -196,6 +196,22 @@ ZMQ_VERSION=`eval pkg-config --modversion libzmq` ZMQ_ROOT=`eval pkg-config --variable=prefix libzmq` AC_SUBST(ZMQ_PREFIX) +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +SAVE_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS -I $ZMQ_PREFIX/include" +AC_CHECK_HEADERS(zmq.hpp, [], [AC_MSG_ERROR([Couldn't find a compatible zmq.hpp])], +[#include + +int main(int, char**) +{ + zmq::context_t c; + zmq::socket_t s(c, ZMQ_REQ); + s.disconnect("some endpoint"); +}]) +CXXFLAGS="$SAVE_CXXFLAGS" +AC_LANG_RESTORE + # We need to define some stuff for threads and stubs case $build_os in From 213ea914ec71ca765cdbde4487d20fae5f2a974d Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Thu, 31 Oct 2019 16:29:10 +0100 Subject: [PATCH 2/2] assets/configure.ac: Be compatible with older zmq.hpp versions as well We used to ship a version of zmg.hpp with cppTango, see 5144cb80 (Add again zmq.hpp before tagging release 9.2.5 to be consistent with 9.2.5 version from SVN Sourceforge (#348), 2017-01-11) in tango-controls/cppTango. And in that version there was no default constructor for zmq::context_t available. The constructor taking an integer parameter is still available in newer versions so we can just use that here. --- assets/configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/configure.ac b/assets/configure.ac index 198fbb701..527c603c1 100644 --- a/assets/configure.ac +++ b/assets/configure.ac @@ -205,7 +205,7 @@ AC_CHECK_HEADERS(zmq.hpp, [], [AC_MSG_ERROR([Couldn't find a compatible zmq.hpp] int main(int, char**) { - zmq::context_t c; + zmq::context_t c(1); zmq::socket_t s(c, ZMQ_REQ); s.disconnect("some endpoint"); }])