an accidental patch for this is in #1264 in the first patch (to HDF5's configuration.sh). The method is roughly what I would propose. The implementation could be done more nicely. I am also not sure how fragile this is. I am not sure how to implement this directly in the flesh (which would be the natural place for this to happen).