diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
index c729a0ed5ecfde840458ae65f4877e85bebe1f82..dc3c031fd761c5ba07980ae133bfe0c4fb90c755 100644
--- a/lustre/autoconf/lustre-core.m4
+++ b/lustre/autoconf/lustre-core.m4
@@ -1431,40 +1431,50 @@ if test x$enable_liblustre_acl = xyes ; then
 fi
 
 #
-# check --with-mpi option
-#
-AC_ARG_WITH([mpi],
-            AC_HELP_STRING([--with-mpi=path],
-                           [set path to mpi install (default=/opt/mpich)]),
-            [
-             case $with_mpi in
-             [[\\/$]]* | ?:[[\\/]]* )
-                 ;;
-             *)
-                 AC_MSG_ERROR([expected absolute directory name for --with-mpi])
+# --enable-mpitest
+#
+AC_ARG_ENABLE(mpitests,
+	AC_HELP_STRING([--enable-mpitest=yes|no|mpich directory],
+                           [include mpi tests]),
+	[
+	 enable_mpitests=yes
+         case $enableval in
+         yes)
+		MPI_ROOT=/opt/mpich
+		LDFLAGS="$LDFLAGS -L$MPI_ROOT/ch-p4/lib -L$MPI_ROOT/ch-p4/lib64"
+		CFLAGS="$CFLAGS -I$MPI_ROOT/include"
+		;;
+         no)
+		enable_mpitests=no
+		;;
+	 [[\\/$]]* | ?:[[\\/]]* )
+		MPI_ROOT=$enableval
+		LDFLAGS="$LDFLAGS -L$with_mpi/lib"
+		CFLAGS="$CFLAGS -I$MPI_ROOT/include"
+                ;;
+         *)
+                 AC_MSG_ERROR([expected absolute directory name for --enable-mpitests or yes or no])
                  ;;
-             esac
-
-             MPI_ROOT=$with_mpi
-             LDFLAGS="$LDFLAGS -L$with_mpi/lib"
-             CFLAGS="$CFLAGS -I$with_mpi/include"
-            ],
-            [
-             MPI_ROOT=/opt/mpich
-             LDFLAGS="$LDFLAGS -L$MPI_ROOT/ch-p4/lib -L$MPI_ROOT/ch-p4/lib64"
-             CFLAGS="$CFLAGS -I$MPI_ROOT/include"
-            ])
+	 esac
+	],
+	[
+	MPI_ROOT=/opt/mpich
+        LDFLAGS="$LDFLAGS -L$MPI_ROOT/ch-p4/lib -L$MPI_ROOT/ch-p4/lib64"
+        CFLAGS="$CFLAGS -I$MPI_ROOT/include"
+	enable_mpitests=yes
+	]
+)
 AC_SUBST(MPI_ROOT)
 
-#
-# check mpi's includes and library
-#
-AC_MSG_CHECKING([whether to build mpitests])
-AC_CHECK_FILE([$MPI_ROOT/include/mpi.h],
-              [AC_CHECK_LIB([mpich],[MPI_Start],[enable_mpitests=yes],[enable_mpitests=no])],
-              [enable_mpitests=no])
+if test x$enable_mpitests != xno; then
+	AC_MSG_CHECKING([whether to mpitests can be built])
+        AC_CHECK_FILE([$MPI_ROOT/include/mpi.h],
+                      [AC_CHECK_LIB([mpich],[MPI_Start],[enable_mpitests=yes],[enable_mpitests=no])],
+                      [enable_mpitests=no])
+fi
 AC_MSG_RESULT([$enable_mpitests])
 
+
 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"