1use strict;
2use warnings;
3use Config;
4use ExtUtils::MakeMaker;
5
6my $lib = '-lcrypto';
7my $inc = '';
8my $nul = $^O eq 'MSWin32' ? 'nul' : '/dev/null';
9
10if (my $dir = $ENV{OPENSSL_PREFIX}) {
11  $lib = "-L$dir/lib -lcrypto";
12  $inc = "-I$dir/include";
13}
14elsif ($ENV{OPENSSL_LIB}) {
15  $lib = $ENV{OPENSSL_LIB};
16  $inc = $ENV{OPENSSL_INCLUDE};
17}
18elsif (`pkg-config --modversion libcrypto 2>$nul`) {
19  $lib = `pkg-config --libs libcrypto 2> $nul`;
20  $inc = `pkg-config --cflags libcrypto 2> $nul`;
21}
22elsif ($^O eq 'MSWin32') {
23  $lib = '-llibeay32' if $Config{cc} =~ /cl/;
24  $lib = '-leay32'    if $Config{cc} =~ /gcc/;
25}
26
27WriteMakefile(
28    'NAME'              => 'Crypt::OpenSSL::DSA',
29    'VERSION_FROM'      => 'lib/Crypt/OpenSSL/DSA.pm', # finds $VERSION
30    'LICENSE'           => 'perl_5',
31    'MIN_PERL_VERSION'  => '5.006',
32    'PREREQ_PM'         => {}, # e.g., Module::Name => 1.1
33    'AUTHOR'            => 'T.J. Mather',
34    'LIBS'              => [ $lib ],
35    'INC'               => $inc,
36    'DEFINE'            => '-DPERL5',   # perl-5.8/gcc-3.2 needs this
37    'META_MERGE'        => {
38      resources => {
39        repository => 'https://github.com/kmx/perl-Crypt-OpenSSL-DSA',
40      },
41    },
42    dist => { TARFLAGS => '--owner=0 --group=0 -cvf' },
43);
44