diff --git a/configure.ac b/configure.ac index 443456b9fc..b7acba55ab 100644 --- a/configure.ac +++ b/configure.ac @@ -1210,11 +1210,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 @@ -1222,7 +1220,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 dnl Check for libsecp256k1, only if explicitly requested