summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 65e9edc)
raw | patch | inline | side by side (parent: 65e9edc)
author | Sebastian Harl <sh@tokkee.org> | |
Sun, 11 Jan 2009 14:10:54 +0000 (15:10 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sun, 11 Jan 2009 14:10:54 +0000 (15:10 +0100) |
This header provides various macros and functions that may be used to
determine the version of libcollectdclient (i.e. collectd). The file will be
auto-created from lcc_features.h.in by configure.
The macro LCC_VERSION (previously defined in client.h) has been moved to this
header as well and has been renamed to LCC_API_VERSION.
This allows for fine grained version checks at compile- and runtime.
determine the version of libcollectdclient (i.e. collectd). The file will be
auto-created from lcc_features.h.in by configure.
The macro LCC_VERSION (previously defined in client.h) has been moved to this
header as well and has been renamed to LCC_API_VERSION.
This allows for fine grained version checks at compile- and runtime.
configure.in | patch | blob | history | |
src/libcollectdclient/Makefile.am | patch | blob | history | |
src/libcollectdclient/client.c | patch | blob | history | |
src/libcollectdclient/client.h | patch | blob | history | |
src/libcollectdclient/lcc_features.h.in | [new file with mode: 0644] | patch | blob |
diff --git a/configure.in b/configure.in
index 55ce936bd0a519952c63a7101e82df808550020c..a220c2ae1df2ec770fd1b3daf165d4ab5e2c17b2 100644 (file)
--- a/configure.in
+++ b/configure.in
AC_SUBST(PERL_BINDINGS)
AC_SUBST(PERL_BINDINGS_OPTIONS)
+dnl libcollectdclient
+LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
+LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
+LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
+
+LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
+
+LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
+
+AC_SUBST(LCC_VERSION_MAJOR)
+AC_SUBST(LCC_VERSION_MINOR)
+AC_SUBST(LCC_VERSION_PATCH)
+AC_SUBST(LCC_VERSION_EXTRA)
+AC_SUBST(LCC_VERSION_STRING)
+
+AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h)
+
AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libiptc/Makefile src/libcollectdclient/Makefile src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
if test "x$with_librrd" = "xyes" \
index ca505603d77450d6790911535651b49a8df43a2d..b8a8cbe1e4eee8789e65682532e97ddd68602984 100644 (file)
AM_CFLAGS = -Wall -Werror
endif
-pkginclude_HEADERS = client.h
+pkginclude_HEADERS = client.h lcc_features.h
lib_LTLIBRARIES = libcollectdclient.la
+BUILT_SOURCES = lcc_features.h
+
libcollectdclient_la_SOURCES = client.c
libcollectdclient_la_LDFLAGS = -version-info 0:0:0
index b2f2daff93798318196dbf9bf32a9710dcdee37d..c5be3b90cec373ad1d6469fb2a9e1faa0d5e5154 100644 (file)
# include "config.h"
#endif
+#include "lcc_features.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
/*
* Public functions
*/
+unsigned int lcc_version (void) /* {{{ */
+{
+ return (LCC_VERSION);
+} /* }}} unsigned int lcc_version */
+
+const char *lcc_version_string (void) /* {{{ */
+{
+ return (LCC_VERSION_STRING);
+} /* }}} const char *lcc_version_string */
+
+const char *lcc_version_extra (void) /* {{{ */
+{
+ return (LCC_VERSION_EXTRA);
+} /* }}} const char *lcc_version_extra */
+
int lcc_connect (const char *address, lcc_connection_t **ret_con) /* {{{ */
{
lcc_connection_t *c;
index a0ab94c7ed9d99318a66c7e68b9b9cfcaabc2685..41fe8d7a0d7ccdc772aa594a67ca848fe6ef9e55 100644 (file)
/*
* Defines
*/
-#define LCC_VERSION 0
#define LCC_NAME_LEN 64
#define LCC_DEFAULT_PORT "25826"
diff --git a/src/libcollectdclient/lcc_features.h.in b/src/libcollectdclient/lcc_features.h.in
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+ * libcollectdclient - src/libcollectdclient/lcc_features.h
+ * Copyright (C) 2009 Sebastian Harl
+ *
+ * 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; only version 2 of the License is applicable.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors:
+ * Sebastian tokkee Harl <sh at tokkee.org>
+ **/
+
+#ifndef LIBCOLLECTD_LCC_FEATURES_H
+#define LIBCOLLECTD_LCC_FEATURES_H 1
+
+#define LCC_API_VERSION 0
+
+#define LCC_VERSION_MAJOR @LCC_VERSION_MAJOR@
+#define LCC_VERSION_MINOR @LCC_VERSION_MINOR@
+#define LCC_VERSION_PATCH @LCC_VERSION_PATCH@
+
+#define LCC_VERSION_EXTRA "@LCC_VERSION_EXTRA@"
+
+#define LCC_VERSION_STRING "@LCC_VERSION_STRING@"
+
+#define LCC_VERSION_ENCODE(major, minor, patch) \
+ ((major) * 10000 + (minor) * 100 + (patch))
+
+#define LCC_VERSION \
+ LCC_VERSION_ENCODE(LCC_VERSION_MAJOR, LCC_VERSION_MINOR, LCC_VERSION_PATCH)
+
+unsigned int lcc_version (void);
+
+const char *lcc_version_string (void);
+
+const char *lcc_version_extra (void);
+
+#endif /* ! LIBCOLLECTD_LCC_FEATURES_H */
+
+/* vim: set sw=4 ts=4 tw=78 noexpandtab : */
+