1use ExtUtils::MakeMaker;
2# See lib/ExtUtils/MakeMaker.pm for details of how to influence
3# the contents of the Makefile that is written.
4WriteMakefile(
5    'NAME'		=> 'I18N::Langinfo',
6    'VERSION_FROM'	=> 'Langinfo.pm', # finds $VERSION
7    'PREREQ_PM'		=> {}, # e.g., Module::Name => 1.1
8    ($] >= 5.005 ?    ## Add these new keywords supported since 5.005
9      (ABSTRACT_FROM => 'Langinfo.pm', # retrieve abstract from module
10       AUTHOR     => 'Jarkko Hietaniemi <jhi@hut.fi>') : ()),
11    'LIBS'		=> [''], # e.g., '-lm'
12    'DEFINE'		=> '', # e.g., '-DHAVE_SOMETHING'
13	# Insert -I. if you add *.h files later:
14    'INC'		=> '', # e.g., '-I/usr/include/other'
15    realclean => {FILES=> 'const-c.inc const-xs.inc'},
16	# Un-comment this if you add C files to link with later:
17    # 'OBJECT'		=> '$(O_FILES)', # link all the C files too
18);
19if (eval {require ExtUtils::Constant; 1}) {
20  # Some older versions of glibc use only enums, no defines, hence all this
21  # hassle (so old glibc that the define is GNU_LIBRARY, not GLIBC):
22  my @names = 'CODESET'; # CODESET isn't an enum in old glibc's langinfo.h
23  push @names,           # This lot are always enums in old langinfo.h:
24    {name=>$_, type=>"IV",
25     macro=>["#if defined($_) || (defined(__GNU_LIBRARY__) && defined(_NL_ITEM))\n",
26             "#endif\n"]}
27      foreach qw (ABDAY_1 ABDAY_2 ABDAY_3 ABDAY_4 ABDAY_5 ABDAY_6 ABDAY_7
28                  ABMON_1 ABMON_10 ABMON_11 ABMON_12 ABMON_2 ABMON_3 ABMON_4
29                  ABMON_5 ABMON_6 ABMON_7 ABMON_8 ABMON_9 ALT_DIGITS AM_STR
30                  DAY_1 DAY_2 DAY_3 DAY_4 DAY_5 DAY_6 DAY_7 D_FMT D_T_FMT ERA
31                  ERA_D_FMT ERA_D_T_FMT ERA_T_FMT MON_1 MON_10 MON_11 MON_12
32                  MON_2 MON_3 MON_4 MON_5 MON_6 MON_7 MON_8 MON_9 NOEXPR NOSTR
33                  PM_STR T_FMT T_FMT_AMPM YESEXPR YESSTR);
34  push @names,           # This lot are only enums for __SVR4_I386_ABI_L1__:
35    {name=>$_, type=>"IV",
36     macro=>["#if defined($_) || (defined(__GNU_LIBRARY__) && defined(_NL_ITEM) && defined(__SVR4_I386_ABI_L1__))\n",
37             "#endif\n"]}
38      foreach qw (CRNCYSTR THOUSEP RADIXCHAR);
39  ExtUtils::Constant::WriteConstants(
40                                     NAME => 'I18N::Langinfo',
41                                     NAMES => \@names,
42                                    );
43} else {
44  use File::Copy;
45  use File::Spec;
46  foreach my $file ('const-c.inc', 'const-xs.inc') {
47    my $fallback = File::Spec->catfile('fallback', $file);
48    copy ($fallback, $file) or die "Can't copy $fallback to $file: $!";
49  }
50}
51