configure error: (g)Fortran could not compile .f90 files

Dear all,
This question was asked in 2008 but no answer ever solved the problem.

I have encountered the same issue while compiling HDF5 with --enable-fortran on High Sierra
using the following:

F77=/usr/local/gfortran/bin/gfortran
F90=/usr/local/gfortran/bin/gfortran
F9X=/usr/local/gfortran/bin/gfortran

./configure -enable-fortran --enable-fortran2003 --prefix=/opt/local/

Thank you for helping.

Hello smarras,

The configure is attempting to compile a simple Fortran example and is not able to.

If you are sure that you can compile with your Fortran compiler, then please try to build again, but first set the FC environment variable to your Fortran compiler. For example:

setenv FC /usr/local/gfortran/bin/gfortran
./configure --enable-fortran …

If that does not solve the issue, then look at the config.log file to see what the issue is. Go to the end of it, and then search backwards for the error message. If you still cannot resolve the issue, please send your config.log file to the HDF Helpdesk (help@hdfgroup.org).

To see the influential environment variables that you can use with configure, type: configure -help

-Barbara
help@hdfgroup.org