printf @_ if $debug;
}
-my $have_setlocale = 0;
-eval {
- require POSIX;
- import POSIX ':locale_h';
- $have_setlocale++;
-};
-
-# Visual C's CRT goes silly on strings of the form "en_US.ISO8859-1"
-# and mingw32 uses said silly CRT
-# This doesn't seem to be an issue any more, at least on Windows XP,
-# so re-enable the tests for Windows XP onwards.
-my $winxp = ($^O eq 'MSWin32' && defined &Win32::GetOSVersion &&
- join('.', (Win32::GetOSVersion())[1..2]) >= 5.1);
-$have_setlocale = 0 if ((($^O eq 'MSWin32' && !$winxp) || $^O eq 'NetWare') &&
- $Config{cc} =~ /^(cl|gcc)/i);
-
-# UWIN seems to loop after taint tests, just skip for now
-$have_setlocale = 0 if ($^O =~ /^uwin/);
-
$a = 'abc %';
my $test_num = 0;
# Let us do some *real* locale work now,
# unless setlocale() is missing (i.e. minitest).
-unless ($have_setlocale) {
- print "1..$test_num\n";
- exit;
-}
-
# The test number before our first setlocale()
my $final_without_setlocale = $test_num;
debug "# Scanning for locales...\n";
-setlocale(&POSIX::LC_ALL, "C");
-
my @Locale = find_locales();
debug "# Locales =\n";
debug "# $_\n";
}
+unless (@Locale) {
+ print "1..$test_num\n";
+ exit;
+}
+
+# We shouldn't get this far unless we know this will succeed
+require POSIX;
+import POSIX ':locale_h';
+
+setlocale(&POSIX::LC_ALL, "C");
+
my %posixes;
my %Problem;
sub find_locales { # Returns an array of all the locales we found on the
# system
+
+ my $have_setlocale = 0;
+ eval {
+ require POSIX;
+ import POSIX ':locale_h';
+ $have_setlocale++;
+ };
+
+ # Visual C's CRT goes silly on strings of the form "en_US.ISO8859-1"
+ # and mingw32 uses said silly CRT
+ # This doesn't seem to be an issue any more, at least on Windows XP,
+ # so re-enable the tests for Windows XP onwards.
+ my $winxp = ($^O eq 'MSWin32' && defined &Win32::GetOSVersion &&
+ join('.', (Win32::GetOSVersion())[1..2]) >= 5.1);
+ $have_setlocale = 0 if ((($^O eq 'MSWin32' && !$winxp) || $^O eq 'NetWare') &&
+ $Config{cc} =~ /^(cl|gcc|g\+\+|ici)/i);
+
+ # UWIN seems to loop after taint tests, just skip for now
+ $have_setlocale = 0 if ($^O =~ /^uwin/);
+
+ return unless $have_setlocale;
+
_trylocale("C", \@Locale);
_trylocale("POSIX", \@Locale);
foreach (0..15) {
}
}
use Config;
-my $have_setlocale = $Config{d_setlocale} eq 'define';
my $have_strtod = $Config{d_strtod} eq 'define';
-$have_setlocale = 0 if $@;
-# Visual C's CRT goes silly on strings of the form "en_US.ISO8859-1"
-# and mingw32 uses said silly CRT
-$have_setlocale = 0 if (($^O eq 'MSWin32' || $^O eq 'NetWare') && $Config{cc} =~ /^(cl|gcc)/i);
-skip_all("no setlocale available") unless $have_setlocale;
my @locales = find_locales();
skip_all("no locales available") unless @locales;