From: Michal Nazarewicz <min...@mina86.com> libmpdclient 2.1 had a buggy implementation of the LIBMPDCLIENT_CHECK_VERSION macro. This commit introduces a work around for that bug, so that mpc can be compiled against libmpdclient 2.1. --- configure.ac | 4 ++-- src/util.h | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac index ad270ed..e403bdc 100644 --- a/configure.ac +++ b/configure.ac @@ -85,8 +85,8 @@ dnl AC_CHECK_LIB(socket, socket, MPC_LIBS="$MPC_LIBS -lsocket",) AC_CHECK_LIB(nsl, gethostbyname, MPC_LIBS="$MPC_LIBS -lnsl",) -PKG_CHECK_MODULES([LIBMPDCLIENT], [libmpdclient >= 2.2],, - [AC_MSG_ERROR([libmpdclient2 is required])]) +PKG_CHECK_MODULES([LIBMPDCLIENT], [libmpdclient >= 2.1],, + [AC_MSG_ERROR([libmpdclient2.1 or newer is required])]) dnl diff --git a/src/util.h b/src/util.h index 83b5c9c..f55e0db 100644 --- a/src/util.h +++ b/src/util.h @@ -4,7 +4,7 @@ Daniel Brown <d...@cs.utexas.edu> * Copyright (C) 2008-2010 Max Kellermann <m...@duempel.org> * Project homepage: http://musicpd.org - + * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -25,6 +25,21 @@ #include <mpd/client.h> +#if !LIBMPDCLIENT_CHECK_VERSION(0,0,0) +/* libmpdclient 2.1 has a bug in LIBMPDCLIENT_CHECK_VERSION macro. + * The bug was that the check operands in the reverse order, so it + * returned true for current and future versions but not past + * versions. So, if the macro returns false for and old version, this + * means that it is the buggy version. */ +# undef LIBMPDCLIENT_CHECK_VERSION +# define LIBMPDCLIENT_CHECK_VERSION(major, minor, patch) \ + ((major) < LIBMPDCLIENT_MAJOR_VERSION || \ + ((major) == LIBMPDCLIENT_MAJOR_VERSION && \ + ((minor) < LIBMPDCLIENT_MINOR_VERSION || \ + ((minor) == LIBMPDCLIENT_MINOR_VERSION && \ + (patch) <= LIBMPDCLIENT_PATCH_VERSION)))) +#endif + struct mpd_connection; struct mpd_song; @@ -54,4 +69,4 @@ print_entity_list(struct mpd_connection *c, enum mpd_entity_type filter_type); void print_filenames(struct mpd_connection *conn); -#endif /* MPC_UTIL_H */ +#endif /* MPC_UTIL_H */ -- 1.7.7.3 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Musicpd-dev-team mailing list Musicpd-dev-team@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team