Skip to content

Commit 9cf5c64

Browse files
2 parents e37eb41 + d3edc5b commit 9cf5c64

File tree

9 files changed

+193
-138
lines changed

9 files changed

+193
-138
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,10 @@ releases
120120
/*.info
121121
test_dash.coverage/
122122
total.coverage/
123+
fuzz.coverage/
123124
coverage_percent.txt
125+
/cov_tool_wrapper.sh
126+
qa-assets/
124127

125128
#build tests
126129
linux-coverage-build

Makefile.am

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ WINDOWS_PACKAGING = $(top_srcdir)/share/pixmaps/dash.ico \
6161
OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_INSTALLER_ICONS) \
6262
$(top_srcdir)/contrib/macdeploy/detached-sig-create.sh
6363

64-
COVERAGE_INFO = baseline.info \
64+
COVERAGE_INFO = $(COV_TOOL_WRAPPER) baseline.info \
6565
test_dash_filtered.info total_coverage.info \
6666
baseline_filtered.info functional_test.info functional_test_filtered.info \
67-
test_dash_coverage.info test_dash.info fuzz.info fuzz_coverage.info
67+
test_dash_coverage.info test_dash.info fuzz.info fuzz_filtered.info fuzz_coverage.info
6868

6969
dist-hook:
7070
-$(GIT) archive --format=tar HEAD -- src/clientversion.cpp | $(AMTAR) -C $(top_distdir) -xf -
@@ -171,15 +171,21 @@ LCOV_FILTER_PATTERN = \
171171
-p "src/secp256k1" \
172172
-p "depends"
173173

174-
baseline.info:
174+
DIR_FUZZ_SEED_CORPUS ?= qa-assets/fuzz_seed_corpus
175+
176+
$(COV_TOOL_WRAPPER):
177+
@echo 'exec $(COV_TOOL) "$$@"' > $(COV_TOOL_WRAPPER)
178+
@chmod +x $(COV_TOOL_WRAPPER)
179+
180+
baseline.info: $(COV_TOOL_WRAPPER)
175181
$(LCOV) -c -i -d $(abs_builddir)/src -o $@
176182

177183
baseline_filtered.info: baseline.info
178184
$(abs_builddir)/contrib/filter-lcov.py $(LCOV_FILTER_PATTERN) $< $@
179185
$(LCOV) -a $@ $(LCOV_OPTS) -o $@
180186

181187
fuzz.info: baseline_filtered.info
182-
@TIMEOUT=15 test/fuzz/test_runner.py qa-assets/fuzz_seed_corpus -l DEBUG
188+
@TIMEOUT=15 test/fuzz/test_runner.py $(DIR_FUZZ_SEED_CORPUS) -l DEBUG
183189
$(LCOV) -c $(LCOV_OPTS) -d $(abs_builddir)/src --t fuzz-tests -o $@
184190
$(LCOV) -z $(LCOV_OPTS) -d $(abs_builddir)/src
185191

configure.ac

Lines changed: 80 additions & 90 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
@@ -92,6 +98,7 @@ AC_PATH_TOOL(AR, ar)
9298
AC_PATH_TOOL(RANLIB, ranlib)
9399
AC_PATH_TOOL(STRIP, strip)
94100
AC_PATH_TOOL(GCOV, gcov)
101+
AC_PATH_TOOL(LLVM_COV, llvm-cov)
95102
AC_PATH_PROG(LCOV, lcov)
96103
dnl Python 3.8 is specified in .python-version and should be used if available, see doc/dependencies.md
97104
AC_PATH_PROGS([PYTHON], [python3.8 python3.9 python3.10 python3.11 python3.12 python3 python])
@@ -460,6 +467,10 @@ if test "x$CXXFLAGS_overridden" = "xno"; then
460467
AX_CHECK_COMPILE_FLAG([-Wdate-time],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wdate-time"],,[[$CXXFLAG_WERROR]])
461468
AX_CHECK_COMPILE_FLAG([-Wconditional-uninitialized],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wconditional-uninitialized"],,[[$CXXFLAG_WERROR]])
462469
AX_CHECK_COMPILE_FLAG([-Wsign-compare],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wsign-compare"],,[[$CXXFLAG_WERROR]])
470+
AX_CHECK_COMPILE_FLAG([-Wduplicated-branches],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wduplicated-branches"],,[[$CXXFLAG_WERROR]])
471+
AX_CHECK_COMPILE_FLAG([-Wduplicated-cond],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wduplicated-cond"],,[[$CXXFLAG_WERROR]])
472+
AX_CHECK_COMPILE_FLAG([-Wlogical-op],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wlogical-op"],,[[$CXXFLAG_WERROR]])
473+
AX_CHECK_COMPILE_FLAG([-Woverloaded-virtual],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Woverloaded-virtual"],,[[$CXXFLAG_WERROR]])
463474
AX_CHECK_COMPILE_FLAG([-Wsuggest-override],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wsuggest-override"],,[[$CXXFLAG_WERROR]],
464475
[AC_LANG_SOURCE([[struct A { virtual void f(); }; struct B : A { void f() final; };]])])
465476
AX_CHECK_COMPILE_FLAG([-Wunreachable-code-loop-increment],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunreachable-code-loop-increment"],,[[$CXXFLAG_WERROR]])
@@ -646,13 +657,8 @@ AC_ARG_WITH([daemon],
646657
[build_bitcoind=$withval],
647658
[build_bitcoind=yes])
648659

649-
use_pkgconfig=yes
650660
case $host in
651661
*mingw*)
652-
653-
dnl pkgconfig does more harm than good with MinGW
654-
use_pkgconfig=no
655-
656662
TARGET_OS=windows
657663
AC_CHECK_LIB([kernel32], [GetModuleFileNameA],, AC_MSG_ERROR(libkernel32 missing))
658664
AC_CHECK_LIB([user32], [main],, AC_MSG_ERROR(libuser32 missing))
@@ -710,16 +716,19 @@ case $host in
710716
dnl It's safe to add these paths even if the functionality is disabled by
711717
dnl the user (--without-wallet or --without-gui for example).
712718

713-
qt5_prefix=$($BREW --prefix qt5 2>/dev/null)
714-
if $BREW list --versions berkeley-db4 >/dev/null && test "x$BDB_CFLAGS" = "x" && test "x$BDB_LIBS" = "x" && test "$use_bdb" != "no"; then
719+
if test "x$use_bdb" != xno && $BREW list --versions berkeley-db4 >/dev/null && test "x$BDB_CFLAGS" = "x" && test "x$BDB_LIBS" = "x"; then
715720
bdb_prefix=$($BREW --prefix berkeley-db4 2>/dev/null)
716721
dnl This must precede the call to BITCOIN_FIND_BDB48 below.
717722
BDB_CFLAGS="-I$bdb_prefix/include"
718723
BDB_LIBS="-L$bdb_prefix/lib -ldb_cxx-4.8"
719724
fi
720-
if test x$qt5_prefix != x; then
721-
PKG_CONFIG_PATH="$qt5_prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
722-
export PKG_CONFIG_PATH
725+
726+
if test "x$use_sqlite" != xno && $BREW list --versions sqlite3 >/dev/null; then
727+
export PKG_CONFIG_PATH="$($BREW --prefix sqlite3 2>/dev/null)/lib/pkgconfig:$PKG_CONFIG_PATH"
728+
fi
729+
730+
if $BREW list --versions qt5 >/dev/null; then
731+
export PKG_CONFIG_PATH="$($BREW --prefix qt5 2>/dev/null)/lib/pkgconfig:$PKG_CONFIG_PATH"
723732
fi
724733

725734
gmp_prefix=$($BREW --prefix gmp 2>/dev/null)
@@ -801,16 +810,6 @@ case $host in
801810
;;
802811
esac
803812

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-
814813
if test x$use_extended_functional_tests != xno; then
815814
AC_SUBST(EXTENDED_FUNCTIONAL_TESTS, --extended)
816815
fi
@@ -819,16 +818,37 @@ if test x$use_lcov = xyes; then
819818
if test x$LCOV = x; then
820819
AC_MSG_ERROR("lcov testing requested but lcov not found")
821820
fi
822-
if test x$GCOV = x; then
823-
AC_MSG_ERROR("lcov testing requested but gcov not found")
824-
fi
825821
if test x$PYTHON = x; then
826822
AC_MSG_ERROR("lcov testing requested but python not found")
827823
fi
828824
if test x$GENHTML = x; then
829825
AC_MSG_ERROR("lcov testing requested but genhtml not found")
830826
fi
831-
LCOV="$LCOV --gcov-tool=$GCOV"
827+
828+
AC_MSG_CHECKING([whether compiler is Clang])
829+
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
830+
#if defined(__clang__) && defined(__llvm__)
831+
// Compiler is Clang
832+
#else
833+
# error Compiler is not Clang
834+
#endif
835+
]])],[
836+
AC_MSG_RESULT([yes])
837+
if test x$LLVM_COV = x; then
838+
AC_MSG_ERROR([lcov testing requested but llvm-cov not found])
839+
fi
840+
COV_TOOL="$LLVM_COV gcov"
841+
],[
842+
AC_MSG_RESULT([no])
843+
if test x$GCOV = x; then
844+
AC_MSG_ERROR([lcov testing requested but gcov not found])
845+
fi
846+
COV_TOOL="$GCOV"
847+
])
848+
AC_SUBST(COV_TOOL)
849+
AC_SUBST(COV_TOOL_WRAPPER, "cov_tool_wrapper.sh")
850+
LCOV="$LCOV --gcov-tool $(pwd)/$COV_TOOL_WRAPPER"
851+
832852
AX_CHECK_LINK_FLAG([[--coverage]], [LDFLAGS="$LDFLAGS --coverage"],
833853
[AC_MSG_ERROR("lcov testing requested but --coverage linker flag does not work")])
834854
AX_CHECK_COMPILE_FLAG([--coverage],[CXXFLAGS="$CXXFLAGS --coverage"],
@@ -1301,9 +1321,11 @@ fi
13011321

13021322
if test x$enable_wallet != xno; then
13031323
dnl Check for libdb_cxx only if wallet enabled
1304-
BITCOIN_FIND_BDB48
1305-
if test x$suppress_external_warnings != xno ; then
1324+
if test "x$use_bdb" != "xno"; then
1325+
BITCOIN_FIND_BDB48
1326+
if test x$suppress_external_warnings != xno ; then
13061327
BDB_CPPFLAGS=SUPPRESS_WARNINGS($BDB_CPPFLAGS)
1328+
fi
13071329
fi
13081330

13091331
dnl Check for sqlite3
@@ -1350,7 +1372,7 @@ fi
13501372
dnl Check for libminiupnpc (optional)
13511373
if test x$use_upnp != xno; then
13521374
AC_CHECK_HEADERS(
1353-
[miniupnpc/miniwget.h miniupnpc/miniupnpc.h miniupnpc/upnpcommands.h miniupnpc/upnperrors.h],
1375+
[miniupnpc/miniupnpc.h miniupnpc/upnpcommands.h miniupnpc/upnperrors.h],
13541376
[AC_CHECK_LIB([miniupnpc], [upnpDiscover], [MINIUPNPC_LIBS=-lminiupnpc], [have_miniupnpc=no])],
13551377
[have_miniupnpc=no]
13561378
)
@@ -1391,11 +1413,8 @@ fi
13911413

13921414
if test x$use_boost = xyes; then
13931415

1394-
dnl Minimum required Boost version
1395-
define(MINIMUM_REQUIRED_BOOST, 1.64.0)
1396-
1397-
dnl Check for Boost libs
1398-
AX_BOOST_BASE([MINIMUM_REQUIRED_BOOST])
1416+
dnl Check for Boost headers
1417+
AX_BOOST_BASE([1.64.0],[],[AC_MSG_ERROR([Boost is not available!])])
13991418
if test x$want_boost = xno; then
14001419
AC_MSG_ERROR([[only libdashconsensus can be built without boost]])
14011420
fi
@@ -1450,69 +1469,40 @@ if test x$use_tests = xyes; then
14501469
fi
14511470
fi
14521471

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
1472+
dnl libevent check
14801473

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
1474+
if test x$build_bitcoin_cli$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench != xnonononono; then
1475+
PKG_CHECK_MODULES([EVENT], [libevent >= 2.0.21], [use_libevent=yes], [AC_MSG_ERROR([libevent version 2.0.21 or greater not found.])])
1476+
if test x$TARGET_OS != xwindows; then
1477+
PKG_CHECK_MODULES([EVENT_PTHREADS], [libevent_pthreads >= 2.0.21],, [AC_MSG_ERROR([libevent_pthreads version 2.0.21 or greater not found.])])
14871478
fi
1479+
fi
14881480

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
1481+
dnl QR Code encoding library check
15021482

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
1483+
if test "x$use_qr" != xno; then
1484+
BITCOIN_QT_CHECK([PKG_CHECK_MODULES([QR], [libqrencode], [have_qrencode=yes], [have_qrencode=no])])
1485+
fi
15111486

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
1487+
dnl ZMQ check
1488+
1489+
if test "x$use_zmq" = xyes; then
1490+
PKG_CHECK_MODULES([ZMQ], [libzmq >= 4],
1491+
AC_DEFINE([ENABLE_ZMQ], [1], [Define to 1 to enable ZMQ functions]),
1492+
[AC_DEFINE([ENABLE_ZMQ], [0], [Define to 1 to enable ZMQ functions])
1493+
AC_MSG_WARN([libzmq version 4.x or greater not found, disabling])
1494+
use_zmq=no])
1495+
else
1496+
AC_DEFINE_UNQUOTED([ENABLE_ZMQ], [0], [Define to 1 to enable ZMQ functions])
1497+
fi
1498+
1499+
if test "x$use_zmq" = xyes; then
1500+
dnl Assume libzmq was built for static linking
1501+
case $host in
1502+
*mingw*)
1503+
ZMQ_CFLAGS="$ZMQ_CFLAGS -DZMQ_STATIC"
1504+
;;
1505+
esac
15161506
fi
15171507

15181508
dnl check if libgmp is present

depends/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ BASE_CACHE ?= $(BASEDIR)/built
3434
SDK_PATH ?= $(BASEDIR)/SDKs
3535
NO_QT ?=
3636
NO_QR ?=
37+
NO_BDB ?=
38+
NO_SQLITE ?=
3739
NO_WALLET ?=
3840
NO_ZMQ ?=
3941
NO_UPNP ?=
@@ -216,10 +218,13 @@ $(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_
216218
-e 's|@CXXFLAGS@|$(strip $(host_CXXFLAGS) $(host_$(release_type)_CXXFLAGS))|' \
217219
-e 's|@CPPFLAGS@|$(strip $(host_CPPFLAGS) $(host_$(release_type)_CPPFLAGS))|' \
218220
-e 's|@LDFLAGS@|$(strip $(host_LDFLAGS) $(host_$(release_type)_LDFLAGS))|' \
221+
-e 's|@allow_host_packages@|$(ALLOW_HOST_PACKAGES)|' \
219222
-e 's|@no_qt@|$(NO_QT)|' \
220223
-e 's|@no_qr@|$(NO_QR)|' \
221224
-e 's|@no_zmq@|$(NO_ZMQ)|' \
222225
-e 's|@no_wallet@|$(NO_WALLET)|' \
226+
-e 's|@no_bdb@|$(NO_BDB)|' \
227+
-e 's|@no_sqlite@|$(NO_SQLITE)|' \
223228
-e 's|@no_upnp@|$(NO_UPNP)|' \
224229
-e 's|@no_natpmp@|$(NO_NATPMP)|' \
225230
-e 's|@debug@|$(DEBUG)|' \

0 commit comments

Comments
 (0)