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.
This commit is contained in:
Max Kellermann 2009-11-10 21:14:22 +01:00
parent de57c21a3b
commit b722d3d7f3
12 changed files with 47 additions and 5 deletions

View File

@ -13,7 +13,7 @@ Dependencies
gcc - http://gcc.gnu.org/ gcc - http://gcc.gnu.org/
Any other C99 compliant compiler should also work. 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. General-purpose utility library.

2
NEWS
View File

@ -68,7 +68,7 @@ ver 0.16 (20??/??/??)
* set the close-on-exec flag on all file descriptors * set the close-on-exec flag on all file descriptors
* obey $(sysconfdir) for default mpd.conf location * obey $(sysconfdir) for default mpd.conf location
* build with large file support by default * build with large file support by default
* require GLib 2.16 * require GLib 2.12
ver 0.15.6 (2009/??/??) ver 0.15.6 (2009/??/??)

View File

@ -141,8 +141,8 @@ dnl
dnl mandatory libraries dnl mandatory libraries
dnl dnl
PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.16 gthread-2.0],, PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.12 gthread-2.0],,
[AC_MSG_ERROR([glib-2.16 is required])]) [AC_MSG_ERROR([GLib 2.12 is required])])
dnl dnl

View File

@ -21,6 +21,7 @@
#include "utils.h" #include "utils.h"
#include "tokenizer.h" #include "tokenizer.h"
#include "path.h" #include "path.h"
#include "glib_compat.h"
#include <glib.h> #include <glib.h>

View File

@ -28,9 +28,28 @@
#include <glib.h> #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) #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_uri_escape_string(const char *unescaped,
G_GNUC_UNUSED const char *reserved_chars_allowed, G_GNUC_UNUSED const char *reserved_chars_allowed,
G_GNUC_UNUSED gboolean allow_utf8) G_GNUC_UNUSED gboolean allow_utf8)

View File

@ -23,6 +23,7 @@
#include "config.h" #include "config.h"
#include "tag.h" #include "tag.h"
#include "icy_metadata.h" #include "icy_metadata.h"
#include "glib_compat.h"
#include <assert.h> #include <assert.h>

View File

@ -26,6 +26,10 @@
#include <stdbool.h> #include <stdbool.h>
#include <sys/types.h> #include <sys/types.h>
#if !GLIB_CHECK_VERSION(2,14,0)
typedef gint64 goffset;
#endif
struct input_stream { struct input_stream {
/** /**
* the plugin which implements this input stream * the plugin which implements this input stream

View File

@ -22,6 +22,7 @@
#include "client.h" #include "client.h"
#include "conf.h" #include "conf.h"
#include "fd_util.h" #include "fd_util.h"
#include "glib_compat.h"
#include "config.h" #include "config.h"
#include <sys/types.h> #include <sys/types.h>

View File

@ -111,8 +111,10 @@ glue_mapper_init(void)
const char *music_dir, *playlist_dir; const char *music_dir, *playlist_dir;
music_dir = config_get_path(CONF_MUSIC_DIR); music_dir = config_get_path(CONF_MUSIC_DIR);
#if GLIB_CHECK_VERSION(2,14,0)
if (music_dir == NULL) if (music_dir == NULL)
music_dir = g_get_user_special_dir(G_USER_DIRECTORY_MUSIC); music_dir = g_get_user_special_dir(G_USER_DIRECTORY_MUSIC);
#endif
playlist_dir = config_get_path(CONF_PLAYLIST_DIR); playlist_dir = config_get_path(CONF_PLAYLIST_DIR);

View File

@ -22,6 +22,7 @@
#include "fifo_buffer.h" #include "fifo_buffer.h"
#include "page.h" #include "page.h"
#include "icy_server.h" #include "icy_server.h"
#include "glib_compat.h"
#include <stdbool.h> #include <stdbool.h>
#include <assert.h> #include <assert.h>

View File

@ -104,6 +104,18 @@ playlist_list_global_finish(void)
playlist_plugin_finish(playlist_plugins[i]); 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 * struct playlist_provider *
playlist_list_open_uri(const char *uri) playlist_list_open_uri(const char *uri)
{ {

View File

@ -22,6 +22,7 @@
#include "playlist.h" #include "playlist.h"
#include "playlist_state.h" #include "playlist_state.h"
#include "volume.h" #include "volume.h"
#include "glib_compat.h"
#include <glib.h> #include <glib.h>
#include <assert.h> #include <assert.h>