There's no "good" place for this. The description in Makefile.def that libitm
uses c++ is only used insofar as the dependencies for libitm -- it's built
after libstdc++ as the language support library. If we put this into the
toplevel configure.ac directly, we have to write a bunch of shell code which
seems less than helpful.
Putting into gcc/cp/config-lang.in is a layering violation, it's true. But
until there's another instance that needs handling, it seems premature to build
infrastructure to handle this. And it's only one line after all...
Tested on x86_64-linux and committed.
r~
PR bootstrap/51072
* config-lang.in (target_libs): Include target-libitm.
diff --git a/gcc/cp/config-lang.in b/gcc/cp/config-lang.in
index 3ed3d8e..6f9b4c9 100644
--- a/gcc/cp/config-lang.in
+++ b/gcc/cp/config-lang.in
@@ -28,6 +28,9 @@ language="c++"
compilers="cc1plus\$(exeext)"
-target_libs="target-libstdc++-v3"
+# ??? libitm is not a language support library like libstdc++, but it does
+# use c++, and this is the easiest way to have it be disabled if we don't
+# include c++ in the set of enabled languages.
+target_libs="target-libstdc++-v3 target-libitm"
gtfiles="\$(srcdir)/cp/rtti.c \$(srcdir)/cp/mangle.c
\$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-tree.h
\$(srcdir)/cp/decl.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c
\$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c
\$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/parser.h
\$(srcdir)/cp/parser.c \$(srcdir)/cp/method.c \$(srcdir)/cp/typeck2.c
\$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h
\$(srcdir)/c-family/c-objc.h \$(srcdir)/c-family/c-lex.c
\$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c
\$(srcdir)/cp/class.c \$(srcdir)/cp/cp-objcp-common.c \$(srcdir)/cp/cp-lang.c
\$(srcdir)/cp/except.c"