HDF5-1.8.14 links to wrong version of itself

Hi
following change in recent version of HDF5:

--- configure.ac-1.8.13
+++ configure.ac-1.8.14
@@ -115,7 +115,12 @@
AM_CXXFLAGS="${AM_CXXFLAGS}"
AM_FCFLAGS="${AM_FCFLAGS}"
AM_CPPFLAGS="${AM_CPPFLAGS}"
-AM_LDFLAGS="${AM_LDFLAGS}"
+# Added to address HDFFV-8944
+if test "x$prefix" = xNONE; then
+ AM_LDFLAGS="$AM_LDFLAGS -L$ac_default_prefix/lib"
+else
+ AM_LDFLAGS="$AM_LDFLAGS -L$prefix/lib"
+fi
CFLAGS="${CFLAGS}"
CXXFLAGS="${CXXFLAGS}"
FCFLAGS="${FCFLAGS}"

causes freshly build libs to link against older version of HDF5:

$ ldd /usr/lib/libhdf5_hl.so.9 | grep hdf5
  libhdf5.so.8 => /usr/lib/libhdf5.so.8 (0x00007f9e999c2000)

I think this change made the initial problem:

- Autotools: Modified configure to add an entry at the beginning of
AM_LDFLAGS for the hdf5 install directory. Without this entry the
relink commands invoked by "make install" to create libraries dependent
on libhdf5.so added a dependency on the first libhdf5.so found in any
directory in AM_LDFLAGS regardless of its version. (LRK - 2014/10/17
HDFFV-8944)

only worse.

Best regards,
Kacper Kowalik