[cxx] Set CXXLD and CCLD in configure (#12625)
commit1ec822976b92527fb57ef6d3ba6ccda2609d7db1
authorAleksey Kliger (λgeek) <akliger@gmail.com>
Mon, 28 Jan 2019 21:22:00 +0000 (28 16:22 -0500)
committerMartin Baulig <mabaul@microsoft.com>
Mon, 28 Jan 2019 21:22:00 +0000 (28 16:22 -0500)
treeb3215abee9385a8c06a16ccffbabb4d40c83e1f0
parentb4534a0cd2f003504578af38f2aa44e4d72a67d6
[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
configure.ac
mono/mini/Makefile.am.in
mono/mini/llvm-jit.cpp
mono/utils/mono-dl.c
mono/utils/mono-dl.h