From 1bda4951ebdb5a5b03a503053d27036dd3b510aa Mon Sep 17 00:00:00 2001 From: Alexey Sheplyakov Date: Mon, 27 Feb 2012 23:47:18 +0200 Subject: [PATCH] [build] Move CLN version info into the include/cln/version.h file... The point is to have a single definition of version for autotools and CMake builds. --- acinclude.m4 | 17 +++++++++++++++ configure.ac | 36 ++++++------------------------- include/cln/version.h | 46 ++++++++++++++++++++++++++++++++++++++++ include/cln/version.h.in | 26 ----------------------- 4 files changed, 70 insertions(+), 55 deletions(-) create mode 100644 acinclude.m4 create mode 100644 include/cln/version.h delete mode 100644 include/cln/version.h.in diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000..6809619 --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,17 @@ +dnl CLN_HEADER_GETVAL(NAME,FILE) +dnl Expand at autoconf time to the value of a "#define NAME" from the given +dnl FILE. The regexps here aren't very robust, but are enough for us. +dnl /dev/null as a parameter prevents a hang if $2 is accidentally omitted. +dnl (shamelessly ripped from GMP, and changed prefix to CL_). + +define(CL_HEADER_GETVAL, +[patsubst(patsubst( +esyscmd([grep "^#define $1 " $2 /dev/null 2>/dev/null]), +[^.*$1[ ]+],[]), +[[ + ]*$],[])]) +define(CL_GET_VERSION, +[CL_HEADER_GETVAL(CL_VERSION_$1,[include/cln/version.h])]) +define(CL_GET_LTVERSION, +[CL_HEADER_GETVAL(CL_LT_$1,[include/cln/version.h])]) + diff --git a/configure.ac b/configure.ac index 4a70321..5a5b552 100644 --- a/configure.ac +++ b/configure.ac @@ -1,23 +1,14 @@ dnl run autoreconf -iv to produce the configure script. -m4_define([cl_version_major], [1]) -m4_define([cl_version_minor], [3]) -m4_define([cl_version_patchlevel], [6]) +m4_define([cl_version_major], CL_GET_VERSION([MAJOR])) +m4_define([cl_version_minor], CL_GET_VERSION([MINOR])) +m4_define([cl_version_patchlevel], CL_GET_VERSION([PATCHLEVEL])) m4_define([cl_version], [cl_version_major.cl_version_minor.cl_version_patchlevel]) dnl Libtool's library version information for CLN. -dnl (Not to be confused with CLN's release version.) -dnl Making new releases: -dnl * increment cl_lt_revision, -dnl * if any interfaces have been added, removed, or changed, then increment -dnl cl_lt_current and set cl_lt_revision to 0, -dnl * if any interfaces have been added, then increment cl_lt_age, -dnl * if any interfaces have been removed, set cl_lt_age to 0. -dnl (On many systems, $(cl_lt_current):$(cl_lt_revision):$(cl_lt_age) results in -dnl libcln.so.$(cl_lt_current)-$(cl_lt_age).) -m4_define([cl_lt_current], [6]) -m4_define([cl_lt_revision], [6]) -m4_define([cl_lt_age], [0]) +m4_define([cl_lt_current], CL_GET_LTVERSION([CURRENT])) +m4_define([cl_lt_revision], CL_GET_LTVERSION([REVISION])) +m4_define([cl_lt_age], CL_GET_LTVERSION([AGE])) m4_define([cl_lt_version], [cl_lt_current:cl_lt_revision:cl_lt_age]) AC_INIT([cln], cl_version) @@ -25,7 +16,7 @@ AC_PREREQ(2.59) AC_CONFIG_SRCDIR(src/integer/gcd/cl_I_gcd.cc) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) -AC_CONFIG_HEADERS(autoconf/cl_config.h include/cln/config.h include/cln/host_cpu.h include/cln/version.h src/base/cl_base_config.h src/base/cl_gmpconfig.h src/timing/cl_t_config.h) +AC_CONFIG_HEADERS(autoconf/cl_config.h include/cln/config.h include/cln/host_cpu.h src/base/cl_base_config.h src/base/cl_gmpconfig.h src/timing/cl_t_config.h) AM_INIT_AUTOMAKE([foreign 1.10 dist-bzip2 subdir-objects]) AH_TOP([#ifndef _CL_CONFIG_H]) AH_TOP([#define _CL_CONFIG_H]) @@ -74,19 +65,6 @@ AC_PROG_LIBTOOL LT_VERSION_INFO=cl_lt_version AC_SUBST(LT_VERSION_INFO) -dnl release version -CL_VERSION_MAJOR=cl_version_major -CL_VERSION_MINOR=cl_version_minor -CL_VERSION_PATCHLEVEL=cl_version_patchlevel -dnl release version for cln/config.h, so it can be tested by the preprocessor -AC_DEFINE_UNQUOTED(CL_VERSION_MAJOR, $CL_VERSION_MAJOR, [Major version number of CLN]) -AC_DEFINE_UNQUOTED(CL_VERSION_MINOR, $CL_VERSION_MINOR, [Minor version number of CLN]) -AC_DEFINE_UNQUOTED(CL_VERSION_PATCHLEVEL, $CL_VERSION_PATCHLEVEL, [Patchlevel version number of CLN]) -dnl concatenated release version -CL_VERSION=cl_version -AC_DEFINE_UNQUOTED(CL_VERSION, $CL_VERSION, [CLN release number]) -AC_SUBST(CL_VERSION) - dnl checks for compiler characteristics dnl AC_LANG([C++]) diff --git a/include/cln/version.h b/include/cln/version.h new file mode 100644 index 0000000..f44c9e0 --- /dev/null +++ b/include/cln/version.h @@ -0,0 +1,46 @@ +/* CLN version information */ + +#ifndef _CL_VERSION_H +#define _CL_VERSION_H + +/* Major version number of CLN */ +#define CL_VERSION_MAJOR 1 +/* Minor version number of CLN */ +#define CL_VERSION_MINOR 3 +/* Patchlevel version number of CLN */ +#define CL_VERSION_PATCHLEVEL 6 + +/** + * Libtool's library version information for CLN. + * (Not to be confused with CLN's release version.) + * Making new releases: + * - increment cl_lt_revision, + * - if any interfaces have been added, removed, or changed, then increment + * cl_lt_current and set cl_lt_revision to 0, + * - if any interfaces have been added, then increment cl_lt_age, + * - if any interfaces have been removed, set cl_lt_age to 0. + * (On many systems, $(cl_lt_current):$(cl_lt_revision):$(cl_lt_age) results in + * libcln.so.$(cl_lt_current)-$(cl_lt_age).) + */ +#define CL_LT_CURRENT 6 +#define CL_LT_AGE 0 +#define CL_LT_REVISION 6 + +#define CL_STR_HELPER(x) #x +#define CL_STR(x) CL_STR_HELPER(x) + +#define CL_VERSION \ + CL_STR(CL_VERSION_MAJOR) "." \ + CL_STR(CL_VERSION_MINOR) "." \ + CL_STR(CL_VERSION_PATCHLEVEL) + +namespace cln { + +extern const int version_major; +extern const int version_minor; +extern const int version_patchlevel; + +} // namespace cln + +#endif /* _CL_VERSION_H */ + diff --git a/include/cln/version.h.in b/include/cln/version.h.in deleted file mode 100644 index aacd909..0000000 --- a/include/cln/version.h.in +++ /dev/null @@ -1,26 +0,0 @@ -/* CLN version information */ - -#ifndef _CL_VERSION_H -#define _CL_VERSION_H - -/* CLN release number */ -#undef CL_VERSION - -/* Major version number of CLN */ -#undef CL_VERSION_MAJOR - -/* Minor version number of CLN */ -#undef CL_VERSION_MINOR - -/* Patchlevel version number of CLN */ -#undef CL_VERSION_PATCHLEVEL - -namespace cln { - -extern const int version_major; -extern const int version_minor; -extern const int version_patchlevel; - -} // namespace cln - -#endif /* _CL_VERSION_H */ -- 2.49.0