From 14c648ff009438830d15de7c8a93c2b29114eb1c Mon Sep 17 00:00:00 2001 From: Thomas Munro Date: Tue, 13 Aug 2024 22:13:52 +1200 Subject: [PATCH] All POSIX systems have langinfo.h and CODESET. We don't need configure probes for HAVE_LANGINFO_H (it is implied by !WIN32), and we don't need to consider systems that have it but don't define CODESET (that was for OpenBSD in commit 81cca218, but it has now had it for 19 years). Reviewed-by: Heikki Linnakangas Discussion: https://postgr.es/m/CA%2BhUKGJqVe0%2BPv9dvC9dSums_PXxGo9SWcxYAMBguWJUGbWz-A%40mail.gmail.com --- configure | 2 +- configure.ac | 1 - meson.build | 1 - src/bin/pg_upgrade/pg_upgrade.c | 4 ---- src/include/pg_config.h.in | 3 --- src/port/chklocale.c | 20 +------------------- 6 files changed, 2 insertions(+), 29 deletions(-) diff --git a/configure b/configure index 4f3aa447566..2abbeb27944 100755 --- a/configure +++ b/configure @@ -13307,7 +13307,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 sys/epoll.h sys/event.h sys/personality.h sys/prctl.h sys/procctl.h sys/signalfd.h sys/ucred.h termios.h ucred.h +for ac_header in atomic.h copyfile.h execinfo.h getopt.h ifaddrs.h mbarrier.h sys/epoll.h sys/event.h sys/personality.h sys/prctl.h sys/procctl.h sys/signalfd.h sys/ucred.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 049bc014911..c46ed2c591a 100644 --- a/configure.ac +++ b/configure.ac @@ -1447,7 +1447,6 @@ AC_CHECK_HEADERS(m4_normalize([ execinfo.h getopt.h ifaddrs.h - langinfo.h mbarrier.h sys/epoll.h sys/event.h diff --git a/meson.build b/meson.build index cc176f11b5d..cd711c6d018 100644 --- a/meson.build +++ b/meson.build @@ -2394,7 +2394,6 @@ header_checks = [ 'execinfo.h', 'getopt.h', 'ifaddrs.h', - 'langinfo.h', 'mbarrier.h', 'stdbool.h', 'strings.h', diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c index 99f3d4543e9..663235816f8 100644 --- a/src/bin/pg_upgrade/pg_upgrade.c +++ b/src/bin/pg_upgrade/pg_upgrade.c @@ -40,10 +40,6 @@ #include -#ifdef HAVE_LANGINFO_H -#include -#endif - #include "catalog/pg_class_d.h" #include "common/file_perm.h" #include "common/logging.h" diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 0e9b108e667..979925cc2e2 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -238,9 +238,6 @@ /* Define to 1 if you have the `kqueue' function. */ #undef HAVE_KQUEUE -/* Define to 1 if you have the header file. */ -#undef HAVE_LANGINFO_H - /* Define to 1 if you have the `ldap_initialize' function. */ #undef HAVE_LDAP_INITIALIZE diff --git a/src/port/chklocale.c b/src/port/chklocale.c index 8cb81c8640e..a0cc52c38df 100644 --- a/src/port/chklocale.c +++ b/src/port/chklocale.c @@ -19,7 +19,7 @@ #include "postgres_fe.h" #endif -#ifdef HAVE_LANGINFO_H +#ifndef WIN32 #include #endif @@ -287,8 +287,6 @@ pg_codepage_to_encoding(UINT cp) #endif #endif /* WIN32 */ -#if (defined(HAVE_LANGINFO_H) && defined(CODESET)) || defined(WIN32) - /* * Given a setting for LC_CTYPE, return the Postgres ID of the associated * encoding, if we can determine it. Return -1 if we can't determine it. @@ -415,19 +413,3 @@ pg_get_encoding_from_locale(const char *ctype, bool write_message) free(sys); return -1; } -#else /* (HAVE_LANGINFO_H && CODESET) || WIN32 */ - -/* - * stub if no multi-language platform support - * - * Note: we could return -1 here, but that would have the effect of - * forcing users to specify an encoding to initdb on such platforms. - * It seems better to silently default to SQL_ASCII. - */ -int -pg_get_encoding_from_locale(const char *ctype, bool write_message) -{ - return PG_SQL_ASCII; -} - -#endif /* (HAVE_LANGINFO_H && CODESET) || WIN32 */