diff --git a/configure.ac b/configure.ac
index 225796677a706183087283af4463474508a6b979..d54d3dc7efe01f4bcd67502c07e3a44a3b06a3a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,6 +60,7 @@ AC_ARG_ENABLE([mpi],
 good_mpi="yes"
 if test "$enable_mpi" = "yes"; then
     AX_MPI([CC="$MPICC" AC_DEFINE(HAVE_MPI, 1, [Define if you have the MPI library.]) ])
+    MPI_LIBRARY="Unknown MPI"
 
     # Various MPI implementations require additional libraries when also using
     # threads. Use mpirun (on PATH) as that seems to be only command with
@@ -83,14 +84,17 @@ if test "$enable_mpi" = "yes"; then
        case "$version" in
          *Intel*MPI*)
             MPI_THREAD_LIBS="-mt_mpi"
+            MPI_LIBRARY="Intel MPI"
             AC_MSG_RESULT([Intel MPI])
          ;;
          *Platform*)
             MPI_THREAD_LIBS="-lmtmpi"
+            MPI_LIBRARY="PLATFORM MPI"
             AC_MSG_RESULT([PLATFORM MPI])
          ;;
          *"Open MPI"*)
             MPI_THREAD_LIBS=""
+            MPI_LIBRARY="Open MPI"
             AC_MSG_RESULT([Open MPI])
             #  OpenMPI should be 1.8.6 or later, if not complain.
             #  Version is last word on first line of -version output.
@@ -109,6 +113,7 @@ if test "$enable_mpi" = "yes"; then
        esac
        AC_SUBST([MPI_THREAD_LIBS])
     fi
+    AC_DEFINE_UNQUOTED([SWIFT_MPI_LIBRARY], ["$MPI_LIBRARY"], [The MPI library name, if known.])
 fi
 AM_CONDITIONAL([HAVEMPI],[test $enable_mpi = "yes"])
 
diff --git a/src/version.c b/src/version.c
index c351b18f0639d554532649cb5c56b4b64ed6b047..7c60767e4d7025f783a4ec34d51b1fa371c40af3 100644
--- a/src/version.c
+++ b/src/version.c
@@ -140,21 +140,26 @@ const char *compiler_version(void) {
 const char *mpi_version(void) {
   static char version[256] = {0};
 #ifdef WITH_MPI
-  int len, std_version, std_subversion;
-/* Check that the library implements the version string routine */
+  int std_version, std_subversion;
+
+  /* Check that the library implements the version string routine */
 #ifdef MPI_MAX_LIBRARY_VERSION_STRING
   static char lib_version[MPI_MAX_LIBRARY_VERSION_STRING] = {0};
+  int len;
   MPI_Get_library_version(lib_version, &len);
 
-  /* Find first \n and truncate string to this length, get many lines from 
+  /* Find first \n and truncate string to this length, can get many lines from
    * some MPIs (MPICH). */
   char *ptr = strchr(lib_version, '\n');
   if (ptr != NULL) *ptr = '\0';
 
 #else
+  /* Use autoconf guessed value. */
   static char lib_version[256] = {0};
-  sprintf(lib_version, "Unknown library");
+  sprintf(lib_version, SWIFT_MPI_LIBRARY);
 #endif
+
+  /* Numeric version. */
   MPI_Get_version(&std_version, &std_subversion);
   snprintf(version, 256, "%s (implementing MPI standard v %i.%i)", lib_version,
            std_version, std_subversion);