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