Skip to content

Commit f8c1eaf

Browse files
committed
allow setting system/bundled libzmq via CLUSTERMQ_USE_SYSTEM_LIBZMQ
1 parent 728d784 commit f8c1eaf

File tree

2 files changed

+48
-37
lines changed

2 files changed

+48
-37
lines changed

configure

+17-37
Original file line numberDiff line numberDiff line change
@@ -17,56 +17,36 @@ int main() {
1717
}
1818
EOF
1919

20-
if $(cc -o libzmq_test libzmq_test.c -lzmq >/dev/null 2>&1); then
21-
echo "* system has libzmq"
22-
if $(./libzmq_test 2>/dev/null); then
23-
echo "* libzmq has DRAFT API -> linking system library"
24-
PKG_CFLAGS="-DZMQ_BUILD_DRAFT_API=1 -fPIC -Icppzmq"
25-
PKG_LIBS="-lzmq"
26-
USE_SYSTEM_LIBZMQ=1
20+
if [ -z "$CLUSTERMQ_USE_SYSTEM_LIBZMQ" ]; then
21+
if $(cc -o libzmq_test libzmq_test.c -lzmq >/dev/null 2>&1); then
22+
echo "* system has libzmq"
23+
if $(./libzmq_test 2>/dev/null); then
24+
echo "* libzmq has DRAFT API -> linking system library"
25+
PKG_CFLAGS="-DZMQ_BUILD_DRAFT_API=1 -fPIC -Icppzmq"
26+
PKG_LIBS="-lzmq"
27+
CLUSTERMQ_USE_SYSTEM_LIBZMQ=1
28+
else
29+
echo "* no DRAFT API found -> using bundled libzmq"
30+
CLUSTERMQ_USE_SYSTEM_LIBZMQ=0
31+
fi
2732
else
28-
echo "* no DRAFT API found -> using bundled libzmq"
33+
echo "* no system libzmq found -> using bundled libzmq"
34+
CLUSTERMQ_USE_SYSTEM_LIBZMQ=0
2935
fi
30-
else
31-
echo "* no system libzmq found -> using bundled libzmq"
3236
fi
3337

34-
if [ -z "$USE_SYSTEM_LIBZMQ" ]; then
35-
if [ ! -f src/libzmq/autogen.sh ]; then
36-
# the tarball has the submodules, a fresh clone does not
37-
git submodule update --init --recursive
38-
fi
38+
if [ "$CLUSTERMQ_USE_SYSTEM_LIBZMQ" -eq "0" ]; then
39+
./src/patch_libzmq.sh
3940

4041
if [ ! -f src/libzmq/src/.libs/libzmq.a ]; then
4142
cd src/libzmq
4243

43-
if [ ! -f src/Makefile.am.orig ]; then
44-
# remove code format helper and valgrind support that CRAN complains about
45-
# sed -i does not work on macOS
46-
mv Makefile.am Makefile.am.orig
47-
sed '/WITH_CLANG_FORMAT/,/VALGRIND_SUPPRESSIONS_FILES/d' Makefile.am.orig > Makefile.am
48-
fi
49-
50-
if [ ! -f src/curve_client_tools.hpp.orig ]; then
51-
# remove disabled gcc check that cran complains about
52-
mv src/curve_client_tools.hpp src/curve_client_tools.hpp.orig
53-
sed '/^#pragma/s|^|//|' src/curve_client_tools.hpp.orig > src/curve_client_tools.hpp
54-
fi
55-
if [ ! -f include/zmq_utils.h.orig ]; then
56-
mv include/zmq_utils.h include/zmq_utils.h.orig
57-
sed '/^#pragma/s|^|//|' include/zmq_utils.h.orig > include/zmq_utils.h
58-
fi
59-
60-
if [ ! -f Makefile.in ]; then
61-
./autogen.sh || exit 1
62-
fi
63-
6444
CXX="$CXX" CXXFLAGS="$CXXFLAGS -fPIC" CPPFLAGS="$CPPFLAGS" ./configure \
45+
--enable-drafts \
6546
--enable-static \
6647
--disable-shared \
6748
--disable-maintainer-mode \
6849
--disable-Werror \
69-
--enable-drafts \
7050
--disable-libbsd \
7151
--disable-libunwind \
7252
--disable-perf \

src/patch_libzmq.sh

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
3+
cd "$(dirname $0)"
4+
5+
if [ ! -f libzmq/autogen.sh ]; then
6+
# the tarball has the submodules, a fresh clone does not
7+
git submodule update --init --recursive
8+
fi
9+
10+
cd libzmq
11+
12+
if [ ! -f src/Makefile.am.orig ]; then
13+
# remove code format helper and valgrind support that CRAN complains about
14+
# sed -i does not work on macOS
15+
mv Makefile.am Makefile.am.orig
16+
sed '/WITH_CLANG_FORMAT/,/VALGRIND_SUPPRESSIONS_FILES/d' Makefile.am.orig > Makefile.am
17+
fi
18+
19+
if [ ! -f src/curve_client_tools.hpp.orig ]; then
20+
# remove disabled gcc check that cran complains about
21+
mv src/curve_client_tools.hpp src/curve_client_tools.hpp.orig
22+
sed '/^#pragma/s|^|//|' src/curve_client_tools.hpp.orig > src/curve_client_tools.hpp
23+
fi
24+
if [ ! -f include/zmq_utils.h.orig ]; then
25+
mv include/zmq_utils.h include/zmq_utils.h.orig
26+
sed '/^#pragma/s|^|//|' include/zmq_utils.h.orig > include/zmq_utils.h
27+
fi
28+
29+
if [ ! -f Makefile.in ]; then
30+
./autogen.sh || exit 1
31+
fi

0 commit comments

Comments
 (0)