diff --git a/doc/Makefile.am b/doc/Makefile.am
index ba6f64c7e825feaaf0e67f0044fccb7a1d046c45..cf5908aafe267701d15382736a9031e6e84764fa 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -22,7 +22,8 @@ doxygen-build.stamp: Doxyfile $(DOCINPUTS)
 
 install-data-local:
 	for f in `find html -type f \! -name "installdox"`; do	\
-		$(INSTALL_DATA) -D $$f $(DESTDIR)$(docdir)/$$f;	\
+		$(INSTALL) -d $(DESTDIR)$(docdir)/html/search;	\
+		$(INSTALL_DATA) $$f $(DESTDIR)$(docdir)/$$f;	\
 	done
 
 	$(INSTALL) -d $(DESTDIR)$(mandir)/man3