Commit 4390d72b authored by Max Kellermann's avatar Max Kellermann

configure.ac: require GLib 2.16

Accidently, MPD has been using several GLib 2.16 functions for a while, and nobody noticed yet. To simplify the code base, let's bump the minimum GLib version for MPD to 2.16. That version is old enough, and it's reasonable to expect users to have it.
parent 2bf740fc
...@@ -13,7 +13,7 @@ Dependencies ...@@ -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 - http://www.gtk.org/ GLib 2.16 - http://www.gtk.org/
General-purpose utility library. General-purpose utility library.
......
...@@ -41,6 +41,7 @@ ver 0.16 (20??/??/??) ...@@ -41,6 +41,7 @@ ver 0.16 (20??/??/??)
* state_file: save only if something has changed * state_file: save only if something has changed
* 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
ver 0.15.5 (2009/??/??) ver 0.15.5 (2009/??/??)
......
...@@ -128,8 +128,8 @@ dnl ...@@ -128,8 +128,8 @@ dnl
dnl mandatory libraries dnl mandatory libraries
dnl dnl
PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.6 gthread-2.0],, PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.16 gthread-2.0],,
[AC_MSG_ERROR([glib-2.6 is required])]) [AC_MSG_ERROR([glib-2.16 is required])])
dnl dnl
......
...@@ -77,10 +77,8 @@ static void version(void) ...@@ -77,10 +77,8 @@ static void version(void)
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
#if GLIB_CHECK_VERSION(2,12,0)
static const char *summary = static const char *summary =
"Music Player Daemon - a daemon for playing music."; "Music Player Daemon - a daemon for playing music.";
#endif
bool bool
parse_cmdline(int argc, char **argv, struct options *options, parse_cmdline(int argc, char **argv, struct options *options,
...@@ -118,9 +116,7 @@ parse_cmdline(int argc, char **argv, struct options *options, ...@@ -118,9 +116,7 @@ parse_cmdline(int argc, char **argv, struct options *options,
context = g_option_context_new("[path/to/mpd.conf]"); context = g_option_context_new("[path/to/mpd.conf]");
g_option_context_add_main_entries(context, entries, NULL); g_option_context_add_main_entries(context, entries, NULL);
#if GLIB_CHECK_VERSION(2,12,0)
g_option_context_set_summary(context, summary); g_option_context_set_summary(context, summary);
#endif
ret = g_option_context_parse(context, &argc, &argv, &error); ret = g_option_context_parse(context, &argc, &argv, &error);
g_option_context_free(context); g_option_context_free(context);
......
...@@ -150,11 +150,6 @@ buffer_free_callback(gpointer data, G_GNUC_UNUSED gpointer user_data) ...@@ -150,11 +150,6 @@ buffer_free_callback(gpointer data, G_GNUC_UNUSED gpointer user_data)
g_free(data); g_free(data);
} }
/* g_queue_clear() was introduced in GLib 2.14 */
#if !GLIB_CHECK_VERSION(2,14,0)
#define g_queue_clear(q) do { g_queue_free(q); q = g_queue_new(); } while (0)
#endif
/** /**
* Frees the current "libcurl easy" handle, and everything associated * Frees the current "libcurl easy" handle, and everything associated
* with it. * with it.
......
...@@ -55,18 +55,12 @@ lastfm_input_init(const struct config_param *param) ...@@ -55,18 +55,12 @@ lastfm_input_init(const struct config_param *param)
if (passwd == NULL || user == NULL) if (passwd == NULL || user == NULL)
return false; return false;
#if GLIB_CHECK_VERSION(2,16,0)
lastfm_data.user = g_uri_escape_string(user, NULL, false); lastfm_data.user = g_uri_escape_string(user, NULL, false);
#else
lastfm_data.user = g_strdup(user);
#endif
#if GLIB_CHECK_VERSION(2,16,0)
if (strlen(passwd) != 32) if (strlen(passwd) != 32)
lastfm_data.md5 = g_compute_checksum_for_string(G_CHECKSUM_MD5, lastfm_data.md5 = g_compute_checksum_for_string(G_CHECKSUM_MD5,
passwd, strlen(passwd)); passwd, strlen(passwd));
else else
#endif
lastfm_data.md5 = g_strdup(passwd); lastfm_data.md5 = g_strdup(passwd);
return true; return true;
...@@ -364,23 +358,16 @@ lastfm_input_open(struct input_stream *is, const char *url) ...@@ -364,23 +358,16 @@ lastfm_input_open(struct input_stream *is, const char *url)
return false; return false;
} }
#if GLIB_CHECK_VERSION(2,16,0)
q = g_uri_escape_string(session, NULL, false); q = g_uri_escape_string(session, NULL, false);
g_free(session); g_free(session);
session = q; session = q;
#endif
/* "adjust" last.fm radio */ /* "adjust" last.fm radio */
if (strlen(url) > 9) { if (strlen(url) > 9) {
char *escaped_url; char *escaped_url;
#if GLIB_CHECK_VERSION(2,16,0)
escaped_url = g_uri_escape_string(url, NULL, false); escaped_url = g_uri_escape_string(url, NULL, false);
#else
escaped_url = g_strdup(url);
#endif
p = g_strconcat("http://ws.audioscrobbler.com/radio/adjust.php?" p = g_strconcat("http://ws.audioscrobbler.com/radio/adjust.php?"
"session=", session, "&url=", escaped_url, "&debug=0", "session=", session, "&url=", escaped_url, "&debug=0",
NULL); NULL);
......
...@@ -108,10 +108,8 @@ glue_mapper_init(void) ...@@ -108,10 +108,8 @@ 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);
......
...@@ -482,11 +482,6 @@ httpd_client_queue_size(const struct httpd_client *client) ...@@ -482,11 +482,6 @@ httpd_client_queue_size(const struct httpd_client *client)
return size; return size;
} }
/* g_queue_clear() was introduced in GLib 2.14 */
#if !GLIB_CHECK_VERSION(2,14,0)
#define g_queue_clear(q) do { g_queue_free(q); q = g_queue_new(); } while (0)
#endif
void void
httpd_client_cancel(struct httpd_client *client) httpd_client_cancel(struct httpd_client *client)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment