Check that the C++ compiler actually works.

AC_PROG_CXX still sets CXX, even if it doesn't
find a working C++ compiler:

http://osdir.com/ml/bug-autoconf-gnu/2010-05/msg00002.html

This causes the Boost checks to fail.

If AC_PROG_CXX finds a working compiler, it sets the GXX shell
variable. Test for this.

Fixes #1178