Commit | Line | Data |
4bbcc6e8 |
1 | #!./perl |
2 | |
3 | BEGIN { |
4 | chdir 't' if -d 't'; |
fb175bb2 |
5 | @INC = '../lib'; |
4bbcc6e8 |
6 | require Config; import Config; |
b270fb37 |
7 | if ($Config{'extensions'} !~ m!\bI18N/Langinfo\b! || |
8 | $Config{'extensions'} !~ m!\bPOSIX\b!) |
9 | { |
10 | print "1..0 # skip: I18N::Langinfo or POSIX unavailable\n"; |
4bbcc6e8 |
11 | exit 0; |
12 | } |
13 | } |
14 | |
bb5b2f6d |
15 | use I18N::Langinfo qw(langinfo ABDAY_1 DAY_1 ABMON_1 MON_1); |
642c2bac |
16 | use POSIX qw(setlocale LC_ALL); |
69af93f8 |
17 | use Config; |
4bbcc6e8 |
18 | |
bb5b2f6d |
19 | print "# ABDAY_1 = ", ABDAY_1, "\n"; |
20 | |
21 | eval { I18N::Langinfo->import('RADIXCHAR') }; # silly glibcs |
22 | print "# RADIXCHAR = ", RADIXCHAR(), " (eval error = '$@')\n"; |
23 | my $has_RADIXCHAR = !$@; |
24 | |
25 | setlocale(LC_ALL, $ENV{LC_ALL} = $ENV{LANG} = "C"); |
4bbcc6e8 |
26 | |
27 | print "1..5\n"; |
28 | |
29 | print "not " unless langinfo(ABDAY_1) eq "Sun"; |
30 | print "ok 1\n"; |
31 | |
32 | print "not " unless langinfo(DAY_1) eq "Sunday"; |
33 | print "ok 2\n"; |
34 | |
35 | print "not " unless langinfo(ABMON_1) eq "Jan"; |
36 | print "ok 3\n"; |
37 | |
38 | print "not " unless langinfo(MON_1) eq "January"; |
39 | print "ok 4\n"; |
40 | |
bb5b2f6d |
41 | my $RADIXCHAR_ok; |
42 | |
43 | if ($has_RADIXCHAR) { |
44 | unless (langinfo(RADIXCHAR()) eq ".") { |
45 | print "not ok 5 - RADIXCHAR not '.' under the C locale\n"; |
46 | } else { |
47 | print "ok 5\n"; |
48 | $RADIXCHAR_ok = 1; |
49 | } |
50 | } else { |
51 | print "ok 5 # Skip: you do not have RADIXHCAR\n"; |
52 | } |
53 | |
54 | unless ($RADIXCHAR_ok) { |
4c1bac79 |
55 | if ($Config{d_gnulibc} || $Config{cppsymbols} =~ /__GNU_LIBRARY_/) { |
69af93f8 |
56 | print <<EOM; |
57 | # |
58 | # You are probably using GNU libc. The RADIXCHAR not getting defined |
bb5b2f6d |
59 | # by I18N::Langinfo is a known problem in some versions of the |
4c1bac79 |
60 | # GNU libc (caused by the combination of using only enums, not cpp |
61 | # definitions, and of hiding the definitions behind rather obscure |
62 | # feature tests). Upgrading your libc is strongly suggested. |
69af93f8 |
63 | # |
64 | EOM |
65 | } |
69af93f8 |
66 | } |
4bbcc6e8 |
67 | |
bb5b2f6d |
68 | |
69 | |
70 | |