diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 4bd7efa6ecd66899b85b82f847291fefa9692224..a20b4976aad3ac5aaf68da506066ed51e4547b65 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,8 @@
+2010-01-20  Paolo Bonzini  <bonzini@gnu.org>
+
+	* configure.ac: Test for executability of GFORTRAN.
+	* configure: Regenerate.
+
 2010-01-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
 	* configure: Regenerate.
diff --git a/libgomp/configure b/libgomp/configure
index 02e2861fb5d0408fb83c548dc50c91b609432a37..23625003a2333b8b8a0b53b0200e8d6a8abea636 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -11459,7 +11459,11 @@ case `echo $GFORTRAN` in
   -* | no* )
     FC=no ;;
   *)
-    FC="$GFORTRAN" ;;
+    if test -x "$GFORTRAN"; then
+      FC="$GFORTRAN"
+    else
+      FC=no
+    fi ;;
 esac
 ac_ext=${ac_fc_srcext-f}
 ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index 792c9f5206875160d18b04775b1f13336d4f4c61..96c958af6e75ee44bc19994bb7319e21d974f1d0 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -146,7 +146,11 @@ case `echo $GFORTRAN` in
   -* | no* )
     FC=no ;;
   *)
-    FC="$GFORTRAN" ;;
+    if test -x "$GFORTRAN"; then
+      FC="$GFORTRAN"
+    else
+      FC=no
+    fi ;;
 esac
 AC_PROG_FC(gfortran)
 FCFLAGS="$FCFLAGS -Wall"