From 161239e0409832d65cb773a08d364b29945b18a7 Mon Sep 17 00:00:00 2001 From: Yannick Brosseau Date: Wed, 1 Jun 2011 11:06:32 -0400 Subject: [PATCH] Add a version.h header It contains the major and minor version numbers [ edit: coding style fixes by Mathieu Desnoyers ] Signed-off-by: Yannick Brosseau Signed-off-by: Mathieu Desnoyers --- .gitignore | 1 + configure.ac | 9 +++++++++ include/Makefile.am | 3 ++- include/ust/version.h.in | 28 ++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 include/ust/version.h.in diff --git a/.gitignore b/.gitignore index 6ae624ee..e9cac90c 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ config.status stamp-h1 libtool ust.pc +include/ust/version.h ustctl/ustctl ust-consumerd/ust-consumerd diff --git a/configure.ac b/configure.ac index 5d914322..cbe23969 100644 --- a/configure.ac +++ b/configure.ac @@ -11,6 +11,14 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AC_CONFIG_SRCDIR([ustctl/ustctl.c]) AC_CONFIG_HEADERS([config.h include/ust/config.h]) AH_TEMPLATE([HAVE_EFFICIENT_UNALIGNED_ACCESS], [Use efficient unaligned access.]) +# Compute minor/major version numbers +major_version=`echo AC_PACKAGE_VERSION | sed 's/\..*//'` +minor_version=`echo AC_PACKAGE_VERSION | sed 's/.*\.//' | sed 's/^0//'` +AC_SUBST([MAJOR_VERSION], [$major_version]) +AC_SUBST([MINOR_VERSION], [$minor_version]) +AC_DEFINE_UNQUOTED([VERSION_MAJOR], $major_version, [UST major version number]) +AC_DEFINE_UNQUOTED([VERSION_MINOR], $minor_version, [UST minor version number]) + # Checks for programs. AC_PROG_CC @@ -175,5 +183,6 @@ AC_CONFIG_FILES([ libustctl/Makefile snprintf/Makefile ust.pc + include/ust/version.h ]) AC_OUTPUT diff --git a/include/Makefile.am b/include/Makefile.am index c6e92b83..eedde64f 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -2,7 +2,8 @@ nobase_include_HEADERS = \ ust/marker.h \ ust/tracepoint.h \ ust/tracepoint_event.h \ - ust/probe.h + ust/probe.h \ + ust/version.h noinst_HEADERS = \ share.h \ diff --git a/include/ust/version.h.in b/include/ust/version.h.in new file mode 100644 index 00000000..d65b9209 --- /dev/null +++ b/include/ust/version.h.in @@ -0,0 +1,28 @@ +#ifndef _UST_VERSION_H +#define _UST_VERSION_H + +/* + * ust/version.h.in. Contains the UST versions + * + * (C) Copyright 2011 Yannick Brosseau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#define UST_MAJOR_VERSION @MAJOR_VERSION@ +#define UST_MINOR_VERSION @MINOR_VERSION@ +#define UST_VERSION @PACKAGE_VERSION@ + +#endif /* _UST_VERSION_H */ -- 2.34.1