Statically link libgfortran in HDF5

When compiling HDF5 with Gnu compilers, there is a dependency on as a shared library. This is quite uncommon on many systems. “Regular” Fortran applications linked with gfortran can be statically linked with libgfortran with the flag “-static-libgfortran” to remove this dependency. Gcc used as a linker does not recognize this flag.

I have experimented with various options for building HDF5, but I always end up with a that depend on

Does anyone know if there are any tricks to build HDF5 with Gnu compilers and statically link to libgfortran?