The AC_PROG_CXX macro checks for possible C++ compilers and in the event of failure, happily just sets CXX to g++ even if it knows g++ doesn't really exist.
My question is, how can you understand if AC_PROG_CXX did actually find a proper compiler?
I am asking because I have a C++ library in my project that could be optionally compiled. I can't seem to figure out how on earth I'm supposed to know whether I can actually compile anything with CXX.
Some of the macros like AC_PROG_CC_C99 give a variable (in this case ac_cv_prog_cc_c99) that can tell me if the feature exists or not. I tried ac_cv_prog_cxx and similar things, but it doesn't seem to exist.
You could try compiling a minimal program, e.g.,
If the compilation fails, we explicitly set
CXXto an empty string. So depending on what you want to do:Or as part of a conditional build in a
Makefile.amfile: