diff options
author | Karl Williamson <khw@cpan.org> | 2019-03-04 14:00:41 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2019-03-06 12:55:44 -0700 |
commit | aa8a2baaface7f59cac19efdab8e51e08e4d67f6 (patch) | |
tree | 3388675339d9b74fcdefc8bc052141f7be73d975 /makedef.pl | |
parent | 7b738cd3cbe0a18f5963a007744dcc94be038aa7 (diff) | |
download | perl-aa8a2baaface7f59cac19efdab8e51e08e4d67f6.tar.gz |
Use POSIX locale functions if setlocale not available
POSIX 2008 added an independent set of locale handling functions beyond
the venerable setlocale. This commit changes so they can be used rather
than have no locale handling if there is, say, a problem with setlocale.
Diffstat (limited to 'makedef.pl')
-rw-r--r-- | makedef.pl | 53 |
1 files changed, 32 insertions, 21 deletions
diff --git a/makedef.pl b/makedef.pl index 10c7d1e330..42436c71ea 100644 --- a/makedef.pl +++ b/makedef.pl @@ -129,32 +129,43 @@ if ($define{USE_ITHREADS} && $ARGS{PLATFORM} ne 'win32' && $ARGS{PLATFORM} ne 'n $define{USE_REENTRANT_API} = 1; } -if ( ($define{USE_ITHREADS} || $define{USE_THREAD_SAFE_LOCALE}) - && $define{HAS_SETLOCALE} - && ! $define{NO_LOCALE} - && ! $define{NO_POSIX_2008_LOCALE}) -{ - $define{HAS_POSIX_2008_LOCALE} = 1 if $define{HAS_NEWLOCALE} - && $define{HAS_FREELOCALE} - && $define{HAS_USELOCALE}; - my $cctype = $ARGS{CCTYPE} =~ s/MSVC//r; - if ( ! $define{NO_THREAD_SAFE_LOCALE} - && ( $define{HAS_POSIX_2008_LOCALE} - || ($ARGS{PLATFORM} eq 'win32' && ( $cctype !~ /\D/ - && $cctype >= 80)))) +if (! $define{NO_LOCALE}) { + if ( ! $define{NO_POSIX_2008_LOCALE} + && $define{HAS_NEWLOCALE} + && $define{HAS_USELOCALE} + && $define{HAS_DUPLOCALE} + && $define{HAS_FREELOCALE}) { - $define{USE_THREAD_SAFE_LOCALE} = 1; - $define{USE_POSIX_2008_LOCALE} = 1 if $define{HAS_POSIX_2008_LOCALE}; + $define{HAS_POSIX_2008_LOCALE} = 1; + $define{USE_LOCALE} = 1; } - - if ( $ARGS{PLATFORM} eq 'win32' - && $define{USE_THREAD_SAFE_LOCALE} - && $cctype < 140) - { - $define{TS_W32_BROKEN_LOCALECONV} = 1; + elsif ($define{HAS_SETLOCALE}) { + $define{USE_LOCALE} = 1; } } +my $cctype = $ARGS{CCTYPE} =~ s/MSVC//r; +if (! $define{HAS_SETLOCALE} && $define{HAS_POSIX_2008_LOCALE}) { + $define{USE_POSIX_2008_LOCALE} = 1; + $define{USE_THREAD_SAFE_LOCALE} = 1; +} +elsif ( ($define{USE_ITHREADS} || $define{USE_THREAD_SAFE_LOCALE}) + && ( $define{HAS_POSIX_2008_LOCALE} + || ($ARGS{PLATFORM} eq 'win32' && ( $cctype !~ /\D/ + && $cctype >= 80))) + && ! $define{NO_THREAD_SAFE_LOCALE}) +{ + $define{USE_THREAD_SAFE_LOCALE} = 1 unless $define{USE_THREAD_SAFE_LOCALE}; + $define{USE_POSIX_2008_LOCALE} = 1 if $define{HAS_POSIX_2008_LOCALE}; +} + +if ( $ARGS{PLATFORM} eq 'win32' + && $define{USE_THREAD_SAFE_LOCALE} + && $cctype < 140) +{ + $define{TS_W32_BROKEN_LOCALECONV} = 1; +} + # perl.h logic duplication ends print STDERR "Defines: (" . join(' ', sort keys %define) . ")\n" |