diff --git a/src/include/port.h b/src/include/port.h
index 9f8465e78ad8a2096460ccb93b2e94acddc1c9f5..94a0e2fe2b44d10fe17ae6300958aee75b1302f6 100644
--- a/src/include/port.h
+++ b/src/include/port.h
@@ -390,6 +390,10 @@ extern int	getpeereid(int sock, uid_t *uid, gid_t *gid);
 extern int	isinf(double x);
 #endif
 
+#ifndef HAVE_MKDTEMP
+extern char *mkdtemp(char *path);
+#endif
+
 #ifndef HAVE_RINT
 extern double rint(double x);
 #endif
@@ -466,9 +470,6 @@ extern int	pg_check_dir(const char *dir);
 /* port/pgmkdirp.c */
 extern int	pg_mkdir_p(char *path, int omode);
 
-/* port/mkdtemp.c */
-extern char *mkdtemp(char *path);
-
 /* port/pqsignal.c */
 typedef void (*pqsigfunc) (int signo);
 extern pqsigfunc pqsignal(int signo, pqsigfunc func);