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 @candidates = map File::Spec->catfile($_, $base), File::Spec->path;
22 for my $path (@candidates) {
23 my $command = MM->maybe_command($path);
24 if (defined $command) {
25 $command .= " @args" if @args;
34 my ($desc, $arg_var, $config_var, $env_var) = @_;
39 if (/^\Q$arg_var\E=(.*)/) {
40 $exe = validate_exe($1);
46 print "Forcing the use of $exe as the $desc.\n";
48 print "Checking for a valid $desc in the PATH... ";
49 $exe = validate_exe($Config{$config_var});
50 # Only fall back to env if we cannot find the one used to build perl.
51 if (not defined $exe and defined $ENV{$env_var}) {
52 $exe = validate_exe($ENV{$env_var});
65 for my $i (0 .. $#ARGV) {
67 if ($arg =~ /^PP=(.*)/) {
69 if (do { no warnings 'numeric'; int $val } or $val =~ /^(?:y|yes)$/i) {
70 print "Forcing the pure-Perl implementation from the arguments passed to Makefile.PL.\n";
77 if (defined $skip_arg) {
78 splice @ARGV, $skip_arg, 1;
83 $cc = check_exe('C compiler', 'CC', 'cc', 'CC');
85 $ld = check_exe('linker', 'LD', 'ld', 'LD');
89 sub is_little_endian {
90 my $order = $Config{byteorder};
91 return 0 unless $order;
92 my $len = length $order;
94 $order = substr $order, 0, 8;
97 return $order eq (join '', 1 .. $len);
103 if (defined $cc and defined $ld) {
104 $PARAMS{C} = [ 'Util.c' ];
105 $PARAMS{XS} = { 'Util.xs' => 'Util.c' };
109 my $unit = { bits => 8, size => 1 };
110 if (not is_little_endian()) {
111 print "Forcing unit size of 8 on non-little-endian systems.\n";
113 print "Checking unit size in bits... ";
114 my $align = $Config{alignbytes} || 1;
115 my @bits = (8, 16, 32, 64);
116 for my $bits (@bits) {
117 my $size = $Config{"u${bits}size"};
119 $unit = { bits => $bits, size => $size } if $size && $size <= $align;
122 " (actually $unit->{size} bytes for $align bytes alignment).\n";
125 my $bits = $unit->{bits};
126 push @DEFINES, '-DBV_UNIT="' . ($Config{"u${bits}type"} || "U$bits") . '"';
127 push @DEFINES, "-DSVU_SIZE=$bits";
131 $PARAMS{OBJECT} = '';
132 print "Falling back to the pure-Perl implementation.\n";
135 $PARAMS{DEFINE} = join ' ', @DEFINES if @DEFINES;
137 my $dist = 'Scalar-Vec-Util';
139 (my $name = $dist) =~ s{-}{::}g;
141 (my $file = $dist) =~ s{-}{/}g;
142 $file = "lib/$file.pm";
151 my %BUILD_REQUIRES = (
153 'ExtUtils::MakeMaker' => 0,
160 configure_requires => {
162 'ExtUtils::MakeMaker' => 0,
170 bugtracker => "http://rt.cpan.org/Dist/Display.html?Name=$dist",
171 homepage => "http://search.cpan.org/dist/$dist/",
172 license => 'http://dev.perl.org/licenses/',
173 repository => "http://git.profvince.com/?p=perl%2Fmodules%2F$dist.git",
179 AUTHOR => 'Vincent Pit <perl@profvince.com>',
181 VERSION_FROM => $file,
182 ABSTRACT_FROM => $file,
184 BUILD_REQUIRES => \%BUILD_REQUIRES,
185 PREREQ_PM => \%PREREQ_PM,
186 MIN_PERL_VERSION => '5.006',
187 META_MERGE => \%META,
189 PREOP => "pod2text -u $file > \$(DISTVNAME)/README",
190 COMPRESS => 'gzip -9f', SUFFIX => 'gz'
193 FILES => "$dist-* *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt*"
203 my $cv = join ' -coverage ', 'cover',
204 qw<statement branch condition path subroutine time>;