diff options
author | Max Kellermann <max@duempel.org> | 2013-12-15 12:32:15 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-12-15 18:43:12 +0100 |
commit | d5dfe7d457b559bd9c53d65d0315c55611cc6a79 (patch) | |
tree | 42825c13cc44e4fe1272d14f9dc26f03ce0ef596 /src/LogBackend.cxx | |
parent | 0db0b4e302f82165b763da7717059911a85c370f (diff) | |
download | mpd-d5dfe7d457b559bd9c53d65d0315c55611cc6a79.tar.gz mpd-d5dfe7d457b559bd9c53d65d0315c55611cc6a79.tar.xz mpd-d5dfe7d457b559bd9c53d65d0315c55611cc6a79.zip |
configure.ac: add option "--disable-glib"
Allows building without GLib. This fails to compile currently,
because GLib is still used in the MPD core.
Diffstat (limited to '')
-rw-r--r-- | src/LogBackend.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/LogBackend.cxx b/src/LogBackend.cxx index a5c0a691f..bddf8db16 100644 --- a/src/LogBackend.cxx +++ b/src/LogBackend.cxx @@ -23,18 +23,24 @@ #include "util/Domain.hxx" #include "util/CharUtil.hxx" +#ifdef HAVE_GLIB #include <glib.h> +#endif #include <assert.h> #include <stdio.h> #include <string.h> +#include <time.h> #ifdef HAVE_SYSLOG #include <syslog.h> #endif static LogLevel log_threshold = LogLevel::INFO; + +#ifdef HAVE_GLIB static const char *log_charset; +#endif static bool enable_timestamp; @@ -48,12 +54,16 @@ SetLogThreshold(LogLevel _threshold) log_threshold = _threshold; } +#ifdef HAVE_GLIB + void SetLogCharset(const char *_charset) { log_charset = _charset; } +#endif + void EnableLogTimestamp() { @@ -142,6 +152,7 @@ LogFinishSysLog() static void FileLog(const Domain &domain, const char *message) { +#ifdef HAVE_GLIB char *converted; if (log_charset != nullptr) { @@ -153,13 +164,16 @@ FileLog(const Domain &domain, const char *message) message = converted; } else converted = nullptr; +#endif fprintf(stderr, "%s%s: %.*s\n", enable_timestamp ? log_date() : "", domain.GetName(), chomp_length(message), message); +#ifdef HAVE_GLIB g_free(converted); +#endif } void |