The 'dumpversion' option of gcc and g++ show just the version number, which is useful. The same is not true of gfortran, which shows a lot of other information, making getting the version more difficult
drkir...@smudge:[~] $ g++ -dumpversion 4.4.1 drkir...@smudge:[~] $ gcc -dumpversion 4.4.1 drkir...@smudge:[~] $ gfortran -dumpversion GNU Fortran (GCC) 4.4.1 Copyright (C) 2009 Free Software Foundation, Inc. GNU Fortran comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of GNU Fortran under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING -- Summary: gfortran -dumpversion does not behave like gcc or g++ Product: gcc Version: 4.4.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: david dot kirkby at onetel dot net GCC build triplet: Solaris 10 update 7 on Sun Ultra 80 GCC host triplet: Solaris 10 update 7 on Sun Ultra 80 GCC target triplet: Solairs 10 update 7 on Sun Ultra 80 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41080