Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added library version compile-time checks

This allows programs to check which version of libmpdclient2 they are
compiled with.
  • Loading branch information...
commit 0aedf7e55bbf58bb5fb83d87a616fb283f9e3e8e 1 parent a353f83
@MaxKellermann MaxKellermann authored
View
1  .gitignore
@@ -28,5 +28,6 @@ doc/doxygen.conf
doc/api
*.exe
*.tar.*
+include/mpd/version.h
test/t_iso8601
View
4 Makefile.am
@@ -34,7 +34,7 @@ mpdinclude_HEADERS = \
include/mpd/song.h \
include/mpd/sticker.h
-AM_CPPFLAGS += -I$(srcdir)/include
+AM_CPPFLAGS += -I$(srcdir)/include -Iinclude
lib_LTLIBRARIES = src/libmpdclient.la
@@ -143,7 +143,7 @@ install-data-local: doc/api/html/index.html
$(DESTDIR)$(docdir)/html
uninstall-local:
- rm -f $(DESTDIR)$(docdir)/html/index.html \
+ rm -f $(DESTDIR)$(docdir)/html/*.html \
$(DESTDIR)$(docdir)/html/*.css \
$(DESTDIR)$(docdir)/html/*.gif \
$(DESTDIR)$(docdir)/html/*.png
View
1  NEWS
@@ -5,6 +5,7 @@ libmpdclient 2.1 (2009/??/??)
* socket: connect in non-blocking mode
* sync: optimistic write, reduce select() calls
* Makefile.am: use --version-script only with GNU ld
+* added library version compile-time checks
libmpdclient 2.0 (2009/10/03)
View
6 configure.ac
@@ -6,6 +6,10 @@ AM_INIT_AUTOMAKE([foreign 1.10 dist-bzip2 subdir-objects])
AM_CONFIG_HEADER([config.h])
AC_CONFIG_MACRO_DIR([m4])
+AC_SUBST(MAJOR_VERSION,2)
+AC_SUBST(MINOR_VERSION,1)
+AC_SUBST(PATCH_VERSION,0)
+
LIBMPDCLIENT_LIBTOOL_VERSION=2:0:0
AC_SUBST(LIBMPDCLIENT_LIBTOOL_VERSION)
@@ -136,4 +140,4 @@ dnl
dnl Done
dnl
-AC_OUTPUT([Makefile libmpdclient.pc doc/doxygen.conf])
+AC_OUTPUT([Makefile include/mpd/version.h libmpdclient.pc doc/doxygen.conf])
View
1  include/mpd/client.h
@@ -68,5 +68,6 @@
#include <mpd/stats.h>
#include <mpd/status.h>
#include <mpd/sticker.h>
+#include <mpd/version.h>
#endif
View
58 include/mpd/version.h.in
@@ -0,0 +1,58 @@
+/* libmpdclient
+ (c) 2003-2009 The Music Player Daemon Project
+ This project's homepage is: http://www.musicpd.org
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/*! \file
+ * \brief MPD client library
+ *
+ * Do not include this header directly. Use mpd/client.h instead.
+ */
+
+#ifndef MPD_VERSION_H
+#define MPD_VERSION_H
+
+#define LIBMPDCLIENT_MAJOR_VERSION @MAJOR_VERSION@
+#define LIBMPDCLIENT_MINOR_VERSION @MINOR_VERSION@
+#define LIBMPDCLIENT_PATCH_VERSION @PATCH_VERSION@
+
+/**
+ * Preprocessor macro which allows you to check which version of
+ * libmpdclient you are compiling with. It can be used in
+ * preprocessor directives.
+ *
+ * @return true if this libmpdclient version equals or is newer than
+ * the specified version number
+ * @since libmpdclient 2.1
+ */
+#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
Please sign in to comment.
Something went wrong with that request. Please try again.