Commit | Line | Data |
0f1612a7 |
1 | # Module makefile for threads (using ExtUtils::MakeMaker) |
2 | |
3 | require 5.008; |
4 | |
5 | use strict; |
6 | use warnings; |
7 | |
fc6e75a2 |
8 | use ExtUtils::MakeMaker; |
0f1612a7 |
9 | |
10 | |
c0003851 |
11 | # Used to check for a 'C' compiler |
12 | sub 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 | |
29 | sub 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 |
47 | # Build options for different environments |
48 | my @conditional_params; |
49 | if (grep { $_ eq 'PERL_CORE=1' } @ARGV) { |
50 | # Core |
51 | push(@conditional_params, 'MAN3PODS' => {}, |
52 | 'NORECURS' => 1); |
53 | } else { |
54 | # CPAN |
c0003851 |
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 |
62 | } |
63 | |
fc6e75a2 |
64 | |
c0003851 |
65 | # Create Makefile |
fc6e75a2 |
66 | WriteMakefile( |
0f1612a7 |
67 | 'NAME' => 'threads', |
68 | 'AUTHOR' => 'Artur Bergman <sky AT crucially DOT net>', |
69 | 'VERSION_FROM' => 'threads.pm', |
70 | 'ABSTRACT_FROM' => 'threads.pm', |
71 | 'PM' => { |
72 | 'threads.pm' => '$(INST_LIBDIR)/threads.pm', |
73 | }, |
74 | 'PREREQ_PM' => { |
75 | 'threads::shared' => 0, |
76 | 'XSLoader' => 0, |
77 | }, |
78 | 'INSTALLDIRS' => 'perl', |
79 | |
80 | ((ExtUtils::MakeMaker->VERSION() lt '6.25') ? |
81 | ('PL_FILES' => { }) : ()), |
82 | ((ExtUtils::MakeMaker->VERSION() gt '6.30') ? |
83 | ('LICENSE' => 'perl') : ()), |
84 | |
85 | @conditional_params |
fc6e75a2 |
86 | ); |
87 | |
0f1612a7 |
88 | # EOF |