Fix build on BG/Q.

Need to check for types before polluting CMAKE_REQUIRED_LIBRARIES with MPI which causes the tests to fail always