add rules for installing documentation
diff --git a/doc/Makefile.am b/doc/Makefile.am
index ce8e608..7ff758b 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -15,9 +15,14 @@
 #  along with this program; if not, write to the Free Software
 #  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
+AUTOMAKE_OPTIONS = foreign
+
 SUBDIRS = . images ru
 
-EXTRA_DIST = comparison.html \
+docdir = $(datadir)/doc/$(PACKAGE)-$(VERSION)
+
+doc_DATA =  \
+	comparison.html \
 	developers.html \
 	documentation.html \
 	download.html \
@@ -28,3 +33,4 @@
 	index.html \
 	news.html
 
+EXTRA_DIST = $(doc_DATA)
diff --git a/doc/images/Makefile.am b/doc/images/Makefile.am
index ce77bf6..2ce7adf 100644
--- a/doc/images/Makefile.am
+++ b/doc/images/Makefile.am
@@ -15,6 +15,13 @@
 #  along with this program; if not, write to the Free Software
 #  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-EXTRA_DIST = 1x1.gif \
+AUTOMAKE_OPTIONS = foreign
+
+docdir = $(datadir)/doc/$(PACKAGE)-$(VERSION)/images
+
+doc_DATA = \
+	1x1.gif \
 	cafebug.gif \
 	logo.jpg
+
+EXTRA_DIST = $(doc_DATA)
diff --git a/doc/ru/Makefile.am b/doc/ru/Makefile.am
index 38c7053..e63a143 100644
--- a/doc/ru/Makefile.am
+++ b/doc/ru/Makefile.am
@@ -15,7 +15,11 @@
 #  along with this program; if not, write to the Free Software
 #  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-EXTRA_DIST = \
+AUTOMAKE_OPTIONS = foreign
+
+docdir = $(datadir)/doc/$(PACKAGE)-$(VERSION)/ru
+
+doc_DATA = \
 	authors.html \
 	comparison.html \
 	developers.html \
@@ -28,3 +32,5 @@
 	index.html \
 	links.html \
 	news.html
+
+EXTRA_DIST = $(doc_DATA)