diff --git a/configure b/configure
index 977b4d3df5..6789b09d03 100755
--- a/configure
+++ b/configure
@@ -19501,7 +19501,10 @@ else
 $as_echo "$as_me: WARNING: could not find perl" >&2;}
 fi
   fi
-  # Now make sure we know where prove is
+  # Now make sure we know where prove is.
+  # Prefer to find prove in the same directory as perl.
+  save_PATH="$PATH"
+  PATH="`dirname "$PERL"`:$PATH"
   if test -z "$PROVE"; then
   for ac_prog in prove
 do
@@ -19556,6 +19559,7 @@ $as_echo_n "checking for PROVE... " >&6; }
 $as_echo "$PROVE" >&6; }
 fi
 
+  PATH="$save_PATH"
   if test -z "$PROVE"; then
     as_fn_error $? "prove not found" "$LINENO" 5
   fi
diff --git a/configure.ac b/configure.ac
index 95e5169c4f..8a70ca16ef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2389,8 +2389,12 @@ if test "$enable_tap_tests" = yes; then
     AX_PROG_PERL_MODULES([IPC::Run=0.79 Test::More=0.98 Time::HiRes=1.52], ,
       [AC_MSG_ERROR([Additional Perl modules are required to run TAP tests])])
   fi
-  # Now make sure we know where prove is
+  # Now make sure we know where prove is.
+  # Prefer to find prove in the same directory as perl.
+  save_PATH="$PATH"
+  PATH="`dirname "$PERL"`:$PATH"
   PGAC_PATH_PROGS(PROVE, prove)
+  PATH="$save_PATH"
   if test -z "$PROVE"; then
     AC_MSG_ERROR([prove not found])
   fi
