From b228803dcff6a945c2e202812eab0b1a70609752 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 3 Oct 2023 04:07:07 +0000 Subject: [PATCH] Bugfix: configure: Correct check for fuzz binary needing a main function --- configure.ac | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 4f71515873..2f3c094c7b 100644 --- a/configure.ac +++ b/configure.ac @@ -1276,11 +1276,9 @@ 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], + TEMP_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $SANITIZER_LDFLAGS" + AC_LINK_IFELSE( [AC_LANG_PROGRAM([[ #include #include @@ -1288,7 +1286,11 @@ if test "$enable_fuzz_binary" = "yes"; then /* comment to remove the main function ... ]],[[ */ int not_main() { - ]])]) + ]])], + [AC_MSG_RESULT([no])], + [AC_MSG_RESULT([yes]); CORE_CPPFLAGS="$CORE_CPPFLAGS -DPROVIDE_FUZZ_MAIN_FUNCTION"] + ) + LDFLAGS="$TEMP_LDFLAGS" fi if test "$enable_wallet" != "no"; then