diff --git a/Makefile.am b/Makefile.am
index d16800ad7d144dc71f81773f9d3a058348739b4c..7ba6efbb258e792adaac69173394c7a6a3064b09 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -12,7 +12,11 @@ if USE_CYTHON
 SUBDIRS += python
 endif
 
-SUBDIRS += doc tests
+if ENABLE_TESTS
+SUBDIRS += tests
+endif
+
+SUBDIRS += doc
 
 ACLOCAL_AMFLAGS = -I m4
 
diff --git a/configure.ac b/configure.ac
index 2611275746b619722724f28a67e985f9eea0569d..f48673d27ca7a09c641d78a82101ab0f3719b97a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -183,8 +183,8 @@ AM_COND_IF([PROXY_CLIENT_OR_SERVER], [
 ], [])
 
 AC_ARG_ENABLE([tests], AS_HELP_STRING([--enable-tests], [Enable tests]), build_tests=yes, build_tests=no)
-AM_CONDITIONAL(OPENDHT_TESTS, test x$build_tests == xyes)
-AM_COND_IF([OPENDHT_TESTS], [
+AM_CONDITIONAL(ENABLE_TESTS, test x$build_tests == xyes)
+AM_COND_IF([ENABLE_TESTS], [
 	PKG_CHECK_MODULES([CppUnit], [cppunit >= 1.12])
 ])
 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 16660000032237f5fbcabc352b013a4a9049972c..5308335e7eccb0fe0f61f6d5d20b1e943d5ee7c5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,9 +1,9 @@
-if OPENDHT_TESTS
+if ENABLE_TESTS
 bin_PROGRAMS = opendht_unit_tests
 
 AM_CPPFLAGS = -I../include
 
+nobase_include_HEADERS = infohashtester.h
 opendht_unit_tests_SOURCES = tests_runner.cpp infohashtester.cpp
-opendht_unit_tests_HEADERS = infohashtester.h
-opendht_unit_tests_LDFLAGS = -lopendht -lcppunit  -L@top_builddir@/src/.libs @Argon2_LDFLAGS@ @GnuTLS_LIBS@
+opendht_unit_tests_LDFLAGS = -lopendht -lcppunit -L@top_builddir@/src/.libs @GnuTLS_LIBS@
 endif
diff --git a/tests/infohashtester.cpp b/tests/infohashtester.cpp
index 1d8f116c48562cb0431f27c5cb954ed350a7d485..d9baba0776f8eceeee89c97059352545e6a13a53 100644
--- a/tests/infohashtester.cpp
+++ b/tests/infohashtester.cpp
@@ -25,7 +25,7 @@
 #include <string>
 
 // opendht
-#include "infohash.h"
+#include "opendht/infohash.h"
 
 namespace test {
 CPPUNIT_TEST_SUITE_REGISTRATION(InfoHashTester);