HDF5 Fortran autotools build

While we strongly recommend using CMake to build HDF5 library, for those who need to use autotools, here’s how to build HDF5 for Fortran.

./configure --enable-fortran --enable-build-mode=production --prefix=~/.local/hdf5/

make -j4 install
-j4
number of build threads (equal or less to number of CPU cores)

This creates static and dynamic HDF5 libraries under the user install prefix:

hdf5/lib/libhdf5.a
hdf5/lib/libhdf5_fortran.a
hdf5/lib/libhdf5_hl.a
hdf5/lib/libhdf5_hl_fortran.a
hdf5/lib/libhdf5hl_fortran.a

The Fortran .mod files that need to be included are under

hdf5/include/

Usage

Tell CMake to use this HDF5 from your project by:

cmake -B build -DHDF5_ROOT=~/.local/hdf5/hdf5

cmake --build build