Re: How to force libtool to use CXX mode?

Bruno Haible <[email protected]> Tue, 14 May 2024 03:52:29 +0200
Newsgroups gmane.comp.gnu.libtool.general
Message-ID <1853071.QCnGb9OGeP@nimes>
Bob Friesenhahn wrote:
> Automake does have a critical bug in that for a target which only optionally has C++ sources, that target is always linked using C++. Without this issue, the trick of including an empty optional C++ source file in the build would work. But I do not want GraphicsMagick to require a C++ compiler.

For a target 'foo', Automake uses a foo_LINK variable, for which it provides a
default definition. Since you are not satisfied with this default definition,
you can and should provide your own definition of this variable. You can then
decide yourself whether it uses
  --tag=CC  or  --tag=CXX
and
  $(CCLD) $(AM_CFLAGS) $(CFLAGS)  or  $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS).

See e.g. in gettext/gettext-tools/src/Makefile.am the 'msgmerge' target and
the msgmerge_LINK variable. This definition has been in use for ca. 20 years.

Bruno