aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2022-04-11 13:58:05 +0100
committerfanquake <fanquake@gmail.com>2022-04-11 14:29:07 +0100
commit7626e547b854c5ef9e25c4e0b3bfb4d1b6319cb0 (patch)
treec0559d50d93d466bfedee75671ff60d66098b647 /configure.ac
parent22e3b6f4d5d2db7dfaa1f6b3d6bc666f294ac900 (diff)
parentc9c4e6cadda85783a005af773a683d44a208bf67 (diff)
Merge bitcoin/bitcoin#24337: build: Do not define `PROVIDE_FUZZ_MAIN_FUNCTION` macro unconditionally
c9c4e6cadda85783a005af773a683d44a208bf67 build: Do not define `PROVIDE_FUZZ_MAIN_FUNCTION` macro unconditionally (Hennadii Stepanov) Pull request description: No need to define the `PROVIDE_FUZZ_MAIN_FUNCTION` macro when the build system has been configured with the `--disable-fuzz-binary` option. See https://github.com/bitcoin/bitcoin/pull/24336#pullrequestreview-881368272. ACKs for top commit: MarcoFalke: Approach ACK c9c4e6cadda85783a005af773a683d44a208bf67 did not review or test 🐤 fanquake: ACK c9c4e6cadda85783a005af773a683d44a208bf67 Checked that `PROVIDE_FUZZ_MAIN_FUNCTION` isn't defined when configuring with `--disable-fuzz-binary`. Tree-SHA512: 54fbf02ba9f5ecc61b176b8ea7d05e308788d4de3f97ed40913e731300d9dc0edfdfcbf8e0a6e74cf1b2e2ae63f6208a34e03b9c8d203d070c457c4a7d9b5f2c
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac38
1 files changed, 18 insertions, 20 deletions
diff --git a/configure.ac b/configure.ac
index c6ece881ac..ee5f0e8d06 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1300,21 +1300,6 @@ if test "$enable_fuzz" = "yes"; then
enable_fuzz_binary=yes
AX_CHECK_PREPROC_FLAG([-DABORT_ON_FAILED_ASSUME], [DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DABORT_ON_FAILED_ASSUME"], [], [$CXXFLAG_WERROR])
-
- AC_MSG_CHECKING([whether main function is needed for fuzz binary])
- AX_CHECK_LINK_FLAG(
- [-fsanitize=$use_sanitizers],
- [AC_MSG_RESULT([no])],
- [AC_MSG_RESULT([yes]); CORE_CPPFLAGS="$CORE_CPPFLAGS -DPROVIDE_FUZZ_MAIN_FUNCTION"],
- [],
- [AC_LANG_PROGRAM([[
- #include <cstdint>
- #include <cstddef>
- extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { return 0; }
- /* comment to remove the main function ...
- ]],[[
- */ int not_main() {
- ]])])
else
BITCOIN_QT_INIT
@@ -1328,8 +1313,25 @@ else
QT_DBUS_INCLUDES=SUPPRESS_WARNINGS($QT_DBUS_INCLUDES)
QT_TEST_INCLUDES=SUPPRESS_WARNINGS($QT_TEST_INCLUDES)
fi
+fi
+
+if test "$enable_fuzz_binary" = "yes"; then
+ AC_MSG_CHECKING([whether main function is needed for fuzz binary])
+ AX_CHECK_LINK_FLAG(
+ [],
+ [AC_MSG_RESULT([no])],
+ [AC_MSG_RESULT([yes]); CORE_CPPFLAGS="$CORE_CPPFLAGS -DPROVIDE_FUZZ_MAIN_FUNCTION"],
+ [$SANITIZER_LDFLAGS],
+ [AC_LANG_PROGRAM([[
+ #include <cstdint>
+ #include <cstddef>
+ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { return 0; }
+ /* comment to remove the main function ...
+ ]],[[
+ */ int not_main() {
+ ]])])
- CORE_CPPFLAGS="$CORE_CPPFLAGS -DPROVIDE_FUZZ_MAIN_FUNCTION"
+ CHECK_RUNTIME_LIB
fi
if test "$enable_wallet" != "no"; then
@@ -1819,10 +1821,6 @@ if test "$build_bitcoin_wallet$build_bitcoin_cli$build_bitcoin_tx$build_bitcoin_
AC_MSG_ERROR([No targets! Please specify at least one of: --with-utils --with-libs --with-daemon --with-gui --enable-bench or --enable-tests])
fi
-if test "$enable_fuzz_binary" = "yes"; then
- CHECK_RUNTIME_LIB
-fi
-
AM_CONDITIONAL([TARGET_DARWIN], [test "$TARGET_OS" = "darwin"])
AM_CONDITIONAL([BUILD_DARWIN], [test "$BUILD_OS" = "darwin"])
AM_CONDITIONAL([TARGET_LINUX], [test "$TARGET_OS" = "linux"])