How to force libtool to use CXX mode?
Bob Friesenhahn <[email protected]> Sun, 12 May 2024 16:01:12 -0500
| Newsgroups | gmane.comp.sysutils.automake.general,gmane.comp.gnu.libtool.general |
|---|---|
| Message-ID | <[email protected]> |
I have expended quite a few days already (over a 6 month span) with attempting to convince Automake to force libtool to link using the C++ compiler. I tried optionally adding an empty C++ source file to the target build but this does not work because then Automake always assumes C++ linkage, even if no C++ source files were included. I previously encountered a libtool-related bug where it determines that the C compiler needs -lm, but the C++ compiler does not, stripping the -lm and resulting in a failed link. Today I read this Automake manual page: https://www.gnu.org/software/automake/manual/html_node/Libtool-Flags.html and so I used the program_LIBTOOLFLAGS or library_LIBTOOLFLAGS to add --tag=CXX to the options. I thought that this must be working. I found that it is not working as desired. I end up with this bad case for compiling C code (did not want to have the --tag=CXX!) /bin/bash ./libtool --tag=CC --tag=CXX --mode=compile clang ... and this command to link the C code using the C++ compiler (should be clang++!) /bin/bash ./libtool --tag=CC --tag=CXX --mode=link clang Libtool misreports the tag it is using so it reports CCLD when the tag is presumably overridden by CXX. The end result fails. Is there a way to solve this problem beyond replicating many modified Makefile.in hunks into Makefile.am? I am faced with backing out my attempt for yet another time. :-( 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