Can't use Fortran 90/95 compiler for F77

View: New views
4 Messages — Rating Filter:   Alert me  

Can't use Fortran 90/95 compiler for F77

by Daily, Jeff A :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 <<testsuite.log>>
We use autoconf to build a mixed Fortran 77/C/C++ code and have recently
run into problems using Fortran 90/95 compilers for F77.  Our Fortran
source is Fortran 77 and all Fortran 77 source files use either the *.f
or *.F extension.  We also set the default INTEGER size of the Fortran
compiler to the same size returned by AC_CHECK_SIZEOF(void*), when
available.  To allow for setting of the default INTEGER size we look for
Fortran 90/95 compilers first using AC_PROG_F77 with a custom argument
list of Fortran compilers to search for.  In particular on a BlueGene/P
system using the IBM XL compilers, the conftest compilation fails during
AC_PROG_F77 because "-qfixed" is required to compile the source
correctly.  I am aware of the macros AC_FC_FREEFORM and AC_FC_SRCEXT yet
neither help in this case.  In my opinion, AC_PROG_F77 should detect any
necessary flags for compiling F77 source with F90/95 compilers.

I've attached the test suite for autoconf on the BlueGene/P platform in
question, although I doubt it matters in this case.

Thanks.

________________________________

Jeff Daily
Scientist
APPLIED COMPUTER SCIENCE

Pacific Northwest National Laboratory
902 Battelle Boulevard
P.O. Box 999, MSIN K7-90
Richland, WA 99352 USA
Tel: 509-372-6548
jeff.daily@...
www.pnl.gov




testsuite.log (49K) Download Attachment

Re: Can't use Fortran 90/95 compiler for F77

by Ralf Wildenhues :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Jeff,

thanks for the report.

* Daily, Jeff A wrote on Tue, Nov 03, 2009 at 09:50:46PM CET:

>  <<testsuite.log>>
> We use autoconf to build a mixed Fortran 77/C/C++ code and have recently
> run into problems using Fortran 90/95 compilers for F77.  Our Fortran
> source is Fortran 77 and all Fortran 77 source files use either the *.f
> or *.F extension.  We also set the default INTEGER size of the Fortran
> compiler to the same size returned by AC_CHECK_SIZEOF(void*), when
> available.  To allow for setting of the default INTEGER size we look for
> Fortran 90/95 compilers first using AC_PROG_F77 with a custom argument
> list of Fortran compilers to search for.  In particular on a BlueGene/P
> system using the IBM XL compilers, the conftest compilation fails during
> AC_PROG_F77 because "-qfixed" is required to compile the source
> correctly.  I am aware of the macros AC_FC_FREEFORM and AC_FC_SRCEXT yet
> neither help in this case.  In my opinion, AC_PROG_F77 should detect any
> necessary flags for compiling F77 source with F90/95 compilers.

First, does using
  ./configure F77="f77 -qfixed"

work, when you replace f77 with your compiler name?

Then, can you try this, and show all output plus config.log?  Thanks.

cat >configure.ac <<\EOF
AC_INIT
AC_PROG_F77
AC_PROG_FC
AC_FC_SRCEXT([f])
AC_OUTPUT
EOF
autoconf
./configure


Cheers,
Ralf



Parent Message unknown Re: Can't use Fortran 90/95 compiler for F77

by Ralf Wildenhues :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Jeff,

thanks for your reply.  Please keep the mailing list in Cc:, so that
others can see, too, and please don't top-post.  Thanks.

* Daily, Jeff A wrote on Wed, Nov 04, 2009 at 05:25:37PM CET:

> From: Ralf Wildenhues:
> > First, does using
> >   ./configure F77="f77 -qfixed"
> >
> > work, when you replace f77 with your compiler name?
> >
> > Then, can you try this, and show all output plus config.log?  Thanks.
> >
> > cat >configure.ac <<\EOF
> > AC_INIT
> > AC_PROG_F77
> > AC_PROG_FC
> > AC_FC_SRCEXT([f])
> > AC_OUTPUT
> > EOF
> > autoconf
> > ./configure

> Adding "-qfixed" worked.  Curiously, removing it also worked this
> morning.  Please ignore my message unless the problem manifests again.
> This likely has more to do with BlueGene/P using a cross-compiler and my
> unfamiliarity with that system.

OK.  Well, if you come across this again, just perform the actions I
noted and report back.  IIRC then the compiler should accept fixed
format if the file has ending .f and the compiler is invoked as "f77",
so it might just be you used a different alias name for it before.

Cheers,
Ralf



Parent Message unknown Re: Can't use Fortran 90/95 compiler for F77

by Ralf Wildenhues :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

* Daily, Jeff A wrote on Thu, Nov 05, 2009 at 12:20:28AM CET:
> It looks like this is an issue of saving the users from themselves.
> Using the Fortran 77 alias on this BGP system sets "-qfixed" as the
> default for xlf.  Using any later Fortran compiler assumes free form
> source regardless of the file's extension.

That matches my recollections on this compiler, thanks.

> The problems don't end
> there, however, since anything but the Fortran 77 compiler barfs on the
> "c" comment indicator in our Fortran 77 source files.

No idea about that.

> And worse yet, for the xlf compilers you must use -WF,-D
> instead of simply -D for the customary -DHAVE_CONFIG_H.

Yeah, I know.  We should fix Automake/Autoconf to cope better with this.
For the moment, if you don't compile any C, C++, or similar sources in
the directory where you compile the Fortran code, you should be able to
put something like this workaround in Makefile.am:
  DEFS = -WF,-DHAVE_CONFIG_H

Cheers,
Ralf