1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22use ExtUtils::MakeMaker;
23# See lib/ExtUtils/MakeMaker.pm for details of how to influence
24# the contents of the Makefile that is written.
25WriteMakefile(
26    'NAME'		=> 'I18N::Langinfo',
27    'VERSION_FROM'	=> 'Langinfo.pm', # finds $VERSION
28    'PREREQ_PM'		=> {}, # e.g., Module::Name => 1.1
29    ($] >= 5.005 ?    ## Add these new keywords supported since 5.005
30      (ABSTRACT_FROM => 'Langinfo.pm', # retrieve abstract from module
31       AUTHOR     => 'Jarkko Hietaniemi <jhi@hut.fi>') : ()),
32    'LIBS'		=> [''], # e.g., '-lm'
33    'DEFINE'		=> '', # e.g., '-DHAVE_SOMETHING'
34	# Insert -I. if you add *.h files later:
35    'INC'		=> '', # e.g., '-I/usr/include/other'
36    'MAN3PODS'		=> {},  # Pods will be built by installman
37    realclean => {FILES=> 'const-c.inc const-xs.inc'},
38	# Un-comment this if you add C files to link with later:
39    # 'OBJECT'		=> '$(O_FILES)', # link all the C files too
40);
41if (eval {require ExtUtils::Constant; 1}) {
42  # Some older versions of glibc use only enums, no defines, hence all this
43  # hassle (so old glibc that the define is GNU_LIBRARY, not GLIBC):
44  my @names = 'CODESET'; # CODESET isn't an enum in old glibc's langinfo.h
45  push @names,           # This lot are always enums in old langinfo.h:
46    {name=>$_, type=>"IV",
47     macro=>["#if defined($_) || (defined(__GNU_LIBRARY__) && defined(_NL_ITEM))\n",
48             "#endif\n"]}
49      foreach qw (ABDAY_1 ABDAY_2 ABDAY_3 ABDAY_4 ABDAY_5 ABDAY_6 ABDAY_7
50                  ABMON_1 ABMON_10 ABMON_11 ABMON_12 ABMON_2 ABMON_3 ABMON_4
51                  ABMON_5 ABMON_6 ABMON_7 ABMON_8 ABMON_9 ALT_DIGITS AM_STR
52                  DAY_1 DAY_2 DAY_3 DAY_4 DAY_5 DAY_6 DAY_7 D_FMT D_T_FMT ERA
53                  ERA_D_FMT ERA_D_T_FMT ERA_T_FMT MON_1 MON_10 MON_11 MON_12
54                  MON_2 MON_3 MON_4 MON_5 MON_6 MON_7 MON_8 MON_9 NOEXPR NOSTR
55                  PM_STR T_FMT T_FMT_AMPM YESEXPR YESSTR);
56  push @names,           # This lot are only enums for __SVR4_I386_ABI_L1__:
57    {name=>$_, type=>"IV",
58     macro=>["#if defined($_) || (defined(__GNU_LIBRARY__) && defined(_NL_ITEM) && defined(__SVR4_I386_ABI_L1__))\n",
59             "#endif\n"]}
60      foreach qw (CRNCYSTR THOUSEP RADIXCHAR);
61  ExtUtils::Constant::WriteConstants(
62                                     NAME => 'I18N::Langinfo',
63                                     NAMES => \@names,
64                                    );
65} else {
66  use File::Copy;
67  use File::Spec;
68  foreach my $file ('const-c.inc', 'const-xs.inc') {
69    my $fallback = File::Spec->catfile('fallback', $file);
70    copy ($fallback, $file) or die "Can't copy $fallback to $file: $!";
71  }
72}
73