From 5ceaae04f73c551fea9dc70351df363efd3d48f6 Mon Sep 17 00:00:00 2001
From: Giovanni Bussi <giovanni.bussi@gmail.com>
Date: Mon, 6 Jul 2015 23:40:01 +0200
Subject: [PATCH] Fixed warning in autoconf

When MPI was requested and not found configure was erroneously
reporting that PLUMED was compiled with MPI support
---
 configure    | 4 +++-
 configure.ac | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 9b82b903f..4cbcd21be 100755
--- a/configure
+++ b/configure
@@ -5489,7 +5489,6 @@ fi
 mpi_found=ko
 # optional libraries follow
 if test $mpi == true ; then
-  mpi_found=ok
 
     found=ko
     ac_fn_cxx_check_header_mongrel "$LINENO" "mpi.h" "ac_cv_header_mpi_h" "$ac_includes_default"
@@ -5512,6 +5511,9 @@ fi
 $as_echo "$as_me: WARNING: cannot enable __PLUMED_MPI" >&2;}
     fi
 
+  if test "x$ac_cv_func_MPI_Init" = xyes; then
+    mpi_found=ok
+  fi
 else
   mpi_found=ko
 fi
diff --git a/configure.ac b/configure.ac
index 54c6beb61..62a4a15cd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -301,8 +301,10 @@ AC_CHECK_LIB([dl],dlopen, [STATIC_LIBS="-ldl $STATIC_LIBS"] [LIBS="-ldl $LIBS"])
 mpi_found=ko
 # optional libraries follow
 if test $mpi == true ; then
-  mpi_found=ok
   PLUMED_CHECK_PACKAGE([mpi.h],[MPI_Init],[__PLUMED_MPI])
+  if test "x$ac_cv_func_MPI_Init" = xyes; then
+    mpi_found=ok
+  fi
 else 
   mpi_found=ko
 fi
-- 
GitLab