--- a/HDF4/config/examples.am
+++ b/HDF4/config/examples.am
@@ -44,7 +44,7 @@
 CLEANFILES=$(EXAMPLE_PROG)
 
 # How to create EXAMPLEDIR if it doesn't already exist
-$(EXAMPLEDIR):
+$(DESTDIR)$(EXAMPLEDIR):
 	mkdir -p $@
 
 # Install and uninstall rules.  We install the source files, not the
@@ -54,27 +54,27 @@
 uninstall-local:
 	@$(MAKE) $(AM_MAKEFLAGS) uninstall-examples
 
-install-examples: $(EXAMPLEDIR) 
+install-examples: $(DESTDIR)$(EXAMPLEDIR) 
 	@for f in X $(INSTALL_FILES); do                                     \
 	  if test $$f != X; then                                             \
-	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);    \
-	    chmod a-x $(EXAMPLEDIR)/$$f;                                     \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(DESTDIR)$(EXAMPLEDIR)/. || exit 1);    \
+	    chmod a-x $(DESTDIR)$(EXAMPLEDIR)/$$f;                                     \
 	  fi;                                                                \
 	done
 	@for f in X $(INSTALL_SCRIPT_FILES); do                              \
 	  if test $$f != X; then                                             \
-	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);    \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(DESTDIR)$(EXAMPLEDIR)/. || exit 1);    \
 	  fi;                                                                \
 	done
 	@for f in X $(INSTALL_TOP_FILES); do                                 \
 	  if test $$f != X; then                                             \
-	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLETOPDIR)/. || exit 1); \
-	    chmod a-x $(EXAMPLETOPDIR)/$$f;                                  \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(DESTDIR)$(EXAMPLETOPDIR)/. || exit 1); \
+	    chmod a-x $(DESTDIR)$(EXAMPLETOPDIR)/$$f;                                  \
 	  fi;                                                                \
 	done
 	@for f in X $(INSTALL_TOP_SCRIPT_FILES); do                          \
 	  if test $$f != X; then                                             \
-	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLETOPDIR)/. || exit 1); \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(DESTDIR)$(EXAMPLETOPDIR)/. || exit 1); \
 	  fi;                                                                \
 	done
 
--- a/HDF4/hdf/examples/Makefile.in
+++ b/HDF4/hdf/examples/Makefile.in
@@ -559,7 +559,7 @@
 AN_read_annotation: $(srcdir)/AN_read_annotation.c
 
 # How to create EXAMPLEDIR if it doesn't already exist
-$(EXAMPLEDIR):
+$(DESTDIR)$(EXAMPLEDIR):
 	mkdir -p $@
 
 # Install and uninstall rules.  We install the source files, not the
@@ -569,27 +569,27 @@
 uninstall-local:
 	@$(MAKE) $(AM_MAKEFLAGS) uninstall-examples
 
-install-examples: $(EXAMPLEDIR) 
+install-examples: $(DESTDIR)$(EXAMPLEDIR) 
 	@for f in X $(INSTALL_FILES); do                                     \
 	  if test $$f != X; then                                             \
-	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);    \
-	    chmod a-x $(EXAMPLEDIR)/$$f;                                     \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(DESTDIR)$(EXAMPLEDIR)/. || exit 1);    \
+	    chmod a-x $(DESTDIR)$(EXAMPLEDIR)/$$f;                                     \
 	  fi;                                                                \
 	done
 	@for f in X $(INSTALL_SCRIPT_FILES); do                              \
 	  if test $$f != X; then                                             \
-	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);    \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(DESTDIR)$(EXAMPLEDIR)/. || exit 1);    \
 	  fi;                                                                \
 	done
 	@for f in X $(INSTALL_TOP_FILES); do                                 \
 	  if test $$f != X; then                                             \
-	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLETOPDIR)/. || exit 1); \
-	    chmod a-x $(EXAMPLETOPDIR)/$$f;                                  \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(DESTDIR)$(EXAMPLETOPDIR)/. || exit 1); \
+	    chmod a-x $(DESTDIR)$(EXAMPLETOPDIR)/$$f;                                  \
 	  fi;                                                                \
 	done
 	@for f in X $(INSTALL_TOP_SCRIPT_FILES); do                          \
 	  if test $$f != X; then                                             \
-	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLETOPDIR)/. || exit 1); \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(DESTDIR)$(EXAMPLETOPDIR)/. || exit 1); \
 	  fi;                                                                \
 	done
 
--- a/HDF4/hdf/fortran/examples/Makefile.in
+++ b/HDF4/hdf/fortran/examples/Makefile.in
@@ -551,7 +551,7 @@
 AN_read_annotation: $(srcdir)/AN_read_annotation.f
 
 # How to create EXAMPLEDIR if it doesn't already exist
-$(EXAMPLEDIR):
+$(DESTDIR)$(EXAMPLEDIR):
 	mkdir -p $@
 
 # Install and uninstall rules.  We install the source files, not the
@@ -561,27 +561,27 @@
 uninstall-local:
 	@$(MAKE) $(AM_MAKEFLAGS) uninstall-examples
 
-install-examples: $(EXAMPLEDIR) 
+install-examples: $(DESTDIR)$(EXAMPLEDIR) 
 	@for f in X $(INSTALL_FILES); do                                     \
 	  if test $$f != X; then                                             \
-	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);    \
-	    chmod a-x $(EXAMPLEDIR)/$$f;                                     \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(DESTDIR)$(EXAMPLEDIR)/. || exit 1);    \
+	    chmod a-x $(DESTDIR)$(EXAMPLEDIR)/$$f;                                     \
 	  fi;                                                                \
 	done
 	@for f in X $(INSTALL_SCRIPT_FILES); do                              \
 	  if test $$f != X; then                                             \
-	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);    \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(DESTDIR)$(EXAMPLEDIR)/. || exit 1);    \
 	  fi;                                                                \
 	done
 	@for f in X $(INSTALL_TOP_FILES); do                                 \
 	  if test $$f != X; then                                             \
-	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLETOPDIR)/. || exit 1); \
-	    chmod a-x $(EXAMPLETOPDIR)/$$f;                                  \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(DESTDIR)$(EXAMPLETOPDIR)/. || exit 1); \
+	    chmod a-x $(DESTDIR)$(EXAMPLETOPDIR)/$$f;                                  \
 	  fi;                                                                \
 	done
 	@for f in X $(INSTALL_TOP_SCRIPT_FILES); do                          \
 	  if test $$f != X; then                                             \
-	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLETOPDIR)/. || exit 1); \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(DESTDIR)$(EXAMPLETOPDIR)/. || exit 1); \
 	  fi;                                                                \
 	done
 
--- a/HDF4/mfhdf/examples/Makefile.in
+++ b/HDF4/mfhdf/examples/Makefile.in
@@ -523,7 +523,7 @@
 chunking_example: $(srcdir)/SD_chunking_example.c
 
 # How to create EXAMPLEDIR if it doesn't already exist
-$(EXAMPLEDIR):
+$(DESTDIR)$(EXAMPLEDIR):
 	mkdir -p $@
 
 # Install and uninstall rules.  We install the source files, not the
@@ -533,27 +533,27 @@
 uninstall-local:
 	@$(MAKE) $(AM_MAKEFLAGS) uninstall-examples
 
-install-examples: $(EXAMPLEDIR) 
+install-examples: $(DESTDIR)$(EXAMPLEDIR) 
 	@for f in X $(INSTALL_FILES); do                                     \
 	  if test $$f != X; then                                             \
-	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);    \
-	    chmod a-x $(EXAMPLEDIR)/$$f;                                     \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(DESTDIR)$(EXAMPLEDIR)/. || exit 1);    \
+	    chmod a-x $(DESTDIR)$(EXAMPLEDIR)/$$f;                                     \
 	  fi;                                                                \
 	done
 	@for f in X $(INSTALL_SCRIPT_FILES); do                              \
 	  if test $$f != X; then                                             \
-	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);    \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(DESTDIR)$(EXAMPLEDIR)/. || exit 1);    \
 	  fi;                                                                \
 	done
 	@for f in X $(INSTALL_TOP_FILES); do                                 \
 	  if test $$f != X; then                                             \
-	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLETOPDIR)/. || exit 1); \
-	    chmod a-x $(EXAMPLETOPDIR)/$$f;                                  \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(DESTDIR)$(EXAMPLETOPDIR)/. || exit 1); \
+	    chmod a-x $(DESTDIR)$(EXAMPLETOPDIR)/$$f;                                  \
 	  fi;                                                                \
 	done
 	@for f in X $(INSTALL_TOP_SCRIPT_FILES); do                          \
 	  if test $$f != X; then                                             \
-	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLETOPDIR)/. || exit 1); \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(DESTDIR)$(EXAMPLETOPDIR)/. || exit 1); \
 	  fi;                                                                \
 	done
 
--- a/HDF4/mfhdf/fortran/examples/Makefile.in
+++ b/HDF4/mfhdf/fortran/examples/Makefile.in
@@ -524,7 +524,7 @@
 SD_chunking_example: $(srcdir)/SD_chunking_example.f
 
 # How to create EXAMPLEDIR if it doesn't already exist
-$(EXAMPLEDIR):
+$(DESTDIR)$(EXAMPLEDIR):
 	mkdir -p $@
 
 # Install and uninstall rules.  We install the source files, not the
@@ -534,27 +534,27 @@
 uninstall-local:
 	@$(MAKE) $(AM_MAKEFLAGS) uninstall-examples
 
-install-examples: $(EXAMPLEDIR) 
+install-examples: $(DESTDIR)$(EXAMPLEDIR) 
 	@for f in X $(INSTALL_FILES); do                                     \
 	  if test $$f != X; then                                             \
-	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);    \
-	    chmod a-x $(EXAMPLEDIR)/$$f;                                     \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(DESTDIR)$(EXAMPLEDIR)/. || exit 1);    \
+	    chmod a-x $(DESTDIR)$(EXAMPLEDIR)/$$f;                                     \
 	  fi;                                                                \
 	done
 	@for f in X $(INSTALL_SCRIPT_FILES); do                              \
 	  if test $$f != X; then                                             \
-	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);    \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(DESTDIR)$(EXAMPLEDIR)/. || exit 1);    \
 	  fi;                                                                \
 	done
 	@for f in X $(INSTALL_TOP_FILES); do                                 \
 	  if test $$f != X; then                                             \
-	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLETOPDIR)/. || exit 1); \
-	    chmod a-x $(EXAMPLETOPDIR)/$$f;                                  \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(DESTDIR)$(EXAMPLETOPDIR)/. || exit 1); \
+	    chmod a-x $(DESTDIR)$(EXAMPLETOPDIR)/$$f;                                  \
 	  fi;                                                                \
 	done
 	@for f in X $(INSTALL_TOP_SCRIPT_FILES); do                          \
 	  if test $$f != X; then                                             \
-	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLETOPDIR)/. || exit 1); \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(DESTDIR)$(EXAMPLETOPDIR)/. || exit 1); \
 	  fi;                                                                \
 	done
 
