1#
2# a MakeMaker script for IO::Socket::SSL (aspa@hip.fi).
3#
4# $Id: Makefile.PL,v 1.1 2000/07/04 10:09:57 aspa Exp $.
5#
6
7use 5.008;
8use ExtUtils::MakeMaker;
9
10
11# Test to make sure that Net::SSLeay can be properly seeded!
12unless (defined $ENV{EGD_PATH}) {
13	foreach (qw(/var/run/egd-pool /dev/egd-pool /etc/egd-pool /etc/entropy)) {
14		if (-S) { $ENV{EGD_PATH}=$_; last }
15	}
16}
17
18$| = 1;
19
20{
21	# issue warning, if Net::SSLeay cannot find random generator
22	# redefine __WARN__ only locally to allow detection of failures
23	# in PREREQ_PM
24	local $SIG{__WARN__} = sub {
25		undef $SIG{__WARN__};
26		my $warning	 = shift;
27		return unless $warning =~ /random/i;
28		print "Net::SSLeay could not find a random number generator on\n";
29		print "your system.	 This will likely cause most of the tests\n";
30		print "to fail.	 Please see the README file for more information.\n";
31		print "the message from Net::SSLeay was: $warning\n";
32
33		# Taken from ExtUtils::MakeMaker 6.16 (Michael Schwern) so that
34		# the prompt() function can be emulated for older versions of ExtUtils::MakeMaker.
35		my $isa_tty = -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT));
36
37		if ($isa_tty) {
38			print "Do you REALLY want to continue? [Default: no] ";
39			die "User cancelled install!\n" if (<STDIN> !~ /^y(?:es)?$/);
40		} else {
41			die "Install cancelled.\n";
42		}
43	};
44
45	if (! defined $ENV{SKIP_RNG_TEST}) {
46		eval { require Net::SSLeay; $Net::SSLeay::trace=1; Net::SSLeay::randomize(); };
47		die $@ if $@ =~ /cancelled/;
48	} else {
49		print "Random Number Generator test skipped.\n";
50	}
51}
52
53# make sure that we have dualvar from the XS Version of Scalar::Util
54if ( eval { require Scalar::Util } ) {
55	eval { Scalar::Util::dualvar( 0,'' ) };
56	die "You need the XS Version of Scalar::Util for dualvar() support" if ($@);
57}
58
59# check if we have something which handles IDN
60if ( ! eval { require Net::IDN::Encode } and ! eval { require Net::LibIDN } and ! eval { require URI; URI->VERSION(1.50) }) {
61	warn <<'EOM';
62
63WARNING
64No library for handling international domain names found.
65It will work but croak if you try to verify an international name against
66a certificate.
67It's recommended to install either Net::IDN::Encode, Net::LibIDN or URI version>=1.50
68
69EOM
70}
71
72# check Version
73if ( eval { require Net::SSLeay } and $Net::SSLeay::VERSION <1.33 ) {
74	warn <<"EOM";
75
76WARNING
77You have version $Net::SSLeay::VERSION of Net::SSLeay.
78Support for subjectAltNames in certificates is only available in Version >=1.33
79so verifying a hostname against the certificate will not work.
80It is recommended to upgrade to a current Net::SSLeay.
81
82EOM
83}
84
85# See lib/ExtUtils/MakeMaker.pm for details of how to influence
86# the contents of the Makefile that is written.
87WriteMakefile(
88	'NAME' => 'IO::Socket::SSL',
89	'AUTHOR' => 'Steffen Ullrich & Peter Behroozi & Marko Asplund',
90	'ABSTRACT' => 'Nearly transparent SSL encapsulation for IO::Socket::INET.',
91	'VERSION_FROM' => 'SSL.pm',
92	'DISTNAME' => 'IO-Socket-SSL',
93	'PREREQ_PM' => {
94		'Net::SSLeay' => 1.21,
95		'Scalar::Util' => 0,
96	},
97	'dist' => { COMPRESS => 'gzip', SUFFIX => 'gz', },
98);
99