Use CXXFLAGS from environment

Fix a typo when checking for warning options to pass to the C++
compiler, and ensure that CXXFLAGS set in the environment are passed to
the compiler.