diff -Naurp ExtUtils-F77-1.15.old/F77.pm ExtUtils-F77-1.15/F77.pm
--- ExtUtils-F77-1.15.old/F77.pm	2005-02-03 10:12:49.000000000 -0500
+++ ExtUtils-F77-1.15/F77.pm	2007-04-16 12:28:35.000000000 -0400
@@ -169,31 +169,32 @@ $F77config{Solaris}{DEFAULT} = 'F77';
 
 ### Generic GNU-77 or F2C system ###
 
+$F77config{Generic}{G77}{Compiler} = find_in_path('g77','f77','fort77','gfortran');
 $F77config{Generic}{G77}{Link} = sub {
-    my @libs = ('g2c', 'f2c');
+foreach my $ext qw(so a) {
+    my @libs = ('gfortran', 'g2c', 'f2c');
     my ($dir, $lib, $test);
     foreach $test (@libs) {
-      $dir = `g77 -print-file-name=lib$test.a`;
+      $dir = `$F77config{Generic}{G77}{Compiler} -print-file-name=lib$test.$ext`;
       chomp $dir;
       # Note that -print-file-name returns just the library name
       # if it cant be found - make sure that we only accept the
       # directory if it returns a proper path (or matches a /)
-      if (defined $dir && $dir ne "lib$test.a") {
+      if (defined $dir && $dir ne "lib$test.$ext") {
         $lib = $test; # Found an existing library
         last; 
       }
     }
 
     if( defined $dir  && defined $lib) {
-        $dir =~ s,/lib$lib.a$,,;
+        $dir =~ s,/lib$lib.$ext$,,;
     } else {
         $dir = "/usr/local/lib";
         $lib = "f2c";
     }    
     return( "-L$dir -L/usr/lib -l$lib -lm" );
-};
+}};
 $F77config{Generic}{G77}{Trail_} = 1;
-$F77config{Generic}{G77}{Compiler} = find_in_path('g77','f77','fort77');
 $F77config{Generic}{G77}{Cflags} = '-O';
 $F77config{Generic}{DEFAULT} = 'G77';
 $F77config{Generic}{F2c}     = $F77config{Generic}{G77};
@@ -219,6 +220,7 @@ $F77config{Cygwin}{DEFAULT}	= 'G77';
 $F77config{Linux}{G77}     = $F77config{Generic}{G77};
 $F77config{Linux}{F2c}     = $F77config{Generic}{G77};
 $F77config{Linux}{DEFAULT} = 'G77';
+$F77config{Linux}{G77}{Cflags} = $Config{optimize};
 
 ### DEC OSF/1 ###