diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4332712d317f1d8b8ea1651b41ebba2f18148402..1a594c79ceb843375e60f3b215f57eb3b2a123c1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,6 +20,7 @@ option (OPENDHT_PROXY_SERVER "Enable DHT proxy server, use Restbed and jsoncpp"
 option (OPENDHT_PUSH_NOTIFICATIONS "Enable push notifications support" OFF)
 option (OPENDHT_PROXY_SERVER_IDENTITY "Allow clients to use the node identity" OFF)
 option (OPENDHT_PROXY_CLIENT "Enable DHT proxy client, use Restbed and jsoncpp" OFF)
+option (OPENDHT_INDEX "Build DHT indexation feature" OFF)
 
 find_package(Doxygen)
 option (OPENDHT_DOCUMENTATION "Create and install the HTML based API documentation (requires Doxygen)" ${DOXYGEN_FOUND})
@@ -131,7 +132,6 @@ list (APPEND opendht_SOURCES
     src/network_engine.cpp
     src/securedht.cpp
     src/dhtrunner.cpp
-    src/indexation/pht.cpp
     src/log.cpp
 )
 
@@ -157,9 +157,14 @@ list (APPEND opendht_HEADERS
     include/opendht/log.h
     include/opendht/log_enable.h
     include/opendht.h
-    include/opendht/indexation/pht.h
 )
 
+if (OPENDHT_INDEX)
+    list (APPEND opendht_SOURCES src/indexation/pht.cpp)
+    list (APPEND opendht_HEADERS include/opendht/indexation/pht.h)
+    add_definitions(-DOPENDHT_INDEXATION)
+endif()
+
 if (OPENDHT_PROXY_SERVER)
   add_definitions(-DOPENDHT_PROXY_SERVER=true)
   if (OPENDHT_PROXY_SERVER_IDENTITY)
diff --git a/configure.ac b/configure.ac
index 7d051d72c9817102b57d51b6396627a320563b1c..2890f2abdfc12ae44da54a21c1e5adf6e77d4425 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,6 +32,13 @@ AS_IF([test "x$enable_logs" != "xno"], [
 	AC_DEFINE([OPENDHT_LOG], [false], [Define if DHT logs are enabled])
 ])
 
+dnl Check for indexation
+AC_ARG_ENABLE([indexation], [AS_HELP_STRING([--enable-indexation], [Enable DHT indexation])])
+AM_CONDITIONAL(ENABLE_INDEXATION, test x$enable_indexation == xyes)
+AS_IF([test "x$enable_indexation" = "xyes"], [
+	AC_DEFINE([OPENDHT_INDEXATION], [1], [Define if DHT indexation is enabled])
+])
+
 dnl Check for Doxygen
 AC_ARG_ENABLE([doc], AS_HELP_STRING([--enable-doc], [Enable documentation generation (doxygen)]))
 AS_IF([test "x$enable_doc" = "xyes"], [
diff --git a/include/opendht.h b/include/opendht.h
index e003a21631f8c4612412db8ed5d493037579f93e..8d0154d385cd8251dd6ae68fd49204349d2c40d5 100644
--- a/include/opendht.h
+++ b/include/opendht.h
@@ -24,4 +24,6 @@
 #endif
 #include "opendht/log.h"
 #include "opendht/default_types.h"
+#ifdef OPENDHT_INDEXATION
 #include "opendht/indexation/pht.h"
+#endif
diff --git a/src/Makefile.am b/src/Makefile.am
index d21212a352de914925bf8c921753c0e09b93e63b..0af5b39665f22afcd15ac3c0e0602c2103cc58fc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,7 +23,6 @@ libopendht_la_SOURCES  = \
         securedht.cpp \
         dhtrunner.cpp \
         default_types.cpp \
-        indexation/pht.cpp \
         log.cpp
 
 if WIN32
@@ -51,8 +50,7 @@ nobase_include_HEADERS = \
         ../include/opendht/default_types.h \
         ../include/opendht/log.h \
         ../include/opendht/log_enable.h \
-        ../include/opendht/rng.h \
-        ../include/opendht/indexation/pht.h
+        ../include/opendht/rng.h
 
 if ENABLE_PROXY_SERVER
 libopendht_la_SOURCES += base64.h base64.cpp dht_proxy_server.cpp
@@ -64,6 +62,11 @@ libopendht_la_SOURCES += dht_proxy_client.cpp
 nobase_include_HEADERS += ../include/opendht/dht_proxy_client.h ../include/opendht/dht_interface.h
 endif
 
+if ENABLE_INDEXATION
+libopendht_la_SOURCES += indexation/pht.cpp
+nobase_include_HEADERS += ../include/opendht/indexation/pht.h
+endif
+
 clean-local:
 	rm -rf libargon2.la
 
diff --git a/tools/dhtnode.cpp b/tools/dhtnode.cpp
index 3d102fb76dd6612337f8b7bd5509c76cf8d3da96..b5a7640539d6e25e0cda619add4a93294b40357b 100644
--- a/tools/dhtnode.cpp
+++ b/tools/dhtnode.cpp
@@ -90,11 +90,13 @@ void print_help() {
               << "  s <key> <str>         Put string value at <key>, signed with our generated private key." << std::endl
               << "  e <key> <dest> <str>  Put string value at <key>, encrypted for <dest> with its public key (if found)." << std::endl;
 
+#ifdef OPENDHT_INDEXATION
     std::cout << std::endl << "Indexation operations on the DHT:" << std::endl
               << "  il <name> <key> [exact match]   Lookup the index named <name> with the key <key>." << std::endl
               << "                                  Set [exact match] to 'false' for inexact match lookup." << std::endl
               << "  ii <name> <key> <value>         Inserts the value <value> under the key <key> in the index named <name>." << std::endl
               << std::endl;
+#endif
 }
 
 void cmd_loop(std::shared_ptr<DhtRunner>& dht, dht_params& params
@@ -111,7 +113,9 @@ void cmd_loop(std::shared_ptr<DhtRunner>& dht, dht_params& params
     using_history();
 #endif
 
+#ifdef OPENDHT_INDEXATION
     std::map<std::string, indexation::Pht> indexes;
+#endif
 
     while (true)
     {
@@ -250,7 +254,13 @@ void cmd_loop(std::shared_ptr<DhtRunner>& dht, dht_params& params
         }
         dht::InfoHash id;
 
-        if (op == "il" or op == "ii") {
+        if (op == "cl") {
+            std::string hash, rem;
+            iss >> hash >> rem;
+            dht->cancelListen(dht::InfoHash(hash), std::stoul(rem));
+        }
+#ifdef OPENDHT_INDEXATION
+        else if (op == "il" or op == "ii") {
             // Pht syntax
             iss >> index >> keystr;
             auto new_index = std::find_if(indexes.begin(), indexes.end(),
@@ -271,11 +281,8 @@ void cmd_loop(std::shared_ptr<DhtRunner>& dht, dht_params& params
                     indexes.emplace(index, Pht {index, std::move(ks), dht});
                 } catch (std::invalid_argument& e) { std::cout << e.what() << std::endl; }
             }
-        } else if (op == "cl") {
-            std::string hash, rem;
-            iss >> hash >> rem;
-            dht->cancelListen(dht::InfoHash(hash), std::stoul(rem));
         }
+#endif
         else {
             // Dht syntax
             iss >> idstr;
@@ -400,6 +407,7 @@ void cmd_loop(std::shared_ptr<DhtRunner>& dht, dht_params& params
                 std::cout << "Announce: " << (ok ? "success" : "failure") << " (took " << print_dt(end-start) << "s)" << std::endl;
             });
         }
+#ifdef OPENDHT_INDEXATION
         else if (op == "il") {
             std::string exact_match;
             iss >> exact_match;
@@ -445,6 +453,7 @@ void cmd_loop(std::shared_ptr<DhtRunner>& dht, dht_params& params
             catch (std::invalid_argument& e) { std::cout << e.what() << std::endl; }
             catch (std::out_of_range& e) { }
         }
+#endif
     }
 
     std::cout << std::endl <<  "Stopping node..." << std::endl;
diff --git a/tools/tools_common.h b/tools/tools_common.h
index 791a8f11a71110f142b200e2d037c31e61917af6..b51cb60ab12344033ad409f0afbee42168066bad 100644
--- a/tools/tools_common.h
+++ b/tools/tools_common.h
@@ -90,6 +90,7 @@ std::map<std::string, std::string> parseStringMap(std::string mapString) {
     return map;
 }
 
+#ifdef OPENDHT_INDEXATION
 dht::indexation::Pht::Key createPhtKey(std::map<std::string, std::string> pht_key_str_map) {
     dht::indexation::Pht::Key pht_key;
     for (auto f : pht_key_str_map) {
@@ -98,6 +99,7 @@ dht::indexation::Pht::Key createPhtKey(std::map<std::string, std::string> pht_ke
     }
     return pht_key;
 }
+#endif
 
 bool isInfoHash(const dht::InfoHash& h) {
     if (not h) {