[cxx] Set CXXLD and CCLD in configure (#12625)
* [cxx] Set CCLD and CXXLD for final linking
Essentialy bypass automake's automatic linker selection based on _SOURCES file
extensions.
The issue:
1. Right now we need to use the C linker unless we're linking with LLVM which
needs C++.
2. Later when we start using C++ in Mono we will still want the C linker,
because we will use a subset of C++ that doesn't depend on the C++ runtime
library (because we don't want to break embedders that don't expect us to
use C++).
So in either case which linker we use is a decision that we want to make
independent of what the file extensions look like.
So we set MONO_CXXLD in configure. If LLVM is enabled, we use $CXX, otherwise
$CC.
Then in mono/mini/Makefile.am.in we set CCLD and CXXLD to MONO_CXXLD. So
whatever automake decides we're going to use the linker that we want.
This partly reverts
988f4a2147669f57ece07df7607ca9f2f60f57a9 which tried
another approach (which turned out not to work).
This should also address https://github.com/mono/mono/issues/12060
Closes https://github.com/mono/mono/issues/12435
* [cxx] Fix link errors if both --enable-llvm and --enable-cxx are on