1require 5.003000;
2
3use strict;
4use ExtUtils::MakeMaker;
5use Getopt::Std;
6use Config qw(%Config);
7
8my $PM = 'lib/Digest/SHA.pm';
9
10my %opts;
11getopts('tx', \%opts);	# -t is no longer used, but allow it anyway
12
13my @defines;
14push(@defines, '-DSHA_PerlIO') if $] >= 5.004;
15push(@defines, '-DNO_SHA_384_512')  if $opts{'x'};
16my $define = join(' ', @defines);
17
18	# Workaround for DEC compiler bug, adapted from Digest::MD5
19
20my @extra = ();
21if ($^O eq 'VMS') {
22	if (defined($Config{ccname})) {
23		if (grep(/VMS_VAX/, @INC) && ($Config{ccname} eq 'DEC')) {
24			# VAX compiler optimizer even up to v6.4 gets stuck
25			push(@extra, OPTIMIZE => "/Optimize=(NODISJOINT)");
26		}
27	}
28}
29
30	# Enhance performance on Intel when using gcc
31
32if ($Config{archname} =~ /^i[3456]86/ && $Config{ccname} eq 'gcc') {
33	push(@extra, OPTIMIZE => '-O1 -fomit-frame-pointer');
34}
35
36my %att = (
37	'NAME'		=> 'Digest::SHA',
38	'VERSION_FROM'	=> $PM,
39	'LIBS'		=> [''],
40	'DEFINE'	=> $define,
41	'INC'		=> '-I.',
42	'EXE_FILES'	=> [ 'shasum' ],
43	'INSTALLDIRS'	=> ($] >= 5.010 and $] < 5.011) ? 'perl' : 'site',
44	@extra,
45);
46
47my $MMversion = $ExtUtils::MakeMaker::VERSION || 0;
48$att{NO_META} = 1 unless $MMversion < 6.10_03;
49
50WriteMakefile(%att);
51