What you really want, after configure has confirmed openmpi with the
macro check, is to extract the libraries listed in the output of
mpif90 -v test.f
that are needed.
Ideally someone could update ompi_config to output the link flags for 3 cases:
C++ linking without using mpicxx
F90 linking without using mpif90
F90 linking without f90
but that's a nontrivial bit of work.
The fortran lib extraction process can be rather hairy if done portably-- the
babel team at llnl has largely solved it in
and related files obtainable from