Make the HDF5 version check more general