Skip to content

Commit dd28089

Browse files
committed
autotools: move checking for zmq library to common area in configure.ac
* Fixes #6679 * Tested with --disable-zmq * Tested with and without pkgconfig * Tested with and without zmq installed Signed-off-by: Johnathan Corgan <[email protected]>
1 parent f297042 commit dd28089

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

configure.ac

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ AC_ARG_ENABLE([glibc-back-compat],
139139

140140
AC_ARG_ENABLE([zmq],
141141
[AS_HELP_STRING([--disable-zmq],
142-
[Disable ZMQ notifications])],
142+
[disable ZMQ notifications])],
143143
[use_zmq=$enableval],
144144
[use_zmq=yes])
145145

@@ -676,6 +676,16 @@ if test x$use_pkgconfig = xyes; then
676676
PKG_CHECK_MODULES([EVENT_PTHREADS], [libevent_pthreads],, [AC_MSG_ERROR(libevent_pthreads not found.)])
677677
fi
678678
fi
679+
680+
if test "x$use_zmq" = "xyes"; then
681+
PKG_CHECK_MODULES([ZMQ],[libzmq >= 4],
682+
[AC_DEFINE([ENABLE_ZMQ],[1],[Define to 1 to enable ZMQ functions])],
683+
[AC_DEFINE([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])
684+
AC_MSG_WARN([libzmq version 4.x or greater not found, disabling])
685+
use_zmq=no])
686+
else
687+
AC_DEFINE_UNQUOTED([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])
688+
fi
679689
]
680690
)
681691
else
@@ -693,6 +703,20 @@ else
693703
fi
694704
fi
695705

706+
if test "x$use_zmq" = "xyes"; then
707+
AC_CHECK_HEADER([zmq.h],
708+
[AC_DEFINE([ENABLE_ZMQ],[1],[Define to 1 to enable ZMQ functions])],
709+
[AC_MSG_WARN([zmq.h not found, disabling zmq support])
710+
use_zmq=no
711+
AC_DEFINE([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])])
712+
AC_CHECK_LIB([zmq],[zmq_ctx_shutdown],ZMQ_LIBS=-lzmq,
713+
[AC_MSG_WARN([libzmq >= 4.0 not found, disabling zmq support])
714+
use_zmq=no
715+
AC_DEFINE([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])])
716+
else
717+
AC_DEFINE_UNQUOTED([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])
718+
fi
719+
696720
BITCOIN_QT_CHECK(AC_CHECK_LIB([protobuf] ,[main],[PROTOBUF_LIBS=-lprotobuf], BITCOIN_QT_FAIL(libprotobuf not found)))
697721
if test x$use_qr != xno; then
698722
BITCOIN_QT_CHECK([AC_CHECK_LIB([qrencode], [main],[QR_LIBS=-lqrencode], [have_qrencode=no])])
@@ -839,20 +863,6 @@ if test x$bitcoin_enable_qt != xno; then
839863
fi
840864
fi
841865

842-
# conditional search for and use libzmq
843-
AC_MSG_CHECKING([whether to build ZMQ support])
844-
if test "x$use_zmq" = "xyes"; then
845-
AC_MSG_RESULT([yes])
846-
PKG_CHECK_MODULES([ZMQ],[libzmq >= 4],
847-
[AC_DEFINE([ENABLE_ZMQ],[1],[Define to 1 to enable ZMQ functions])],
848-
[AC_DEFINE([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])
849-
AC_MSG_WARN([libzmq version 4.x or greater not found, disabling])
850-
use_zmq=no])
851-
else
852-
AC_MSG_RESULT([no, --disable-zmq used])
853-
AC_DEFINE_UNQUOTED([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])
854-
fi
855-
856866
AM_CONDITIONAL([ENABLE_ZMQ], [test "x$use_zmq" = "xyes"])
857867

858868
AC_MSG_CHECKING([whether to build test_bitcoin])

0 commit comments

Comments
 (0)