The macro AC_PROG_CXX doesn't really check whether the C++ compiler works (compare with AC_PROG_CC). This change adds a new local macro AC_PROG_CXX_WORKS that is really checking whether C++ compiler works. See #5177. If there is no C++ compiler installed, configure prints
checking whether the C++ compiler works... no configure: error: C++ compiler doesn't work.