From 29349f50749eb1ac7d42b9af4d1f2d5a0410842b Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Tue, 24 Aug 2021 14:56:27 +0900 Subject: [PATCH] Exclude dlog dependency when dlog disabled. Change-Id: Ieacca63024ed65a0719e1e7a84786db3af655741 Signed-off-by: Joonbum Ko --- common/tdm_log.c | 12 +++++++++--- configure.ac | 18 ++++++++++++++++-- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/common/tdm_log.c b/common/tdm_log.c index 68621bf..b16f86b 100644 --- a/common/tdm_log.c +++ b/common/tdm_log.c @@ -42,7 +42,6 @@ #include #include #include -#include #include #include "tdm.h" @@ -60,8 +59,10 @@ #define LOG_TAG "TDM" #if ENABLE_DLOG +#include static unsigned int dlog_enable = 1; #else +#include static unsigned int dlog_enable = 0; #endif static unsigned int color_enable = 1; @@ -193,6 +194,7 @@ tdm_log_print(int level, const char *fmt, ...) if (level > tdm_log_debug_level) return; +#if ENABLE_DLOG if (dlog_enable) { log_priority dlog_prio; switch (level) { @@ -214,11 +216,15 @@ tdm_log_print(int level, const char *fmt, ...) va_start(arg, fmt); __dlog_vprint(LOG_ID_SYSTEM, dlog_prio, LOG_TAG, fmt, arg); va_end(arg); - } else { + } + else +#endif + { va_start(arg, fmt); _tdm_log_vprint_stdout(level, fmt, arg); va_end(arg); - } + } + assert(level > assert_level); } diff --git a/configure.ac b/configure.ac index d1f3dcc..c161573 100644 --- a/configure.ac +++ b/configure.ac @@ -54,8 +54,22 @@ fi PKG_CHECK_MODULES(WAYLAND_SCANNER, wayland-scanner >= 1.7.0) -PKG_CHECK_MODULES(TDM, dlog libtbm libpng pixman-1 wayland-server iniparser hal-api-tdm) -PKG_CHECK_MODULES(TDM_CLIENT, dlog libtbm wayland-client) +PKG_CHECK_MODULES(TDM, libtbm libpng pixman-1 wayland-server iniparser hal-api-tdm) +PKG_CHECK_MODULES(TDM_CLIENT, libtbm wayland-client) + +PKG_CHECK_EXISTS([dlog], [have_dlog="yes"], [have_dlog="no"]) +AC_MSG_CHECKING([Have dlog logger]) +AC_MSG_RESULT([${have_dlog}]) +if test "x${have_dlog}" = "xyes"; then + AC_DEFINE([HAVE_DLOG], [1], [Define to 1 if you have dlog]) + + PKG_CHECK_MODULES(DLOG, dlog) + + TDM_CFLAGS="$TDM_CFLAGS $DLOG_CFLAGS " + TDM_CLIENT_CFLAGS+="$TDM_CLIENT_CFLAGS $DLOG_CFLAGS " + TDM_LIBS+="$TDM_LIBS $DLOG_LIBS " + TDM_CLIENT_LIBS="$TDM_CLIENT_LIBS $DLOG_LIBS " +fi PKG_CHECK_MODULES(TTRACE, [ttrace], -- 2.7.4