https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107691
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- have_valgrind_h is never set anywhere. Adding before that code in configure.ac: dnl # This check AC_REQUIREs various stuff, so it *must not* be inside dnl # an if statement. This was the source of very frustrating bugs dnl # in converting to autoconf 2.5x! AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no) Should fix the issue I think.