Skip to content

Commit 6e4c9b5

Browse files
kwvgPastaPastaPasta
authored andcommitted
partial bitcoin#18307: Require pkg-config for all of the hosts
excludes: - a661449 inapplicable: - 6fd2118 - 06cfc9c above two commits are inapplicable as tighter UniValue integration got rid of that logic altogether, backported as dash#4823
1 parent 5ded21d commit 6e4c9b5

File tree

1 file changed

+35
-73
lines changed

1 file changed

+35
-73
lines changed

configure.ac

Lines changed: 35 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ AC_CONFIG_HEADERS([src/config/bitcoin-config.h])
1313
AC_CONFIG_AUX_DIR([build-aux])
1414
AC_CONFIG_MACRO_DIR([build-aux/m4])
1515

16+
m4_ifndef([PKG_PROG_PKG_CONFIG], [AC_MSG_ERROR([PKG_PROG_PKG_CONFIG macro not found. Please install pkg-config and re-run autogen.sh])])
17+
PKG_PROG_PKG_CONFIG
18+
if test "x$PKG_CONFIG" = x; then
19+
AC_MSG_ERROR([pkg-config not found])
20+
fi
21+
1622
BITCOIN_DAEMON_NAME=dashd
1723
BITCOIN_GUI_NAME=dash-qt
1824
BITCOIN_CLI_NAME=dash-cli
@@ -646,13 +652,8 @@ AC_ARG_WITH([daemon],
646652
[build_bitcoind=$withval],
647653
[build_bitcoind=yes])
648654

649-
use_pkgconfig=yes
650655
case $host in
651656
*mingw*)
652-
653-
dnl pkgconfig does more harm than good with MinGW
654-
use_pkgconfig=no
655-
656657
TARGET_OS=windows
657658
AC_CHECK_LIB([kernel32], [GetModuleFileNameA],, AC_MSG_ERROR(libkernel32 missing))
658659
AC_CHECK_LIB([user32], [main],, AC_MSG_ERROR(libuser32 missing))
@@ -801,16 +802,6 @@ case $host in
801802
;;
802803
esac
803804

804-
if test x$use_pkgconfig = xyes; then
805-
m4_ifndef([PKG_PROG_PKG_CONFIG], [AC_MSG_ERROR(PKG_PROG_PKG_CONFIG macro not found. Please install pkg-config and re-run autogen.sh.)])
806-
m4_ifdef([PKG_PROG_PKG_CONFIG], [
807-
PKG_PROG_PKG_CONFIG
808-
if test x"$PKG_CONFIG" = "x"; then
809-
AC_MSG_ERROR(pkg-config not found.)
810-
fi
811-
])
812-
fi
813-
814805
if test x$use_extended_functional_tests != xno; then
815806
AC_SUBST(EXTENDED_FUNCTIONAL_TESTS, --extended)
816807
fi
@@ -1450,69 +1441,40 @@ if test x$use_tests = xyes; then
14501441
fi
14511442
fi
14521443

1453-
if test x$use_pkgconfig = xyes; then
1454-
: dnl
1455-
m4_ifdef(
1456-
[PKG_CHECK_MODULES],
1457-
[
1458-
if test x$use_qr != xno; then
1459-
BITCOIN_QT_CHECK([PKG_CHECK_MODULES([QR], [libqrencode], [have_qrencode=yes], [have_qrencode=no])])
1460-
fi
1461-
if test x$build_bitcoin_cli$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench != xnononono; then
1462-
PKG_CHECK_MODULES([EVENT], [libevent >= 2.0.21], [use_libevent=yes], [AC_MSG_ERROR(libevent version 2.0.21 or greater not found.)])
1463-
if test x$TARGET_OS != xwindows; then
1464-
PKG_CHECK_MODULES([EVENT_PTHREADS], [libevent_pthreads >= 2.0.21],, [AC_MSG_ERROR(libevent_pthreads version 2.0.21 or greater not found.)])
1465-
fi
1466-
fi
1467-
1468-
if test "x$use_zmq" = "xyes"; then
1469-
PKG_CHECK_MODULES([ZMQ],[libzmq >= 4],
1470-
[AC_DEFINE([ENABLE_ZMQ],[1],[Define to 1 to enable ZMQ functions])],
1471-
[AC_DEFINE([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])
1472-
AC_MSG_WARN([libzmq version 4.x or greater not found, disabling])
1473-
use_zmq=no])
1474-
else
1475-
AC_DEFINE_UNQUOTED([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])
1476-
fi
1477-
]
1478-
)
1479-
else
1444+
dnl libevent check
14801445

1481-
if test x$build_bitcoin_cli$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench != xnonononono; then
1482-
AC_CHECK_HEADER([event2/event.h], [use_libevent=yes], AC_MSG_ERROR(libevent headers missing),)
1483-
AC_CHECK_LIB([event],[main],EVENT_LIBS=-levent,AC_MSG_ERROR(libevent missing))
1484-
if test x$TARGET_OS != xwindows; then
1485-
AC_CHECK_LIB([event_pthreads],[main],EVENT_PTHREADS_LIBS=-levent_pthreads,AC_MSG_ERROR(libevent_pthreads missing))
1486-
fi
1446+
if test x$build_bitcoin_cli$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench != xnonononono; then
1447+
PKG_CHECK_MODULES([EVENT], [libevent >= 2.0.21], [use_libevent=yes], [AC_MSG_ERROR([libevent version 2.0.21 or greater not found.])])
1448+
if test x$TARGET_OS != xwindows; then
1449+
PKG_CHECK_MODULES([EVENT_PTHREADS], [libevent_pthreads >= 2.0.21],, [AC_MSG_ERROR([libevent_pthreads version 2.0.21 or greater not found.])])
14871450
fi
1451+
fi
14881452

1489-
if test "x$use_zmq" = "xyes"; then
1490-
AC_CHECK_HEADER([zmq.h],
1491-
[AC_DEFINE([ENABLE_ZMQ],[1],[Define to 1 to enable ZMQ functions])],
1492-
[AC_MSG_WARN([zmq.h not found, disabling zmq support])
1493-
use_zmq=no
1494-
AC_DEFINE([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])])
1495-
AC_CHECK_LIB([zmq],[zmq_ctx_shutdown],ZMQ_LIBS=-lzmq,
1496-
[AC_MSG_WARN([libzmq >= 4.0 not found, disabling zmq support])
1497-
use_zmq=no
1498-
AC_DEFINE([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])])
1499-
else
1500-
AC_DEFINE_UNQUOTED([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])
1501-
fi
1453+
dnl QR Code encoding library check
15021454

1503-
if test "x$use_zmq" = "xyes"; then
1504-
dnl Assume libzmq was built for static linking
1505-
case $host in
1506-
*mingw*)
1507-
ZMQ_CFLAGS="$ZMQ_CFLAGS -DZMQ_STATIC"
1508-
;;
1509-
esac
1510-
fi
1455+
if test "x$use_qr" != xno; then
1456+
BITCOIN_QT_CHECK([PKG_CHECK_MODULES([QR], [libqrencode], [have_qrencode=yes], [have_qrencode=no])])
1457+
fi
15111458

1512-
if test x$use_qr != xno; then
1513-
BITCOIN_QT_CHECK([AC_CHECK_LIB([qrencode], [main],[QR_LIBS=-lqrencode], [have_qrencode=no])])
1514-
BITCOIN_QT_CHECK([AC_CHECK_HEADER([qrencode.h],, have_qrencode=no)])
1515-
fi
1459+
dnl ZMQ check
1460+
1461+
if test "x$use_zmq" = xyes; then
1462+
PKG_CHECK_MODULES([ZMQ], [libzmq >= 4],
1463+
AC_DEFINE([ENABLE_ZMQ], [1], [Define to 1 to enable ZMQ functions]),
1464+
[AC_DEFINE([ENABLE_ZMQ], [0], [Define to 1 to enable ZMQ functions])
1465+
AC_MSG_WARN([libzmq version 4.x or greater not found, disabling])
1466+
use_zmq=no])
1467+
else
1468+
AC_DEFINE_UNQUOTED([ENABLE_ZMQ], [0], [Define to 1 to enable ZMQ functions])
1469+
fi
1470+
1471+
if test "x$use_zmq" = xyes; then
1472+
dnl Assume libzmq was built for static linking
1473+
case $host in
1474+
*mingw*)
1475+
ZMQ_CFLAGS="$ZMQ_CFLAGS -DZMQ_STATIC"
1476+
;;
1477+
esac
15161478
fi
15171479

15181480
dnl check if libgmp is present

0 commit comments

Comments
 (0)