--- a/configure.in
+++ b/configure.in
@@ -1191,8 +1191,9 @@ AC_CHECK_FILE(/dev/zero)
 # Not all systems can mmap /dev/zero (such as HP-UX).  Check for that.
 if test "$ac_cv_func_mmap" = "yes" &&
    test "$ac_cv_file__dev_zero" = "yes"; then
-    AC_MSG_CHECKING(for mmap that can map /dev/zero)
-    AC_TRY_RUN([
+    AC_CACHE_CHECK([for mmap that can map /dev/zero],
+    [ac_cv_mmap__dev_zero],
+    [AC_TRY_RUN([
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -1215,9 +1216,7 @@ if test "$ac_cv_func_mmap" = "yes" &&
             return 3;
         }
         return 0;
-    }], [], [ac_cv_file__dev_zero=no], [ac_cv_file__dev_zero=no])
-
-    AC_MSG_RESULT($ac_cv_file__dev_zero)
+    }], [], [ac_cv_file__dev_zero=no], [ac_cv_file__dev_zero=no])])
 fi
 
 # Now we determine which one is our anonymous shmem preference.