1package F77Conf;
2# a minimal hardcoded config designed for debian so that we don't need
3# ExtUtils::F77 when building PDL
4
5print "Config   ",__PACKAGE__->config(),"\n";
6print "Compiler ",__PACKAGE__->compiler(),"\n";
7print "Runtime  ",__PACKAGE__->runtime(),"\n";
8print "Trail_   ",__PACKAGE__->trail_() ? "yes" : "no", "\n";
9print "Cflags   ",__PACKAGE__->cflags(),"\n";
10
11
12sub config {
13  return 'debian';
14}
15
16sub runtime {
17  my $libpath = `gfortran -print-libgcc-file-name`;
18  $libpath =~ s/libgcc[.]a$//;
19  chomp $libpath;
20  my $ldflags = '';
21  $ldflags .= $ENV{LDFLAGS} if (defined $ENV{LDFLAGS});
22  $ldflags .= " -L$libpath -lgcc -lgfortran";
23  return($ldflags);
24}
25
26sub trail_ {
27  return 1;
28}
29
30sub compiler {
31  return 'gfortran';
32}
33
34sub cflags {
35  my $fflags = '';
36  $fflags = $ENV{FFLAGS} if (defined $ENV{FFLAGS});
37  $fflags.=' -fPIC';
38  return($fflags);
39}
40
41sub testcompiler {
42  my ($this) = @_;
43    my $file = "/tmp/testf77$$";
44    my $ret;
45    open(OUT,">$file.f");
46    print OUT "      print *, 'Hello World'\n";
47    print OUT "      end\n";
48    close(OUT);
49    print "Compiling the test Fortran program...\n";
50    my ($compiler,$cflags) = ($this->compiler,$this->cflags);
51    system "$compiler $cflags $file.f -o ${file}_exe";
52    print "Executing the test program...\n";
53    if (`${file}_exe` ne " Hello World\n") {
54       print "Test of Fortran Compiler FAILED. \n";
55       print "Do not know how to compile Fortran on your system\n";
56       $ret=0;
57    }
58    else{
59       print "Congratulations you seem to have a working f77!\n";
60       $ret=1;
61    }
62    unlink("${file}_exe"); unlink("$file.f"); unlink("$file.o") if -e "$file.o";
63    return $ret;
64}
65
661;
67
68