Skip to content

Commit

Permalink
Fix mingw locale builds
Browse files Browse the repository at this point in the history
Experience has shown that mingw with an older runtime library doesn't
have more modern Windows features working properly.  This commit causes
it to compile with workarounds, but allows the user to

-Accflags='-DUCRT_USED'

to indicate to Configure that the code will be using the modern CRT.
  • Loading branch information
khwilliamson committed May 6, 2023
1 parent f7f860b commit 456026b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions perl.h
Expand Up @@ -1355,7 +1355,7 @@ typedef enum {
* Windows for any vintage recent enough to have _MSC_VER defined */
# if defined(USE_LOCALE_THREADS) && ! defined(NO_THREAD_SAFE_LOCALE)
# if defined(USE_POSIX_2008_LOCALE) \
|| (defined(WIN32) && defined(_MSC_VER))
|| (defined(WIN32) && (defined(_MSC_VER) || defined(UCRT_USED)))
# define USE_THREAD_SAFE_LOCALE
# else
# define EMULATE_THREAD_SAFE_LOCALES
Expand Down Expand Up @@ -1401,13 +1401,19 @@ typedef enum {
* thinks LC_ALL is so as to inform the Windows libc when switching
* contexts. */
# define USE_PL_CUR_LC_ALL
# endif

/* Microsoft documentation reads in the change log for VS 2015: "The
* localeconv function declared in locale.h now works correctly when
* per-thread locale is enabled. In previous versions of the library, this
* function would return the lconv data for the global locale, not the
* thread's locale." */
# if _MSC_VER < 1900
* thread's locale."
*
* Mingw without UCRT is likely broken */
# if defined(WIN32)
# if ! defined(_MSC_VER) && ! defined(UCRT_USED)
# define TS_W32_BROKEN_LOCALECONV
# elif _MSC_VER < 1900
# define TS_W32_BROKEN_LOCALECONV
# endif
# endif
Expand Down

0 comments on commit 456026b

Please sign in to comment.