https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100017
--- Comment #72 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Guess another option would be to do that RAW_CXX_FLAGS_FOR_TARGET="$RAW_CXX_FLAGS_FOR_TARGET -nostdinc++" in the toplevel configure.ac after all the GCC_TARGET_TOOL lines. While GCC_TARGET_TOOL does AC_SUBST on the second argument, so AC_SUBST(RAW_CXX_FLAGS_FOR_TARGET), in autoconf AC_SUBST just remembers that it should be substituted and does the substitutions late, so when the var is changed in between it will propagate to the Makefiles etc. --- configure.ac 2022-01-04 23:11:22.153595595 +0100 +++ configure.ac 2022-01-06 21:59:49.274985505 +0100 @@ -3669,6 +3669,8 @@ GCC_TARGET_TOOL(strip, STRIP_FOR_TARGET, GCC_TARGET_TOOL(windres, WINDRES_FOR_TARGET, WINDRES, [binutils/windres]) GCC_TARGET_TOOL(windmc, WINDMC_FOR_TARGET, WINDMC, [binutils/windmc]) +RAW_CXX_FOR_TARGET="$RAW_CXX_FOR_TARGET -nostdinc++" + AC_SUBST(FLAGS_FOR_TARGET) AC_SUBST(RAW_CXX_FOR_TARGET) completely untested...