5 use ExtUtils::MakeMaker;
13 my (@candidates, @args);
14 if (File::Spec->file_name_is_absolute($name)) {
15 # No need to look for args if the name is absolute.
18 (my $base, @args) = split ' ', $name;
19 for my $path_entry (File::Spec->path) {
20 my ($vol, $dir, $file) = File::Spec->splitpath($path_entry, 1);
21 next if defined $file and length $file;
22 push @candidates, File::Spec->catpath($vol, $dir, $base);
26 for my $path (@candidates) {
27 my $command = MM->maybe_command($path);
28 if (defined $command) {
29 $command .= " @args" if @args;
38 my ($desc, $arg_var, $config_var, $env_var) = @_;
43 if (/^\Q$arg_var\E=(.*)/) {
44 $exe = validate_exe($1);
50 print "Forcing the use of $exe as the $desc.\n";
52 print "Checking for a valid $desc in the PATH... ";
53 $exe = validate_exe($Config{$config_var});
54 # Only fall back to env if we cannot find the one used to build perl.
55 if (not defined $exe and defined $ENV{$env_var}) {
56 $exe = validate_exe($ENV{$env_var});
69 for my $i (0 .. $#ARGV) {
71 if ($arg =~ /^PP=(.*)/) {
73 if (do { no warnings 'numeric'; int $val } or $val =~ /^(?:y|yes)$/i) {
74 print "Forcing the pure-Perl implementation from the arguments passed to Makefile.PL.\n";
81 if (defined $skip_arg) {
82 splice @ARGV, $skip_arg, 1;
87 $cc = check_exe('C compiler', 'CC', 'cc', 'CC');
89 $ld = check_exe('linker', 'LD', 'ld', 'LD');
93 sub is_little_endian {
94 my $order = $Config{byteorder};
95 return 0 unless $order;
96 my $len = length $order;
98 $order = substr $order, 0, 8;
101 return $order eq (join '', 1 .. $len);
107 if (defined $cc and defined $ld) {
108 $PARAMS{C} = [ 'Util.c' ];
109 $PARAMS{XS} = { 'Util.xs' => 'Util.c' };
113 my $unit = { bits => 8, size => 1 };
114 if (not is_little_endian()) {
115 print "Forcing unit size of 8 on non-little-endian systems.\n";
117 print "Checking unit size in bits... ";
118 my $align = $Config{alignbytes} || 1;
119 my @bits = (8, 16, 32, 64);
120 for my $bits (@bits) {
121 my $size = $Config{"u${bits}size"};
123 $unit = { bits => $bits, size => $size } if $size && $size <= $align;
126 " (actually $unit->{size} bytes for $align bytes alignment).\n";
129 my $bits = $unit->{bits};
130 push @DEFINES, '-DBV_UNIT="' . ($Config{"u${bits}type"} || "U$bits") . '"';
131 push @DEFINES, "-DSVU_SIZE=$bits";
135 $PARAMS{OBJECT} = '';
136 print "Falling back to the pure-Perl implementation.\n";
139 $PARAMS{DEFINE} = join ' ', @DEFINES if @DEFINES;
141 my $dist = 'Scalar-Vec-Util';
143 (my $name = $dist) =~ s{-}{::}g;
145 (my $file = $dist) =~ s{-}{/}g;
146 $file = "lib/$file.pm";
155 my %BUILD_REQUIRES = (
157 'ExtUtils::MakeMaker' => 0,
164 configure_requires => {
166 'ExtUtils::MakeMaker' => 0,
174 bugtracker => "http://rt.cpan.org/Dist/Display.html?Name=$dist",
175 homepage => "http://search.cpan.org/dist/$dist/",
176 license => 'http://dev.perl.org/licenses/',
177 repository => "http://git.profvince.com/?p=perl%2Fmodules%2F$dist.git",
183 AUTHOR => 'Vincent Pit <perl@profvince.com>',
185 VERSION_FROM => $file,
186 ABSTRACT_FROM => $file,
188 BUILD_REQUIRES => \%BUILD_REQUIRES,
189 PREREQ_PM => \%PREREQ_PM,
190 MIN_PERL_VERSION => '5.006',
191 META_MERGE => \%META,
193 PREOP => "pod2text -u $file > \$(DISTVNAME)/README",
194 COMPRESS => 'gzip -9f', SUFFIX => 'gz'
197 FILES => "$dist-* *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt*"
207 my $cv = join ' -coverage ', 'cover',
208 qw<statement branch condition path subroutine time>;