From 91a350462393e8a92d731860bd18ed1dfd6568b0 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 26 Jan 2011 16:29:34 +0000 Subject: [PATCH] Add comedilib_version.h header, produced by ./configure, included by comedilib.h, containing COMEDILIB_VERSION_MAJOR, COMEDILIB_VERSION_MINOR, COMEDILIB_VERSION_MICRO, and COMEDILIB_CHECK_VERSION(major,minor,micro). This can be used to perform C pre-processor checks for API changes in comedilib. --- configure.ac | 66 +++++++++++++++++++++++++++------- include/Makefile.am | 2 +- include/comedilib.h | 1 + include/comedilib_version.h.in | 52 +++++++++++++++++++++++++++ 4 files changed, 107 insertions(+), 14 deletions(-) create mode 100644 include/comedilib_version.h.in diff --git a/configure.ac b/configure.ac index 1fe2250..e59cb56 100644 --- a/configure.ac +++ b/configure.ac @@ -1,13 +1,3 @@ - -AC_INIT([comedilib], [0.10.0]) -AC_CANONICAL_TARGET([]) - -AC_CONFIG_MACRO_DIR([m4]) -AC_CONFIG_AUX_DIR([.]) -#COMEDILIB_DEBUG="-Wall -Werror" -COMEDILIB_DEBUG="-Wall" -AM_INIT_AUTOMAKE([-Wall -Werror]) - # libtool version: current:revision:age # # If the library source code has changed at all since the last update, then @@ -22,10 +12,59 @@ AM_INIT_AUTOMAKE([-Wall -Werror]) # If any interfaces have been removed since the last public release, then set # age to 0. # -# AS_LIBTOOL arguments are (prefix, current, revision, age) -AS_LIBTOOL(COMEDILIB, 10, 0, 10) +# In summary: +# +# If any interface has been changed or removed, `c:r:a' becomes `c+1:0:0'; +# else if any interface has been added, `c:r:a' becomes `c+1:0:a+1'; +# else, `c:r:a' becomes `c:r+1:a'. +# +m4_define([comedilib_lt_current], [10]) +m4_define([comedilib_lt_revision], [0]) +m4_define([comedilib_lt_age], [10]) + #libscxi c:r:a -SCXI_SO_VERSION=9:0:9 +m4_define([scxi_lt_current], [9]) +m4_define([scxi_lt_revision], [0]) +m4_define([scxi_lt_age], [9]) + +# comedilib version: major.minor.micro +# +# Currently: +# * 'major' may be incremented at the whim of the maintainers. +# * 'minor' is libtool 'current' minus the value of 'current' when major +# changed (comedilib_major_base_current). +# * 'micro' is libtool 'revision'. + +# Manually set 'comedilib_major_base_current' to new 'comedilib_lt_current' +# whenever 'comedilib_version_major' is incremented below. +m4_define([comedilib_major_base_current], [0]) + +m4_define([comedilib_version_major], [0]) +m4_define([comedilib_version_minor], + [m4_eval(comedilib_lt_current - comedilib_major_base_current)]) +m4_define([comedilib_version_micro], [comedilib_lt_revision]) +m4_define([comedilib_pkg_version], + [comedilib_version_major.comedilib_version_minor.comedilib_version_micro]) + +AC_INIT([comedilib], [comedilib_pkg_version]) +AC_CANONICAL_TARGET([]) + +COMEDILIB_VERSION_MAJOR=comedilib_version_major +COMEDILIB_VERSION_MINOR=comedilib_version_minor +COMEDILIB_VERSION_MICRO=comedilib_version_micro +AC_SUBST(COMEDILIB_VERSION_MAJOR) +AC_SUBST(COMEDILIB_VERSION_MINOR) +AC_SUBST(COMEDILIB_VERSION_MICRO) + +AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_AUX_DIR([.]) +#COMEDILIB_DEBUG="-Wall -Werror" +COMEDILIB_DEBUG="-Wall" +AM_INIT_AUTOMAKE([-Wall -Werror]) + +# AS_LIBTOOL arguments are (prefix, current, revision, age) +AS_LIBTOOL(COMEDILIB, comedilib_lt_current, comedilib_lt_revision, comedilib_lt_age) +SCXI_SO_VERSION=scxi_lt_current:scxi_lt_revision:scxi_lt_age AC_SUBST(SCXI_SO_VERSION) AM_CONFIG_HEADER(config.h) @@ -208,6 +247,7 @@ etc/udev/Makefile doc/Makefile demo/Makefile include/Makefile +include/comedilib_version.h lib/Makefile man/Makefile scxi/Makefile diff --git a/include/Makefile.am b/include/Makefile.am index 14acb38..b214c72 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,3 +1,3 @@ -include_HEADERS = comedi.h comedilib.h comedi_errno.h comedilib_scxi.h +include_HEADERS = comedi.h comedilib.h comedi_errno.h comedilib_scxi.h comedilib_version.h diff --git a/include/comedilib.h b/include/comedilib.h index afbf9c8..0f9bbca 100644 --- a/include/comedilib.h +++ b/include/comedilib.h @@ -26,6 +26,7 @@ #define _COMEDILIB_H #include +#include #include #include #include diff --git a/include/comedilib_version.h.in b/include/comedilib_version.h.in new file mode 100644 index 0000000..2c236b9 --- /dev/null +++ b/include/comedilib_version.h.in @@ -0,0 +1,52 @@ +/* + comedilib_version.h + header file for comedilib's version number + + COMEDI - Linux Control and Measurement Device Interface + Copyright (C) 1997-2000 David A. Schleef + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + ublished by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + 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 Lesser General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Cambridge, MA 02111, USA. + +*/ + +#ifndef _COMEDILIB_VERSION_H +#define _COMEDILIB_VERSION_H + +/* Note that this header file first appeared in comedilib 0.10.0, so + * the header file and macros won't exist in earlier versions unless + * retro-fitted by a third party packager. */ + +#define COMEDILIB_VERSION_MAJOR @COMEDILIB_VERSION_MAJOR@ +#define COMEDILIB_VERSION_MINOR @COMEDILIB_VERSION_MINOR@ +#define COMEDILIB_VERSION_MICRO @COMEDILIB_VERSION_MICRO@ + +/** + * COMEDILIB_CHECK_VERSION: + * @major: major version + * @minor: minor version + * @micro: micro version + * + * Evaluates to %TRUE when the comedilib version (as indicated by + * COMEDILIB_VERSION_MAJOR, COMEDILIB_VERSION_MINOR, + * COMEDILIB_VERSION_MICRO) is at least as great as the given version. + */ +#define COMEDILIB_CHECK_VERSION(major, minor, micro) \ + (COMEDILIB_VERSION_MAJOR > (major) || \ + (COMEDILIB_VERSION_MAJOR == (major) && \ + (COMEDLIB_VERSION_MINOR > (minor) || \ + (COMEDILIB_VERSION_MINOR == (minor) && \ + COMEDILIB_VERSION_MICRO >= (micro))))) + +#endif /* _COMEDILIB_VERSION_H */ -- 2.26.2