This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Removed typo that caused a variable to shadow an existing variable
[perl5.git] / ext / threads / Makefile.PL
CommitLineData
0f1612a7
JH
1# Module makefile for threads (using ExtUtils::MakeMaker)
2
3require 5.008;
4
5use strict;
6use warnings;
7
fc6e75a2 8use ExtUtils::MakeMaker;
0f1612a7
JH
9
10
c0003851
JH
11# Used to check for a 'C' compiler
12sub check_cc
13{
14 require File::Spec;
15
16 my $cmd = $_[0];
17 if (-x $cmd or MM->maybe_command($cmd)) {
18 return (1); # CC command found
19 }
20 for my $dir (File::Spec->path(), '.') {
21 my $abs = File::Spec->catfile($dir, $cmd);
22 if (-x $abs or MM->maybe_command($abs)) {
23 return (1); # CC command found
24 }
25 }
26 return;
27}
28
29sub have_cc
30{
31 eval { require Config_m; }; # ExtUtils::FakeConfig (+ ActivePerl)
32 if ($@) {
33 eval { require Config; }; # Everyone else
34 }
35 my @chunks = split(/ /, $Config::Config{cc});
36 # $Config{cc} may contain args; try to find out the program part
37 while (@chunks) {
38 if (check_cc("@chunks")) {
39 return (1); # CC command found
40 }
41 pop(@chunks);
42 }
43 return;
44}
45
46
0f1612a7
JH
47# Build options for different environments
48my @conditional_params;
49if (grep { $_ eq 'PERL_CORE=1' } @ARGV) {
50 # Core
51 push(@conditional_params, 'MAN3PODS' => {},
52 'NORECURS' => 1);
53} else {
54 # CPAN
c0003851
JH
55
56 # Verify that a 'C' compiler is available
57 if (! have_cc()) {
58 die("No 'C' compiler found to build 'threads'\n");
59 }
60
61 push(@conditional_params, 'DEFINE' => '-DHAS_PPPORT_H');
0f1612a7
JH
62}
63
7f595b02 64my $prereqs;
fc6e75a2 65
7f595b02 66if (!$ENV{PERL_CORE}) {
f5e29820 67 $prereqs = {
3ab14376
JH
68 'strict' => 0,
69 'warnings' => 0,
70 'overload' => 0,
71 'Config' => 0,
72 'Carp' => 0,
0f1612a7 73 'XSLoader' => 0,
3ab14376
JH
74
75 'ExtUtils::testlib' => 0,
7f595b02
SP
76 'Hash::Util' => 0,
77 'IO::File' => 0,
78 };
79}
80
81# Create Makefile
82WriteMakefile(
83 'NAME' => 'threads',
84 'AUTHOR' => 'Artur Bergman, Jerry D. Hedden <jdhedden AT cpan DOT org>',
85 'VERSION_FROM' => 'threads.pm',
86 'ABSTRACT_FROM' => 'threads.pm',
87 'PM' => {
88 'threads.pm' => '$(INST_LIBDIR)/threads.pm',
0f1612a7 89 },
7f595b02 90 'PREREQ_PM' => $prereqs,
0f1612a7
JH
91 'INSTALLDIRS' => 'perl',
92
93 ((ExtUtils::MakeMaker->VERSION() lt '6.25') ?
94 ('PL_FILES' => { }) : ()),
95 ((ExtUtils::MakeMaker->VERSION() gt '6.30') ?
96 ('LICENSE' => 'perl') : ()),
97
98 @conditional_params
fc6e75a2
AB
99);
100
0f1612a7 101# EOF