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