Remove unused function checks
Avoid fetching the g++ version again
Prefer lapack and blas headers from atlas subdirectory

This makes sure the correct cblas.h and clapack.h headers are chosen on
Debian and Ubuntu.
Fix order of have_library calls