From a5137e8ac4ae9257d83e075ead40b37efc77d49c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Sat, 17 Mar 2018 14:47:23 -0400
Subject: [PATCH] tests: fix build with autotools

---
 Makefile.am              | 6 +++++-
 configure.ac             | 4 ++--
 tests/Makefile.am        | 6 +++---
 tests/infohashtester.cpp | 2 +-
 4 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index d16800ad..7ba6efbb 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 26112757..f48673d2 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 16660000..5308335e 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 1d8f116c..d9baba07 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);
-- 
GitLab