--- configure.orig	2014-05-06 04:15:52.000000000 +0200
+++ configure	2014-07-23 11:21:47.616743649 +0200
@@ -5399,7 +5399,7 @@
 ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_fc_compiler_gnu
 if test -n "$ac_tool_prefix"; then
-  for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn nagfor xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
+  for ac_prog in gfortran g95 xlf95 f95 fort ifort mpif77 mpif90 ifc efc pgfortran pgf95 lf95 ftn nagfor xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
@@ -5443,7 +5443,7 @@
 fi
 if test -z "$FC"; then
   ac_ct_FC=$FC
-  for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn nagfor xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
+  for ac_prog in gfortran g95 xlf95 f95 fort ifort mpif77 mpif90 ifc efc pgfortran pgf95 lf95 ftn nagfor xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -5672,7 +5672,7 @@
 ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_fc_compiler_gnu
 if test -n "$ac_tool_prefix"; then
-  for ac_prog in f90 pgf90 slf90 f95 g95 xlf95 efc ifort ftn
+  for ac_prog in f90 pgf90 slf90 f95 g95 xlf95 efc ifort mpif77 mpif90 ftn
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
@@ -5716,7 +5716,7 @@
 fi
 if test -z "$FC"; then
   ac_ct_FC=$FC
-  for ac_prog in f90 pgf90 slf90 f95 g95 xlf95 efc ifort ftn
+  for ac_prog in f90 pgf90 slf90 f95 g95 xlf95 efc ifort mpif77 mpif90 ftn
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -7908,7 +7908,7 @@
   mpicc)
     ## The mpich compiler. Use mpiexec from the same directory if it
     ## exists.
-    PARALLEL=mpicc
+    PARALLEL="$CC_BASENAME"
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mpiexec" >&5
 $as_echo_n "checking for mpiexec... " >&6; }
 
@@ -7970,7 +7970,7 @@
     *mpif90*)
       ## The Fortran mpich compiler. Use mpiexec from the same directory
       ## if it exists.
-      PARALLEL=mpif90
+      PARALLEL="$FC"
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mpiexec" >&5
 $as_echo_n "checking for mpiexec... " >&6; }
 
@@ -12704,7 +12704,7 @@
         ;;
       # icc used to be incompatible with GCC.
       # ICC 10 doesn't accept -KPIC any more.
-      icc* | ifort*)
+      icc* | mpicc*| ifort* | mpif77* | mpif90*)
 	lt_prog_compiler_wl='-Wl,'
 	lt_prog_compiler_pic='-fPIC'
 	lt_prog_compiler_static='-static'
@@ -13340,11 +13340,11 @@
 					# Portland Group f77 and f90 compilers
 	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag -Mnomain' ;;
-	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
+	ecc*,ia64* | icc*,ia64* | mpicc*,ia64*)	# Intel C compiler on ia64
 	  tmp_addflag=' -i_dynamic' ;;
-	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	efc*,ia64* | ifort*,ia64* | mpif77*,ia64* | mpif90*,ia64*)	# Intel Fortran compiler on ia64
 	  tmp_addflag=' -i_dynamic -nofor_main' ;;
-	ifc* | ifort*)			# Intel Fortran compiler
+	ifc* | ifort* | mpif77* | mpif90*)			# Intel Fortran compiler
 	  tmp_addflag=' -nofor_main' ;;
 	lf95*)				# Lahey Fortran 8.1
 	  whole_archive_flag_spec=
@@ -13826,7 +13826,7 @@
   link_all_deplibs=yes
   allow_undefined_flag="$_lt_dar_allow_undefined"
   case $cc_basename in
-     ifort*) _lt_dar_can_shared=yes ;;
+     ifort* | mpif77* | mpif90*) _lt_dar_can_shared=yes ;;
      *) _lt_dar_can_shared=$GCC ;;
   esac
   if test "$_lt_dar_can_shared" = "yes"; then
@@ -16824,7 +16824,7 @@
   link_all_deplibs_CXX=yes
   allow_undefined_flag_CXX="$_lt_dar_allow_undefined"
   case $cc_basename in
-     ifort*) _lt_dar_can_shared=yes ;;
+     ifort* | mpif77* | mpif90*) _lt_dar_can_shared=yes ;;
      *) _lt_dar_can_shared=$GCC ;;
   esac
   if test "$_lt_dar_can_shared" = "yes"; then
@@ -19735,7 +19735,7 @@
         ;;
       # icc used to be incompatible with GCC.
       # ICC 10 doesn't accept -KPIC any more.
-      icc* | ifort*)
+      icc* | mpicc* | ifort* | mpif77* | mpif90*)
 	lt_prog_compiler_wl_FC='-Wl,'
 	lt_prog_compiler_pic_FC='-fPIC'
 	lt_prog_compiler_static_FC='-static'
@@ -20356,11 +20356,11 @@
 					# Portland Group f77 and f90 compilers
 	  whole_archive_flag_spec_FC='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag -Mnomain' ;;
-	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
+	ecc*,ia64* | icc*,ia64* | mpicc*,ia64*)	# Intel C compiler on ia64
 	  tmp_addflag=' -i_dynamic' ;;
-	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	efc*,ia64* | ifort*,ia64* | mpif77*,ia64* | mpif90*,ia64*)	# Intel Fortran compiler on ia64
 	  tmp_addflag=' -i_dynamic -nofor_main' ;;
-	ifc* | ifort*)			# Intel Fortran compiler
+	ifc* | ifort* | mpif77* | mpif90*)			# Intel Fortran compiler
 	  tmp_addflag=' -nofor_main' ;;
 	lf95*)				# Lahey Fortran 8.1
 	  whole_archive_flag_spec_FC=
@@ -20814,7 +20814,7 @@
   link_all_deplibs_FC=yes
   allow_undefined_flag_FC="$_lt_dar_allow_undefined"
   case $cc_basename in
-     ifort*) _lt_dar_can_shared=yes ;;
+     ifort* | mpif77* | mpif90*) _lt_dar_can_shared=yes ;;
      *) _lt_dar_can_shared=$GCC ;;
   esac
   if test "$_lt_dar_can_shared" = "yes"; then
