diff --git a/README.md b/README.md
index 614b8923b0a11a00509254b1896ad321ba6b4ea1..50c424cbd9fd41615f2744437614779c70e2d5b7 100644
--- a/README.md
+++ b/README.md
@@ -42,13 +42,12 @@ Requirements
 Installation
 -------------------------------------
 
-* Run `autogen.sh` and then `./configure`.
+* Run `autogen.sh` and then
+  `./configure --with-moduledir=/usr/lib/dovecot/modules`.
 
 * Type `make` to compile the plugin.
 
-* Find the plugin at `src/.libs/lib18_trees_plugin.so`.
-
-* Copy to `/usr/lib/dovecot/modules/`
+* Type `make install` to install the plugin to `/usr/lib/dovecot/modules/`
 
 * Enable the plugin. For example, add `mail_plugins = expire quota trees`
   to `/etc/dovecot/conf.d/10-mail.conf`
diff --git a/src/Makefile.am b/src/Makefile.am
index d8d70c77cf5de06e47d9bf48f31feb04e6a70cbb..13db4e44643b09714c94ce26d1d6e206cbb3ae61 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,6 +2,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/src -I$(builddir) $(LIBDOVECOT_INCLUDE)
 
 lib_LTLIBRARIES = lib18_trees_plugin.la
 
+libdir = $(moduledir)
+
 lib18_trees_plugin_la_SOURCES = \
 	trees-common.c  \
 	trees-common.h  \