[WIP] Improve compiler logic in configure.

The highlights of this pull request are:

- `--with-cc` has been killed in favour of setting the CXX environment variable (this follows the UNIX way&trade;).
- `./configure` will now automatically try to detect a compiler instead of just assuming GCC (or Clang on OS X).
- Compiler version detection now works properly on Clang and ICC as well as GCC.

In order to avoid merge conflicts I have held back some changes until #577 is merged.