Commit | Line | Data |
b30ea4af |
1 | # Module makefile for threads::shared (using ExtUtils::MakeMaker) |
2 | |
3 | require 5.008; |
4 | |
5 | use strict; |
6 | use warnings; |
7 | |
b050c948 |
8 | use ExtUtils::MakeMaker; |
b050c948 |
9 | |
b30ea4af |
10 | |
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 | |
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 | |
53 | } else { |
54 | # CPAN |
55 | |
56 | # Verify that a 'C' compiler is available |
57 | if (! have_cc()) { |
291f766e |
58 | die("OS unsupported: ERROR: No 'C' compiler found to build 'threads::shared'\n"); |
b30ea4af |
59 | } |
60 | |
3bc7ad01 |
61 | push(@conditional_params, 'DEFINE' => '-DHAS_PPPORT_H', |
62 | 'PREREQ_PM' => { |
63 | 'strict' => 0, |
64 | 'warnings' => 0, |
3bc7ad01 |
65 | 'Config' => 0, |
66 | 'Carp' => 0, |
67 | 'XSLoader' => 0, |
68 | |
69 | 'Test' => 0, |
70 | 'Test::More' => 0, |
71 | 'ExtUtils::testlib' => 0, |
72 | }); |
b30ea4af |
73 | } |
74 | |
75 | |
76 | # Create Makefile |
b050c948 |
77 | WriteMakefile( |
b30ea4af |
78 | 'NAME' => 'threads::shared', |
79 | 'AUTHOR' => 'Artur Bergman, Jerry D. Hedden <jdhedden AT cpan DOT org>', |
80 | 'VERSION_FROM' => 'shared.pm', |
81 | 'ABSTRACT_FROM' => 'shared.pm', |
82 | 'PM' => { |
83 | 'shared.pm' => '$(INST_LIBDIR)/shared.pm', |
84 | }, |
b30ea4af |
85 | 'INSTALLDIRS' => 'perl', |
86 | |
87 | ((ExtUtils::MakeMaker->VERSION() lt '6.25') ? |
88 | ('PL_FILES' => { }) : ()), |
89 | ((ExtUtils::MakeMaker->VERSION() gt '6.30') ? |
90 | ('LICENSE' => 'perl') : ()), |
b050c948 |
91 | |
b30ea4af |
92 | @conditional_params |
b050c948 |
93 | ); |
b30ea4af |
94 | |
33d16ee7 |
95 | # Additional 'make' targets |
96 | sub MY::postamble |
97 | { |
98 | return <<'_EXTRAS_'; |
99 | fixfiles: |
100 | @dos2unix `cat MANIFEST` |
101 | @$(CHMOD) 644 `cat MANIFEST` |
102 | @$(CHMOD) 755 examples/*.pl |
103 | |
104 | ppport: |
105 | @( cd /tmp; perl -e 'use Devel::PPPort; Devel::PPPort::WriteFile("ppport.h");' ) |
106 | @if ! cmp -s ppport.h /tmp/ppport.h; then \ |
107 | ( tkdiff ppport.h /tmp/ppport.h & ); \ |
108 | perl /tmp/ppport.h; \ |
109 | fi |
110 | _EXTRAS_ |
111 | } |
112 | |
b30ea4af |
113 | # EOF |