diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 9a6265b..274f90c 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -444,11 +444,18 @@ with_temp_install = \

 ifeq ($(enable_tap_tests),yes)

+ifdef PGXS
+define prove_installcheck
+rm -rf '$(CURDIR)'/tmp_check
+cd $(srcdir) && TESTDIR='$(CURDIR)' PATH="$(bindir):$$PATH" PGPORT='6$(DEF_PGPORT)' top_builddir='$(top_builddir)' PG_REGRESS='$(top_builddir)/src/test/regr
+endef
+else
 define prove_installcheck
 rm -rf '$(CURDIR)'/tmp_check
 $(MKDIR_P) '$(CURDIR)'/tmp_check
 cd $(srcdir) && TESTDIR='$(CURDIR)' PATH="$(bindir):$$PATH" PGPORT='6$(DEF_PGPORT)' top_builddir='$(CURDIR)/$(top_builddir)' PG_REGRESS='$(CURDIR)/$(top_bui
 endef
+endif

 define prove_check
 rm -rf '$(CURDIR)'/tmp_check