Debian Codegraph @

lang/perl/BerkeleyDB/Makefile.PL

raw
1 #! perl -w
2
3 # It should not be necessary to edit this file. The configuration for
4 # BerkeleyDB is controlled from the file config.in
5
6
7 BEGIN { die "BerkeleyDB needs Perl 5.004_04 or greater" if $] < 5.004_04 ; }
8
9 use strict ;
10 use ExtUtils::MakeMaker ;
11 use Config ;
12
13 # Check for the presence of sfio
14 if ($Config{'d_sfio'}) {
15 print <<EOM;
16
17 WARNING: Perl seems to have been built with SFIO support enabled.
18 Please read the SFIO Notes in the README file.
19
20 EOM
21 }
22
23 my $LIB_DIR ;
24 my $INC_DIR ;
25 my $DB_NAME ;
26 my $LIBS ;
27
28 ParseCONFIG() ;
29
30 if (defined $DB_NAME)
31 { $LIBS = $DB_NAME }
32 else {
33 if ($^O eq 'MSWin32')
34 { $LIBS = '-llibdb' }
35 elsif ($^O =~ /aix/i ) {
36 $LIBS .= '-ldb -lpthread ';
37 if ($Config{'cc'} eq 'gcc' && $Config{'osvers'} eq '5.1')
38 { $LIBS .= '-lgcc_s' }
39 }
40 else
41 { $LIBS = '-ldb' }
42 }
43
44 # OS2 is a special case, so check for it now.
45 my $OS2 = "" ;
46 $OS2 = "-DOS2" if $^O eq 'os2' ;
47
48 my $WALL = '';
49 #$WALL = ' -Wall ' if $Config{'cc'} =~ /gcc/ ;
50
51
52 WriteMakefile(
53 NAME => 'BerkeleyDB',
54 LIBS => ["-L${LIB_DIR} $LIBS"],
55 #MAN3PODS => {}, # Pods will be built by installman.
56 INC => "-I$INC_DIR",
57 VERSION_FROM => 'BerkeleyDB.pm',
58 XSPROTOARG => '-noprototypes',
59 DEFINE => "$OS2 $WALL",
60 #'macro' => { INSTALLDIRS => 'perl' },
61 'dist' => {COMPRESS=>'gzip', SUFFIX=>'gz'},
62 ($] >= 5.005
63 ? (ABSTRACT_FROM => 'BerkeleyDB.pod',
64 AUTHOR => 'Paul Marquess <[email protected]>')
65 : ()
66 ),
67 ((ExtUtils::MakeMaker->VERSION() gt '6.30')
68 ? ('LICENSE' => 'perl')
69 : ()
70 ),
71
72 );
73
74
75 sub MY::libscan
76 {
77 my $self = shift ;
78 my $path = shift ;
79
80 return undef
81 if $path =~ /(~|\.bak)$/ ||
82 $path =~ /^\..*\.swp$/ ;
83
84 return $path;
85 }
86
87
88 sub MY::postamble {
89 '
90 $(NAME).pod: $(NAME).pod.P t/examples.t.T t/examples3.t.T mkpod
91 perl ./mkpod
92
93 $(NAME).xs: typemap
94 $(TOUCH) $(NAME).xs
95
96 Makefile: config.in
97
98
99 ' ;
100 }
101
102 sub ParseCONFIG
103 {
104 my ($k, $v) ;
105 my @badkey = () ;
106 my %Info = () ;
107 my @Options = qw( INCLUDE LIB DBNAME ) ;
108 my %ValidOption = map {$_, 1} @Options ;
109 my %Parsed = %ValidOption ;
110 my $CONFIG = 'config.in' ;
111
112 print "Parsing $CONFIG...\n" ;
113
114 # DBNAME is optional, so pretend it has been parsed.
115 delete $Parsed{'DBNAME'} ;
116
117 open(F, "$CONFIG") or die "Cannot open file $CONFIG: $!\n" ;
118 while (<F>) {
119 s/^\s*|\s*$//g ;
120 next if /^\s*$/ or /^\s*#/ ;
121 s/\s*#\s*$// ;
122
123 ($k, $v) = split(/\s+=\s+/, $_, 2) ;
124 $k = uc $k ;
125 if ($ValidOption{$k}) {
126 delete $Parsed{$k} ;
127 $Info{$k} = $v ;
128 }
129 else {
130 push(@badkey, $k) ;
131 }
132 }
133 close F ;
134
135 print "Unknown keys in $CONFIG ignored [@badkey]\n"
136 if @badkey ;
137
138 # check parsed values
139 my @missing = () ;
140 die "The following keys are missing from $CONFIG file: [@missing]\n"
141 if @missing = keys %Parsed ;
142
143 $INC_DIR = $ENV{'BERKELEYDB_INCLUDE'} || $Info{'INCLUDE'} ;
144 $LIB_DIR = $ENV{'BERKELEYDB_LIB'} || $Info{'LIB'} ;
145 $DB_NAME = $ENV{BERKELEYDB_NAME} || $Info{'DBNAME'} ;
146 #$DB_NAME = $ENV{} || $Info{'DBNAME'} if defined $Info{'DBNAME'} ;
147
148 print "Looks Good.\n" ;
149
150 }
151
152 # end of file Makefile.PL