From e4333b13df0c8fe712c0efb66930cc1da74201db Mon Sep 17 00:00:00 2001 From: Jim Hague Date: Thu, 24 Oct 2019 13:43:20 +0100 Subject: [PATCH] Add debug message options. --- CMakeLists.txt | 22 ++++++++++++++++++++++ cmake/include/cmakeconfig.h.in | 9 +++++++++ 2 files changed, 31 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index fcec99c5..3b35846c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,6 +104,28 @@ if ((NOT ENABLE_SHARED) AND (NOT ENABLE_STATIC)) message(FATAL_ERROR "You must build either static or shared libraries.") endif () +include(CMakeDependentOption) +option(ENABLE_DEBUG_ALL "Enable all debugging messages.") +cmake_dependent_option(ENABLE_DEBUG_REQ "Enable request debugging messages." OFF "NOT ENABLE_DEBUG_ALL" ON) +cmake_dependent_option(ENABLE_DEBUG_SCHED "Enable scheduling debugging messages." OFF "NOT ENABLE_DEBUG_ALL" ON) +cmake_dependent_option(ENABLE_DEBUG_STUB "Enable stub debugging messages." OFF "NOT ENABLE_DEBUG_ALL" ON) +cmake_dependent_option(ENABLE_DEBUG_DAEMON "Enable daemon debugging messages." OFF "NOT ENABLE_DEBUG_ALL" ON) +cmake_dependent_option(ENABLE_DEBUG_DNSSEC "Enable DNSSEC debugging messages." OFF "NOT ENABLE_DEBUG_ALL" ON) +cmake_dependent_option(ENABLE_DEBUG_SERVER "Enable server debugging messages." OFF "NOT ENABLE_DEBUG_ALL" ON) +cmake_dependent_option(ENABLE_DEBUG_ANCHOR "Enable anchor debugging messages." OFF "NOT ENABLE_DEBUG_ALL" ON) +# Above names chosen for user consistency. Now define substituted names. +set(REQ_DEBUG ${ENABLE_DEBUG_REQ}) +set(SCHED_DEBUG ${ENABLE_DEBUG_SCHED}) +set(STUB_DEBUG ${ENABLE_DEBUG_STUB}) +set(DAEMON_DEBUG ${ENABLE_DEBUG_DAEMON}) +set(SEC_DEBUG ${ENABLE_DEBUG_DNSSEC}) +set(SERVER_DEBUG ${ENABLE_DEBUG_SERVER}) +set(ANCHOR_DEBUG ${ENABLE_DEBUG_ANCHOR}) + +option(ENABLE_DEBUG_KEEP_CONNECTIONS_OPEN "Disable connection idle timeout. Do not enable.") +mark_as_advanced(ENABLE_DEBUG_KEEP_CONNECTIONS_OPEN) +set(KEEP_CONNECTIONS_OPEN_DEBUG ${ENABLE_DEBUG_KEEP_CONNECTIONS_OPEN}) + # Options variables. string(TIMESTAMP timestamp "%Y-%m-%dT%H:%M:%SZ") set(CURRENT_DATE "${timestamp}" CACHE STRING "Current date of the compilation, set to fixed date for reproducible builds.") diff --git a/cmake/include/cmakeconfig.h.in b/cmake/include/cmakeconfig.h.in index 1f7f8d51..de1cc999 100644 --- a/cmake/include/cmakeconfig.h.in +++ b/cmake/include/cmakeconfig.h.in @@ -166,6 +166,15 @@ #cmakedefine FD_SETSIZE @FD_SETSIZE@ +#cmakedefine REQ_DEBUG 1 +#cmakedefine SCHED_DEBUG 1 +#cmakedefine STUB_DEBUG 1 +#cmakedefine DAEMON_DEBUG 1 +#cmakedefine SEC_DEBUG 1 +#cmakedefine SERVER_DEBUG 1 +#cmakedefine ANCHOR_DEBUG 1 +#cmakedefine KEEP_CONNECTIONS_OPEN_DEBUG 1 + #cmakedefine HAVE_TARGET_ENDIANNESS #cmakedefine TARGET_IS_BIG_ENDIAN