Skip to content

Allow debug messages to be configured to have timestamps

Very useful when debugging.

Packages like xfdesktop can be modified like this to support the feature.

diff --git a/configure.ac b/configure.ac
index d21cd05a..bfe78e4b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -221,6 +221,22 @@ AM_CONDITIONAL([ENABLE_TESTS], [test x"$enable_tests" = x"yes"])
 dnl check for debugging support
 XDT_FEATURE_DEBUG([xdt_debug_default])
 
+AC_ARG_ENABLE([debug-time],
+              [
+AS_HELP_STRING([--enable-debug-time], [Include timestamps in debug messages (default=disabled)])
+AS_HELP_STRING([--disable-debug-time], [Don't include timestamps in debug messages (default=disabled)])
+              ],
+              [enable_debug_time=$enableval], [enable_debug_time=no])
+
+if test x"$enable_debug_time" = xyes; then
+  if test "x$ac_cv_header_time_h" = xyes; then
+    AC_DEFINE([DEBUG_TIME], [1], [Define to include timestamps in debug messages])
+  else
+    echo "time.h not found; disabling debug-time."
+    enable_debug_time="no; time.h not found"
+  fi
+fi
+
 AC_CONFIG_FILES([
 Makefile
 backgrounds/Makefile
@@ -248,4 +264,6 @@ echo "* Windowing:"
 echo "      X11:                                      $ENABLE_X11"
 echo "      Wayland:                                  $ENABLE_WAYLAND"
 echo "* Test programs:                                $enable_tests"
+echo "* Debug:                                        $enable_debug"
+echo "* Debug time:                                   $enable_debug_time"
 echo

Maybe it can also be converted to a macro in xdt-features.m4.

Merge request reports

Loading