1require 5.003000;
2
3use ExtUtils::MakeMaker;
4use Getopt::Std;
5use Config;
6
7my $PM = 'lib/Digest/SHA.pm';
8
9my $PERL_CORE = 0;
10$PERL_CORE = 1 if grep { $_ eq 'PERL_CORE=1' } @ARGV;
11
12my %opts;
13getopts('tx', \%opts);
14
15my @defines;
16push(@defines, '-DSHA_PERL_MODULE') if $] >= 5.004;
17push(@defines, '-DSHA_THREAD_SAFE') if $opts{'t'};
18push(@defines, '-DNO_SHA_384_512')  if $opts{'x'};
19
20	# Configure SHA source to use static arrays for
21	# message schedules if compiling on Intel platforms.
22	# This seems to speed things up a bit.  However,
23	# DON'T do this if thread-safe option is in force.
24
25if ($Config{archname} =~ /^i[3456]86/) {
26	push(@defines, '-DSHA_STO_CLASS=static') unless $opts{'t'};
27}
28
29my $define = join(' ', @defines);
30
31my %att = (
32	'NAME'		=> 'Digest::SHA',
33	'VERSION_FROM'	=> $PM,
34	'LIBS'		=> [''],
35	'DEFINE'	=> $define,
36	'INC'		=> '-I.',
37	$PERL_CORE ? () : (
38	    'EXE_FILES'		=> [ 'shasum' ],
39	    'INSTALLDIRS'	=> ($] >= 5.010) ? 'perl' : 'site',
40	),
41);
42
43my $MMversion = $ExtUtils::MakeMaker::VERSION || 0;
44$att{NO_META} = 1 unless $MMversion < 6.10_03;
45
46WriteMakefile(%att);
47