HDF4 build broken when using DESTDIR


Release 4.2.10 of hdf4 seems to have broken installation using DESTDIR.

This is how I'm doing the build (as non-root):

   export CFLAGS=$CFLAGS" -fPIC"
  ./configure --prefix=/usr --disable-netcdf --enable-shared
  make DESTDIR=/tmp/hdf4/ install

It gives this error:

make[1]: Leaving directory '/home/fhs/src/abs/hdf4-nonetcdf/src/hdf-4.2.10'
+ for d in hdf mfhdf
+ cd hdf
+ make install-examples
make[1]: Entering directory
+ for d in examples
+ cd examples
+ make install-examples
make[2]: Entering directory
mkdir -p /usr/examples/c
mkdir: cannot create directory ‘/usr/examples’: Permission denied
Makefile:563: recipe for target '/usr/examples/c' failed
make[2]: *** [/usr/examples/c] Error 1
make[2]: Leaving directory
+ exit 1
Makefile:639: recipe for target 'install-examples' failed
make[1]: *** [install-examples] Error 1
make[1]: Leaving directory
+ exit 1
Makefile:872: recipe for target 'install-examples' failed
make: *** [install-examples] Error 1

I worked around this issue by changing these variables in
hdf/examples/Makefile.in and mfhdf/examples/Makefile.in:

  EXAMPLEDIR = $(prefix)/examples/c
  EXAMPLETOPDIR = $(prefix)/examples

to this:

  EXAMPLEDIR = ${DESTDIR}$(prefix)/examples/c
  EXAMPLETOPDIR = ${DESTDIR}$(prefix)/examples

I think similar changes are necessary for the fortran examples.

I hope this gets fixed in the next release.