diff --git a/src/include/port.h b/src/include/port.h
index d9d61d0083d350950e529bd87ae2a8e392f4f143..9d742ace0f89ddeaaa878b6cfac80c7d9f26d48a 100644
--- a/src/include/port.h
+++ b/src/include/port.h
@@ -184,15 +184,6 @@ extern unsigned char pg_ascii_tolower(unsigned char ch);
 #ifdef printf
 #undef printf
 #endif
-/*
- * Versions of libintl >= 0.18? try to replace setlocale() with a macro
- * to their own versions.  Remove the macro, if it exists, because it
- * ends up calling the wrong version when the backend and libintl use
- * different versions of msvcrt.
- */
-#if defined(setlocale) && defined(WIN32)
-#undef setlocale
-#endif
 
 extern int	pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
 extern int
@@ -235,6 +226,16 @@ __attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2)));
 #endif
 #endif   /* USE_REPL_SNPRINTF */
 
+/*
+ * Versions of libintl >= 0.18? try to replace setlocale() with a macro
+ * to their own versions.  Remove the macro, if it exists, because it
+ * ends up calling the wrong version when the backend and libintl use
+ * different versions of msvcrt.
+ */
+#if defined(setlocale) && defined(WIN32)
+#undef setlocale
+#endif
+
 /* Portable prompt handling */
 extern char *simple_prompt(const char *prompt, int maxlen, bool echo);