|
|
@@ -260,6 +260,30 @@ mono_sgen_LDADD = \
|
|
|
|
|
|
mono_sgen_LDFLAGS = $(static_flags) $(monobinldflags) $(monobin_platform_ldflags)
|
|
|
|
|
|
+
|
|
|
+if STATIC_MONO
|
|
|
+# Force the C++ linker if we linked mono against libmono.a and if we know that
|
|
|
+# libmono.a has C++ code in it.
|
|
|
+#
|
|
|
+# The conditional logic here has to match exactly what we do for deciding
|
|
|
+# whether to add libmini-cxx.la into libmini.la. If we do, then force the use
|
|
|
+# of the C++ linker here.
|
|
|
+#
|
|
|
+# Have to use the nodist_EXTRA_..._SOURCES hack because if we set
|
|
|
+# ..._LINK=$(CXXLINK) directly, it will not use the ..._LDFLAGS and other
|
|
|
+# linker flags and so we would end up with linker errors because we wouldn't pick up
|
|
|
+# monobin_platform_ldflags, for example.
|
|
|
+if ENABLE_LLVM
|
|
|
+nodist_EXTRA_mono_boehm_SOURCES = dummy.cpp
|
|
|
+nodist_EXTRA_mono_sgen_SOURCES = dummy.cpp
|
|
|
+else
|
|
|
+if ENABLE_LLVM_RUNTIME
|
|
|
+nodist_EXTRA_mono_boehm_SOURCES = dummy.cpp
|
|
|
+nodist_EXTRA_mono_sgen_SOURCES = dummy.cpp
|
|
|
+endif
|
|
|
+endif
|
|
|
+endif
|
|
|
+
|
|
|
if BITCODE
|
|
|
libmonoldflags += -no-undefined
|
|
|
endif
|
|
|
@@ -290,10 +314,12 @@ if SUPPORT_BOEHM
|
|
|
monow_LDADD = $(mono_boehm_LDADD)
|
|
|
monow_LDFLAGS = $(mono_boehm_LDFLAGS) -mwindows
|
|
|
monow_SOURCES = $(mono_boehm_SOURCES)
|
|
|
+nodist_EXTRA_monow_SOURCES = $(nodist_EXTRA_mono_boehm_SOURCES)
|
|
|
else
|
|
|
monow_LDADD = $(mono_sgen_LDADD)
|
|
|
monow_LDFLAGS = $(mono_sgen_LDFLAGS) -mwindows
|
|
|
monow_SOURCES = $(mono_sgen_SOURCES)
|
|
|
+nodist_EXTRA_monow_SOURCES = $(nodist_EXTRA_mono_sgen_SOURCES)
|
|
|
endif
|
|
|
endif
|
|
|
|
|
|
@@ -386,10 +412,12 @@ if ENABLE_LLVM
|
|
|
if LOADED_LLVM
|
|
|
llvm_sources = \
|
|
|
mini-llvm-loaded.c
|
|
|
+llvm_cxx_sources =
|
|
|
else
|
|
|
llvm_sources = \
|
|
|
mini-llvm.c \
|
|
|
- mini-llvm-loaded.c \
|
|
|
+ mini-llvm-loaded.c
|
|
|
+llvm_cxx_sources = \
|
|
|
mini-llvm-cpp.cpp \
|
|
|
llvm-jit.cpp
|
|
|
endif
|
|
|
@@ -704,8 +732,28 @@ endif
|
|
|
# This library is shared between mono and mono-sgen, since the code in mini/ doesn't contain
|
|
|
# compile time dependencies on boehm/sgen.
|
|
|
#
|
|
|
-libmini_la_SOURCES = $(common_sources) $(llvm_sources) $(llvm_runtime_sources) $(arch_sources) $(os_sources)
|
|
|
+libmini_la_SOURCES = $(common_sources) $(llvm_sources) $(arch_sources) $(os_sources)
|
|
|
libmini_la_CFLAGS = $(AM_CFLAGS) @CXX_ADD_CFLAGS@
|
|
|
+if ENABLE_LLVM
|
|
|
+libmini_la_LIBADD = libmini-cxx.la
|
|
|
+noinst_LTLIBRARIES += libmini-cxx.la
|
|
|
+else
|
|
|
+if ENABLE_LLVM_RUNTIME
|
|
|
+libmini_la_LIBADD = libmini-cxx.la
|
|
|
+noinst_LTLIBRARIES += libmini-cxx.la
|
|
|
+endif
|
|
|
+endif
|
|
|
+
|
|
|
+# Split out the C++ sources so that if they're not used, libmini will be linked
|
|
|
+# with the C linker. The issue is that the automatic linker selection (See
|
|
|
+# https://www.gnu.org/software/automake/manual/html_node/How-the-Linker-is-Chosen.html)
|
|
|
+# looks at all the _SOURCES for a target, even those that are only
|
|
|
+# conditionally added, even if the condition is false. So because we sometimes
|
|
|
+# build mini-llvm-cpp.cpp we always get the c++ linker. But that's not what we
|
|
|
+# want.
|
|
|
+libmini_cxx_la_SOURCES = $(llvm_cxx_sources) $(llvm_runtime_sources)
|
|
|
+libmini_cxx_la_CFLAGS = $(AM_CFLAGS) @CXX_ADD_CFLAGS@
|
|
|
+
|
|
|
|
|
|
libmonoboehm_2_0_la_SOURCES =
|
|
|
libmonoboehm_2_0_la_CFLAGS = $(mono_boehm_CFLAGS) @CXX_ADD_CFLAGS@
|