configure.ac: add option "--disable-glib"
Allows building without GLib. This fails to compile currently, because GLib is still used in the MPD core.
This commit is contained in:
@@ -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
|
||||
|
@@ -31,13 +31,16 @@
|
||||
#include "util/Domain.hxx"
|
||||
#include "system/FatalError.hxx"
|
||||
|
||||
#ifdef HAVE_GLIB
|
||||
#include <glib.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <glib.h>
|
||||
|
||||
#define LOG_LEVEL_SECURE LogLevel::INFO
|
||||
|
||||
@@ -110,9 +113,11 @@ log_init(bool verbose, bool use_stdout, Error &error)
|
||||
{
|
||||
const struct config_param *param;
|
||||
|
||||
#ifdef HAVE_GLIB
|
||||
const char *charset;
|
||||
g_get_charset(&charset);
|
||||
SetLogCharset(charset);
|
||||
#endif
|
||||
|
||||
if (verbose)
|
||||
SetLogThreshold(LogLevel::DEBUG);
|
||||
|
@@ -79,7 +79,9 @@
|
||||
#include "ArchiveList.hxx"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GLIB
|
||||
#include <glib.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -92,6 +94,8 @@
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
static constexpr unsigned DEFAULT_BUFFER_SIZE = 4096;
|
||||
static constexpr unsigned DEFAULT_BUFFER_BEFORE_PLAY = 10;
|
||||
|
||||
@@ -359,11 +363,13 @@ int mpd_main(int argc, char *argv[])
|
||||
setlocale(LC_CTYPE,"");
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GLIB
|
||||
g_set_application_name("Music Player Daemon");
|
||||
|
||||
#if !GLIB_CHECK_VERSION(2,32,0)
|
||||
/* enable GLib's thread safety code */
|
||||
g_thread_init(nullptr);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
winsock_init();
|
||||
@@ -473,7 +479,7 @@ int mpd_main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
if (!glue_state_file_init(error)) {
|
||||
g_printerr("%s\n", error.GetMessage());
|
||||
LogError(error);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
@@ -40,6 +40,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include <assert.h>
|
||||
#include <signal.h>
|
||||
|
||||
class SignalMonitor final : private SocketMonitor {
|
||||
#ifdef USE_SIGNALFD
|
||||
|
@@ -23,7 +23,7 @@
|
||||
#include "util/Domain.hxx"
|
||||
#include "LogV.hxx"
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef HAVE_GLIB
|
||||
#include <glib.h>
|
||||
#endif
|
||||
|
||||
@@ -78,12 +78,16 @@ FatalError(const char *msg, const Error &error)
|
||||
FormatFatalError("%s: %s", msg, error.GetMessage());
|
||||
}
|
||||
|
||||
#ifdef HAVE_GLIB
|
||||
|
||||
void
|
||||
FatalError(const char *msg, GError *error)
|
||||
{
|
||||
FormatFatalError("%s: %s", msg, error->message);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
FatalSystemError(const char *msg)
|
||||
{
|
||||
|
@@ -45,9 +45,11 @@ gcc_noreturn
|
||||
void
|
||||
FatalError(const char *msg, const Error &error);
|
||||
|
||||
#ifdef HAVE_GLIB
|
||||
gcc_noreturn
|
||||
void
|
||||
FatalError(const char *msg, GError *error);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Call this after a system call has failed that is not supposed to
|
||||
|
Reference in New Issue
Block a user