diff --git a/avrdude/configure.ac b/avrdude/configure.ac
index 28cca8b6..9981ab89 100644
--- a/avrdude/configure.ac
+++ b/avrdude/configure.ac
@@ -59,6 +59,26 @@ AC_CHECK_FUNCS([memset select strcasecmp strdup strerror strncasecmp strtol strt
 
 # Checks for misc stuff.
 
+AC_ARG_ENABLE(
+	[versioned-doc],
+	AC_HELP_STRING(
+		[--enable-versioned-doc],
+		[install docs in directory with version name (default)]),
+	[case "${enableval}" in
+		yes) versioned_doc=yes ;;
+		no)  versioned_doc=no ;;
+		*)   AC_MSG_ERROR(bad value ${enableval} for versioned-doc option) ;;
+		esac],
+	[versioned_doc=yes])
+
+if test "$versioned_doc" = "yes"; then
+    DOC_INST_DIR='$(DESTDIR)$(datadir)/doc/avrdude-$(VERSION)'
+else
+    DOC_INST_DIR='$(DESTDIR)$(datadir)/doc/avrdude'
+fi
+
+AC_SUBST(DOC_INST_DIR, $DOC_INST_DIR)
+
 # Find the parallel serial device files based on target system
 # If a system doesn't have a PC style parallel, mark it as unknown.
 case $target in
diff --git a/avrdude/doc/Makefile.am b/avrdude/doc/Makefile.am
index 3ef76cb1..6427b6af 100644
--- a/avrdude/doc/Makefile.am
+++ b/avrdude/doc/Makefile.am
@@ -32,3 +32,19 @@ html:
 
 clean-local:
 	rm -rf avrdude-html *.info
+
+install-data-local: install-docs
+
+install-docs: html ps pdf
+	$(mkinstalldirs) $(DOC_INST_DIR)
+	$(INSTALL_DATA) avrdude.ps $(DOC_INST_DIR)/avrdude.ps
+	$(INSTALL_DATA) avrdude.pdf $(DOC_INST_DIR)/avrdude.pdf
+	$(mkinstalldirs) $(DOC_INST_DIR)/avrdude-html
+	@list=`echo avrdude-html/*.html`; \
+		for file in $$list; \
+		do \
+			$(INSTALL_DATA) $$file $(DOC_INST_DIR)/$$file; \
+		done
+
+uninstall-local:
+	rm -rf $(DOC_INST_DIR)