aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-11-10 21:14:22 +0100
committerMax Kellermann <max@duempel.org>2009-11-10 21:14:22 +0100
commitb722d3d7f365b106794a3f40435ab220098959c5 (patch)
treefc539d0aa20b0357547ced148cc88f18f648d7fe
parentde57c21a3bec43bffb3fc6a85197f5489e18168f (diff)
configure.ac: require GLib 2.12
Drop the required GLib version from 2.16 to 2.12, because many current systems still don't have GLib 2.16. This requires several new compatibility functions in glib_compat.h.
-rw-r--r--INSTALL2
-rw-r--r--NEWS2
-rw-r--r--configure.ac4
-rw-r--r--src/conf.c1
-rw-r--r--src/glib_compat.h21
-rw-r--r--src/input/curl_input_plugin.c1
-rw-r--r--src/input_stream.h4
-rw-r--r--src/listen.c1
-rw-r--r--src/main.c2
-rw-r--r--src/output/httpd_client.c1
-rw-r--r--src/playlist_list.c12
-rw-r--r--src/state_file.c1
12 files changed, 47 insertions, 5 deletions
diff --git a/INSTALL b/INSTALL
index 82cb0c71..cf087ef8 100644
--- a/INSTALL
+++ b/INSTALL
@@ -13,7 +13,7 @@ Dependencies
gcc - http://gcc.gnu.org/
Any other C99 compliant compiler should also work.
-GLib 2.16 - http://www.gtk.org/
+GLib 2.12 - http://www.gtk.org/
General-purpose utility library.
diff --git a/NEWS b/NEWS
index bc571c03..fa668f1b 100644
--- a/NEWS
+++ b/NEWS
@@ -68,7 +68,7 @@ ver 0.16 (20??/??/??)
* set the close-on-exec flag on all file descriptors
* obey $(sysconfdir) for default mpd.conf location
* build with large file support by default
-* require GLib 2.16
+* require GLib 2.12
ver 0.15.6 (2009/??/??)
diff --git a/configure.ac b/configure.ac
index 8366a0a5..f7d6d6e0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -141,8 +141,8 @@ dnl
dnl mandatory libraries
dnl
-PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.16 gthread-2.0],,
- [AC_MSG_ERROR([glib-2.16 is required])])
+PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.12 gthread-2.0],,
+ [AC_MSG_ERROR([GLib 2.12 is required])])
dnl
diff --git a/src/conf.c b/src/conf.c
index 4da44c77..647ddec3 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -21,6 +21,7 @@
#include "utils.h"
#include "tokenizer.h"
#include "path.h"
+#include "glib_compat.h"
#include <glib.h>
diff --git a/src/glib_compat.h b/src/glib_compat.h
index 679307fb..641fef99 100644
--- a/src/glib_compat.h
+++ b/src/glib_compat.h
@@ -28,9 +28,28 @@
#include <glib.h>
+#if !GLIB_CHECK_VERSION(2,14,0)
+
+#define g_queue_clear(q) do { g_queue_free(q); q = g_queue_new(); } while (0)
+
+static inline guint
+g_timeout_add_seconds(guint interval, GSourceFunc function, gpointer data)
+{
+ return g_timeout_add(interval * 1000, function, data);
+}
+
+#endif /* !2.14 */
+
#if !GLIB_CHECK_VERSION(2,16,0)
-static char *
+static inline void
+g_propagate_prefixed_error(GError **dest_r, GError *src,
+ G_GNUC_UNUSED const gchar *format, ...)
+{
+ g_propagate_error(dest_r, src);
+}
+
+static inline char *
g_uri_escape_string(const char *unescaped,
G_GNUC_UNUSED const char *reserved_chars_allowed,
G_GNUC_UNUSED gboolean allow_utf8)
diff --git a/src/input/curl_input_plugin.c b/src/input/curl_input_plugin.c
index c3928a09..b8e9435a 100644
--- a/src/input/curl_input_plugin.c
+++ b/src/input/curl_input_plugin.c
@@ -23,6 +23,7 @@
#include "config.h"
#include "tag.h"
#include "icy_metadata.h"
+#include "glib_compat.h"
#include <assert.h>
diff --git a/src/input_stream.h b/src/input_stream.h
index 9e4a526e..edecb846 100644
--- a/src/input_stream.h
+++ b/src/input_stream.h
@@ -26,6 +26,10 @@
#include <stdbool.h>
#include <sys/types.h>
+#if !GLIB_CHECK_VERSION(2,14,0)
+typedef gint64 goffset;
+#endif
+
struct input_stream {
/**
* the plugin which implements this input stream
diff --git a/src/listen.c b/src/listen.c
index 668a8077..c1611d4f 100644
--- a/src/listen.c
+++ b/src/listen.c
@@ -22,6 +22,7 @@
#include "client.h"
#include "conf.h"
#include "fd_util.h"
+#include "glib_compat.h"
#include "config.h"
#include <sys/types.h>
diff --git a/src/main.c b/src/main.c
index 70166fef..2c970ba0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -111,8 +111,10 @@ glue_mapper_init(void)
const char *music_dir, *playlist_dir;
music_dir = config_get_path(CONF_MUSIC_DIR);
+#if GLIB_CHECK_VERSION(2,14,0)
if (music_dir == NULL)
music_dir = g_get_user_special_dir(G_USER_DIRECTORY_MUSIC);
+#endif
playlist_dir = config_get_path(CONF_PLAYLIST_DIR);
diff --git a/src/output/httpd_client.c b/src/output/httpd_client.c
index 8157ebb4..62ede81b 100644
--- a/src/output/httpd_client.c
+++ b/src/output/httpd_client.c
@@ -22,6 +22,7 @@
#include "fifo_buffer.h"
#include "page.h"
#include "icy_server.h"
+#include "glib_compat.h"
#include <stdbool.h>
#include <assert.h>
diff --git a/src/playlist_list.c b/src/playlist_list.c
index 2c6237ed..d6359463 100644
--- a/src/playlist_list.c
+++ b/src/playlist_list.c
@@ -104,6 +104,18 @@ playlist_list_global_finish(void)
playlist_plugin_finish(playlist_plugins[i]);
}
+/* g_uri_parse_scheme() was introduced in GLib 2.16 */
+#if !GLIB_CHECK_VERSION(2,16,0)
+static char *
+g_uri_parse_scheme(const char *uri)
+{
+ const char *end = strstr(uri, "://");
+ if (end == NULL)
+ return NULL;
+ return g_strndup(uri, end - uri);
+}
+#endif
+
struct playlist_provider *
playlist_list_open_uri(const char *uri)
{
diff --git a/src/state_file.c b/src/state_file.c
index aa66720c..4c7dab42 100644
--- a/src/state_file.c
+++ b/src/state_file.c
@@ -22,6 +22,7 @@
#include "playlist.h"
#include "playlist_state.h"
#include "volume.h"
+#include "glib_compat.h"
#include <glib.h>
#include <assert.h>