diff --git a/configure.in b/configure.in
index d4954805d59c54d00eaedec73fe92b9a1a00e1e0..5e39a346ff7432ecf28144b8e55337ea939d0aee 100644
--- a/configure.in
+++ b/configure.in
@@ -42,9 +42,10 @@ if test -d "$dovecotdir/src"; then
   have_dovecot_libs=yes
 else
   # compiling against installed headers
-  echo 
-  echo "Cannot compile against the installed headers only."
-  AC_MSG_ERROR([dovecot-source not found]);
+  echo "WARNING: Cannot build Sieve commandline tools without the compiled"
+  echo "         Dovecot sources. Compiling against headers will only build"
+  echo "         the Sieve plugin." 
+  have_dovecot_libs=no
 fi
 AM_CONDITIONAL(HAVE_DOVECOT_LIBS, test "$have_dovecot_libs" = "yes")
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 6cefe1d780b71124d7e473c28016e85887ace271..6389f2132a228b4f511bbde4387ee2fc0ed1bac5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,2 +1,6 @@
-SUBDIRS = lib-sieve lib-sieve-tool sieve-tools plugins testsuite
+if HAVE_DOVECOT_LIBS
+LIB_DEPEND_DIRS=lib-sieve-tool sieve-tools testsuite
+endif
+
+SUBDIRS = lib-sieve plugins $(LIB_DEPEND_DIRS)