diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-10-02 11:59:12 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-10-02 11:59:12 +0000 |
commit | 4c1bac7903e553f2ead34f5fdf31e5541acbca0c (patch) | |
tree | c0f4014d0626840283dc9b810eb1183dd5797bc7 /ext | |
parent | b5a1df5a5dab453e4cd4be5d2eca4efe2d8c4e51 (diff) | |
download | perl-4c1bac7903e553f2ead34f5fdf31e5541acbca0c.tar.gz |
Work around old buggy glibcs for langinfo constants,
from Nicholas Clark and David Dyck.
p4raw-id: //depot/perl@12306
Diffstat (limited to 'ext')
-rw-r--r-- | ext/I18N/Langinfo/Langinfo.t | 8 | ||||
-rw-r--r-- | ext/I18N/Langinfo/Makefile.PL | 23 |
2 files changed, 22 insertions, 9 deletions
diff --git a/ext/I18N/Langinfo/Langinfo.t b/ext/I18N/Langinfo/Langinfo.t index 4dd72139d7..b2e97f9d8f 100644 --- a/ext/I18N/Langinfo/Langinfo.t +++ b/ext/I18N/Langinfo/Langinfo.t @@ -32,14 +32,16 @@ print "ok 3\n"; print "not " unless langinfo(MON_1) eq "January"; print "ok 4\n"; -unless (langinfo(RADIXCHAR) eq ".") { +unless (eval { langinfo(RADIXCHAR) } eq ".") { print "not ok 5 - RADIXCHAR undefined\n"; - if ($Config{d_gnulibc} || $Config{cppsymbols} =~ /GLIBC/) { + if ($Config{d_gnulibc} || $Config{cppsymbols} =~ /__GNU_LIBRARY_/) { print <<EOM; # # You are probably using GNU libc. The RADIXCHAR not getting defined # by I18N::Langinfo is a known problem in some older versions of the -# GNU libc. +# GNU libc (caused by the combination of using only enums, not cpp +# definitions, and of hiding the definitions behind rather obscure +# feature tests). Upgrading your libc is strongly suggested. # EOM } diff --git a/ext/I18N/Langinfo/Makefile.PL b/ext/I18N/Langinfo/Makefile.PL index 63137ff90a..2c211ccc87 100644 --- a/ext/I18N/Langinfo/Makefile.PL +++ b/ext/I18N/Langinfo/Makefile.PL @@ -20,14 +20,25 @@ WriteMakefile( # 'OBJECT' => '$(O_FILES)', # link all the C files too ); if (eval {require ExtUtils::Constant; 1}) { - my @names = (qw(ABDAY_1 ABDAY_2 ABDAY_3 ABDAY_4 ABDAY_5 ABDAY_6 ABDAY_7 + # Some older versions of glibc use only enums, no defines, hence all this + # hassle (so old glibc that the define is GNU_LIBRARY, not GLIBC): + my @names = 'CODESET'; # CODESET isn't an enum in old glibc's langinfo.h + push @names, # This lot are always enums in old langinfo.h: + {name=>$_, type=>"IV", + macro=>["#if defined($_) || (defined(__GNU_LIBRARY__) && defined(_NL_ITEM))\n", + "#endif\n"]} + foreach qw (ABDAY_1 ABDAY_2 ABDAY_3 ABDAY_4 ABDAY_5 ABDAY_6 ABDAY_7 ABMON_1 ABMON_10 ABMON_11 ABMON_12 ABMON_2 ABMON_3 ABMON_4 ABMON_5 ABMON_6 ABMON_7 ABMON_8 ABMON_9 ALT_DIGITS AM_STR - CODESET CRNCYSTR DAY_1 DAY_2 DAY_3 DAY_4 DAY_5 DAY_6 DAY_7 - D_FMT D_T_FMT ERA ERA_D_FMT ERA_D_T_FMT ERA_T_FMT MON_1 - MON_10 MON_11 MON_12 MON_2 MON_3 MON_4 MON_5 MON_6 MON_7 - MON_8 MON_9 NOEXPR NOSTR PM_STR RADIXCHAR THOUSEP T_FMT - T_FMT_AMPM YESEXPR YESSTR)); + DAY_1 DAY_2 DAY_3 DAY_4 DAY_5 DAY_6 DAY_7 D_FMT D_T_FMT ERA + ERA_D_FMT ERA_D_T_FMT ERA_T_FMT MON_1 MON_10 MON_11 MON_12 + MON_2 MON_3 MON_4 MON_5 MON_6 MON_7 MON_8 MON_9 NOEXPR NOSTR + PM_STR T_FMT T_FMT_AMPM YESEXPR YESSTR); + push @names, # This lot are only enums for __SVR4_I386_ABI_L1__: + {name=>$_, type=>"IV", + macro=>["#if defined($_) || (defined(__GNU_LIBRARY__) && defined(_NL_ITEM) && defined(__SVR4_I386_ABI_L1__))\n", + "#endif\n"]} + foreach qw (CRNCYSTR THOUSEP RADIXCHAR); ExtUtils::Constant::WriteConstants( NAME => 'I18N::Langinfo', NAMES => \@names, |