ExtUtils-F77
view release on metacpan or search on metacpan
return () unless defined $compiler;
# Get compiler "family"
$compiler=~/(g77|f77|fort77|gfortran|g95)/;
my $comp_fam = $1;
debug "ExtUtils::F77: compiler family is $comp_fam\n";
# Get compiler version number
my @t =`$compiler --version`; $t[0] =~ /(\d+)\.(\d+)\.(\d+)/;
my $version = "$1.$2"; # Major version number
debug "ExtUtils::F77: $compiler version $version.$3\n";
# Sigh special case random extra gfortran libs to avoid PERL_DL_NONLAZY meltdowns. KG 25/10/2015
my $append = "";
my $osvers = (split(/\./,$Config{osvers}))[0]; # Extract first digit in X.Y.Z version numbers
if ( $Config{osname} =~ /darwin/ && $osvers >= 14
&& $comp_fam eq 'gfortran' && $version >= 4.9 ) {
# Add extra libs for gfortran versions >= 4.9 and OS X
$append = "-lgcc_ext.10.5 -lgcc_s.10.5 -lquadmath";
}
my @libs = @{$COMPLIBS{$comp_fam}};
my ($dir, $lib, $test);
foreach $test (@libs) {
$dir = gfortran_find_libdir($compiler, $test);
$lib = $test, last if defined $dir;
}
gfortran_make_linkline($dir, $lib, "/usr/local/lib", "f2c", $append);
}
1; # Return true
__END__
=head1 NAME
ExtUtils::F77 - Simple interface to F77 libs
=head1 DESCRIPTION
This module tries to figure out how to link C programs with
Fortran subroutines on your system. Basically one must add a list
of Fortran runtime libraries. The problem is their location
and name varies with each OS/compiler combination! It was originally
developed to make building and installation of the L<PGPLOT> module easier,
which links to the pgplot Fortran graphics library. It is now used by a number
of perl modules.
This module tries to implement a simple
'rule-of-thumb' database for various flavours of UNIX systems.
A simple self-documenting Perl database of knowledge/code
for figuring out how to link for various combinations of OS and
compiler is embedded in the modules Perl code. Please help
save the world by submitted patches for new database entries for
your system at L<https://github.com/PDLPorters/extutils-f77>
Note the default on most systems is now to search for a generic 'GNU' compiler
which can be gfortran, g77, g95 or fort77 (in that order based on usage) and then find
the appropriate link libraries automatically. (This is the 'Generic' 'GNU' database entry
in the code.)
The target compiler can be explicitly overriden by setting the
environment variable F77, e.g.
% setenv F77 "x86_64-pc-linux-gnu-gfortran"
% perl -MExtUtils::F77 -e 'print ExtUtils::F77->compiler, "\n"'
The library list which the module returns
can be explicitly overridden by setting the environment
variable F77LIBS, e.g.
% setenv F77LIBS "-lfoo -lbar"
% perl -MExtUtils::F77 -e 'print ExtUtils::F77->runtime, "\n"'
...
=head1 SYNOPSIS
use ExtUtils::F77; # Automatic guess
use ExtUtils::F77 qw(sunos); # Specify system
use ExtUtils::F77 qw(linux g77); # Specify system and compiler
$fortranlibs = ExtUtils::F77->runtime;
=head1 METHODS
The following are all class methods.
=head2 runtime
Returns a list of F77 runtime libraries.
$fortranlibs = ExtUtils::F77->runtime;
=head2 runtimeok
Returns TRUE only if runtime libraries have been found successfully.
=head2 trail_
Returns true if F77 names have trailing underscores.
=head2 compiler
Returns command to execute the compiler (e.g. 'f77').
=head2 cflags
Returns compiler flags.
=head2 testcompiler
Test to see if compiler actually works.
=head1 DEBUGGING
To debug this module, and/or get more information about its workings,
set C<$ExtUtils::F77::DEBUG> to a true value. If set, it will C<warn>
various information about its operations.
As of version 1.22, this module will no longer print or warn if it is
working normally.
=head1 SEE ALSO
L<PDL> (PDL::Minuit and PDL::Slatec), L<PGPLOT>
=head1 AUTHOR
Karl Glazebrook, with many other contributions (see git repository at https://github.com/PDLPorters/extutils-f77)
( run in 3.090 seconds using v1.01-cache-2.11-cpan-cdf2f3d4e48 )