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