BUG: Bug fix for Issue #5315

Added new logic to the fortran compiler version check to handle cases where
gcc is built with "--with-pkgversion=*some_string*, where *some_string*
contains numbers that might be incorrectly interpreted as a gcc version.

This includes some additional tests. All tests run successfully on Linux
Python version 2.7.8 and 3.4.2.
Thank you for the suggestions. I'll incorporate them now and submit a new version.