r10925 - in /branches/upstream/libextutils-f77-perl: ./ current/ current/._F77.pm current/CHANGES current/COPYING current/F77.pm current/MANIFEST current/META.yml current/Makefile.PL current/README current/t/ current/t/require.t

ghostbar-guest at users.alioth.debian.org ghostbar-guest at users.alioth.debian.org
Thu Dec 6 19:53:17 UTC 2007


Author: ghostbar-guest
Date: Thu Dec  6 19:53:17 2007
New Revision: 10925

URL: http://svn.debian.org/wsvn/?sc=1&rev=10925
Log:
[svn-inject] Installing original source of libextutils-f77-perl

Added:
    branches/upstream/libextutils-f77-perl/
    branches/upstream/libextutils-f77-perl/current/
    branches/upstream/libextutils-f77-perl/current/._F77.pm   (with props)
    branches/upstream/libextutils-f77-perl/current/CHANGES
    branches/upstream/libextutils-f77-perl/current/COPYING
    branches/upstream/libextutils-f77-perl/current/F77.pm
    branches/upstream/libextutils-f77-perl/current/MANIFEST
    branches/upstream/libextutils-f77-perl/current/META.yml
    branches/upstream/libextutils-f77-perl/current/Makefile.PL
    branches/upstream/libextutils-f77-perl/current/README
    branches/upstream/libextutils-f77-perl/current/t/
    branches/upstream/libextutils-f77-perl/current/t/require.t

Added: branches/upstream/libextutils-f77-perl/current/._F77.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libextutils-f77-perl/current/._F77.pm?rev=10925&op=file
==============================================================================
Binary file - no diff available.

Propchange: branches/upstream/libextutils-f77-perl/current/._F77.pm
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: branches/upstream/libextutils-f77-perl/current/CHANGES
URL: http://svn.debian.org/wsvn/branches/upstream/libextutils-f77-perl/current/CHANGES?rev=10925&op=file
==============================================================================
--- branches/upstream/libextutils-f77-perl/current/CHANGES (added)
+++ branches/upstream/libextutils-f77-perl/current/CHANGES Thu Dec  6 19:53:17 2007
@@ -1,0 +1,101 @@
+ExtUtils::F77 Changes list 
+--------------------------
+
+v1.16 released May 16th
+------------------------
+
+* Added new config entry for Darwin/OSX (using gcc 4.0 and g77, gfortran or g95)
+* Added new entry for gfortran under Linux (thanks to Thomas Erben).
+* Works fine under g77 on intel Mac OS X.
+
+v1.15 released Jan 3rd, 2006
+----------------------------
+
+* Jim Edwards f90 patch for SGI irix64
+* Added version number print to the startup
+* Solaris patches from Diab Jerius
+* OSX warning patch from Doug Burke
+* Win32 patches from Rob - Sisyphus <kalinabears at iinet.net.au> (2005/1/25)
+
+v1.14 released Jun 15th 2001
+----------------------------
+
+* Diab Jerius' Solaris regex patch
+* Tim Butler's Solaris patch
+* Now prints version on "use"
+* David Meleedy's Solaris patch?
+* My mix and match of all the above
+* Added COPYING file for Licence statement
+* Tim Jeness' latest Solaris patch
+* My own patch to make sure gcclibs are appended for g77
+
+v1.13 released May 8th 2000
+---------------------------
+
+* Small IRIX patch from Christian Soeller.
+* Tim Butler's Solaris patch (to make sure directories in path really
+  do contain libF77.a)
+* Charles Lane's latest VMS patch (properly blanks VMS libs)
+* Changed my email address.
+* Added Gokhan Ulu's <ulu at ultra.bu.edu> patch to use Solaris 
+  LD_LIBRARY_PATH variable to assist in locating F77 libs.
+
+v1.12 released Oct 26th 1999
+----------------------------
+
+* SGI coding suggestion from Tim Jenness to suppress a warning.
+
+v1.11 released Oct 15th 1999
+-----------------------------
+
+* Now removed from PGPLOT module distribution to avoid confusing CPAN,
+  now purely available standalone.
+* Got rid of some "for my $foo" ism's for 5.003 compatibility.
+* Christian's cygwin patches.
+* Patch to restore fallback to g77 behaviour if o/s compiler not found.
+  (e.g. solaris)
+* IRIX changes from Ovidiu Toader <ovi at physics.utoronto.ca>
+* Fixed g77 to use -lg2c in prefererence
+
+v1.10 released May 14th 1999
+-----------------------------
+
+Tim Jenness <t.jenness at jach.hawaii.edu>:
+* Fixes for Redhat 6.0 searching for libg2c.a
+* Better POD documentation
+* New runtimeok() method
+
+v1.09 released May 11th, 1999
+-----------------------------
+
+* Yet another IRIX patch (Allen Smith <easmith at beatrice.rutgers.edu>, Nov 1998)
+* Added -lg2c support provisionally
+* Yet another IRIX mod from Christian Soeller  <c.soeller at auckland.ac.nz>
+* Improved docs slightly.
+* Small VMS patch from Chuck Lane <lane at duphy4.physics.drexel.edu>
+
+
+v1.08 released Sep 11th, 1998
+-----------------------------
+
+* Better gcc detection (Anton Berezin)
+* Improved libf2c directory location
+* fixed pod2man bugs in documentation
+* IRIX n32 fix
+
+
+v1.07 released May 21st, 1998.
+------------------------------
+
+* Now supports VMS! Thanks to Charles Lane for his patch
+
+* Added -lxlf90 to AIX libs (Andreas Heitmann)
+
+* Added g77/f77/fort77 search for Generic g77/f2c
+
+* Fixed minor bug in falling back to g77/f2c
+
+* Added support for explicit overriding of Fortran libs
+  using the environment variable F77LIBS.
+  
+  

Added: branches/upstream/libextutils-f77-perl/current/COPYING
URL: http://svn.debian.org/wsvn/branches/upstream/libextutils-f77-perl/current/COPYING?rev=10925&op=file
==============================================================================
--- branches/upstream/libextutils-f77-perl/current/COPYING (added)
+++ branches/upstream/libextutils-f77-perl/current/COPYING Thu Dec  6 19:53:17 2007
@@ -1,0 +1,35 @@
+  Copyright (c) 2001 by Karl Glazebrook. All rights reserved.  This distribution 
+  is free software; you can redistribute it and/or modify it under the same 
+  terms as Perl itself.
+
+  THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
+  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED.  IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+  IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.
+
+  BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+  FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+  OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+  PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
+  EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS
+  WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+  ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+  WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+  REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
+  DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
+  DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM
+  (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
+  INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF
+  THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
+  OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

Added: branches/upstream/libextutils-f77-perl/current/F77.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libextutils-f77-perl/current/F77.pm?rev=10925&op=file
==============================================================================
--- branches/upstream/libextutils-f77-perl/current/F77.pm (added)
+++ branches/upstream/libextutils-f77-perl/current/F77.pm Thu Dec  6 19:53:17 2007
@@ -1,0 +1,675 @@
+
+package ExtUtils::F77;
+
+use Config;
+use File::Spec;
+
+=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!
+
+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 sending database entries for
+your system to karl_pgplot at mac.com
+
+The library list which the module returns 
+can be explicitly overridden by setting the environment 
+variable F77LIBS, e.g.
+
+  % setenv F77LIBS "-lfoo -lbar"
+  % perl Makefile.PL
+  ...
+
+=cut
+
+$VERSION = "1.16";
+
+warn "\nExtUtils::F77: Version $VERSION\n";
+
+# Database starts here. Basically we have a large hash specifying
+# entries for each os/compiler combination. Entries can be code refs
+# in which case they are executed and the returned value used. This
+# allows us to be quite smart.
+
+# Hash key convention is uppercase first letter of
+# hash keys. First key is usually the name of the architecture as
+# returned by Config (modulo ucfirst()).
+
+print "Loaded ExtUtils::F77 version $VERSION\n";
+
+%F77config=();
+
+### SunOS (use this as a template for new entries) ###
+
+# Code to figure out and return link-string for this architecture
+# Returns false if it can't find anything sensible.
+
+$F77config{Sunos}{F77}{Link} = sub {  
+       $dir = find_highest_SC("/usr/lang/SC*");
+       return "" unless $dir; # Failure
+       print "$Pkg: Found Fortran latest version lib dir $dir\n";
+       return "-L$dir -lF77 -lm";
+};
+
+# Whether symbols (subroutine names etc.) have trailing underscores 
+# (true/false)
+
+$F77config{Sunos}{F77}{Trail_} = 1; 
+
+# Name of default compiler - corresponds to one of the above keys
+
+$F77config{Sunos}{DEFAULT} = 'F77'; 
+
+# Program to run to actually compile stuff
+
+$F77config{Sunos}{F77}{Compiler} = 'f77';
+
+# Associated compiler flags
+
+$F77config{Sunos}{F77}{Cflags} = '-O';
+
+############ Rest of database is here ############ 
+
+### Solaris ###
+
+$F77config{Solaris}{F77}{Link} = sub {
+     my $NSPATH;
+     my $dir;
+
+     #find the SUNWspro entry of nonstandard inst. in LD_LIBRARY_PATH
+     if ( defined $ENV{'LD_LIBRARY_PATH'} &&
+	  $ENV{'LD_LIBRARY_PATH'} =~ m{([^:]*SUNWspro[^/]*)} )
+     {
+       $NSPATH = $1;
+     }
+
+     elsif ( defined $ENV{'PATH'} ) {
+
+       foreach ( split (/:/,$ENV{PATH}) ) {
+	 if ( m{(.*SUNWspro[^/]*)} ) {
+	   $NSPATH = $1;
+	   last;
+	 }
+       }
+     }
+
+
+     if (defined $NSPATH) {
+
+       print "$Pkg: Found F77 path:--->$NSPATH\n";
+
+       $dir = find_highest_SC("$NSPATH/WS*/lib") ||
+              find_highest_SC("$NSPATH/SC*/lib") ||
+	      find_highest_SC("$NSPATH/sunwspro*/SUNWspro/SC*/lib");
+
+       # that failed.  try $NSPATH/lib. use glob to
+       # match for libF77.*, as libF77.a isn't there anymore?
+       unless ( $dir )
+       {
+	 print "$Pkg: Trying $NSPATH/lib\n";
+	 $dir = "$NSPATH/lib" if glob("$NSPATH/lib/libF77*");
+       }
+	      
+     } else {
+     }
+     return "" unless $dir; # Failure
+     print "$Pkg: Found Fortran latest version lib dir $dir\n";
+
+     my @libs;
+
+     # determine libraries. Forte 7 doesn't have F77 or M77
+     if ( qx/$F77config{Solaris}{F77}{Compiler} -V 2>&1/ 
+                      =~ /Forte Developer 7/ )
+     {
+       push @libs, qw/
+		      -lf77compat
+		      -lfui
+		      -lfai
+		      -lfai2
+		      -lfsumai
+		      -lfprodai
+		      -lfminlai
+		      -lfmaxlai
+		      -lfminvai
+		      -lfmaxvai
+		      -lfsu 
+		      -lsunmath
+		      -lm
+		      /;
+     }
+     else
+     {
+       push @libs, qw/
+		      -lF77
+		      -lM77
+		      -lsunmath
+		      -lm
+		      /;
+     }
+
+     join( ' ', "-L$dir", @libs );
+ };
+
+
+$F77config{Solaris}{F77}{Trail_} = 1;
+$F77config{Solaris}{F77}{Compiler} = 'f77';
+$F77config{Solaris}{F77}{Cflags} = '-O';
+$F77config{Solaris}{DEFAULT} = 'F77';
+
+### Generic GNU-77 or F2C system ###
+
+$F77config{Generic}{G77}{Link} = sub {
+    my @libs = ('g2c', 'f2c');
+    my ($dir, $lib, $test);
+    foreach $test (@libs) {
+      $dir = `g77 -print-file-name=lib$test.a`;
+      chomp $dir;
+      # Note that -print-file-name returns just the library name
+      # if it cant be found - make sure that we only accept the
+      # directory if it returns a proper path (or matches a /)
+      if (defined $dir && $dir ne "lib$test.a") {
+        $lib = $test; # Found an existing library
+        last; 
+      }
+    }
+
+    if( defined $dir  && defined $lib) {
+        $dir =~ s,/lib$lib.a$,,;
+    } else {
+        $dir = "/usr/local/lib";
+        $lib = "f2c";
+    }    
+    return( "-L$dir -L/usr/lib -l$lib -lm" );
+};
+$F77config{Generic}{G77}{Trail_} = 1;
+$F77config{Generic}{G77}{Compiler} = find_in_path('g77','f77','fort77');
+$F77config{Generic}{G77}{Cflags} = '-O';
+$F77config{Generic}{DEFAULT} = 'G77';
+$F77config{Generic}{F2c}     = $F77config{Generic}{G77};
+
+### cygwin ###
+#"-lg2c -lm";
+# needed this on my cygwin system to get things working properly
+sub getcyglink {
+   return join ' ', map {my $lp = `g77 -print-file-name=lib$_.a`;
+			$lp =~ s|/[^/]+$||;
+			 $lp =~ s|L([a-z,A-Z]):|L//$1|g;
+			 "-L$lp -l$_"} qw/g2c m/;
+}
+
+$F77config{Cygwin}{G77}{Trail_} = 1;
+$F77config{Cygwin}{G77}{Compiler} = 'g77';
+$F77config{Cygwin}{G77}{Cflags} = '-O';
+$F77config{Cygwin}{G77}{Link}	= \&getcyglink;
+$F77config{Cygwin}{DEFAULT}	= 'G77';
+
+### Linux ###
+
+$F77config{Linux}{G77}     = $F77config{Generic}{G77};
+$F77config{Linux}{F2c}     = $F77config{Generic}{G77};
+#
+# database entry for the gfortran compiler
+#
+$F77config{Linux}{GFortran}{Link} = sub {
+    $dir = `gfortran -print-file-name=libgfortran.a`;
+    chomp $dir;
+    # Note that -print-file-name returns just the library name
+    # if it cant be found - make sure that we only accept the
+    # directory if it returns a proper path (or matches a /)
+
+    if( defined $dir ) {
+        $dir =~ s,/libgfortran.a$,,;
+    } else {
+        $dir = "/usr/local/lib";
+    }    
+    return( "-L$dir -L/usr/lib -lgfortran -lm" );
+};
+$F77config{Linux}{GFortran}{Trail_}   = 1;
+$F77config{Linux}{GFortran}{Compiler} = 'gfortran';
+$F77config{Linux}{GFortran}{Cflags}   = '-O';
+$F77config{Linux}{DEFAULT} = 'G77';
+
+# check for 'non g77' DEFAULT compilers on Linux:
+if (ucfirst($Config{'osname'}) eq "Linux") 
+{
+  my $default;
+
+  # check for gfortran compiler:
+  $default = find_in_path('gfortran');
+
+  if( $default =~ /gfortran/ )
+  {
+     $F77config{Linux}{DEFAULT} = 'GFortran'; 
+  } 
+
+  # code for ifort, g95 etc........
+}
+
+### DEC OSF/1 ###
+
+$F77config{Dec_osf}{F77}{Link}   = "-L/usr/lib -lUfor -lfor -lFutil -lm -lots -lc";
+$F77config{Dec_osf}{F77}{Trail_} = 1;
+$F77config{Dec_osf}{F77}{Compiler} = 'f77';
+$F77config{Dec_osf}{F77}{Cflags} = '-O';
+$F77config{Dec_osf}{DEFAULT}     = 'F77';
+
+### HP/UX ###
+
+$F77config{Hpux}{F77}{Link}   = "-L/usr/lib -lcl -lm";
+$F77config{Hpux}{F77}{Trail_} = 0;
+$F77config{Hpux}{F77}{Compiler} = 'f77';
+$F77config{Hpux}{F77}{Cflags} = '-O';
+$F77config{Hpux}{DEFAULT}     = 'F77';
+
+### IRIX ###
+
+# From: Ovidiu Toader <ovi at physics.utoronto.ca>
+# For an SGI running IRIX 6.4 or higher (probably lower than 6.4 also)
+# there is a new abi, -64, which produces 64 bit executables. This is no
+# longer an experimental feature and I am using it exclusively without any
+# problem. The code below is what I use instead of original IRIX section
+# in the ExtUtils::F77 package. It adds the -64 flag and it is supposed to
+# provide the same functionality as the old code for a non -64 abi. 
+
+if (ucfirst($Config{'osname'}) eq "Irix")
+{
+  my ($cflags,$mips,$default_abi,$abi,$mips_dir,$libs);
+  $cflags = $Config{cc};
+  ($mips) = ($cflags =~ /(-mips\d)/g);
+  $mips = "" if ! defined($mips);
+  $mips_dir = $mips;$mips_dir =~ s/-//g;
+  $default_abi = $Config{osvers} >= 6.4 ? "-n32" : "-o32";
+ GET_ABI:
+  {
+    # -32 seems to be synonymous for -o32 (CS)
+    $abi = "-o32",last GET_ABI if $cflags =~ /-o?32/;
+    $abi = "-n32",last GET_ABI if $cflags =~ /-n32/;
+    $abi = "-64",last GET_ABI if $cflags =~ /-64/;
+    $abi = $default_abi;
+  }
+  if ( $abi eq "-64" ){
+    $libs = ( (-r "/usr/lib64/$mips_dir") && (-d _) && (-x _) ) ?
+	"-L/usr/lib64/$mips_dir" : "";
+    $libs .=  " -L/usr/lib64 -lfortran -lm";
+  }
+  if ( $abi eq "-n32" ){
+    $libs = ( (-r "/usr/lib32/$mips_dir") && (-d _) && (-x _) ) ?
+	"-L/usr/lib32/$mips_dir" : "";
+    $libs .=  " -L/usr/lib32 -lfortran -lm";
+  }
+  if ( $abi eq "-o32" ){
+    $libs = "-L/usr/lib -lF77 -lI77 -lU77 -lisam -lm";
+  }
+  $F77config{Irix}{F77}{Cflags}   = "$abi $mips";
+  $F77config{Irix}{F77}{Link}     = "$libs";
+  $F77config{Irix}{F77}{Trail_}   = 1;
+  $F77config{Irix}{F77}{Compiler} = "f77 $abi";
+  $F77config{Irix}{DEFAULT}       = 'F77';
+}
+
+### AIX ###
+
+$F77config{Aix}{F77}{Link}   = "-L/usr/lib -lxlf90 -lxlf -lc -lm";
+$F77config{Aix}{F77}{Trail_} = 0;
+$F77config{Aix}{DEFAULT}     = 'F77';
+
+### FreeBSD ###
+
+$F77config{Freebsd}{F77}{Trail_} = 1;
+$F77config{Freebsd}{F77}{Link}   = '-L/usr/lib -lf2c -lm';
+$F77config{Freebsd}{DEFAULT}     = 'F77';
+
+### VMS ###
+
+$F77config{VMS}{Fortran}{Trail_} = 0;
+$F77config{VMS}{Fortran}{Link}   = ' ';         # <---need this space!
+$F77config{VMS}{DEFAULT}     = 'Fortran';
+$F77config{VMS}{Fortran}{Compiler} = 'Fortran';
+
+### Darwin (Mac OS X) ###
+
+$F77config{Darwin}{GFortran}{Trail_} = 1;
+$F77config{Darwin}{GFortran}{Cflags} = ' ';        # <---need this space!
+$F77config{Darwin}{GFortran}{Link}   = '-L/usr/local/lib -lgfortran';    
+$F77config{Darwin}{GFortran}{Compiler} = 'gfortran';
+
+$F77config{Darwin}{DEFAULT}     = 'G77';
+
+############ End of database is here ############ 
+
+=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;
+
+=cut
+
+# Package variables
+
+$Runtime = "-LSNAFU -lwontwork";
+$RuntimeOK = 0;
+$Trail_  = 1;
+$Pkg   = "";
+$Compiler = "";
+$Cflags = "";
+
+sub get; # See below
+
+# All the figuring out occurs during import - this is because
+# a lot of the answers depend on a lot of the guesswork.
+
+sub import {
+   no warnings; # Shuts up complaints on Win32 when running PDL tests
+   $Pkg    = shift;
+   my $system   = ucfirst(shift);  # Set package variables
+   my $compiler = ucfirst(shift);
+   $Runtime = "-LSNAFU -lwontwork";
+
+   # Guesses if system/compiler not specified.
+
+   $system   = ucfirst $Config{'osname'} unless $system;
+   $system = 'Cygwin' if $system =~ /Cygwin/;
+   $compiler = get $F77config{$system}{DEFAULT} unless $compiler;
+
+   print "$Pkg: Using system=$system compiler=" .
+       (defined $compiler ? $compiler : "<undefined>") . "\n";
+
+   if (defined($ENV{F77LIBS})) {
+      print "Overriding Fortran libs from value of enviroment variable F77LIBS = $ENV{F77LIBS}\n";
+      $Runtime = $ENV{F77LIBS};
+   }
+   else {
+
+     # Try this combination
+
+     if ( defined( $compiler ) and defined( $F77config{$system} )){
+     	my $flibs = get ($F77config{$system}{$compiler}{Link});
+        if ($flibs ne "") {
+     	   $Runtime = $flibs;# . gcclibs();
+	   # We don't want to append gcc libs if we are using
+	   # non gnu compilers. Initially, explicitly check for
+	   # use of sun compiler
+	   $Runtime .= gcclibs($flibs) unless $flibs =~ /sunmath/;
+	   $Runtime =~ s|L([a-z,A-Z]):|L//$1|g if $^O =~ /cygwin/i;
+           $Runtime = ' ' if $^O eq 'VMS';  # <-- need this space!
+	   print "Runtime: $Runtime\n";
+           $ok = 1;
+     	   $ok = validate_libs($Runtime) if $flibs ne "";
+	}
+     }else {
+     	$Runtime = $ok = "";
+     }
+
+     # If it doesn't work try Generic + GNU77
+
+      unless (("$Runtime" ne "-LSNAFU -lwontwork") && $ok) {
+     	print <<"EOD";
+$Pkg: Unable to guess and/or validate system/compiler configuration
+$Pkg: Will try system=Generic Compiler=G77
+EOD
+    	 $system   = "Generic";
+    	 $compiler = "G77";
+    	 my $flibs = get ($F77config{$system}{$compiler}{Link});
+    	 $Runtime =  $flibs . gcclibs($flibs);
+    	 $ok = validate_libs($Runtime) if $flibs ne "";
+    	 print "$Pkg: Well that didn't appear to validate. Well I will try it anyway.\n"
+    	      unless $Runtime && $ok;
+       }
+
+      $RuntimeOK = $ok;
+
+   } # Not overriding   
+
+   # Now get the misc info for the methods.
+
+   if (defined( $F77config{$system}{$compiler}{Trail_} )){
+      $Trail_  = get $F77config{$system}{$compiler}{Trail_};  
+   }
+   else{ 
+      print << "EOD";
+$Pkg: There does not appear to be any configuration info about
+$Pkg: names with trailing underscores for system $system. Will assume
+$Pkg: F77 names have trailing underscores.
+EOD
+      $Trail_ = 1;
+   }
+
+   if (defined( $F77config{$system}{$compiler}{Compiler} )) {
+	$Compiler = get $F77config{$system}{$compiler}{Compiler};
+   } else {
+	print << "EOD";
+$Pkg: There does not appear to be any configuration info about
+$Pkg: the F77 compiler name. Will assume 'f77'.
+EOD
+	$Compiler = 'f77';
+   }
+print "$Pkg: Compiler: $Compiler\n";
+
+   if (defined( $F77config{$system}{$compiler}{Cflags} )) {
+	$Cflags = get $F77config{$system}{$compiler}{Cflags} ;
+   } else {
+	print << "EOD";
+$Pkg: There does not appear to be any configuration info about
+$Pkg: the options for the F77 compiler. Will assume none
+$Pkg: necessary.
+EOD
+	$Cflags = '';
+   }
+
+   print "$Pkg: Cflags: $Cflags\n";
+
+} # End of import ()
+
+=head1 METHODS
+
+The following methods are provided:
+
+=over 4
+
+=item * B<runtime>
+
+Returns a list of F77 runtime libraries.
+
+  $fortranlibs = ExtUtils::F77->runtime;
+
+=item * B<runtimeok>
+
+Returns TRUE only if runtime libraries have been found successfully.
+
+=item * B<trail_>
+
+Returns true if F77 names have trailing underscores.
+
+=item * B<compiler>
+
+Returns command to execute the compiler (e.g. 'f77').
+
+=item * B<cflags>
+
+Returns compiler flags.
+
+=item * B<testcompiler>
+
+Test to see if compiler actually works.
+
+=back
+
+More methods  will probably be added in the future.
+
+=cut
+	
+sub runtime { return $Runtime; }
+sub runtimeok { return $RuntimeOK; }
+sub trail_  { return $Trail_; }
+sub compiler { return $Compiler; }
+sub cflags  { return $Cflags; }
+
+### Minor internal utility routines ###
+
+# Get hash entry, evaluating code references
+
+sub get { ref($_[0]) eq "CODE" ? &{$_[0]} : $_[0] };
+
+# Test if any files exist matching glob
+
+sub any_exists {
+    my @glob = glob(shift);
+    return scalar(@glob);
+}
+
+# Find highest version number of SCN.N(.N) directories
+# (Nasty SunOS/Solaris naming scheme for F77 libs]
+sub find_highest_SC {
+    print "$Pkg: Scanning for $_[0]\n";
+    my @glob = glob(shift);
+    my %n=();
+    for (@glob) {
+      #print "Found $_\n";
+       if ( m|/SC(\d)\.(\d)/?.*$| ) {
+           $n{$_} = $1 *100 + $2 * 10;
+       }
+       if ( m|/SC(\d)\.(\d)\.(\d)/?.*$| ) {
+           $n{$_} = $1 *100 + $2 * 10 + $3;
+       }
+    }
+    my @sorted_dirs = grep {-f "$_/libF77.a"} sort {$n{$a} <=> $n{$b}} @glob;
+
+    return pop @sorted_dirs; # Highest N
+}
+
+# Validate a string of form "-Ldir -lfoo -lbar"
+
+sub validate_libs {
+   print "$Pkg: Validating $_[0]   ";
+   my @args = split(' ',shift());
+   my $pat;
+   my $ret = 1;
+
+   # Create list of directories to search (with common defaults)
+
+   my @path = ();     
+   for (@args, "/usr/lib", "/lib") { 
+      push @path, $1 if /^-L(.+)$/ && -d $1;
+   }
+
+   # Search directories
+
+   for (@args) {      
+      next if /^-L/;
+      next if $_ eq "-lm"; # Ignore this common guy
+      if (/^-l(.+)$/) {
+         $pat = join(" ", map {$_."/lib".$1.".*"} @path); # Join dirs + file
+         #print "Checking for $pat\n";
+         unless (any_exists($pat)) {
+            print "\n$Pkg:    Unable to find library $_" ;
+            $ret = 0;
+         }
+       }
+   }
+   print $ret ? "[ok]\n" : "\n";
+   return $ret;
+}
+
+
+sub testcompiler {
+
+    my $file = File::Spec->tmpdir . "/testf77$$";
+    $file =~ s/\\/\//g; # For Win32
+
+    my $ret;
+    open(OUT,">$file.f");
+    print OUT "      print *, 'Hello World'\n";
+    print OUT "      end\n";
+    close(OUT);
+    print "Compiling the test Fortran program...\n";
+    system "$Compiler $Cflags $file.f -o ${file}_exe";
+    print "Executing the test program...\n";
+    if (`${file}_exe` ne " Hello World\n") {
+       print "Test of Fortran Compiler FAILED. \n";
+       print "Do not know how to compile Fortran on your system\n";
+       $ret=0;
+    }
+    else{
+       print "Congratulations you seem to have a working f77!\n";
+       $ret=1;
+    }
+    unlink("${file}_exe"); unlink("$file.f"); unlink("$file.o") if -e "$file.o";
+    return $ret;
+};
+
+# Return gcc libs (e.g. -L/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3_U1/2.7.0 -lgcc)
+
+sub gcclibs {
+   my $flibs = shift; # Fortran libs
+   my $isgcc = $Config{'cc'} eq 'gcc';
+   if (!$isgcc && $^O ne 'VMS') {
+      print "Checking for gcc in disguise:\n";
+      $isgcc = 1 if $Config{gccversion};
+      my $string;
+      if ($isgcc) {
+        $string = "Compiler is gcc version $Config{gccversion}";
+        $string .= "\n" unless $string =~ /\n$/;
+      } else {
+        $string = "Not gcc\n";
+      }
+      print $string;
+   }
+   if ($isgcc or ($flibs =~ /-lg2c/) or ($flibs =~ /-lf2c/) ) {
+       $gccdir = `gcc -print-libgcc-file-name`; chomp $gccdir;
+       $gccdir =~ s/\/libgcc.a//;
+       return " -L$gccdir -lgcc";   
+   }else{
+       return "";
+   }
+}
+
+# Try and find a program in the users PATH
+
+sub find_in_path {
+   my @names = @_;
+   my @path;
+   if($^O =~ /mswin32/i) {
+     for(@names) { $_ .= '.exe'}
+     @path = split(";", $ENV{PATH});
+     }
+   else {@path = split(":",$ENV{PATH})}
+   my ($name,$dir);
+   for $name (@names) {
+      for $dir (@path) {
+         if (-x $dir."/$name") {
+	    print "Found compiler $name\n";
+	    return $name;
+	  }
+      }
+   }
+   return '' if $^O eq 'VMS';
+   return undef;
+#   die "Unable to find a fortran compiler using names: ".join(" ", at names);
+}
+
+
+=head1 AUTHOR
+
+Karl Glazebrook (kgb at aaoepp.aao.GOV.AU).
+
+=cut
+
+
+1; # Return true
+
+
+
+

Added: branches/upstream/libextutils-f77-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libextutils-f77-perl/current/MANIFEST?rev=10925&op=file
==============================================================================
--- branches/upstream/libextutils-f77-perl/current/MANIFEST (added)
+++ branches/upstream/libextutils-f77-perl/current/MANIFEST Thu Dec  6 19:53:17 2007
@@ -1,0 +1,8 @@
+CHANGES
+README
+Makefile.PL
+F77.pm
+MANIFEST
+t/require.t
+COPYING
+META.yml                                 Module meta-data (added by MakeMaker)

Added: branches/upstream/libextutils-f77-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libextutils-f77-perl/current/META.yml?rev=10925&op=file
==============================================================================
--- branches/upstream/libextutils-f77-perl/current/META.yml (added)
+++ branches/upstream/libextutils-f77-perl/current/META.yml Thu Dec  6 19:53:17 2007
@@ -1,0 +1,10 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
+name:         ExtUtils-F77
+version:      1.16
+version_from: F77.pm
+installdirs:  site
+requires:
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.17

Added: branches/upstream/libextutils-f77-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libextutils-f77-perl/current/Makefile.PL?rev=10925&op=file
==============================================================================
--- branches/upstream/libextutils-f77-perl/current/Makefile.PL (added)
+++ branches/upstream/libextutils-f77-perl/current/Makefile.PL Thu Dec  6 19:53:17 2007
@@ -1,0 +1,13 @@
+
+# Makefile.PL for ExtUtils::F77
+
+use ExtUtils::MakeMaker;
+# # See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# # the contents of the Makefile that is written.
+WriteMakefile(
+     'NAME'	=> 'ExtUtils::F77',
+     'VERSION_FROM'	=> 'F77.pm',  
+     'linkext'  => {LINKTYPE => ''},  # Only .pm files in this directory
+    'dist'      => { COMPRESS=>"gzip", SUFFIX=>"gz" }
+ );
+

Added: branches/upstream/libextutils-f77-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/libextutils-f77-perl/current/README?rev=10925&op=file
==============================================================================
--- branches/upstream/libextutils-f77-perl/current/README (added)
+++ branches/upstream/libextutils-f77-perl/current/README Thu Dec  6 19:53:17 2007
@@ -1,0 +1,18 @@
+
+
+ExtUtils::F77 module 
+--------------------
+
+Karl Glazebrook
+
+karlglazebrook at yahoo.com
+
+[see file CHANGES for new features]
+
+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!
+
+Please see file COPYING for copyright/license information
+

Added: branches/upstream/libextutils-f77-perl/current/t/require.t
URL: http://svn.debian.org/wsvn/branches/upstream/libextutils-f77-perl/current/t/require.t?rev=10925&op=file
==============================================================================
--- branches/upstream/libextutils-f77-perl/current/t/require.t (added)
+++ branches/upstream/libextutils-f77-perl/current/t/require.t Thu Dec  6 19:53:17 2007
@@ -1,0 +1,52 @@
+#!/usr/local/bin/perl -w
+
+# Simple test to just load the F77.pm module
+
+use strict;
+use vars qw/$loaded/;
+
+BEGIN { $| = 1; print "1..2\n"; }
+END {print "not ok 1\n" unless $loaded;}
+use ExtUtils::F77;
+$loaded = 1;
+print "ok 1\n";
+
+# try compiling ?
+
+open(FH,">hello.f");
+print FH "
+      subroutine hello_fortran
+      print *, 'Hello from the wonderful world of fortran'
+c     $ExtUtils::F77::Compiler $ExtUtils::F77::Cflags $ExtUtils::F77::Runtime
+      return
+      end
+";
+
+close FH;
+unlink "hello.o" if(-e "hello.o");
+my $compile_command = "$ExtUtils::F77::Compiler  $ExtUtils::F77::Cflags -c hello.f ";
+my $rc = system($compile_command);
+$rc = 0xffff & $rc;
+if($rc){
+  if($rc == 0xff00){
+	 print "2  ERROR: $compile_command failed: $!";
+  }elsif ($rc > 0x80) {
+	 $rc >>= 8;
+	 print "2  WARNING: $compile_command returned non-zero exit status $rc\n";
+  }else{
+	 if($rc & 0x80){
+		print "2  $compile_command coredumped from signal $rc";
+	 }else{
+		print "2  $compile_command returned signal $rc";
+	 }
+  }  
+}else{
+  unlink "hello.f","hello.o";
+  print "ok 2\n" 
+}
+
+# how about linking - too complicated? 
+
+
+
+




More information about the Pkg-perl-cvs-commits mailing list