c++cautotools

Autotools: Switching part of project to a different compiler


I'm working on a big, old, project that is using autotools. I would like to switch one part of the project to C++ (from C).

How can I switch the compiler used for a part of the project? I don't like the idea of completely splitting the project into two parts. The directory has only Makefile.am and I suppose I should register this somehow in configure.ac.


Solution

  • You must define output variable CXX in configure.ac (the simplest way is by using AC_PROG_CXX macro), then all files with appropriate suffixes (.cc, .cpp) will be compiled by C++ compiler.