Re: How to force libtool to use CXX mode?
Bob Friesenhahn <[email protected]> Tue, 14 May 2024 16:02:06 -0500
| Newsgroups | gmane.comp.gnu.libtool.general |
|---|---|
| Message-ID | <[email protected]> |
On 5/13/24 20:52, Bruno Haible wrote: > 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. The GraphicsMagick Makefile.in file has 107 such link statements for libraries/modules and 112 foo_LINK variables overall. Unfortunately, Automake is not consistent and there is a entirely different link request used for optionally built programs such as for tests. Indeed I am most recently proceeding down this path. Since it is not allowed to wrap a target replacement in an Automake condition, I am finding it necessary to write new rules which use variables that I define. The goal is to support linking as C or C++. Not all of the libraries, modules, or programs need to be linkable with C++ but this seems like quite a lot of messy work and quite a lot of divergence from the original Automake Makefile. Bob -- Bob Friesenhahn [email protected], http://www.simplesystems.org/users/bfriesen/ GraphicsMagick Maintainer, http://www.GraphicsMagick.org/ Public Key, http://www.simplesystems.org/users/bfriesen/public-key.txt