Next: Objective C Compiler, Previous: C Compiler, Up: Compilers and Preprocessors
Determine a C++ compiler to use. Check whether the environment variable
CXX
orCCC
(in that order) is set; if so, then set output variableCXX
to its value.Otherwise, if the macro is invoked without an argument, then search for a C++ compiler under the likely names (first
g++
andc++
then other names). If none of those checks succeed, then as a last resort setCXX
tog++
.This macro may, however, be invoked with an optional first argument which, if specified, must be a blank-separated list of C++ compilers to search for. This just gives the user an opportunity to specify an alternative search list for the C++ compiler. For example, if you didn't like the default order, then you could invoke
AC_PROG_CXX
like this:AC_PROG_CXX([gcc cl KCC CC cxx cc++ xlC aCC c++ g++])If using the GNU C++ compiler, set shell variable
GXX
to ‘yes’. If output variableCXXFLAGS
was not already set, set it to -g -O2 for the GNU C++ compiler (-O2 on systems where G++ does not accept -g), or -g for other compilers.
Set output variable
CXXCPP
to a command that runs the C++ preprocessor. If ‘$CXX -E’ doesn't work, /lib/cpp is used. It is portable to runCXXCPP
only on files with a .c, .C, .cc, or .cpp extension.Some preprocessors don't indicate missing include files by the error status. For such preprocessors an internal variable is set that causes other macros to check the standard error from the preprocessor and consider the test failed if any warnings have been reported. However, it is not known whether such broken preprocessors exist for C++.