From ce1646b8a6397a5fc4b965cd4eadc6d334215cce Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@gmail.com>
Date: Sat, 23 Jul 2022 15:19:54 +1200
Subject: [PATCH 1/2] Remove configure probe for wctype.h.

This is present in POSIX and Windows.
---
 configure                          | 2 +-
 configure.ac                       | 1 -
 src/backend/utils/adt/formatting.c | 2 --
 src/include/pg_config.h.in         | 3 ---
 src/include/regex/regcustom.h      | 2 --
 src/include/tsearch/ts_locale.h    | 2 --
 src/tools/msvc/Solution.pm         | 1 -
 7 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/configure b/configure
index e80d371da7..6651321208 100755
--- a/configure
+++ b/configure
@@ -13875,7 +13875,7 @@ $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
 fi
 
 
-for ac_header in atomic.h copyfile.h execinfo.h getopt.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/event.h sys/ipc.h sys/personality.h sys/prctl.h sys/procctl.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/signalfd.h sys/sockio.h sys/uio.h sys/un.h termios.h ucred.h wctype.h
+for ac_header in atomic.h copyfile.h execinfo.h getopt.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/event.h sys/ipc.h sys/personality.h sys/prctl.h sys/procctl.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/signalfd.h sys/sockio.h sys/uio.h sys/un.h termios.h ucred.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
diff --git a/configure.ac b/configure.ac
index 6d3d2f3ffa..1e92fd6abd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1469,7 +1469,6 @@ AC_CHECK_HEADERS(m4_normalize([
 	sys/un.h
 	termios.h
 	ucred.h
-	wctype.h
 ]))
 
 # On BSD, test for net/if.h will fail unless sys/socket.h
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c
index e909c1a200..5ba1ff4666 100644
--- a/src/backend/utils/adt/formatting.c
+++ b/src/backend/utils/adt/formatting.c
@@ -75,9 +75,7 @@
  * declare them in <wchar.h>, so include that too.
  */
 #include <wchar.h>
-#ifdef HAVE_WCTYPE_H
 #include <wctype.h>
-#endif
 
 #ifdef USE_ICU
 #include <unicode/ustring.h>
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index 21e9283731..000ed9bde2 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -700,9 +700,6 @@
 /* Define to 1 if you have the `wcstombs_l' function. */
 #undef HAVE_WCSTOMBS_L
 
-/* Define to 1 if you have the <wctype.h> header file. */
-#undef HAVE_WCTYPE_H
-
 /* Define to 1 if you have the <winldap.h> header file. */
 #undef HAVE_WINLDAP_H
 
diff --git a/src/include/regex/regcustom.h b/src/include/regex/regcustom.h
index 100c52d640..4e215267f8 100644
--- a/src/include/regex/regcustom.h
+++ b/src/include/regex/regcustom.h
@@ -46,9 +46,7 @@
  * declare them in <wchar.h>, so include that too.
  */
 #include <wchar.h>
-#ifdef HAVE_WCTYPE_H
 #include <wctype.h>
-#endif
 
 #include "mb/pg_wchar.h"
 
diff --git a/src/include/tsearch/ts_locale.h b/src/include/tsearch/ts_locale.h
index 7d7c4e16c6..949258760d 100644
--- a/src/include/tsearch/ts_locale.h
+++ b/src/include/tsearch/ts_locale.h
@@ -24,9 +24,7 @@
  * declare them in <wchar.h>, so include that too.
  */
 #include <wchar.h>
-#ifdef HAVE_WCTYPE_H
 #include <wctype.h>
-#endif
 
 /* working state for tsearch_readline (should be a local var in caller) */
 typedef struct
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index 2f364ab112..f8df6acabe 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -426,7 +426,6 @@ sub GenerateFiles
 		HAVE_UUID_UUID_H                         => undef,
 		HAVE_WINLDAP_H                           => undef,
 		HAVE_WCSTOMBS_L                          => 1,
-		HAVE_WCTYPE_H                            => 1,
 		HAVE_VISIBILITY_ATTRIBUTE                => undef,
 		HAVE_WRITEV                              => undef,
 		HAVE_X509_GET_SIGNATURE_NID              => 1,
-- 
2.36.1

