c++gnuautotoolsautoconf

Checking for a C++ compiler's presence


The GNU documentation for AC_PROG_CXX states that:

Otherwise, if the macro is invoked without an argument, then search for a C++ compiler under the likely names (first g++ and c++ then other names). If none of those checks succeed, then as a last resort set CXX to g++.

which implies that whether or not a working C++ compiler is found, the CXX variable will be set to something. As a result, it is impossible to use CXX to know whether a C++ compiler is available.

How can I check that a C++ compiler is available at ./configure time?


Solution

  • You can add an extra AC_CHECK_PROG check, to make sure the compiler is found.