This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Sync up with Digest-MD5-2.38 from CPAN
[perl5.git] / ext / DB_File / Makefile.PL
1 use strict;
2 use warnings;
3
4 use ExtUtils::MakeMaker ;
5 use ExtUtils::Constant qw(WriteConstants);
6 use Config ;
7
8 # OS2 is a special case, so check for it now.
9 my $OS2 = "-DOS2" if $Config{'osname'} eq 'os2' ;
10
11 my $LIB = "-ldb" ;
12 # so is win32
13 $LIB = "-llibdb" if $^O eq 'MSWin32' ;
14
15 WriteMakefile(
16         NAME            => 'DB_File',
17         LIBS            => ["-L/usr/local/lib $LIB"],
18         MAN3PODS        => {},         # Pods will be built by installman.
19         #INC            => '-I/usr/local/include',
20         VERSION_FROM    => 'DB_File.pm',
21         OBJECT          => 'version$(OBJ_EXT) DB_File$(OBJ_EXT)',
22         XSPROTOARG      => '-noprototypes',
23         DEFINE          => $OS2 || "",
24         INC             => ($^O eq "MacOS" ? "-i ::::db:include" : ""),
25         XS_VERSION      => eval MM->parse_version('DB_File.pm'),
26     ((ExtUtils::MakeMaker->VERSION() gt '6.30')
27             ?  ('LICENSE'  => 'perl')
28             : ()
29     ),
30     (
31         $] >= 5.005
32             ? (ABSTRACT_FROM => 'DB_File.pm',
33                 AUTHOR       => 'Paul Marquess <pmqs@cpan.org>')
34             : ()
35     ),
36
37         'depend'        => {'version$(OBJ_EXT)' => 'version.c'},
38         'clean'         => {FILES => 'constants.h constants.xs'},
39         );
40
41 my @names = qw(
42         BTREEMAGIC
43         BTREEVERSION
44         DB_LOCK
45         DB_SHMEM
46         DB_TXN
47         HASHMAGIC
48         HASHVERSION
49         MAX_PAGE_NUMBER
50         MAX_PAGE_OFFSET
51         MAX_REC_NUMBER
52         RET_ERROR
53         RET_SPECIAL
54         RET_SUCCESS
55         R_CURSOR
56         R_DUP
57         R_FIRST
58         R_FIXEDLEN
59         R_IAFTER
60         R_IBEFORE
61         R_LAST
62         R_NEXT
63         R_NOKEY
64         R_NOOVERWRITE
65         R_PREV
66         R_RECNOSYNC
67         R_SETCURSOR
68         R_SNAPSHOT
69         __R_UNUSED
70         );
71
72     # Check the constants above all appear in @EXPORT in DB_File.pm
73     my %names = map { $_, 1} @names;
74     open F, "<DB_File.pm" or die "Cannot open DB_File.pm: $!\n";
75     while (<F>)
76     {
77         last if /^\s*\@EXPORT\s+=\s+qw\(/ ;
78     }
79
80     while (<F>)
81     {
82         last if /^\s*\)/ ;
83         /(\S+)/ ;
84         delete $names{$1} if defined $1 ;
85     }
86     close F ;
87
88     if ( keys %names )
89     {
90         my $missing = join ("\n\t", sort keys %names) ;
91         die "The following names are missing from \@EXPORT in DB_File.pm\n" .
92             "\t$missing\n" ;
93     }
94     
95
96     WriteConstants( NAME => 'DB_File',
97                     NAMES => \@names,
98                     C_FILE  => 'constants.h',
99                     XS_FILE  => 'constants.xs',
100                   );