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});
64 my $cc = check_exe('C compiler', 'CC', 'cc', 'CC');
68 $ld = check_exe('linker', 'LD', 'ld', 'LD');
71 sub is_little_endian {
72 my $order = $Config{byteorder};
73 return 0 unless $order;
74 my $len = length $order;
76 $order = substr $order, 0, 8;
79 return $order eq (join '', 1 .. $len);
85 if (defined $cc and defined $ld) {
86 $PARAMS{C} = [ 'Util.c' ];
87 $PARAMS{XS} = { 'Util.xs' => 'Util.c' };
91 my $unit = { bits => 8, size => 1 };
92 if (not is_little_endian()) {
93 print "Forcing unit size of 8 on non-little-endian systems.\n";
95 print "Checking unit size in bits... ";
96 my $align = $Config{alignbytes} || 1;
97 my @bits = (8, 16, 32, 64);
98 for my $bits (@bits) {
99 my $size = $Config{"u${bits}size"};
101 $unit = { bits => $bits, size => $size } if $size && $size <= $align;
104 " (actually $unit->{size} bytes for $align bytes alignment).\n";
107 my $bits = $unit->{bits};
108 push @DEFINES, '-DBV_UNIT="' . ($Config{"u${bits}type"} || "U$bits") . '"';
109 push @DEFINES, "-DSVU_SIZE=$bits";
113 $PARAMS{OBJECT} = '';
116 $PARAMS{DEFINE} = join ' ', @DEFINES if @DEFINES;
118 my $dist = 'Scalar-Vec-Util';
120 (my $name = $dist) =~ s{-}{::}g;
122 (my $file = $dist) =~ s{-}{/}g;
123 $file = "lib/$file.pm";
132 my %BUILD_REQUIRES = (
134 'ExtUtils::MakeMaker' => 0,
141 configure_requires => {
143 'ExtUtils::MakeMaker' => 0,
151 bugtracker => "http://rt.cpan.org/Dist/Display.html?Name=$dist",
152 homepage => "http://search.cpan.org/dist/$dist/",
153 license => 'http://dev.perl.org/licenses/',
154 repository => "http://git.profvince.com/?p=perl%2Fmodules%2F$dist.git",
160 AUTHOR => 'Vincent Pit <perl@profvince.com>',
162 VERSION_FROM => $file,
163 ABSTRACT_FROM => $file,
165 BUILD_REQUIRES => \%BUILD_REQUIRES,
166 PREREQ_PM => \%PREREQ_PM,
167 MIN_PERL_VERSION => '5.006',
168 META_MERGE => \%META,
170 PREOP => "pod2text -u $file > \$(DISTVNAME)/README",
171 COMPRESS => 'gzip -9f', SUFFIX => 'gz'
174 FILES => "$dist-* *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt*"
184 my $cv = join ' -coverage ', 'cover',
185 qw<statement branch condition path subroutine time>;