--- configure.orig	2009-06-24 13:45:44.000000000 +0200
+++ configure	2010-10-31 22:17:08.000000000 +0100
@@ -27344,7 +27344,7 @@
 fi
 
 case `basename "$F77"` in
-gfortran)
+gfortran*)
 	F2C_LIBS="$F2C_LIBS -lgfortran"
 	;;
 *)
@@ -33508,7 +33508,7 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <$ac_header>
+#include <mpi.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -33548,7 +33548,7 @@
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <$ac_header>
+#include <mpi.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -33643,7 +33643,7 @@
 	elif test $ac_cv_header_mpicxx_h = yes ; then
 				have_mpi_cxx_header=yes
 		mpi_cxx_header="mpicxx.h"
-		try_mpi_LIBS="-lmpi -lmpi_cxx"
+		try_mpi_LIBS="-lmpich -lmpichcxx -lmpl -pthread"
 	fi
 
 	if test $ac_cv_header_mpi_h = yes -a $have_mpi_cxx_header = yes ; then
@@ -33655,7 +33655,6 @@
 ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
-		try_mpi_LIBS=
 		save_LIBS=$LIBS
  		cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -33664,7 +33663,7 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-#include <$mpi_cxx_header>
+#include <mpi.h>
 
 int
 main ()
@@ -33715,7 +33714,7 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-#include <mpi_cxx_header>
+#include <mpi.h>
 
 int
 main ()
