Math-Pari
view release on metacpan or search on metacpan
utils/Math/PariBuild.pm view on Meta::CPAN
sub inline_headers2 {
my ($asmarch, $pari_version, $paridir) = (@_);
return ([inline_headers_pre(@_)], [inline_headers(@_)])
if $pari_version < 2003000;
return inline_headers_by_dir(@_);
}
sub known_asmarch {
defined inline_headers_arr(@_);
}
sub choose_and_report_assembler {
my($machine, $pari_version) = (shift, shift);
my %asmarch = (
sun3 => 'm86k',
sparc => 'sparcv8_micro',
sparcv9 => 'sparcv8_micro',
port => 'none',
mips => 'none',
fx2800 => 'none',
ia64 => (($Config{longsize}||4) == 8 ? 'ia64' : 'none'),
hppa => ($Config{osvers} =~ /^.\.10\./
? 'hppa' : 'none'),
);
my $asmarch = $asmarch{$machine} || $machine; # Temporary only
my %skip64 = (alpha => 1, none => 1);
if (not ( $skip64{$asmarch} or $asmarch =~ /\D64$/ )
and (($Config{longsize} || 0) == 8 or $common::src eq 'src64')) {
$asmarch .= '_64';
$asmarch = 'hppa64' if $asmarch eq 'hppa_64';
$asmarch = 'x86_64' if $asmarch eq 'ix86_64';
}
unless (known_asmarch $asmarch, $pari_version) {
warn <<EOW;
#### Do not know how to build for assembler `$asmarch'. ####
#### Reversing to assembler-less type `port'. ####
#### ####
#### If you think your processor's assembler is supported ####
#### by PARI, edit libPARI/Makefile.PL and report. ####
#### ####
#### Alternatively, specify machine=YOURTYPE or machine=none ####
#### on the ####
#### perl Makefile.PL ####
#### command line. ####
#### Recognized types: ####
#### alpha hppa m86k none sparcv7 sparcv8 sparcv8_micro ####
#### sparcv8_super ix86 (ppc ia64 after 2.2.7) ####
EOW
$machine = 'port';
$asmarch = 'none';
}
if ($asmarch eq 'none') {
print "...I will use portable assembler-less build\n";
} else {
print "...I will use assembler build of type '$asmarch'.\n";
}
print <<EOP if $asmarch =~ /^hppa/;
###
### Some time ago HPPA assembler files were not relocatable,
### if this is still true, they are probably unsuitable for dynamic linking.
### It is advisable to restart Makefile.PL with an extra argument
### machine=port
### if you are planning for dynamic linking of Math::Pari.
###
### NOTE: machine=port results in a significant drop in performance.
### For a static build (which makes a new perl executable with the library
### compiled in [and arranges for it to be compiled in when
### other extensions are statically built later]):
### perl Makefile.PL LINKTYPE=static
### make static
### make perl
### make test
### make install
###
EOP
return $asmarch;
}
# Output (last two optional):
# [Which file to compile, whether you need to preprocess it to ./kernel1.s,
# Additional file to compile, need? to preprocess it to ./kernel2.s,]
sub sparcv8_kernel_files_old {
my ($asmarch, $pari_version, $Using_gnu_as) = (shift, shift, shift);
my $_ext = (($pari_version < 2000015) ? 's' : 'S');
my $cvt = $Using_gnu_as || $Config{osname} =~ /^(linux|nextstep)$/;
my $sparcv8_kernel = ($cvt
? ["sparcv8/level0.$_ext", 1,
"sparcv8/level0_$asmarch.$_ext", 1]
: ["sparcv8/level0.$_ext", 0,
"sparcv8/level0_$asmarch.$_ext", 0]);
# kernel2.o is not needed if the compiler can inline assembler:
my $sparcv8_need_kernel2 =
!$Config{gccversion} || $Config{osname} =~ /^(linux|nextstep)$/;
$sparcv8_kernel = [$sparcv8_kernel->[2], $sparcv8_kernel->[3]]
unless $sparcv8_need_kernel2;
return $sparcv8_kernel;
}
sub sparcv7_kernel_files {
my ($asmarch, $pari_version, $Using_gnu_as) = (shift, shift, shift);
my $_ext = (($pari_version < 2000015) ? 's' : 'S');
my $cvt = $Using_gnu_as || $Config{osname} =~ /^(linux|nextstep|netbsd)$/;
return ["sparcv7/level0.$_ext", $cvt];
}
sub kernel_files {
my ($asmarch, $pari_version, $Using_gnu_as, $paridir) = (@_);
return [] if $pari_version >= 2003000;
return sparcv8_kernel_files_old($asmarch, $pari_version, $Using_gnu_as)
if $asmarch =~ /^sparcv8/ and $pari_version < 2002006;
return sparcv7_kernel_files($asmarch, $pari_version, $Using_gnu_as)
if $asmarch eq 'sparcv7';
my $sparcv8_kernel = ["sparcv8_micro/level0_common.S", 1,
"$asmarch/level0.S", 1]; # 2.2.* only
( run in 1.149 second using v1.01-cache-2.11-cpan-71847e10f99 )