Remove configure check for _configthreadlocale().
authorThomas Munro <[email protected]>
Wed, 27 Nov 2024 09:34:03 +0000 (22:34 +1300)
committerThomas Munro <[email protected]>
Wed, 27 Nov 2024 10:12:19 +0000 (23:12 +1300)
All modern Windows systems have _configthreadlocale().  It was first
introduced in msvcr80.dll from Visual Studio 2005.  Historically, MinGW
was stuck on even older msvcrt.dll, but added its own dummy
implementation of the function when using msvcrt.dll years ago anyway,
effectively rendering the configure test useless.  In practice we don't
encounter the dummy anymore because modern MinGW uses ucrt.

Reviewed-by: Peter Eisentraut <[email protected]>
Discussion: https://postgr.es/m/CWZBBRR6YA8D.8EHMDRGLCKCD%40neon.tech

configure
configure.ac
meson.build
src/include/pg_config.h.in
src/interfaces/ecpg/ecpglib/descriptor.c
src/interfaces/ecpg/ecpglib/ecpglib_extern.h
src/interfaces/ecpg/ecpglib/execute.c

index 199d666aa730eb394d12cc6c0668211b2f1612e0..163ef9a7732c8c0d5cd1a3bc9f90b05dcbb04977 100755 (executable)
--- a/configure
+++ b/configure
 
 # Win32 (really MinGW) support
 if test "$PORTNAME" = "win32"; then
-  for ac_func in _configthreadlocale
-do :
-  ac_fn_c_check_func "$LINENO" "_configthreadlocale" "ac_cv_func__configthreadlocale"
-if test "x$ac_cv_func__configthreadlocale" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE__CONFIGTHREADLOCALE 1
-_ACEOF
-
-fi
-done
-
   case " $LIBOBJS " in
   *" dirmod.$ac_objext "* ) ;;
   *) LIBOBJS="$LIBOBJS dirmod.$ac_objext"
index 4f56bb5062e75d706cfc24646791464d315e177f..8c3367bd545c81104d67f23db9b3a9e1dd43ebf7 100644 (file)
@@ -1820,7 +1820,6 @@ fi
 
 # Win32 (really MinGW) support
 if test "$PORTNAME" = "win32"; then
-  AC_CHECK_FUNCS(_configthreadlocale)
   AC_LIBOBJ(dirmod)
   AC_LIBOBJ(kill)
   AC_LIBOBJ(open)
index 83e61d0f4a83fcf3bd210598be2601f4a4960b1c..ff3848b1d8527a1053d4b0dc0ba1d84ae53a95ae 100644 (file)
@@ -2617,7 +2617,6 @@ endif
 # XXX: Might be worth conditioning some checks on the OS, to avoid doing
 # unnecessary checks over and over, particularly on windows.
 func_checks = [
-  ['_configthreadlocale', {'skip': host_system != 'windows'}],
   ['backtrace_symbols', {'dependencies': [execinfo_dep]}],
   ['clock_gettime', {'dependencies': [rt_dep], 'define': false}],
   ['copyfile'],
index 40e4b2e381644fd6c180ebf7029b6828f1515a49..6e25afc58fd69bdef10d8e1fd16010f3b56bf43f 100644 (file)
 /* Define to 1 if your compiler understands __builtin_unreachable. */
 #undef HAVE__BUILTIN_UNREACHABLE
 
-/* Define to 1 if you have the `_configthreadlocale' function. */
-#undef HAVE__CONFIGTHREADLOCALE
-
 /* Define to 1 if you have __cpuid. */
 #undef HAVE__CPUID
 
index ad279e245c4ac33f9157d73642d295419552cfd8..56e2bc41531d78d7de0a84ffc36582d6a9d03923 100644 (file)
@@ -490,7 +490,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
        Assert(ecpg_clocale);
        stmt.oldlocale = uselocale(ecpg_clocale);
 #else
-#ifdef HAVE__CONFIGTHREADLOCALE
+#ifdef WIN32
        stmt.oldthreadlocale = _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
 #endif
        stmt.oldlocale = ecpg_strdup(setlocale(LC_NUMERIC, NULL), lineno);
@@ -510,7 +510,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
            setlocale(LC_NUMERIC, stmt.oldlocale);
            ecpg_free(stmt.oldlocale);
        }
-#ifdef HAVE__CONFIGTHREADLOCALE
+#ifdef WIN32
        if (stmt.oldthreadlocale != -1)
            (void) _configthreadlocale(stmt.oldthreadlocale);
 #endif
index bad3cd9920bb8fc652a064f878bec327fc40bb86..75cc68275bdacb951ff3cbc4348970c918329d3a 100644 (file)
@@ -77,7 +77,7 @@ struct statement
    locale_t    oldlocale;
 #else
    char       *oldlocale;
-#ifdef HAVE__CONFIGTHREADLOCALE
+#ifdef WIN32
    int         oldthreadlocale;
 #endif
 #endif
index c578c21cf66458b7849cabb5decd8ad751ecc032..466d5600f9b95c743567bb92d13a4b76762b1cc2 100644 (file)
@@ -1995,7 +1995,7 @@ ecpg_do_prologue(int lineno, const int compat, const int force_indicator,
        return false;
    }
 #else
-#ifdef HAVE__CONFIGTHREADLOCALE
+#ifdef WIN32
    stmt->oldthreadlocale = _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
 #endif
    stmt->oldlocale = ecpg_strdup(setlocale(LC_NUMERIC, NULL), lineno);
@@ -2219,7 +2219,7 @@ ecpg_do_epilogue(struct statement *stmt)
 #else
    if (stmt->oldlocale)
        setlocale(LC_NUMERIC, stmt->oldlocale);
-#ifdef HAVE__CONFIGTHREADLOCALE
+#ifdef WIN32
 
    /*
     * This is a bit trickier than it looks: if we failed partway through