diff options
-rw-r--r-- | common/log.c | 8 | ||||
-rw-r--r-- | m4/spice-deps.m4 | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/common/log.c b/common/log.c index d4a6d28..e39eefc 100644 --- a/common/log.c +++ b/common/log.c @@ -138,6 +138,14 @@ SPICE_CONSTRUCTOR_FUNC(spice_log_init) g_log_set_handler(SPICE_LOG_DOMAIN, G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, spice_logger, NULL); + /* Threading is always enabled from 2.31.0 onwards */ + /* Our logging is potentially used from different threads. + * Older glibs require that g_thread_init() is called when + * doing that. */ +#if !GLIB_CHECK_VERSION(2, 31, 0) + if (!g_thread_supported()) + g_thread_init(NULL); +#endif } static void spice_logv(const char *log_domain, diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4 index fb43cd2..170adf2 100644 --- a/m4/spice-deps.m4 +++ b/m4/spice-deps.m4 @@ -173,7 +173,7 @@ AC_DEFUN([SPICE_CHECK_PIXMAN], [ # use in the GLIB2_CFLAGS and GLIB2_LIBS variables. #------------------ AC_DEFUN([SPICE_CHECK_GLIB2], [ - PKG_CHECK_MODULES(GLIB2, glib-2.0 >= 2.22 gio-2.0 >= 2.22) + PKG_CHECK_MODULES(GLIB2, glib-2.0 >= 2.22 gio-2.0 >= 2.22 gthread-2.0 >= 2.22) ]) # SPICE_CHECK_PYTHON_MODULES() |