Skip to content

Commit 7d9008f

Browse files
committed
Merge #18307: build: Require pkg-config for all of the hosts
92bc268 build: Detect missed pkg-config early (Hennadii Stepanov) 1739eb2 build: Drop unused use_pkgconfig variable (Hennadii Stepanov) a661449 build: Drop use_pkgconfig check for libmultiprocess check (Hennadii Stepanov) 90b95e7 build: Drop dead non-pkg-config code for libevent check (Hennadii Stepanov) 44a14af build: Drop dead non-pkg-config code for qrencode check (Hennadii Stepanov) 10cbae0 build: Drop dead non-pkg-config code for ZMQ check (Hennadii Stepanov) 06cfc9c build: Fix indentation in UNIVALUE check (Hennadii Stepanov) 6fd2118 build: Drop dead non-pkg-config code for UNIVALUE check (Hennadii Stepanov) e9edbe4 build: Always use pkg-config (Hennadii Stepanov) 9e2e753 build: Always define ZMQ_STATIC for MinGW (Hennadii Stepanov) Pull request description: This PR: - is based on #18297 (already merged) - drops all of the non-pkg-config paths from the `configure` script Ref: #17768 ACKs for top commit: fanquake: ACK 92bc268. I re-gitian-built. There are a couple follow-ups that I'll PR shortly. Thanks for addressing my feedback above. I took too long to get back to this. laanwj: ACK 92bc268 Tree-SHA512: 83c2d9cf03518867a1ebf7e26a8fc5b6dd8962ef983fe0d84e0c7eb74717f4c36a834da02faf0e503ffd87167005351671cf040c0d4ddae57ee152a6ff84012b
2 parents daae8b8 + 92bc268 commit 7d9008f

File tree

1 file changed

+52
-112
lines changed

1 file changed

+52
-112
lines changed

configure.ac

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

17+
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])])
18+
PKG_PROG_PKG_CONFIG
19+
if test "x$PKG_CONFIG" = x; then
20+
AC_MSG_ERROR([pkg-config not found])
21+
fi
22+
1723
BITCOIN_DAEMON_NAME=bitcoind
1824
BITCOIN_GUI_NAME=bitcoin-qt
1925
BITCOIN_CLI_NAME=bitcoin-cli
@@ -560,13 +566,8 @@ AC_ARG_WITH([daemon],
560566
[build_bitcoind=$withval],
561567
[build_bitcoind=yes])
562568

563-
use_pkgconfig=yes
564569
case $host in
565570
*mingw*)
566-
567-
dnl pkgconfig does more harm than good with MinGW
568-
use_pkgconfig=no
569-
570571
TARGET_OS=windows
571572
AC_CHECK_LIB([kernel32], [GetModuleFileNameA],, AC_MSG_ERROR(libkernel32 missing))
572573
AC_CHECK_LIB([user32], [main],, AC_MSG_ERROR(libuser32 missing))
@@ -670,16 +671,6 @@ case $host in
670671
;;
671672
esac
672673

673-
if test x$use_pkgconfig = xyes; then
674-
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.)])
675-
m4_ifdef([PKG_PROG_PKG_CONFIG], [
676-
PKG_PROG_PKG_CONFIG
677-
if test x"$PKG_CONFIG" = "x"; then
678-
AC_MSG_ERROR(pkg-config not found.)
679-
fi
680-
])
681-
fi
682-
683674
if test x$use_extended_functional_tests != xno; then
684675
AC_SUBST(EXTENDED_FUNCTIONAL_TESTS, --extended)
685676
fi
@@ -1303,115 +1294,66 @@ CPPFLAGS="$TEMP_CPPFLAGS"
13031294

13041295
fi
13051296

1306-
if test x$use_pkgconfig = xyes; then
1307-
: dnl
1308-
m4_ifdef(
1309-
[PKG_CHECK_MODULES],
1310-
[
1311-
if test x$use_qr != xno; then
1312-
BITCOIN_QT_CHECK([PKG_CHECK_MODULES([QR], [libqrencode], [have_qrencode=yes], [have_qrencode=no])])
1313-
fi
1314-
if test x$build_bitcoin_cli$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench != xnonononono; then
1315-
PKG_CHECK_MODULES([EVENT], [libevent >= 2.0.21], [use_libevent=yes], [AC_MSG_ERROR(libevent version 2.0.21 or greater not found.)])
1316-
if test x$TARGET_OS != xwindows; then
1317-
PKG_CHECK_MODULES([EVENT_PTHREADS], [libevent_pthreads >= 2.0.21],, [AC_MSG_ERROR(libevent_pthreads version 2.0.21 or greater not found.)])
1318-
fi
1319-
fi
1320-
1321-
if test "x$use_zmq" = "xyes"; then
1322-
PKG_CHECK_MODULES([ZMQ],[libzmq >= 4],
1323-
[AC_DEFINE([ENABLE_ZMQ],[1],[Define to 1 to enable ZMQ functions])],
1324-
[AC_DEFINE([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])
1325-
AC_MSG_WARN([libzmq version 4.x or greater not found, disabling])
1326-
use_zmq=no])
1327-
else
1328-
AC_DEFINE_UNQUOTED([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])
1329-
fi
1330-
]
1331-
)
1332-
else
1297+
dnl libevent check
13331298

1334-
if test x$build_bitcoin_cli$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench != xnonononono; then
1335-
AC_CHECK_HEADER([event2/event.h], [use_libevent=yes], AC_MSG_ERROR(libevent headers missing),)
1336-
AC_CHECK_LIB([event],[main],EVENT_LIBS=-levent,AC_MSG_ERROR(libevent missing))
1337-
if test x$TARGET_OS != xwindows; then
1338-
AC_CHECK_LIB([event_pthreads],[main],EVENT_PTHREADS_LIBS=-levent_pthreads,AC_MSG_ERROR(libevent_pthreads missing))
1339-
fi
1299+
if test x$build_bitcoin_cli$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench != xnonononono; then
1300+
PKG_CHECK_MODULES([EVENT], [libevent >= 2.0.21], [use_libevent=yes], [AC_MSG_ERROR([libevent version 2.0.21 or greater not found.])])
1301+
if test x$TARGET_OS != xwindows; then
1302+
PKG_CHECK_MODULES([EVENT_PTHREADS], [libevent_pthreads >= 2.0.21],, [AC_MSG_ERROR([libevent_pthreads version 2.0.21 or greater not found.])])
13401303
fi
1304+
fi
13411305

1342-
if test "x$use_zmq" = "xyes"; then
1343-
AC_CHECK_HEADER([zmq.h],
1344-
[AC_DEFINE([ENABLE_ZMQ],[1],[Define to 1 to enable ZMQ functions])],
1345-
[AC_MSG_WARN([zmq.h not found, disabling zmq support])
1346-
use_zmq=no
1347-
AC_DEFINE([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])])
1348-
AC_CHECK_LIB([zmq],[zmq_ctx_shutdown],ZMQ_LIBS=-lzmq,
1349-
[AC_MSG_WARN([libzmq >= 4.0 not found, disabling zmq support])
1350-
use_zmq=no
1351-
AC_DEFINE([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])])
1352-
else
1353-
AC_DEFINE_UNQUOTED([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])
1354-
fi
1306+
dnl QR Code encoding library check
13551307

1356-
if test "x$use_zmq" = "xyes"; then
1357-
dnl Assume libzmq was built for static linking
1358-
case $host in
1359-
*mingw*)
1360-
ZMQ_CFLAGS="$ZMQ_CFLAGS -DZMQ_STATIC"
1361-
;;
1362-
esac
1363-
fi
1308+
if test "x$use_qr" != xno; then
1309+
BITCOIN_QT_CHECK([PKG_CHECK_MODULES([QR], [libqrencode], [have_qrencode=yes], [have_qrencode=no])])
1310+
fi
13641311

1365-
if test x$use_qr != xno; then
1366-
BITCOIN_QT_CHECK([AC_CHECK_LIB([qrencode], [main],[QR_LIBS=-lqrencode], [have_qrencode=no])])
1367-
BITCOIN_QT_CHECK([AC_CHECK_HEADER([qrencode.h],, have_qrencode=no)])
1368-
fi
1312+
dnl ZMQ check
1313+
1314+
if test "x$use_zmq" = xyes; then
1315+
PKG_CHECK_MODULES([ZMQ], [libzmq >= 4],
1316+
AC_DEFINE([ENABLE_ZMQ], [1], [Define to 1 to enable ZMQ functions]),
1317+
[AC_DEFINE([ENABLE_ZMQ], [0], [Define to 1 to enable ZMQ functions])
1318+
AC_MSG_WARN([libzmq version 4.x or greater not found, disabling])
1319+
use_zmq=no])
1320+
else
1321+
AC_DEFINE_UNQUOTED([ENABLE_ZMQ], [0], [Define to 1 to enable ZMQ functions])
1322+
fi
1323+
1324+
if test "x$use_zmq" = xyes; then
1325+
dnl Assume libzmq was built for static linking
1326+
case $host in
1327+
*mingw*)
1328+
ZMQ_CFLAGS="$ZMQ_CFLAGS -DZMQ_STATIC"
1329+
;;
1330+
esac
13691331
fi
13701332

13711333
dnl univalue check
13721334

13731335
need_bundled_univalue=yes
1374-
13751336
if test x$build_bitcoin_wallet$build_bitcoin_cli$build_bitcoin_tx$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench = xnonononononono; then
13761337
need_bundled_univalue=no
13771338
else
1378-
1379-
if test x$system_univalue != xno ; then
1380-
found_univalue=no
1381-
if test x$use_pkgconfig = xyes; then
1382-
: #NOP
1383-
m4_ifdef(
1384-
[PKG_CHECK_MODULES],
1385-
[
1386-
PKG_CHECK_MODULES([UNIVALUE],[libunivalue >= 1.0.4],[found_univalue=yes],[true])
1387-
]
1388-
)
1389-
else
1390-
AC_CHECK_HEADER([univalue.h],[
1391-
AC_CHECK_LIB([univalue], [main],[
1392-
UNIVALUE_LIBS=-lunivalue
1393-
found_univalue=yes
1394-
],[true])
1395-
],[true])
1339+
if test x$system_univalue != xno; then
1340+
PKG_CHECK_MODULES([UNIVALUE], [libunivalue >= 1.0.4], [found_univalue=yes], [found_univalue=no])
1341+
if test x$found_univalue = xyes; then
1342+
system_univalue=yes
1343+
need_bundled_univalue=no
1344+
elif test x$system_univalue = xyes; then
1345+
AC_MSG_ERROR([univalue not found])
1346+
else
1347+
system_univalue=no
1348+
fi
13961349
fi
13971350

1398-
if test x$found_univalue = xyes ; then
1399-
system_univalue=yes
1400-
need_bundled_univalue=no
1401-
elif test x$system_univalue = xyes ; then
1402-
AC_MSG_ERROR([univalue not found])
1403-
else
1404-
system_univalue=no
1351+
if test x$need_bundled_univalue = xyes; then
1352+
UNIVALUE_CFLAGS='-I$(srcdir)/univalue/include'
1353+
UNIVALUE_LIBS='univalue/libunivalue.la'
14051354
fi
14061355
fi
14071356

1408-
if test x$need_bundled_univalue = xyes ; then
1409-
UNIVALUE_CFLAGS='-I$(srcdir)/univalue/include'
1410-
UNIVALUE_LIBS='univalue/libunivalue.la'
1411-
fi
1412-
1413-
fi
1414-
14151357
AM_CONDITIONAL([EMBEDDED_UNIVALUE],[test x$need_bundled_univalue = xyes])
14161358
AC_SUBST(UNIVALUE_CFLAGS)
14171359
AC_SUBST(UNIVALUE_LIBS)
@@ -1420,12 +1362,10 @@ dnl libmultiprocess library check
14201362

14211363
libmultiprocess_found=no
14221364
if test "x$with_libmultiprocess" = xyes || test "x$with_libmultiprocess" = xauto; then
1423-
if test "x$use_pkgconfig" = xyes; then
1424-
m4_ifdef([PKG_CHECK_MODULES], [PKG_CHECK_MODULES([LIBMULTIPROCESS], [libmultiprocess], [
1425-
libmultiprocess_found=yes;
1426-
libmultiprocess_prefix=`$PKG_CONFIG --variable=prefix libmultiprocess`;
1427-
], [true])])
1428-
fi
1365+
m4_ifdef([PKG_CHECK_MODULES], [PKG_CHECK_MODULES([LIBMULTIPROCESS], [libmultiprocess], [
1366+
libmultiprocess_found=yes;
1367+
libmultiprocess_prefix=`$PKG_CONFIG --variable=prefix libmultiprocess`;
1368+
], [true])])
14291369
elif test "x$with_libmultiprocess" != xno; then
14301370
AC_MSG_ERROR([--with-libmultiprocess=$with_libmultiprocess value is not yes, auto, or no])
14311371
fi

0 commit comments

Comments
 (0)