diff --git a/configure.ac b/configure.ac
index 81d1cde3895e707d77901e79f4985bab83e7a062..64a7119c816f0119f5d72f06b524afaf09cf3ea5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,44 +36,32 @@ LT_INIT
 m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], [AC_SUBST([pkgconfigdir], ['${libdir}/pkgconfig'])])
 AC_CONFIG_FILES([libknot.pc])
 
-AC_CACHE_CHECK([for reentrant lex], [ac_cv_path_LEX],
-  [AC_PATH_PROGS_FEATURE_CHECK([LEX], [$LEX flex gflex],
-  [cat >conftest.l <<_ACEOF
-%{
-%}
+# Build Knot DNS daemon
+AC_ARG_ENABLE([daemon],
+    AS_HELP_STRING([--disable-daemon], [Don't build Knot DNS main daemon]), [], [enable_daemon=yes])
+AM_CONDITIONAL([HAVE_DAEMON], [test "$enable_daemon" = "yes"])
 
-%option reentrant
-%option bison-bridge
-%option noinput
-%option nounput
-%option noreject
+# Build Knot DNS utilities
+AC_ARG_ENABLE([utilities],
+    AS_HELP_STRING([--disable-utilities], [Don't build Knot DNS utilities]), [], [enable_utilities=yes])
+AM_CONDITIONAL([HAVE_UTILS], [test "$enable_utilities" = "yes"])
 
-BLANK [ \t\n]
+# Build Knot DNS documentation
+AC_ARG_ENABLE([documentation],
+    AS_HELP_STRING([--disable-documentation], [Don't build Knot DNS documentation]), [], [enable_documentation=yes])
+AM_CONDITIONAL([HAVE_DOCS], [test "$enable_documentation" = "yes"])
 
-%%
-<<EOF>> return 0;
-%%
-_ACEOF
-_AC_DO_VAR(ac_path_LEX conftest.l)
-test $ac_status -eq 0 && ac_cv_path_LEX=$ac_path_LEX ac_path_LEX_found=true
-rm -f conftest.l lexyy.c lex.yy.c
-],
-[AC_MSG_ERROR([could not find lex that supports reentrant parsers])])])
-AC_SUBST([LEX], [$ac_cv_path_LEX])
-AM_PROG_LEX
+######################
+# Generic dependencies
+######################
 
-AC_PROG_YACC
-YACC_BISON=`bison --version | awk '{print $1;exit}'`
-AS_IF([test "x$YACC_BISON" != "xbison"],
-    [AC_MSG_ERROR([GNU bison needed for reentrant parsers, set the \$YACC variable before running configure])])
 AC_PROG_INSTALL
 
 # Set zone parser type
 AC_ARG_ENABLE([fastparser],
     AS_HELP_STRING([--disable-fastparser], [Use slower zone parser]),
     [], [enable_fastparser=yes])
-AM_CONDITIONAL([FAST_PARSER], [test "$enable_fastparser" = yes])
-
+AM_CONDITIONAL([FAST_PARSER], [test "$enable_fastparser" = "yes"])
 
 # GnuTLS crypto backend
 PKG_CHECK_MODULES([gnutls], [gnutls >= 3.0 nettle])
@@ -81,21 +69,6 @@ PKG_CHECK_MODULES([gnutls], [gnutls >= 3.0 nettle])
 # JSON for DNSSEC status storage
 PKG_CHECK_MODULES([jansson], [jansson >= 2.3])
 
-# Systemd integration
-AC_ARG_ENABLE([systemd],
-    AS_HELP_STRING([--enable-systemd=auto|yes|no], [enable systemd integration [default=auto]]),
-    [enable_systemd="$enableval"], [enable_systemd=auto])
-
-AS_IF([test "$enable_system" != "no"],[
-  AS_CASE([$enable_systemd],
-    [auto],[PKG_CHECK_MODULES([systemd], [libsystemd-daemon libsystemd-journal], [enable_systemd=yes], [enable_systemd=no])],
-    [yes],[PKG_CHECK_MODULES([systemd], [libsystemd-daemon libsystemd-journal])],
-    [*],[AC_MSG_ERROR([Invalid value of --enable-systemd.])])
-    ])
-
-AS_IF([test "$enable_systemd" = "yes"],[
-  AC_DEFINE([ENABLE_SYSTEMD], [1], [Use systemd integration.])])
-
 # Debug modules
 AC_ARG_ENABLE([debug],
     AS_HELP_STRING([--enable-debug=server,zones,ns,loader,dnssec],
@@ -183,17 +156,74 @@ AC_ARG_WITH([configdir],
         [config_dir=$withval])
 AC_SUBST(config_dir)
 
-# Checks for libraries.
-# FIXME: Replace `main' with a function in `-lm':
+#########################################
+# Dependencies needed for Knot DNS daemon
+#########################################
+AS_IF([test "$enable_daemon" = "yes"],[
+
+AC_CACHE_CHECK([for reentrant lex], [ac_cv_path_LEX],
+  [AC_PATH_PROGS_FEATURE_CHECK([LEX], [$LEX flex gflex],
+  [cat >conftest.l <<_ACEOF
+%{
+%}
+
+%option reentrant
+%option bison-bridge
+%option noinput
+%option nounput
+%option noreject
+
+BLANK [ \t\n]
+
+%%
+<<EOF>> return 0;
+%%
+_ACEOF
+_AC_DO_VAR(ac_path_LEX conftest.l)
+test $ac_status -eq 0 && ac_cv_path_LEX=$ac_path_LEX ac_path_LEX_found=true
+rm -f conftest.l lexyy.c lex.yy.c
+],
+[AC_MSG_ERROR([could not find lex that supports reentrant parsers])])])
+AC_SUBST([LEX], [$ac_cv_path_LEX])
+AM_PROG_LEX
+
+AC_PROG_YACC
+YACC_BISON=`bison --version | awk '{print $1;exit}'`
+AS_IF([test "x$YACC_BISON" != "xbison"],
+    [AC_MSG_ERROR([GNU bison needed for reentrant parsers, set the \$YACC variable before running configure])])
+
+])
+
+# Systemd integration
+AC_ARG_ENABLE([systemd],
+    AS_HELP_STRING([--enable-systemd=auto|yes|no], [enable systemd integration [default=auto]]),
+    [enable_systemd="$enableval"], [enable_systemd=auto])
+
+AS_IF([test "$enable_daemon" = "yes"],[
+
+AS_IF([test "$enable_system" != "no"],[
+  AS_CASE([$enable_systemd],
+    [auto],[PKG_CHECK_MODULES([systemd], [libsystemd-daemon libsystemd-journal], [enable_systemd=yes], [enable_systemd=no])],
+    [yes],[PKG_CHECK_MODULES([systemd], [libsystemd-daemon libsystemd-journal])],
+    [*],[AC_MSG_ERROR([Invalid value of --enable-systemd.])])
+    ])
+
+AS_IF([test "$enable_systemd" = "yes"],[
+  AC_DEFINE([ENABLE_SYSTEMD], [1], [Use systemd integration.])])
+])
 
 dnl Check for userspace-rcu library
 AC_ARG_WITH(urcu,
 [  --with-urcu=DIR        where to find userspace-rcu library])
 
+AS_IF([test "$enable_daemon" = "yes"],[
+
 AS_IF([test "$with_urcu" != "no"], [
   PKG_CHECK_MODULES([liburcu], liburcu, [
     CPPFLAGS="$CPPFLAGS $liburcu_CFLAGS"
     LIBS="$LIBS $liburcu_LIBS"
+    liburcu_PKGCONFIG="liburcu"
+    AC_SUBST([liburcu_PKGCONFIG])
     with_urcu=yes
   ],[
     for try_urcu in "$with_urcu" "" "/usr/local"; do
@@ -213,6 +243,8 @@ AS_IF([test "$with_urcu" != "no"], [
 
       AC_SEARCH_LIBS([rcu_set_pointer_sym], [urcu], [
         with_urcu=yes
+	AC_SUBST([liburcu_CFLAGS])
+	AC_SUBST([liburcu_LIBS])
 	break
       ],[
         CPPFLAGS="$save_CPPFLAGS"
@@ -225,34 +257,23 @@ AS_IF([test "$with_urcu" != "no"], [
 
     AS_IF([test "$with_urcu" = "no"],[
       AC_MSG_ERROR([liburcu is required])
-    ])
+      ],[
+      ])
   ])
 ])
 
 AC_SEARCH_LIBS([urcu_init], [urcu], [AC_MSG_ERROR([liburcu is too old (< 0.4.0), urcu_init symbol found])], [])
+])
 
-dnl Check for libidn.
-AC_ARG_WITH(libidn,
-    AC_HELP_STRING([--with-libidn=[DIR]], [Support IDN (needs GNU Libidn)]),
-    with_libidn=$withval,
-    with_libidn=yes
-    )
-
-AS_IF([test "$with_libidn" != "no"],[
-    PKG_CHECK_MODULES([libidn], [libidn >= 0.0.0], [
-        with_libidn=yes
-        AC_DEFINE([LIBIDN], [1], [Define to 1 to enable IDN support])
-        ],[
-        with_libidn=no
-        AC_MSG_WARN([libidn not found])
-	])])
-
+opt_dnstap=no
+AS_IF([test "$enable_daemon" = "yes"],[
 dnl Check for dnstap.
 dt_DNSTAP([
     LIBS="$LIBS $DNSTAP_LIBS"
     CPPFLAGS="$CPPFLAGS $DNSTAP_CFLAGS"
     AC_DEFINE([USE_DNSTAP], [1], [Define to 1 to enable dnstap support])
     ])
+])
 
 AM_CONDITIONAL([HAVE_DNSTAP], test "$opt_dnstap" != "no")
 
@@ -264,6 +285,7 @@ AC_ARG_WITH([lmdb],
     ])
 
 have_lmdb=no
+
 AS_IF([test "$with_lmdb" != "no"],[
     save_CPPFLAGS=$CPPFLAGS
     save_LIBS=$LIBS
@@ -283,6 +305,7 @@ AS_IF([test "$with_lmdb" != "no"],[
       AC_SEARCH_LIBS([mdb_env_open], [lmdb], [
           AC_CHECK_HEADERS([lmdb.h], [], [
               AC_ERROR([lmdb headers not found in `$try_lmdb', is your installation complete?])])
+	  lmdb_LIBS="-llmdb"
           have_lmdb=yes
           break
           ],[
@@ -297,19 +320,46 @@ AS_IF([test "$with_lmdb" != "no"],[
     ])
 
 AS_IF([test "$have_lmdb" != "no"],[
-  enable_lmdb=shared
-  ],[
-  enable_lmdb=embedded
-  ])
-
+    AC_SUBST([lmdb_CFLAGS])
+    AC_SUBST([lmdb_LIBS])
+    enable_lmdb=shared
+    ],[enable_lmdb=embedded])
 AM_CONDITIONAL([HAVE_LMDB], test "$have_lmdb" != "no")
 
+AS_IF([test "$enable_daemon" = "yes"],[
+
 dnl Check for rosedb module 
 AC_ARG_ENABLE([rosedb],
     AS_HELP_STRING([--disable-rosedb], [Do not enable static RR query module.]),
     [], [enable_rosedb=no])
-AM_CONDITIONAL([HAVE_ROSEDB], [test "$enable_rosedb" = yes])
+]) # Knot DNS daemon dependencies
+
 AS_IF([test "$enable_rosedb" = yes], [AC_DEFINE([HAVE_ROSEDB], [1], [Define to 1 to enable static RR query module.])])
+AM_CONDITIONAL([HAVE_ROSEDB], [test "$enable_rosedb" = yes])
+
+
+############################################
+# Dependencies needed for Knot DNS utilities
+############################################
+
+dnl Check for libidn.
+AC_ARG_WITH(libidn,
+    AC_HELP_STRING([--with-libidn=[DIR]], [Support IDN (needs GNU Libidn)]),
+    with_libidn=$withval,
+    with_libidn=yes
+    )
+
+AS_IF([test "$enable_utilities" = "yes"],[
+AS_IF([test "$with_libidn" != "no"],[
+    PKG_CHECK_MODULES([libidn], [libidn >= 0.0.0], [
+        with_libidn=yes
+        AC_DEFINE([LIBIDN], [1], [Define to 1 to enable IDN support])
+        ],[
+        with_libidn=no
+        AC_MSG_WARN([libidn not found])
+	])])
+
+]) # Knot DNS utilities dependencies
 
 AC_SEARCH_LIBS([pow], [m])
 AC_SEARCH_LIBS([pthread_create], [pthread], [], [AC_MSG_ERROR([pthreads not found])])
@@ -349,6 +399,8 @@ CPPFLAGS="$CPPFLAGS $CFLAG_VISIBILITY"
 # Add code coverage macro
 AX_CODE_COVERAGE
 
+AS_IF([test "$enable_documentation" = "yes"],[
+
 AC_PATH_PROGS([SPHINXBUILD], [sphinx-build sphinx-build-3], [false])
 AS_IF([test "$SPHINXBUILD" = "false"],
   [AC_MSG_WARN([Could not find the 'sphinx-build' executable, you will be unable to regenerate documentation.])],
@@ -360,6 +412,13 @@ AS_IF([test "$SPHINXBUILD" = "false"],
      [AC_MSG_WARN([Could not find the 'makeinfo' executable, you will be unable to generate info documentation.])])
   ])
 
+])
+
+AC_SUBST([libknot_pc_REQ])
+AC_SUBST([libknot_pc_REQP])
+AC_SUBST([libknot_pc_LIBS])
+AC_SUBST([libknot_pc_LIBSP])
+
 AM_CONDITIONAL([HAVE_SPHINXBUILD], test "$SPHINXBUILD" != "false")
 AM_CONDITIONAL([HAVE_PDFLATEX], test "$PDFLATEX" != "false")
 AM_CONDITIONAL([HAVE_MAKEINFO], test "$MAKEINFO" != "false")
@@ -406,6 +465,11 @@ AC_MSG_RESULT([
     Storage dir: ${storage_dir}
     Config dir:  ${config_dir}
 
+    Knot DNS libraries:     yes
+    Knot DNS daemon:        ${enable_daemon}
+    Knot DNS utils:         ${enable_utilities}
+    Knot DNS documentation: ${enable_documentation}
+
     Fast zone parser:      ${enable_fastparser}
     Utilities with IDN:    ${with_libidn}
     Systemd integration:   ${enable_systemd}
diff --git a/dnssec/Makefile.am b/dnssec/Makefile.am
index e79f05c0462879c8e0422f6ca0f874d46bc0ba71..0a7d2fc8e10f2dc8cbbb5c0ce066585a6b4b4be9 100644
--- a/dnssec/Makefile.am
+++ b/dnssec/Makefile.am
@@ -45,7 +45,7 @@ libdnssec_la_CPPFLAGS = \
 libdnssec_la_LDFLAGS = \
 	$(gnutls_LIBS) \
 	$(jansson_LIBS) \
-	-version-info 0:1:0
+	$(VERSION_INFO)
 
 libdnssec_la_LIBADD = \
 	libshared.la
diff --git a/dnssec/man/Makefile.am b/dnssec/man/Makefile.am
index 88b6ff1a0930c9b47330ff6676e5c2990844512a..a5a66dae4c7ef1075f2bd61ea047cac60623eae3 100644
--- a/dnssec/man/Makefile.am
+++ b/dnssec/man/Makefile.am
@@ -1,4 +1,7 @@
+if HAVE_UTILS
 MANPAGES = keymgr.8 knsec3hash.1
+endif # HAVE_UTILS
+
 dist_man_MANS = $(MANPAGES)
 
 clean-local:
diff --git a/dnssec/utils/Makefile.am b/dnssec/utils/Makefile.am
index 189fd9b53ee080efc37371c2f9f253c4c74815c6..ed442343006d496d2c1f15203b08b42c8fa075d9 100644
--- a/dnssec/utils/Makefile.am
+++ b/dnssec/utils/Makefile.am
@@ -1,3 +1,5 @@
+if HAVE_UTILS
+
 noinst_LTLIBRARIES = libutils.la
 
 AM_CPPFLAGS = \
@@ -43,3 +45,5 @@ knsec3hash_LDADD = \
 bin_PROGRAMS = \
 	keymgr \
 	knsec3hash
+
+endif # HAVE_UTILS
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 652d2003a7bb2e2cf4b777b85e9c5cc4da973302..1bef0b237f9f978c6d3002747597e832f6916f48 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -17,6 +17,8 @@ ALLSPHINXOPTS  = -n -d $(SPHINXBUILDDIR)/doctrees -D latex_paper_size=a4 $(SPHIN
 
 .PHONY: html-local singlehtml pdf-local info-local
 
+if HAVE_DOCS
+
 if HAVE_SPHINXBUILD
 html-local:
 	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(SPHINXBUILDDIR)/html
@@ -56,5 +58,7 @@ html-local singlehtml pdf-local info-local:
 	@echo "Please install sphinx (python-sphinx) to generate Knot DNS documentation."
 endif
 
+endif # HAVE_DOCS
+
 clean-local:
 	-rm -rf _build
diff --git a/libknot.pc.in b/libknot.pc.in
index 0fab294422d18df9eee7245318cd992315ec3ce9..b5b1f947fccbea595b26bfa994fa67ddd394ec0b 100644
--- a/libknot.pc.in
+++ b/libknot.pc.in
@@ -5,7 +5,10 @@ includedir=@includedir@
 
 Name: libknot
 Description: Knot DNS library
-URL: http://www.knot-dns.cz
+URL: https://www.knot-dns.cz
 Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -lknot -lknot-int @LIBS@
-Cflags: -I${includedir}
+Requires.private: gnutls >= 3.0, nettle, jansson, @liburcu_PKGCONFIG@
+Libs: -L${libdir} -lknot
+Libs.private: -lknot-int -ldnssec @liburcu_LIBS@ @lmdb_LIBS@
+Cflags: -I${includedir} @liburcu_CFLAGS@ @lmdb_CFLAGS@
+
diff --git a/m4/dnstap.m4 b/m4/dnstap.m4
index e6dee5f2ab854ea4a47fd12a4ff396c0a8304b76..c23ede901b422d625af0603daa3d17717bd34eeb 100644
--- a/m4/dnstap.m4
+++ b/m4/dnstap.m4
@@ -10,11 +10,11 @@ AC_DEFUN([dt_DNSTAP],
                    [Enable dnstap support (requires fstrm, protobuf-c)]),
     [opt_dnstap=$enableval], [opt_dnstap=no])
 
-  if test "x$opt_dnstap" != "xno"; then
+  AS_IF([test "$opt_dnstap" != "no"],[
     AC_PATH_PROG([PROTOC_C], [protoc-c])
-    if test -z "$PROTOC_C"; then
+    AS_IF([test -z "$PROTOC_C"],[
       AC_MSG_ERROR([The protoc-c program was not found. Please install protobuf-c!])
-    fi
+      ])
     PKG_CHECK_MODULES([libfstrm], [libfstrm])
     PKG_CHECK_MODULES([libprotobuf_c], [libprotobuf-c >= 1.0.0])
     DNSTAP_CFLAGS="$libfstrm_CFLAGS $libprotobuf_c_CFLAGS"
@@ -22,5 +22,5 @@ AC_DEFUN([dt_DNSTAP],
     $1
   m4_ifvaln([$2], [else
     $2])dnl
-  fi
+  ])
 ])
diff --git a/man/Makefile.am b/man/Makefile.am
index 6d1d399bd9d764fc35e59801b3fa4f9aa27590e5..7c8485727d46e5fc0aeaafb2953058046535b49a 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -1,4 +1,13 @@
-MANPAGES = knot.conf.5 knotc.8 knotd.8 kdig.1 khost.1 knsupdate.1
+MANPAGES = 
+
+if HAVE_DAEMON
+MANPAGES += knot.conf.5 knotc.8 knotd.8
+endif # HAVE_DAEMON
+
+if HAVE_UTILS
+MANPAGES += kdig.1 khost.1 knsupdate.1
+endif # HAVE_UTILS
+
 dist_man_MANS = $(MANPAGES)
 
 clean-local:
diff --git a/src/Makefile.am b/src/Makefile.am
index 7ceb93003a0f07562b87e22eded177fd1aa25183..4fbacf2b564996107a231a5df6c55d8d773b5411 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,10 +1,18 @@
 ACLOCAL_AMFLAGS = -I $(top_srcdir)/m4
 SUBDIRS = dnstap .
 
+lib_LTLIBRARIES = libknot-int.la libknot.la
+noinst_LTLIBRARIES =
+
+if HAVE_DAEMON
 sbin_PROGRAMS = knotc knotd
+noinst_LTLIBRARIES += libknotd.la
+endif
+
+if HAVE_UTILS
 bin_PROGRAMS = kdig khost knsupdate
-lib_LTLIBRARIES = libknot-int.la libknot.la
-noinst_LTLIBRARIES = libknotd.la libknotus.la
+noinst_LTLIBRARIES += libknotus.la
+endif
 
 # $(YACC) will generate header file
 AM_CPPFLAGS = \
@@ -20,6 +28,8 @@ AM_YFLAGS = -d
 libknotd_la_YFLAGS = -pcf_ -d
 libknotd_la_LFLAGS = # TODO: reentrant parser, prefix
 
+if HAVE_DAEMON
+
 BUILT_SOURCES =					\
 	knot/conf/libknotd_la-cf-lex.c		\
 	knot/conf/libknotd_la-cf-parse.c	\
@@ -36,6 +46,10 @@ knotc_SOURCES =					\
 knotd_SOURCES =					\
 	knot/main.c
 
+endif # HAVE_DAEMON
+
+if HAVE_UTILS
+
 kdig_SOURCES =					\
 	utils/kdig/kdig_exec.c			\
 	utils/kdig/kdig_exec.h			\
@@ -77,6 +91,8 @@ libknotus_la_SOURCES =				\
 	utils/common/token.c			\
 	utils/common/token.h
 
+endif # HAVE_UTILS
+
 # dynamic: libknot internal headers
 nobase_libknot_int_la_HEADERS =			\
 	libknot/internal/array-sort.h		\
@@ -199,6 +215,8 @@ libknot_la_SOURCES =				\
 	libknot/tsig-op.c			\
 	$(libknot_la_HEADERS)
 
+if HAVE_DAEMON
+
 # static: server shared
 libknotd_la_SOURCES =				\
 	knot/conf/cf-lex.l			\
@@ -333,6 +351,8 @@ libknotd_la_SOURCES =				\
 	knot/zone/zonefile.c			\
 	knot/zone/zonefile.h
 
+endif # HAVE_DAEMON
+
 # linking
 libknot_int_la_CPPFLAGS = $(AM_CPPFLAGS) $(lmdb_CFLAGS)
 libknot_int_la_CFLAGS = $(AM_CFLAGS) -fvisibility=default
@@ -342,6 +362,8 @@ libknot_la_CPPFLAGS = $(AM_CPPFLAGS)
 libknot_la_LDFLAGS = $(AM_LDFLAGS) $(RELEASE_INFO) $(VERSION_INFO)
 libknot_la_LIBADD  = libknot-int.la ../dnssec/libdnssec.la zscanner/libzscanner.la
 
+if HAVE_DAEMON
+
 libknotd_la_CPPFLAGS  = $(AM_CPPFLAGS) $(systemd_CFLAGS)
 libknotd_la_LDFLAGS = $(AM_LDFLAGS) $(systemd_LIBS)
 libknotd_la_LIBADD = libknot.la
@@ -350,45 +372,65 @@ libknotus_la_CPPFLAGS = $(AM_CPPFLAGS) $(libidn_CFLAGS)
 libknotus_la_LDFLAGS = $(AM_LDFLAGS) $(libidn_LIBS)
 libknotus_la_LIBADD = libknot.la
 
+endif # HAVE_DAEMON
+
 # includes
 libknot_ladir = $(includedir)
 libknot_int_ladir = $(includedir)
 
+if HAVE_DAEMON
+
 # sbin programs
 knotd_LDADD = libknot.la libknotd.la
 knotc_LDADD = libknot.la libknotd.la
 
+endif # HAVE_DAEMON
+
+if HAVE_UTILS
+
 # bin programs
-BIN_LIBS = libknotus.la
+BIN_LIBS = ../dnssec/libdnssec.la libknot.la libknot-int.la libknotus.la
 kdig_LDADD       = $(BIN_LIBS) $(libidn_LIBS)
 khost_LDADD      = $(BIN_LIBS) $(libidn_LIBS)
 knsupdate_LDADD  = $(BIN_LIBS) zscanner/libzscanner.la
 
+endif # HAVE_UTILS
+
+
 if HAVE_DNSTAP
+
+if HAVE_DAEMON
 libknotd_la_SOURCES +=				\
 	knot/modules/dnstap.c			\
 	knot/modules/dnstap.h
+libknotd_la_LIBADD += dnstap/libdnstap.la
+endif # HAVE_DAEMOM
 
+if HAVE_UTILS
 kdig_LDADD         += dnstap/libdnstap.la
 khost_LDADD        += dnstap/libdnstap.la
-libknotd_la_LIBADD += dnstap/libdnstap.la
-endif
+endif # HAVE_UTILS
+
+endif # HAVE_DNSTAP
 
+if HAVE_DAEMON
 # rose sources and client tool
 if HAVE_ROSEDB
 libknotd_la_SOURCES +=				\
-	knot/modules/rosedb.c				\
+	knot/modules/rosedb.c			\
 	knot/modules/rosedb.h
 
-rosedb_tool_SOURCES =					\
+rosedb_tool_SOURCES =				\
 	knot/modules/rosedb_tool.c
 
+if HAVE_UTILS
 bin_PROGRAMS += rosedb_tool
 rosedb_tool_LDADD = libknot.la libknotd.la
-endif
+endif # HAVE_UTILS
+endif # HAVE_ROSEDB
+endif # HAVE_DAEMON
 
-if HAVE_LMDB
-else
+if !HAVE_LMDB
 libknot_int_la_SOURCES +=		\
 	libknot/internal/namedb/mdb.c	\
 	libknot/internal/namedb/midl.c
@@ -402,8 +444,10 @@ endif
 # pkg-config
 pkgconfig_DATA = $(top_srcdir)/libknot.pc
 
+if HAVE_DAEMON
 # Create storage and run-time directories
 install-data-hook:
 	$(INSTALL) -d $(DESTDIR)/@config_dir@
 	$(INSTALL) -d $(DESTDIR)/@run_dir@
 	$(INSTALL) -d $(DESTDIR)/@storage_dir@
+endif # HAVE_DAEMON
diff --git a/src/zscanner/Makefile.am b/src/zscanner/Makefile.am
index 9a115f379e384e4a8ff952f623a6c7f24c963e44..43000435862c6553238ec54a0a060cdb5b5dd6bf 100644
--- a/src/zscanner/Makefile.am
+++ b/src/zscanner/Makefile.am
@@ -36,6 +36,6 @@ nodist_libzscanner_la_SOURCES =		\
 libzscanner_la_CFLAGS = $(CODE_COVERAGE_CFLAGS)
 libzscanner_la_LDFLAGS =		\
 	$(CODE_COVERAGE_LDFLAGS)	\
-	-version-info 0:1:0
+	$(VERSION_INFO)
 
 include $(srcdir)/tests/Makefile.inc