diff --git a/.gitignore b/.gitignore
index d34259ff..4c954dfa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,59 +1,59 @@
 *.o
 *.a
 *.la
 *.lo
 *.pc
 *.tar.*
 *.sha256*
 stamp-h1
 Makefile.in
 Makefile
 .deps
 .libs
 .version
 .dirstamp
 
 # build-aux/release.mk related litter
 /.tarball-version
 /tag-*
 
 aclocal.m4
 autoconf
 autoheader
 autom4te.cache
 automake
 compile
 config.*
 configure*
 debian/changelog
 debian/kronosnetd.postinst
 debian/patches
 depcomp
 install-sh
 libtoolize
 ltmain.sh
 m4/libtool.m4
 m4/lt~obsolete.m4
 m4/ltoptions.m4
 m4/ltsugar.m4
 m4/ltversion.m4
 missing
 libtool
 autoscan.log
 init/kronosnetd
 init/kronosnetd.service
 kronosnetd/kronosnetd
 kronosnetd/knet-keygen
 kronosnetd/kronosnetd.logrotate
 kronosnet.spec
 *.swp
 *_test
 *_bench
 test-driver
 *.trs
 *.log
-Doxyfile
-doxyfile.stamp
-xml/
+Doxyfile*
+doxyfile*.stamp
+xml-*/
 doxyxml
 *.3
diff --git a/Makefile.am b/Makefile.am
index b598c3e9..e65fc263 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,199 +1,203 @@
 #
 # Copyright (C) 2010-2018 Red Hat, Inc.  All rights reserved.
 #
 # Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
 #
 # This software licensed under GPL-2.0+, LGPL-2.0+
 #
 
 MAINTAINERCLEANFILES	= Makefile.in aclocal.m4 configure depcomp \
 			  config.guess config.sub missing install-sh \
 			  ltmain.sh compile config.h.in config.h.in~ \
 			  autoscan.log configure.scan test-driver \
 			  m4/libtool.m4 m4/lt~obsolete.m4 m4/ltoptions.m4 \
 			  m4/ltsugar.m4 m4/ltversion.m4
 
 include $(top_srcdir)/build-aux/check.mk
 
 AUTOMAKE_OPTIONS	= foreign
 
 ACLOCAL_AMFLAGS		= -I m4
 
 SPEC			= $(PACKAGE_NAME).spec
 
 TARGZFILE		= $(PACKAGE_NAME)-$(VERSION).tar.gz
 
 EXTRA_DIST		= autogen.sh .version \
 			  NOTES_TO_PACKAGE_MAINTAINERS \
-			  $(SPEC).in
+			  $(SPEC).in build-aux
 
-SUBDIRS			= build-aux init libtap libknet kronosnetd
+SUBDIRS			= init libtap libknet kronosnetd
+
+if BUILD_MAN
+SUBDIRS			+= man
+endif
 
 if BUILD_POC
 SUBDIRS			+= poc-code
 endif
 
 dist_doc_DATA		= \
 			  COPYING.applications \
 			  COPYING.libraries \
 			  COPYRIGHT \
 			  README.licence \
 			  README
 
 all-local: $(SPEC)
 
 clean-local:
 	rm -f $(SPEC)
 
 distclean-local:
 	rm -f $(PACKAGE_NAME)-*.tar.* $(PACKAGE_NAME)-*.sha256* tag-*
 
 ## make rpm/srpm section.
 
 $(SPEC): $(SPEC).in .version config.status
 	rm -f $@-t $@
 	date="`LC_ALL=C date "+%a %b %d %Y"`" && \
 	if [ -f $(abs_srcdir)/.tarball-version ]; then \
 		gitver="`cat $(abs_srcdir)/.tarball-version`" && \
 		rpmver=$$gitver && \
 		alphatag="" && \
 		dirty="" && \
 		numcomm="0"; \
 	else \
 		gitver="`GIT_DIR=$(abs_srcdir)/.git git describe --abbrev=4 --match='v*' HEAD 2>/dev/null`" && \
 		rpmver=`echo $$gitver | sed -e "s/^v//" -e "s/-.*//g"` && \
 		alphatag=`echo $$gitver | sed -e "s/.*-//" -e "s/^g//"` && \
 		vtag=`echo $$gitver | sed -e "s/-.*//g"` && \
 		numcomm=`GIT_DIR=$(abs_srcdir)/.git git rev-list $$vtag..HEAD | wc -l` && \
 		cd $(abs_srcdir) && \
 		git update-index --refresh > /dev/null 2>&1 || true && \
 		dirty=`git diff-index --name-only HEAD 2>/dev/null` && cd - 2>/dev/null; \
 	fi && \
 	if [ -n "$$dirty" ]; then dirty="dirty"; else dirty=""; fi && \
 	if [ "$$numcomm" = "0" ]; then \
 		sed \
 			-e "s#@version@#$$rpmver#g" \
 			-e "s#%glo.*alpha.*##g" \
 			-e "s#%glo.*numcomm.*##g" \
 			-e "s#@dirty@#$$dirty#g" \
 			-e "s#@date@#$$date#g" \
 		$(abs_srcdir)/$@.in > $@-t; \
 	else \
 		sed \
 			-e "s#@version@#$$rpmver#g" \
 			-e "s#@alphatag@#$$alphatag#g" \
 			-e "s#@numcomm@#$$numcomm#g" \
 			-e "s#@dirty@#$$dirty#g" \
 			-e "s#@date@#$$date#g" \
 		$(abs_srcdir)/$@.in > $@-t; \
 	fi; \
 	if [ -z "$$dirty" ]; then sed -i -e "s#%glo.*dirty.*##g" $@-t; fi
 if BUILD_SCTP
 	sed -i -e "s#@sctp@#bcond_without#g" $@-t
 else
 	sed -i -e "s#@sctp@#bcond_with#g" $@-t
 endif
 if BUILD_CRYPTO_NSS
 	sed -i -e "s#@nss@#bcond_without#g" $@-t
 else
 	sed -i -e "s#@nss@#bcond_with#g" $@-t
 endif
 if BUILD_CRYPTO_OPENSSL
 	sed -i -e "s#@openssl@#bcond_without#g" $@-t
 else
 	sed -i -e "s#@openssl@#bcond_with#g" $@-t
 endif
 if BUILD_COMPRESS_ZLIB
 	sed -i -e "s#@zlib@#bcond_without#g" $@-t
 else
 	sed -i -e "s#@zlib@#bcond_with#g" $@-t
 endif
 if BUILD_COMPRESS_LZ4
 	sed -i -e "s#@lz4@#bcond_without#g" $@-t
 else
 	sed -i -e "s#@lz4@#bcond_with#g" $@-t
 endif
 if BUILD_COMPRESS_LZO2
 	sed -i -e "s#@lzo2@#bcond_without#g" $@-t
 else
 	sed -i -e "s#@lzo2@#bcond_with#g" $@-t
 endif
 if BUILD_COMPRESS_LZMA
 	sed -i -e "s#@lzma@#bcond_without#g" $@-t
 else
 	sed -i -e "s#@lzma@#bcond_with#g" $@-t
 endif
 if BUILD_COMPRESS_BZIP2
 	sed -i -e "s#@bzip2@#bcond_without#g" $@-t
 else
 	sed -i -e "s#@bzip2@#bcond_with#g" $@-t
 endif
 if BUILD_KRONOSNETD
 	sed -i -e "s#@kronosnetd@#bcond_without#g" $@-t
 else
 	sed -i -e "s#@kronosnetd@#bcond_with#g" $@-t
 endif
 if BUILD_LIBTAP
 	sed -i -e "s#@libtap@#bcond_without#g" $@-t
 else
 	sed -i -e "s#@libtap@#bcond_with#g" $@-t
 endif
 if BUILD_RUNAUTOGEN
 	sed -i -e "s#@runautogen@#bcond_without#g" $@-t
 else
 	sed -i -e "s#@runautogen@#bcond_with#g" $@-t
 endif
 if OVERRIDE_RPM_DEBUGINFO
 	sed -i -e "s#@overriderpmdebuginfo@#bcond_without#g" $@-t
 else
 	sed -i -e "s#@overriderpmdebuginfo@#bcond_with#g" $@-t
 endif
 if BUILD_RPM_DEBUGINFO
 	sed -i -e "s#@rpmdebuginfo@#bcond_without#g" $@-t
 else
 	sed -i -e "s#@rpmdebuginfo@#bcond_with#g" $@-t
 endif
 if BUILD_MAN
 	sed -i -e "s#@buildman@#bcond_without#g" $@-t
 else
 	sed -i -e "s#@buildman@#bcond_with#g" $@-t
 endif
 	sed -i -e "s#@defaultadmgroup@#$(DEFAULTADMGROUP)#g" $@-t
 	chmod a-w $@-t
 	mv $@-t $@
 	rm -f $@-t*
 
 $(TARGZFILE):
 	$(MAKE) dist
 
 RPMBUILDOPTS	= --define "_sourcedir $(abs_builddir)" \
 		  --define "_specdir $(abs_builddir)" \
 		  --define "_builddir $(abs_builddir)" \
 		  --define "_srcrpmdir $(abs_builddir)" \
 		  --define "_rpmdir $(abs_builddir)"
 
 srpm: clean
 	$(MAKE) $(SPEC) $(TARGZFILE)
 	rpmbuild $(RPMBUILDOPTS) --nodeps -bs $(SPEC)
 
 rpm: clean
 	$(MAKE) $(SPEC) $(TARGZFILE)
 	rpmbuild $(RPMBUILDOPTS) -ba $(SPEC)
 
 # release/versioning
 BUILT_SOURCES	= .version
 .version:
 	echo $(VERSION) > $@-t && mv $@-t $@
 
 dist-hook: gen-ChangeLog
 	echo $(VERSION) > $(distdir)/.tarball-version
 
 gen_start_date = 2000-01-01
 .PHONY: gen-ChangeLog
 gen-ChangeLog:
 	if test -d $(abs_sourcedir)/.git; then				\
 		LC_ALL=C $(top_srcdir)/build-aux/gitlog-to-changelog	\
 			--since=$(gen_start_date) > $(distdir)/cl-t;	\
 		rm -f $(distdir)/ChangeLog;				\
 		mv $(distdir)/cl-t $(distdir)/ChangeLog;		\
 	fi
diff --git a/build-aux/Makefile.am b/build-aux/Makefile.am
deleted file mode 100644
index 8e522762..00000000
--- a/build-aux/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# Copyright (C) 2018 Red Hat, Inc.  All rights reserved.
-#
-# Authors: Fabio M. Di Nitto <fabbione@kronosnet.org>
-#
-# This software licensed under GPL-2.0+, LGPL-2.0+
-#
-
-MAINTAINERCLEANFILES	= Makefile.in
-
-include $(top_srcdir)/build-aux/check.mk
-
-EXTRA_DIST	= check.mk gitlog-to-changelog git-version-gen \
-		  knet_valgrind_helgrind.supp knet_valgrind_memcheck.supp \
-		  release.mk update-copyright.sh
-
-# Avoid Automake warnings about overriding these user variables.
-# Programs in this directory are used during the build only.
-AUTOMAKE_OPTIONS = -Wno-gnu
-EXEEXT=$(BUILD_EXEEXT)
-CC=$(CC_FOR_BUILD)
-CFLAGS=$(CFLAGS_FOR_BUILD)
-CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
-LDFLAGS=$(LDFLAGS_FOR_BUILD)
-
-if BUILD_MAN
-
-noinst_PROGRAMS	= doxyxml
-
-doxyxml_SOURCES = doxyxml.c
-doxyxml_CFLAGS = $(AM_CFLAGS) $(libqb_BUILD_CFLAGS) $(libxml_BUILD_CFLAGS)
-doxyxml_LDADD = $(libqb_BUILD_LIBS) $(libxml_BUILD_LIBS)
-
-endif
diff --git a/configure.ac b/configure.ac
index 34c2a97d..bd122016 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,475 +1,474 @@
 #
 # Copyright (C) 2010-2018 Red Hat, Inc.  All rights reserved.
 #
 # Authors: Fabio M. Di Nitto <fabbione@kronosnet.org>
 #          Federico Simoncelli <fsimon@kronosnet.org>
 #
 # This software licensed under GPL-2.0+, LGPL-2.0+
 #
 
 #                                               -*- Autoconf -*-
 # Process this file with autoconf to produce a configure script.
 #
 
 AC_PREREQ([2.63])
 AC_INIT([kronosnet],
 	m4_esyscmd([build-aux/git-version-gen .tarball-version]),
 	[devel@lists.kronosnet.org])
 # Don't let AC_PROC_CC (invoked by AC_USE_SYSTEM_EXTENSIONS) replace
 # undefined CFLAGS with -g -O2, overriding our special OPT_CFLAGS.
 : ${CFLAGS=""}
 AC_USE_SYSTEM_EXTENSIONS
 AM_INIT_AUTOMAKE([1.13 dist-bzip2 dist-xz color-tests -Wno-portability subdir-objects])
 
 LT_PREREQ([2.2.6])
 # --enable-new-dtags: Use RUNPATH instead of RPATH.
 # It is necessary to have this done before libtool does linker detection.
 # See also: https://github.com/kronosnet/kronosnet/issues/107
 # --as-needed: Modern systems have builtin ceil() making -lm superfluous but
 # AC_SEARCH_LIBS can't detect this because it tests with a false prototype
 AX_CHECK_LINK_FLAG([-Wl,--enable-new-dtags],
 		   [AM_LDFLAGS=-Wl,--enable-new-dtags],
 		   [AC_MSG_ERROR(["Linker support for --enable-new-dtags is required"])])
 AX_CHECK_LINK_FLAG([-Wl,--as-needed], [AM_LDFLAGS="$AM_LDFLAGS -Wl,--as-needed"])
 
 AC_SUBST([AM_LDFLAGS])
 saved_LDFLAGS="$LDFLAGS"
 LDFLAGS="$AM_LDFLAGS $LDFLAGS"
 LT_INIT
 LDFLAGS="$saved_LDFLAGS"
 
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_SRCDIR([kronosnetd/main.c])
 AC_CONFIG_HEADERS([config.h])
 
 AC_CANONICAL_HOST
 
 AC_LANG([C])
 
 systemddir=${prefix}/lib/systemd/system
 
 if test "$prefix" = "NONE"; then
 	prefix="/usr"
 	if test "$localstatedir" = "\${prefix}/var"; then
 		localstatedir="/var"
 	fi
 	if test "$sysconfdir" = "\${prefix}/etc"; then
 		sysconfdir="/etc"
 	fi
 	if test "$systemddir" = "NONE/lib/systemd/system"; then
 		systemddir=/lib/systemd/system
 	fi
 	if test "$libdir" = "\${exec_prefix}/lib"; then
 		if test -e /usr/lib64; then
 			libdir="/usr/lib64"
 		else
 			libdir="/usr/lib"
 		fi
 	fi
 fi
 
 AC_PROG_AWK
 AC_PROG_GREP
 AC_PROG_SED
 AC_PROG_CPP
 AC_PROG_CC
 AC_PROG_CC_C99
 if test "x$ac_cv_prog_cc_c99" = "xno"; then
 	AC_MSG_ERROR(["C99 support is required"])
 fi
 AC_PROG_LN_S
 AC_PROG_INSTALL
 AC_PROG_MAKE_SET
 PKG_PROG_PKG_CONFIG
 
 AC_CHECK_PROGS([VALGRIND_EXEC], [valgrind])
 AM_CONDITIONAL([HAS_VALGRIND], [test x$VALGRIND_EXEC != "x"])
 
 # KNET_OPTION_DEFINES(stem,type,detection code)
 # stem: enters name of option, Automake conditional and preprocessor define
 # type: compress or crypto, determines where the default comes from
 AC_DEFUN([KNET_OPTION_DEFINES],[
 AC_ARG_ENABLE([$2-$1],[AS_HELP_STRING([--disable-$2-$1],[disable libknet $1 support])],,
 	[enable_$2_$1="$enable_$2_all"])
 AM_CONDITIONAL([BUILD_]m4_toupper([$2_$1]),[test "x$enable_$2_$1" = xyes])
 if test "x$enable_$2_$1" = xyes; then
 	$3
 fi
 AC_DEFINE_UNQUOTED([WITH_]m4_toupper([$2_$1]), [`test "x$enable_$2_$1" != xyes; echo $?`], $1 $2 [built in])
 ])
 
 AC_ARG_ENABLE([man],
 	[AS_HELP_STRING([--disable-man],[disable man page creation])],,
 	[ enable_man="yes" ])
 AM_CONDITIONAL([BUILD_MAN], [test x$enable_man = xyes])
 
 AC_ARG_ENABLE([libknet-sctp],
 	[AS_HELP_STRING([--disable-libknet-sctp],[disable libknet SCTP support])],,
 	[ enable_libknet_sctp="yes" ])
 AM_CONDITIONAL([BUILD_SCTP], [test x$enable_libknet_sctp = xyes])
 
 AC_ARG_ENABLE([crypto-all],
 	[AS_HELP_STRING([--disable-crypto-all],[disable libknet all crypto modules support])],,
 	[ enable_crypto_all="yes" ])
 
 KNET_OPTION_DEFINES([nss],[crypto],[PKG_CHECK_MODULES([nss], [nss])])
 KNET_OPTION_DEFINES([openssl],[crypto],[
 	PKG_CHECK_MODULES([openssl],[libcrypto < 1.1],
 			  [AC_DEFINE_UNQUOTED([BUILDCRYPTOOPENSSL10], [1], [openssl 1.0 crypto])],
 			  [PKG_CHECK_MODULES([openssl],[libcrypto >= 1.1],
 					     [AC_DEFINE_UNQUOTED([BUILDCRYPTOOPENSSL11], [1], [openssl 1.1 crypto])])])
 ])
 
 AC_ARG_ENABLE([compress-all],
 	[AS_HELP_STRING([--disable-compress-all],[disable libknet all compress modules support])],,
 	[ enable_compress_all="yes" ])
 
 KNET_OPTION_DEFINES([zlib],[compress],[PKG_CHECK_MODULES([zlib], [zlib])])
 KNET_OPTION_DEFINES([lz4],[compress],[PKG_CHECK_MODULES([liblz4], [liblz4])])
 KNET_OPTION_DEFINES([lzo2],[compress],[
 	PKG_CHECK_MODULES([lzo2], [lzo2],
 		[# work around broken pkg-config file in v2.10
 		 AC_SUBST([lzo2_CFLAGS],[`echo $lzo2_CFLAGS | sed 's,/lzo *, ,'`])],
 		[AC_CHECK_HEADERS([lzo/lzo1x.h],
 			[AC_CHECK_LIB([lzo2], [lzo1x_decompress_safe],
 				[AC_SUBST([lzo2_LIBS], [-llzo2])])],
 				[AC_MSG_ERROR(["missing required lzo/lzo1x.h header"])])])
 ])
 KNET_OPTION_DEFINES([lzma],[compress],[PKG_CHECK_MODULES([liblzma], [liblzma])])
 KNET_OPTION_DEFINES([bzip2],[compress],[
 	PKG_CHECK_MODULES([bzip2], [bzip2],,
 		[AC_CHECK_HEADERS([bzlib.h],
 			[AC_CHECK_LIB([bz2], [BZ2_bzBuffToBuffCompress],
 				[AC_SUBST([bzip2_LIBS], [-lbz2])])],
 				[AC_MSG_ERROR(["missing required bzlib.h"])])])
 ])
 
 AC_ARG_ENABLE([poc],
 	[AS_HELP_STRING([--enable-poc],[enable building poc code])],,
 	[ enable_poc="no" ])
 AM_CONDITIONAL([BUILD_POC], [test x$enable_poc = xyes])
 
 AC_ARG_ENABLE([kronosnetd],
 	[AS_HELP_STRING([--enable-kronosnetd],[Kronosnetd support])],,
 	[ enable_kronosnetd="no" ])
 AM_CONDITIONAL([BUILD_KRONOSNETD], [test x$enable_kronosnetd = xyes])
 
 AC_ARG_ENABLE([runautogen],
 	[AS_HELP_STRING([--enable-runautogen],[run autogen.sh])],,
 	[ enable_runautogen="no" ])
 AM_CONDITIONAL([BUILD_RUNAUTOGEN], [test x$enable_runautogen = xyes])
 
 override_rpm_debuginfo_option="yes"
 AC_ARG_ENABLE([rpm-debuginfo],
 	[AS_HELP_STRING([--enable-rpm-debuginfo],[build debuginfo packages])],,
 	[ enable_rpm_debuginfo="no", override_rpm_debuginfo_option="no" ])
 AM_CONDITIONAL([BUILD_RPM_DEBUGINFO], [test x$enable_rpm_debuginfo = xyes])
 AM_CONDITIONAL([OVERRIDE_RPM_DEBUGINFO], [test x$override_rpm_debuginfo_option = xyes])
 
 AC_ARG_ENABLE([libtap],
 	[AS_HELP_STRING([--enable-libtap],[libtap support])],,
 	[ enable_libtap="no" ])
 
 if test "x$enable_kronosnetd" = xyes; then
 	enable_libtap=yes
 fi
 AM_CONDITIONAL([BUILD_LIBTAP], [test x$enable_libtap = xyes])
 
 ## local helper functions
 # this function checks if CC support options passed as
 # args. Global CPPFLAGS are ignored during this test.
 cc_supports_flag() {
 	saveCPPFLAGS="$CPPFLAGS"
 	CPPFLAGS="$@"
 	if echo $CC | grep -q clang; then
 		CPPFLAGS="-Werror $CPPFLAGS"
 	fi
 	AC_MSG_CHECKING([whether $CC supports "$@"])
 	AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
 			  [RC=0; AC_MSG_RESULT([yes])],
 			  [RC=1; AC_MSG_RESULT([no])])
 	CPPFLAGS="$saveCPPFLAGS"
 	return $RC
 }
 
 # Checks for libraries.
 AX_PTHREAD(,[AC_MSG_ERROR([POSIX threads support is required])])
 saved_LIBS="$LIBS"
 LIBS=
 AC_SEARCH_LIBS([ceil], [m], , [AC_MSG_ERROR([ceil not found])])
 AC_SUBST([m_LIBS], [$LIBS])
 LIBS=
 AC_SEARCH_LIBS([clock_gettime], [rt], , [AC_MSG_ERROR([clock_gettime not found])])
 AC_SUBST([rt_LIBS], [$LIBS])
 LIBS=
 AC_SEARCH_LIBS([dlopen], [dl dld], , [AC_MSG_ERROR([dlopen not found])])
 AC_SUBST([dl_LIBS], [$LIBS])
 LIBS="$saved_LIBS"
 
 # OS detection
 
 AC_MSG_CHECKING([for os in ${host_os}])
 case "$host_os" in
 	*linux*)
 		AC_DEFINE_UNQUOTED([KNET_LINUX], [1], [Compiling for Linux platform])
 		AC_MSG_RESULT([Linux])
 		;;
 	*bsd*)
 		AC_DEFINE_UNQUOTED([KNET_BSD], [1], [Compiling for BSD platform])
 		AC_MSG_RESULT([BSD])
 		if test "x$enable_libtap" = xyes; then
 			AC_MSG_ERROR([libtap is not currently supported on BSD platforms])
 		fi
 		;;
 	*)
 		AC_MSG_ERROR([Unsupported OS? hmmmm])
 		;;
 esac
 
 # Checks for header files.
 AC_CHECK_HEADERS([sys/epoll.h])
 AC_CHECK_FUNCS([kevent])
 # if neither sys/epoll.h nor kevent are present, we should fail.
 
 if test "x$ac_cv_header_sys_epoll_h" = xno && test "x$ac_cv_func_kevent" = xno; then
 	AC_MSG_ERROR([Both epoll and kevent unavailable on this OS])
 fi
 
 if test "x$ac_cv_header_sys_epoll_h" = xyes && test "x$ac_cv_func_kevent" = xyes; then
 	AC_MSG_ERROR([Both epoll and kevent available on this OS, please contact the maintainers to fix the code])
 fi
 
 if test "x$enable_libknet_sctp" = xyes; then
 	AC_CHECK_HEADERS([netinet/sctp.h],, [AC_MSG_ERROR(["missing required SCTP headers"])])
 fi
 
 # Checks for typedefs, structures, and compiler characteristics.
 AC_C_INLINE
 AC_TYPE_PID_T
 AC_TYPE_SIZE_T
 AC_TYPE_SSIZE_T
 AC_TYPE_UINT8_T
 AC_TYPE_UINT16_T
 AC_TYPE_UINT32_T
 AC_TYPE_UINT64_T
 AC_TYPE_INT8_T
 AC_TYPE_INT16_T
 AC_TYPE_INT32_T
 AC_TYPE_INT64_T
 
 if test "x$enable_man" = "xyes"; then
 	AC_ARG_VAR([DOXYGEN], [override doxygen executable])
 	AC_CHECK_PROGS([DOXYGEN], [doxygen], [no])
 	if test "x$DOXYGEN" = xno; then
 		AC_MSG_ERROR(["Doxygen command not found"])
 	fi
 	# required by doxyxml to build man pages dynamically
 	# Don't let AC_PROC_CC (invoked by AX_PROG_CC_FOR_BUILD) replace
 	# undefined CFLAGS_FOR_BUILD with -g -O2, overriding our special OPT_CFLAGS.
 	: ${CFLAGS_FOR_BUILD=""}
 	AX_PROG_CC_FOR_BUILD
 	saved_PKG_CONFIG="$PKG_CONFIG"
 	saved_ac_cv_path_PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
 	unset PKG_CONFIG ac_cv_path_PKG_CONFIG
 	AC_PATH_PROG([PKG_CONFIG], [pkg-config])
 	PKG_CHECK_MODULES([libqb_BUILD], [libqb])
 	PKG_CHECK_MODULES([libxml_BUILD], [libxml-2.0])
 	PKG_CONFIG="$saved_PKG_CONFIG"
 	ac_cv_path_PKG_CONFIG="$saved_ac_cv_path_PKG_CONFIG"
 fi
 
 # checks (for kronosnetd)
 if test "x$enable_kronosnetd" = xyes; then
 	AC_CHECK_HEADERS([security/pam_appl.h],
 			 [AC_CHECK_LIB([pam], [pam_start],
 				       [AC_SUBST([pam_LIBS], [-lpam])],
 				       [AC_MSG_ERROR([Unable to find LinuxPAM devel files])])])
 
 	AC_CHECK_HEADERS([security/pam_misc.h],
 			 [AC_CHECK_LIB([pam_misc], [misc_conv],
 				       [AC_SUBST([pam_misc_LIBS], [-lpam_misc])],
 				       [AC_MSG_ERROR([Unable to find LinuxPAM MISC devel files])])])
 
 	PKG_CHECK_MODULES([libqb], [libqb])
 
 	AC_CHECK_LIB([qb], [qb_log_thread_priority_set],
 		     [have_qb_log_thread_priority_set="yes"],
 		     [have_qb_log_thread_priority_set="no"])
 	if test "x${have_qb_log_thread_priority_set}" = xyes; then
 		AC_DEFINE_UNQUOTED([HAVE_QB_LOG_THREAD_PRIORITY_SET], [1], [have qb_log_thread_priority_set])
 	fi
 fi
 
 # local options
 AC_ARG_ENABLE([debug],
 	[AS_HELP_STRING([--enable-debug],[enable debug build])])
 
 AC_ARG_WITH([initdefaultdir],
 	[AS_HELP_STRING([--with-initdefaultdir=DIR],[path to /etc/sysconfig or /etc/default dir])],
 	[ INITDEFAULTDIR="$withval" ],
 	[ INITDEFAULTDIR="$sysconfdir/default" ])
 
 AC_ARG_WITH([initddir],
 	[AS_HELP_STRING([--with-initddir=DIR],[path to init script directory])],
 	[ INITDDIR="$withval" ],
 	[ INITDDIR="$sysconfdir/init.d" ])
 
 AC_ARG_WITH([systemddir],
 	[AS_HELP_STRING([--with-systemddir=DIR],[path to systemd unit files directory])],
 	[ SYSTEMDDIR="$withval" ],
 	[ SYSTEMDDIR="$systemddir" ])
 
 AC_ARG_WITH([syslogfacility],
 	[AS_HELP_STRING([--with-syslogfacility=FACILITY],[default syslog facility])],
 	[ SYSLOGFACILITY="$withval" ],
 	[ SYSLOGFACILITY="LOG_DAEMON" ])
 
 AC_ARG_WITH([sysloglevel],
 	[AS_HELP_STRING([--with-sysloglevel=LEVEL],[default syslog level])],
 	[ SYSLOGLEVEL="$withval" ],
 	[ SYSLOGLEVEL="LOG_INFO" ])
 
 AC_ARG_WITH([defaultadmgroup],
 	[AS_HELP_STRING([--with-defaultadmgroup=GROUP],
 		[define PAM group. Users part of this group will be allowed to configure
 		 kronosnet. Others will only receive read-only rights.])],
 	[ DEFAULTADMGROUP="$withval" ],
 	[ DEFAULTADMGROUP="kronosnetadm" ])
 
 ## random vars
 LOGDIR=${localstatedir}/log/
 RUNDIR=${localstatedir}/run/
 DEFAULT_CONFIG_DIR=${sysconfdir}/kronosnet
 
 ## do subst
 
 AC_SUBST([DEFAULT_CONFIG_DIR])
 AC_SUBST([INITDEFAULTDIR])
 AC_SUBST([INITDDIR])
 AC_SUBST([SYSTEMDDIR])
 AC_SUBST([LOGDIR])
 AC_SUBST([DEFAULTADMGROUP])
 
 AC_DEFINE_UNQUOTED([DEFAULT_CONFIG_DIR],
 		   ["$(eval echo ${DEFAULT_CONFIG_DIR})"],
 		   [Default config directory])
 
 AC_DEFINE_UNQUOTED([DEFAULT_CONFIG_FILE],
 		   ["$(eval echo ${DEFAULT_CONFIG_DIR}/kronosnetd.conf)"],
 		   [Default config file])
 
 AC_DEFINE_UNQUOTED([LOGDIR],
 		   ["$(eval echo ${LOGDIR})"],
 		   [Default logging directory])
 
 AC_DEFINE_UNQUOTED([DEFAULT_LOG_FILE],
 		   ["$(eval echo ${LOGDIR}/kronosnetd.log)"],
 		   [Default log file])
 
 AC_DEFINE_UNQUOTED([RUNDIR],
 		   ["$(eval echo ${RUNDIR})"],
 		   [Default run directory])
 
 AC_DEFINE_UNQUOTED([SYSLOGFACILITY],
 		   [$(eval echo ${SYSLOGFACILITY})],
 		   [Default syslog facility])
 
 AC_DEFINE_UNQUOTED([SYSLOGLEVEL],
 		   [$(eval echo ${SYSLOGLEVEL})],
 		   [Default syslog level])
 
 AC_DEFINE_UNQUOTED([DEFAULTADMGROUP],
 		   ["$(eval echo ${DEFAULTADMGROUP})"],
 		   [Default admin group])
 
 # debug build stuff
 if test "x${enable_debug}" = xyes; then
 	AC_DEFINE_UNQUOTED([DEBUG], [1], [Compiling Debugging code])
 	OPT_CFLAGS="-O0"
 else
 	OPT_CFLAGS="-O3"
 fi
 
 # gdb flags
 if test "x${GCC}" = xyes; then
 	GDB_FLAGS="-ggdb3"
 else
 	GDB_FLAGS="-g"
 fi
 
 # extra warnings
 EXTRA_WARNINGS=""
 
 WARNLIST="
 	all
 	extra
 	unused
 	shadow
 	missing-prototypes
 	missing-declarations
 	suggest-attribute=noreturn
 	suggest-attribute=format
 	strict-prototypes
 	declaration-after-statement
 	pointer-arith
 	write-strings
 	cast-align
 	bad-function-cast
 	missing-format-attribute
 	float-equal
 	format=2
 	format-signedness
 	format-security
 	format-nonliteral
 	no-long-long
 	unsigned-char
 	gnu89-inline
 	no-strict-aliasing
 	error
 	address
 	cpp
 	overflow
 	parentheses
 	sequence-point
 	switch
 	shift-overflow=2
 	overlength-strings
 	retundent-decls
 	init-self
 	uninitialized
 	unused-but-set-variable
 	unused-function
 	unused-result
 	unused-value
 	unused-variable
 	unknown-pragmas
 	no-unused-parameter
 	"
 
 for j in $WARNLIST; do
 	if cc_supports_flag -W$j; then
 		EXTRA_WARNINGS="$EXTRA_WARNINGS -W$j";
 	fi
 done
 
 AC_SUBST([AM_CFLAGS],["$OPT_CFLAGS $GDB_FLAGS $EXTRA_WARNINGS"])
 
 AC_CONFIG_FILES([
 		Makefile
 		init/Makefile
 		libtap/Makefile
 		libtap/libtap.pc
 		kronosnetd/Makefile
 		kronosnetd/kronosnetd.logrotate
 		libknet/Makefile
 		libknet/libknet.pc
 		libknet/tests/Makefile
-		libknet/man/Doxyfile
-		libknet/man/Makefile
-		build-aux/Makefile
+		man/Makefile
+		man/Doxyfile-knet
 		poc-code/Makefile
 		poc-code/iov-hash/Makefile
 		poc-code/access-list/Makefile
 		])
 
 AC_OUTPUT
diff --git a/kronosnet.spec.in b/kronosnet.spec.in
index e8bb46cc..a9cb445e 100644
--- a/kronosnet.spec.in
+++ b/kronosnet.spec.in
@@ -1,537 +1,537 @@
 ###############################################################################
 ###############################################################################
 ##
 ##  Copyright (C) 2012-2018 Red Hat, Inc.  All rights reserved.
 ##
 ##  This copyrighted material is made available to anyone wishing to use,
 ##  modify, copy, or redistribute it subject to the terms and conditions
 ##  of the GNU General Public License v.2 or higher
 ##
 ###############################################################################
 ###############################################################################
 
 # keep around ready for later user
 %global alphatag @alphatag@
 %global numcomm @numcomm@
 %global dirty @dirty@
 
 # set defaults from ./configure invokation
 %@sctp@ sctp
 %@nss@ nss
 %@openssl@ openssl
 %@zlib@ zlib
 %@lz4@ lz4
 %@lzo2@ lzo2
 %@lzma@ lzma
 %@bzip2@ bzip2
 %@kronosnetd@ kronosnetd
 %@libtap@ libtap
 %@runautogen@ runautogen
 %@rpmdebuginfo@ rpmdebuginfo
 %@overriderpmdebuginfo@ overriderpmdebuginfo
 %@buildman@ buildman
 
 %if %{with overriderpmdebuginfo}
 %undefine _enable_debug_packages
 %endif
 
 %if %{with sctp}
 %global buildsctp 1
 %endif
 %if %{with nss}
 %global buildcryptonss 1
 %endif
 %if %{with openssl}
 %global buildcryptoopenssl 1
 %endif
 %if %{with zlib}
 %global buildcompresszlib 1
 %endif
 %if %{with lz4}
 %global buildcompresslz4 1
 %endif
 %if %{with lzo2}
 %global buildcompresslzo2 1
 %endif
 %if %{with lzma}
 %global buildcompresslzma 1
 %endif
 %if %{with bzip2}
 %global buildcompressbzip2 1
 %endif
 %if %{with libtap}
 %global buildlibtap 1
 %endif
 %if %{with kronosnetd}
 %global buildlibtap 1
 %global buildkronosnetd 1
 %endif
 %if %{with runautogen}
 %global buildautogen 1
 %endif
 %if %{with buildman}
 %global buildmanpages 1
 %endif
 
 # main (empty) package
 # http://www.rpm.org/max-rpm/s1-rpm-subpack-spec-file-changes.html
 
 Name: kronosnet
 Summary: Multipoint-to-Multipoint VPN daemon
 Version: @version@
 Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist}
 License: GPLv2+ and LGPLv2+
 Group: System Environment/Base
 URL: https://github.com/kronosnet/kronosnet/
 Source0: https://github.com/kronosnet/kronosnet/archive/%{name}-%{version}%{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}}.tar.gz
 
 ## Setup/build bits
 
 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 
 # Build dependencies
 BuildRequires: gcc
 # required to build man pages
 %if %{defined buildmanpages}
 BuildRequires: libqb-devel libxml2-devel doxygen
 %endif
 %if %{defined buildsctp}
 BuildRequires: lksctp-tools-devel
 %endif
 %if %{defined buildcryptonss}
 BuildRequires: /usr/include/nss3/nss.h /usr/include/nspr4/nspr.h
 %endif
 %if %{defined buildcryptoopenssl}
 BuildRequires: /usr/include/openssl/conf.h
 %endif
 %if %{defined buildcompresszlib}
 BuildRequires: zlib-devel
 %endif
 %if %{defined buildcompresslz4}
 BuildRequires: /usr/include/lz4hc.h
 %endif
 %if %{defined buildcompresslzo2}
 BuildRequires: lzo-devel
 %endif
 %if %{defined buildcompresslzma}
 BuildRequires: xz-devel
 %endif
 %if %{defined buildcompressbzip2}
 BuildRequires: /usr/include/bzlib.h
 %endif
 %if %{defined buildkronosnetd}
 BuildRequires: pam-devel
 %endif
 %if %{defined buildautogen}
 BuildRequires: autoconf
 BuildRequires: automake
 BuildRequires: libtool
 %endif
 
 %prep
 %setup -q -n %{name}-%{version}%{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}}
 
 %build
 %if %{with runautogen}
     ./autogen.sh
 %endif
 
 %{configure} \
 %if %{defined buildmanpages}
 	--enable-man \
 %else
 	--disable-man \
 %endif
 %if %{defined buildsctp}
 	--enable-libknet-sctp \
 %else
 	--disable-libknet-sctp \
 %endif
 %if %{defined buildcryptonss}
 	--enable-crypto-nss \
 %else
 	--disable-crypto-nss \
 %endif
 %if %{defined buildcryptoopenssl}
 	--enable-crypto-openssl \
 %else
 	--disable-crypto-openssl \
 %endif
 %if %{defined buildcompresszlib}
 	--enable-compress-zlib \
 %else
 	--disable-compress-zlib \
 %endif
 %if %{defined buildcompresslz4}
 	--enable-compress-lz4 \
 %else
 	--disable-compress-lz4 \
 %endif
 %if %{defined buildcompresslzo2}
 	--enable-compress-lzo2 \
 %else
 	--disable-compress-lzo2 \
 %endif
 %if %{defined buildcompresslzma}
 	--enable-compress-lzma \
 %else
 	--disable-compress-lzma \
 %endif
 %if %{defined buildcompressbzip2}
 	--enable-compress-bzip2 \
 %else
 	--disable-compress-bzip2 \
 %endif
 %if %{defined buildkronosnetd}
 	--enable-kronosnetd \
 %endif
 %if %{defined buildlibtap}
 	--enable-libtap \
 %endif
 	--with-initdefaultdir=%{_sysconfdir}/sysconfig/ \
 %if %{defined _unitdir}
 	--with-systemddir=%{_unitdir}
 %else
 	--with-initddir=%{_sysconfdir}/rc.d/init.d/
 %endif
 
 make %{_smp_mflags}
 
 %install
 rm -rf %{buildroot}
 make install DESTDIR=%{buildroot}
 
 # tree cleanup
 # remove static libraries
 find %{buildroot} -name "*.a" -exec rm {} \;
 # remove libtools leftovers
 find %{buildroot} -name "*.la" -exec rm {} \;
 
 # handle systemd vs init script
 %if %{defined _unitdir}
 # remove init scripts
 rm -rf %{buildroot}/etc/init.d
 %else
 # remove systemd specific bits
 find %{buildroot} -name "*.service" -exec rm {} \;
 %endif
 
 # remove docs
 rm -rf %{buildroot}/usr/share/doc/kronosnet
 
 %clean
 rm -rf %{buildroot}
 
 # main empty package
 %description
 kronosnet source
 
 %if %{defined buildkronosnetd}
 ## Runtime and subpackages section
 %package -n kronosnetd
 Group: System Environment/Base
 Summary: Multipoint-to-Multipoint VPN daemon
 %if %{defined _unitdir}
 # Needed for systemd unit
 Requires(post):   systemd-sysv
 Requires(post):   systemd-units
 Requires(preun):  systemd-units
 Requires(postun): systemd-units
 %else
 Requires(post): chkconfig
 Requires(preun): chkconfig, initscripts
 %endif
 Requires(post): shadow-utils
 Requires(preun): shadow-utils
 Requires: pam, /etc/pam.d/passwd
 
 %description -n kronosnetd
  The kronosnet daemon is a bridge between kronosnet switching engine
  and kernel network tap devices, to create and administer a
  distributed LAN over multipoint-to-multipoint VPNs.
  The daemon does a poor attempt to provide a configure UI similar
  to other known network devices/tools (Cisco, quagga).
  Beside looking horrific, it allows runtime changes and
  reconfiguration of the kronosnet(s) without daemon reload
  or service disruption.
 
 %post -n kronosnetd
 %if %{defined _unitdir}
  %if 0%{?systemd_post:1}
   %systemd_post kronosnetd.service
  %else
   /bin/systemctl daemon-reload >/dev/null 2>&1 || :
  %endif
 %else
 /sbin/chkconfig --add kronosnetd
 %endif
 /usr/sbin/groupadd --force --system @defaultadmgroup@
 
 %preun -n kronosnetd
 %if %{defined _unitdir}
  %if 0%{?systemd_preun:1}
   %systemd_preun kronosnetd.service
  %else
 if [ "$1" -eq 0 ]; then
 	/bin/systemctl --no-reload disable kronosnetd.service
 	/bin/systemctl stop kronosnetd.service >/dev/null 2>&1
 fi
 %endif
 %else
 if [ "$1" = 0 ]; then
 	/sbin/service kronosnetd stop >/dev/null 2>&1
 	/sbin/chkconfig --del kronosnetd
 fi
 %endif
 
 %files -n kronosnetd
 %defattr(-,root,root,-)
 %doc COPYING.* COPYRIGHT 
 %dir %{_sysconfdir}/kronosnet
 %dir %{_sysconfdir}/kronosnet/*
 %config(noreplace) %{_sysconfdir}/sysconfig/kronosnetd
 %config(noreplace) %{_sysconfdir}/pam.d/kronosnetd
 %config(noreplace) %{_sysconfdir}/logrotate.d/kronosnetd
 %if %{defined _unitdir}
 %{_unitdir}/kronosnetd.service
 %else
 %config(noreplace) %{_sysconfdir}/rc.d/init.d/kronosnetd
 %endif
 %{_sbindir}/*
 %{_mandir}/man8/*
 %endif
 
 %if %{defined buildlibtap}
 %package -n libtap1
 Group: System Environment/Libraries
 Summary: Simple userland wrapper around kernel tap devices
 
 %description -n libtap1
  This is an over-engineered commodity library to manage a pool
  of tap devices and provides the basic
  pre-up.d/up.d/down.d/post-down.d infrastructure.
 
 %files -n libtap1
 %defattr(-,root,root,-)
 %doc COPYING.* COPYRIGHT
 %{_libdir}/libtap.so.*
 
 %post -n libtap1 -p /sbin/ldconfig
 
 %postun -n libtap1 -p /sbin/ldconfig
 
 %package -n libtap1-devel
 Group: Development/Libraries
 Summary: Simple userland wrapper around kernel tap devices (developer files)
 Requires: libtap1 = %{version}-%{release}
 Requires: pkgconfig
 
 %description -n libtap1-devel
  This is an over-engineered commodity library to manage a pool
  of tap devices and provides the basic
  pre-up.d/up.d/down.d/post-down.d infrastructure.
 
 %files -n libtap1-devel
 %defattr(-,root,root,-)
 %doc COPYING.* COPYRIGHT
 %{_libdir}/libtap.so
 %{_includedir}/libtap.h
 %{_libdir}/pkgconfig/libtap.pc
 %endif
 
 %package -n libknet1
 Group: System Environment/Libraries
 Summary: Kronosnet core switching implementation
 
 %description -n libknet1
  The whole kronosnet core is implemented in this library.
  Please refer to the not-yet-existing documentation for further
  information.
 
 %files -n libknet1
 %defattr(-,root,root,-)
 %doc COPYING.* COPYRIGHT
 %{_libdir}/libknet.so.*
 %dir %{_libdir}/kronosnet
 
 %post -n libknet1 -p /sbin/ldconfig
 
 %postun -n libknet1 -p /sbin/ldconfig
 
 %package -n libknet1-devel
 Group: Development/Libraries
 Summary: Kronosnet core switching implementation (developer files)
 Requires: libknet1 = %{version}-%{release}
 Requires: pkgconfig
 
 %description -n libknet1-devel
  The whole kronosnet core is implemented in this library.
  Please refer to the not-yet-existing documentation for further
  information. 
 
 %files -n libknet1-devel
 %defattr(-,root,root,-)
 %doc COPYING.* COPYRIGHT
 %{_libdir}/libknet.so
 %{_includedir}/libknet.h
 %{_libdir}/pkgconfig/libknet.pc
 %if %{defined buildmanpages}
-%{_mandir}/man3/*.3.gz
+%{_mandir}/man3/knet*.3.gz
 %endif
 
 %if %{defined buildcryptonss}
 %package -n libknet1-crypto-nss-plugin
 Group: System Environment/Libraries
 Summary: libknet1 nss support
 Requires: libknet1 = %{version}-%{release}
 
 %description -n libknet1-crypto-nss-plugin
  NSS crypto support for libknet1.
 
 %files -n libknet1-crypto-nss-plugin
 %defattr(-,root,root,-)
 %{_libdir}/kronosnet/crypto_nss.so
 %endif
 
 %if %{defined buildcryptoopenssl}
 %package -n libknet1-crypto-openssl-plugin
 Group: System Environment/Libraries
 Summary: libknet1 openssl support
 Requires: libknet1 = %{version}-%{release}
 
 %description -n libknet1-crypto-openssl-plugin
  OpenSSL crypto support for libknet1.
 
 %files -n libknet1-crypto-openssl-plugin
 %defattr(-,root,root,-)
 %{_libdir}/kronosnet/crypto_openssl.so
 %endif
 
 %if %{defined buildcompresszlib}
 %package -n libknet1-compress-zlib-plugin
 Group: System Environment/Libraries
 Summary: libknet1 zlib support
 Requires: libknet1 = %{version}-%{release}
 
 %description -n libknet1-compress-zlib-plugin
  zlib compression support for libknet1.
 
 %files -n libknet1-compress-zlib-plugin
 %defattr(-,root,root,-)
 %{_libdir}/kronosnet/compress_zlib.so
 %endif
 %if %{defined buildcompresslz4}
 %package -n libknet1-compress-lz4-plugin
 Group: System Environment/Libraries
 Summary: libknet1 lz4 and lz4hc support
 Requires: libknet1 = %{version}-%{release}
 
 %description -n libknet1-compress-lz4-plugin
  lz4 and lz4hc compression support for libknet1.
 
 %files -n libknet1-compress-lz4-plugin
 %defattr(-,root,root,-)
 %{_libdir}/kronosnet/compress_lz4.so
 %{_libdir}/kronosnet/compress_lz4hc.so
 %endif
 
 %if %{defined buildcompresslzo2}
 %package -n libknet1-compress-lzo2-plugin
 Group: System Environment/Libraries
 Summary: libknet1 lzo2 support
 Requires: libknet1 = %{version}-%{release}
 
 %description -n libknet1-compress-lzo2-plugin
  lzo2 compression support for libknet1.
 
 %files -n libknet1-compress-lzo2-plugin
 %defattr(-,root,root,-)
 %{_libdir}/kronosnet/compress_lzo2.so
 %endif
 
 %if %{defined buildcompresslzma}
 %package -n libknet1-compress-lzma-plugin
 Group: System Environment/Libraries
 Summary: libknet1 lzma support
 Requires: libknet1 = %{version}-%{release}
 
 %description -n libknet1-compress-lzma-plugin
  lzma compression support for libknet1.
 
 %files -n libknet1-compress-lzma-plugin
 %defattr(-,root,root,-)
 %{_libdir}/kronosnet/compress_lzma.so
 %endif
 
 %if %{defined buildcompressbzip2}
 %package -n libknet1-compress-bzip2-plugin
 Group: System Environment/Libraries
 Summary: libknet1 bzip2 support
 Requires: libknet1 = %{version}-%{release}
 
 %description -n libknet1-compress-bzip2-plugin
  bzip2 compression support for libknet1.
 
 %files -n libknet1-compress-bzip2-plugin
 %defattr(-,root,root,-)
 %{_libdir}/kronosnet/compress_bzip2.so
 %endif
 
 %package -n libknet1-crypto-plugins-all
 Group: System Environment/Libraries
 Summary: libknet1 crypto plugins meta package
 %if %{defined buildcryptonss}
 Requires: libknet1-crypto-nss-plugin
 %endif
 %if %{defined buildcryptoopenssl}
 Requires: libknet1-crypto-openssl-plugin
 %endif
 
 %description -n libknet1-crypto-plugins-all
  meta package to install all of libknet1 crypto plugins
 
 %files -n libknet1-crypto-plugins-all
 
 %package -n libknet1-compress-plugins-all
 Group: System Environment/Libraries
 Summary: libknet1 compress plugins meta package
 %if %{defined buildcompresszlib}
 Requires: libknet1-compress-zlib-plugin
 %endif
 %if %{defined buildcompresslz4}
 Requires: libknet1-compress-lz4-plugin
 %endif
 %if %{defined buildcompresslzo2}
 Requires: libknet1-compress-lzo2-plugin
 %endif
 %if %{defined buildcompresslzma}
 Requires: libknet1-compress-lzma-plugin
 %endif
 %if %{defined buildcompressbzip2}
 Requires: libknet1-compress-bzip2-plugin
 %endif
 
 %description -n libknet1-compress-plugins-all
  meta package to install all of libknet1 compress plugins
 
 %files -n libknet1-compress-plugins-all
 
 %package -n libknet1-plugins-all
 Group: System Environment/Libraries
 Summary: libknet1 plugins meta package
 Requires: libknet1-compress-plugins-all
 Requires: libknet1-crypto-plugins-all
 
 %description -n libknet1-plugins-all
  meta package to install all of libknet1 plugins
 
 %files -n libknet1-plugins-all
 
 %if %{with rpmdebuginfo}
 %debug_package
 %endif
 
 %changelog
 * @date@ Autotools generated version <nobody@nowhere.org> - @version@-1-@numcomm@.@alphatag@.@dirty@
 - These aren't the droids you're looking for.
 
diff --git a/libknet/Makefile.am b/libknet/Makefile.am
index 94965790..c3c3157c 100644
--- a/libknet/Makefile.am
+++ b/libknet/Makefile.am
@@ -1,149 +1,149 @@
 #
 # Copyright (C) 2010-2018 Red Hat, Inc.  All rights reserved.
 #
 # Authors: Fabio M. Di Nitto <fabbione@kronosnet.org>
 #          Federico Simoncelli <fsimon@kronosnet.org>
 #
 # This software licensed under GPL-2.0+, LGPL-2.0+
 #
 
 MAINTAINERCLEANFILES	= Makefile.in
 
 include $(top_srcdir)/build-aux/check.mk
 
 SYMFILE			= libknet_exported_syms
 
 EXTRA_DIST		= $(SYMFILE)
 
-SUBDIRS			= . tests man
+SUBDIRS			= . tests
 
 libversion		= 1:0:0
 
 # override global LIBS that pulls in lots of craft we don't need here
 LIBS			=
 
 sources			= \
 			  common.c \
 			  compat.c \
 			  compress.c \
 			  crypto.c \
 			  handle.c \
 			  host.c \
 			  links.c \
 			  logging.c \
 			  netutils.c \
 			  threads_common.c \
 			  threads_dsthandler.c \
 			  threads_heartbeat.c \
 			  threads_pmtud.c \
 			  threads_rx.c \
 			  threads_tx.c \
 			  transports.c \
 			  transport_common.c \
 			  transport_loopback.c \
 			  transport_udp.c \
 			  transport_sctp.c
 
 include_HEADERS		= libknet.h
 
 pkgconfigdir		= $(libdir)/pkgconfig
 
 pkgconfig_DATA		= libknet.pc
 
 noinst_HEADERS		= \
 			  common.h \
 			  compat.h \
 			  compress.h \
 			  compress_model.h \
 			  crypto.h \
 			  crypto_model.h \
 			  host.h \
 			  internals.h \
 			  links.h \
 			  logging.h \
 			  netutils.h \
 			  onwire.h \
 			  threads_common.h \
 			  threads_dsthandler.h \
 			  threads_heartbeat.h \
 			  threads_pmtud.h \
 			  threads_rx.h \
 			  threads_tx.h \
 			  transports.h \
 			  transport_common.h \
 			  transport_loopback.h \
 			  transport_udp.h \
 			  transport_sctp.h
 
 lib_LTLIBRARIES		= libknet.la
 
 libknet_la_SOURCES	= $(sources)
 
 libknet_la_CFLAGS	= $(AM_CFLAGS) $(PTHREAD_CFLAGS)
 
 EXTRA_libknet_la_DEPENDENCIES	= $(SYMFILE)
 
 libknet_la_LDFLAGS	= $(AM_LDFLAGS) \
 			  -Wl,--version-script=$(srcdir)/$(SYMFILE) \
 			  -Wl,-rpath=$(pkglibdir) \
 			  -version-number $(libversion)
 
 libknet_la_LIBADD	= $(PTHREAD_LIBS) $(dl_LIBS) $(rt_LIBS) $(m_LIBS)
 
 # Prepare empty value for appending
 pkglib_LTLIBRARIES	=
 
 # MODULE_LDFLAGS would mean a target-specific variable for Automake
 MODULELDFLAGS		= $(AM_LDFLAGS) -module -avoid-version -export-dynamic
 
 if BUILD_COMPRESS_ZLIB
 pkglib_LTLIBRARIES	+= compress_zlib.la
 compress_zlib_la_LDFLAGS = $(MODULELDFLAGS)
 compress_zlib_la_CFLAGS	= $(AM_CFLAGS) $(zlib_CFLAGS)
 compress_zlib_la_LIBADD	= $(zlib_LIBS)
 endif
 
 if BUILD_COMPRESS_LZ4
 pkglib_LTLIBRARIES	+= compress_lz4.la compress_lz4hc.la
 compress_lz4_la_LDFLAGS	= $(MODULELDFLAGS)
 compress_lz4_la_CFLAGS	= $(AM_CFLAGS) $(liblz4_CFLAGS)
 compress_lz4_la_LIBADD	= $(liblz4_LIBS)
 compress_lz4hc_la_LDFLAGS = $(MODULELDFLAGS)
 compress_lz4hc_la_CFLAGS = $(AM_CFLAGS) $(liblz4_CFLAGS)
 compress_lz4hc_la_LIBADD = $(liblz4_LIBS)
 endif
 
 if BUILD_COMPRESS_LZO2
 pkglib_LTLIBRARIES	+= compress_lzo2.la
 compress_lzo2_la_LDFLAGS = $(MODULELDFLAGS)
 compress_lzo2_la_CFLAGS	= $(AM_CFLAGS) $(lzo2_CFLAGS)
 compress_lzo2_la_LIBADD	= $(lzo2_LIBS)
 endif
 
 if BUILD_COMPRESS_LZMA
 pkglib_LTLIBRARIES	+= compress_lzma.la
 compress_lzma_la_LDFLAGS = $(MODULELDFLAGS)
 compress_lzma_la_CFLAGS	= $(AM_CFLAGS) $(liblzma_CFLAGS)
 compress_lzma_la_LIBADD	= $(liblzma_LIBS)
 endif
 
 if BUILD_COMPRESS_BZIP2
 pkglib_LTLIBRARIES	+= compress_bzip2.la
 compress_bzip2_la_LDFLAGS = $(MODULELDFLAGS)
 compress_bzip2_la_CFLAGS = $(AM_CFLAGS) $(bzip2_CFLAGS)
 compress_bzip2_la_LIBADD = $(bzip2_LIBS)
 endif
 
 if BUILD_CRYPTO_NSS
 pkglib_LTLIBRARIES	+= crypto_nss.la
 crypto_nss_la_LDFLAGS	= $(MODULELDFLAGS)
 crypto_nss_la_CFLAGS	= $(AM_CFLAGS) $(nss_CFLAGS)
 crypto_nss_la_LIBADD	= $(nss_LIBS)
 endif
 
 if BUILD_CRYPTO_OPENSSL
 pkglib_LTLIBRARIES	+= crypto_openssl.la
 crypto_openssl_la_LDFLAGS = $(MODULELDFLAGS)
 crypto_openssl_la_CFLAGS = $(AM_CFLAGS) $(openssl_CFLAGS)
 crypto_openssl_la_LIBADD = $(openssl_LIBS)
 endif
diff --git a/libknet/man/Doxyfile.in b/man/Doxyfile-knet.in
similarity index 80%
rename from libknet/man/Doxyfile.in
rename to man/Doxyfile-knet.in
index 034ba8af..50d78bd5 100644
--- a/libknet/man/Doxyfile.in
+++ b/man/Doxyfile-knet.in
@@ -1,17 +1,17 @@
 #
 # Copyright (C) 2017-2018 Red Hat, Inc.  All rights reserved.
 #
 # Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
 #         Christine Caulfield <ccaulfie@redhat.com>
 #
 # This software licensed under GPL-2.0+, LGPL-2.0+
 #
 PROJECT_NAME	       = @PACKAGE_NAME@
 PROJECT_NUMBER         = @PACKAGE_VERSION@
-INPUT                  = @srcdir@/../libknet.h
-XML_OUTPUT             = @abs_builddir@/xml
+INPUT                  = @abs_top_srcdir@/libknet/libknet.h
+XML_OUTPUT             = @abs_builddir@/xml-knet
 GENERATE_XML           = YES
 XML_PROGRAMLISTING     = NO
 AUTOLINK_SUPPORT       = NO
 GENERATE_HTML          = NO
 GENERATE_LATEX         = NO
diff --git a/libknet/man/Makefile.am b/man/Makefile.am
similarity index 71%
rename from libknet/man/Makefile.am
rename to man/Makefile.am
index f7f01afb..e0c8a3a3 100644
--- a/libknet/man/Makefile.am
+++ b/man/Makefile.am
@@ -1,89 +1,103 @@
 #
 # Copyright (C) 2017-2018 Red Hat, Inc.  All rights reserved.
 #
 # Authors: Fabio M. Di Nitto <fabbione@kronosnet.org>
 #          Federico Simoncelli <fsimon@kronosnet.org>
 #
 # This software licensed under GPL-2.0+, LGPL-2.0+
 #
 
 MAINTAINERCLEANFILES	= Makefile.in
 
 include $(top_srcdir)/build-aux/check.mk
 
+# Avoid Automake warnings about overriding these user variables.
+# Programs in this directory are used during the build only.
+AUTOMAKE_OPTIONS = -Wno-gnu
+EXEEXT=$(BUILD_EXEEXT)
+CC=$(CC_FOR_BUILD)
+CFLAGS=$(CFLAGS_FOR_BUILD)
+CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
+LDFLAGS=$(LDFLAGS_FOR_BUILD)
+
 if BUILD_MAN
 
-man3_MANS = \
+noinst_PROGRAMS	= doxyxml
+
+doxyxml_SOURCES = doxyxml.c
+doxyxml_CFLAGS = $(AM_CFLAGS) $(libqb_BUILD_CFLAGS) $(libxml_BUILD_CFLAGS)
+doxyxml_LDADD = $(libqb_BUILD_LIBS) $(libxml_BUILD_LIBS)
+
+knet_man3_MANS = \
 		knet_addrtostr.3 \
 		knet_handle_add_datafd.3 \
 		knet_handle_clear_stats.3 \
 		knet_handle_compress.3 \
 		knet_handle_crypto.3 \
 		knet_handle_enable_filter.3 \
 		knet_handle_enable_pmtud_notify.3 \
 		knet_handle_enable_sock_notify.3 \
 		knet_handle_free.3 \
 		knet_handle_get_channel.3 \
 		knet_get_compress_list.3 \
 		knet_get_crypto_list.3 \
 		knet_handle_get_datafd.3 \
 		knet_handle_get_stats.3 \
 		knet_get_transport_id_by_name.3 \
 		knet_get_transport_list.3 \
 		knet_get_transport_name_by_id.3 \
 		knet_handle_get_transport_reconnect_interval.3 \
 		knet_handle_new.3 \
 		knet_handle_pmtud_get.3 \
 		knet_handle_pmtud_getfreq.3 \
 		knet_handle_pmtud_setfreq.3 \
 		knet_handle_remove_datafd.3 \
 		knet_handle_setfwd.3 \
 		knet_handle_set_transport_reconnect_interval.3 \
 		knet_host_add.3 \
 		knet_host_enable_status_change_notify.3 \
 		knet_host_get_host_list.3 \
 		knet_host_get_id_by_host_name.3 \
 		knet_host_get_name_by_host_id.3 \
 		knet_host_get_policy.3 \
 		knet_host_get_status.3 \
 		knet_host_remove.3 \
 		knet_host_set_name.3 \
 		knet_host_set_policy.3 \
 		knet_link_clear_config.3 \
 		knet_link_get_config.3 \
 		knet_link_get_enable.3 \
 		knet_link_get_link_list.3 \
 		knet_link_get_ping_timers.3 \
 		knet_link_get_pong_count.3 \
 		knet_link_get_priority.3 \
 		knet_link_get_status.3 \
 		knet_link_set_config.3 \
 		knet_link_set_enable.3 \
 		knet_link_set_ping_timers.3 \
 		knet_link_set_pong_count.3 \
 		knet_link_set_priority.3 \
 		knet_log_get_loglevel.3 \
 		knet_log_get_loglevel_id.3 \
 		knet_log_get_loglevel_name.3 \
 		knet_log_get_subsystem_id.3 \
 		knet_log_get_subsystem_name.3 \
 		knet_log_set_loglevel.3 \
 		knet_recv.3 \
 		knet_send.3 \
 		knet_send_sync.3 \
 		knet_strtoaddr.3
 
-$(MANS): doxyfile.stamp
+man3_MANS = $(knet_man3_MANS)
 
-$(top_builddir)/build-aux/doxyxml: $(top_srcdir)/build-aux/doxyxml.c
-	$(MAKE) -C $(top_builddir)/build-aux doxyxml
+$(MANS): doxyfile-knet.stamp
 
-doxyfile.stamp: Doxyfile $(top_srcdir)/libknet/libknet.h $(top_builddir)/build-aux/doxyxml $(top_srcdir)/build-aux/doxyxml.c
-	$(DOXYGEN) Doxyfile
-	$(top_builddir)/build-aux/doxyxml -m -P -o $(builddir) -s 3 -p @PACKAGE_NAME@ -H "Kronosnet Programmer's Manual" -d $(builddir)/xml/ libknet_8h.xml
+doxyfile-knet.stamp: $(builddir)/doxyxml Doxyfile-knet $(top_srcdir)/libknet/libknet.h
+	$(DOXYGEN) Doxyfile-knet
+	$(builddir)/doxyxml -m -P -o $(builddir) -s 3 -p @PACKAGE_NAME@ -H "Kronosnet Programmer's Manual" -d $(builddir)/xml-knet/ libknet_8h.xml
 	touch doxyfile.stamp
 
 endif
 
 clean-local:
-	rm -rf doxyfile.stamp xml *.3
+	rm -rf doxyfile*.stamp xml* *.3
diff --git a/build-aux/doxyxml.c b/man/doxyxml.c
similarity index 100%
rename from build-aux/doxyxml.c
rename to man/doxyxml.c