This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate from maint:
[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         'depend'        => {'version$(OBJ_EXT)' => 'version.c'},
26         'clean'         => {FILES => 'constants.h constants.xs'},
27         );
28
29 my @names = qw(
30         BTREEMAGIC
31         BTREEVERSION
32         DB_LOCK
33         DB_SHMEM
34         DB_TXN
35         HASHMAGIC
36         HASHVERSION
37         MAX_PAGE_NUMBER
38         MAX_PAGE_OFFSET
39         MAX_REC_NUMBER
40         RET_ERROR
41         RET_SPECIAL
42         RET_SUCCESS
43         R_CURSOR
44         R_DUP
45         R_FIRST
46         R_FIXEDLEN
47         R_IAFTER
48         R_IBEFORE
49         R_LAST
50         R_NEXT
51         R_NOKEY
52         R_NOOVERWRITE
53         R_PREV
54         R_RECNOSYNC
55         R_SETCURSOR
56         R_SNAPSHOT
57         __R_UNUSED
58         );
59
60     # Check the constants above all appear in @EXPORT in DB_File.pm
61     my %names = map { $_, 1} @names;
62     open F, "<DB_File.pm" or die "Cannot open DB_File.pm: $!\n";
63     while (<F>)
64     {
65         last if /^\s*\@EXPORT\s+=\s+qw\(/ ;
66     }
67
68     while (<F>)
69     {
70         last if /^\s*\)/ ;
71         /(\S+)/ ;
72         delete $names{$1} if defined $1 ;
73     }
74     close F ;
75
76     if ( keys %names )
77     {
78         my $missing = join ("\n\t", sort keys %names) ;
79         die "The following names are missing from \@EXPORT in DB_File.pm\n" .
80             "\t$missing\n" ;
81     }
82     
83
84     WriteConstants( NAME => 'DB_File',
85                     NAMES => \@names,
86                     C_FILE  => 'constants.h',
87                     XS_FILE  => 'constants.xs',
88                   );