From f4a9899e93609f763418308b79d11e4ca6033344 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Mon, 22 Mar 2021 12:24:34 -0400 Subject: [PATCH] configure: centralize version information Centralise version information at the beginning of configure.ac to improve readability. This is part of an effort to standardise our autotools setup across project to simplify maintenance. Change-Id: Ia4de4737ac73e7dac55341e7b238780501289350 Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- .gitignore | 2 +- configure.ac | 112 +++++++++++++++++++++------------ include/lttng/ust-version.h.in | 12 ++-- 3 files changed, 82 insertions(+), 44 deletions(-) diff --git a/.gitignore b/.gitignore index 76aa21b7..15d19b64 100644 --- a/.gitignore +++ b/.gitignore @@ -21,8 +21,8 @@ autom4te.cache/ /include/config.h /include/config.h.in /include/stamp-h1 -/include/lttng/config.h /include/lttng/stamp-h2 +/include/lttng/stamp-h3 /include/lttng/ust-version.h /include/lttng/ust-config.h /config/ar-lib diff --git a/configure.ac b/configure.ac index 9b6a3f1c..d5ea3ee9 100644 --- a/configure.ac +++ b/configure.ac @@ -1,41 +1,44 @@ -# SPDX-License-Identifier: LGPL-2.1-only - -dnl Version infos -m4_define([V_MAJOR], [2]) -m4_define([V_MINOR], [13]) -m4_define([V_PATCH], [0]) -m4_define([V_EXTRA], [pre]) -m4_define([V_NAME], [[Codename TBD]]) -m4_define([V_DESC], [[Description TBD]]) - -m4_define([V_STRING], [V_MAJOR.V_MINOR.V_PATCH]) -m4_ifdef([V_EXTRA], [m4_append([V_STRING], [-V_EXTRA])]) - -AC_PREREQ([2.69]) -AC_INIT([lttng-ust], V_STRING, [mathieu dot desnoyers at efficios dot com], [], [https://lttng.org]) - -dnl Substitute minor/major/patchlevel version numbers -AC_SUBST([MAJOR_VERSION], [V_MAJOR]) -AC_SUBST([MINOR_VERSION], [V_MINOR]) -AC_SUBST([PATCHLEVEL_VERSION], [V_PATCH]) +dnl SPDX-License-Identifier: LGPL-2.1-only +dnl +dnl Copyright (C) 2021 EfficiOS, Inc. +dnl +dnl Process this file with autoconf to produce a configure script. + + +# Project version information +m4_define([ust_version_major], [2]) +m4_define([ust_version_minor], [13]) +m4_define([ust_version_patch], [0]) +m4_define([ust_version_dev_stage], [-pre]) +m4_define([ust_version], ust_version_major[.]ust_version_minor[.]ust_version_patch[]ust_version_dev_stage) +m4_define([ust_version_name], [[Codename TBD]]) +m4_define([ust_version_description], [[Description TBD]]) + +# Library version information of "liblttng-ust" +# Following the numbering scheme proposed by libtool for the library version +# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html +m4_define([ust_lib_version_current], [1]) +m4_define([ust_lib_version_revision], [0]) +m4_define([ust_lib_version_age], [0]) +m4_define([ust_lib_version], ust_lib_version_current[:]ust_lib_version_revision[:]ust_lib_version_age) +# Library version information of "liblttng-ust-ctl" # Following the numbering scheme proposed by libtool for the library version # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html -# This is the library version of liblttng-ust. -m4_define([UST_LIB_V_MAJOR], [1]) -m4_define([UST_LIB_V_MINOR], [0]) -m4_define([UST_LIB_V_PATCH], [0]) +m4_define([ust_ctl_lib_version_current], [5]) +m4_define([ust_ctl_lib_version_revision], [0]) +m4_define([ust_ctl_lib_version_age], [0]) +m4_define([ust_ctl_lib_version], ust_ctl_lib_version_current[:]ust_ctl_lib_version_revision[:]ust_ctl_lib_version_age) + -AC_SUBST([LTTNG_UST_LIBRARY_VERSION], [UST_LIB_V_MAJOR:UST_LIB_V_MINOR:UST_LIB_V_PATCH]) -AC_DEFINE([CONFIG_LTTNG_UST_LIBRARY_VERSION_MAJOR], [UST_LIB_V_MAJOR], [Major SONAME number of the ust library]) -# note: remember to update tracepoint.h dlopen() to match this version -# number. TODO: eventually automate by exporting the major number. +## ## +## Autoconf base setup ## +## ## -# This is the library version of liblttng-ust-ctl, used internally by -# liblttng-ust, lttng-sessiond, and lttng-consumerd. -AC_SUBST([LTTNG_UST_CTL_LIBRARY_VERSION], [5:0:0]) +AC_PREREQ([2.69]) +AC_INIT([lttng-ust],[ust_version],[mathieu dot desnoyers at efficios dot com],[],[https://lttng.org]) -AC_CONFIG_HEADERS([include/config.h include/lttng/ust-config.h]) +AC_CONFIG_HEADERS([include/config.h include/lttng/ust-config.h include/lttng/ust-version.h]) AC_CONFIG_AUX_DIR([config]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR([include/lttng/tracepoint.h]) @@ -43,6 +46,11 @@ AC_CONFIG_SRCDIR([include/lttng/tracepoint.h]) AC_CANONICAL_TARGET AC_CANONICAL_HOST + +## ## +## Automake base setup ## +## ## + AM_INIT_AUTOMAKE([1.12 foreign dist-bzip2 no-dist-gzip tar-ustar nostdinc -Wall -Wno-portability -Werror]) AM_MAINTAINER_MODE([enable]) @@ -466,6 +474,16 @@ they will not be installed. AM_CONDITIONAL([ENABLE_MAN_PAGES], [test "x$man_pages_opt" != "xno"]) AM_CONDITIONAL([HAVE_ASCIIDOC_XMLTO], [test "x$have_asciidoc_xmlto" = "xyes"]) + +# Defined in include/lttng/ust-version.h +AC_DEFINE([LTTNG_UST_MAJOR_VERSION], ust_version_major, [LTTng UST major version]) +AC_DEFINE([LTTNG_UST_MINOR_VERSION], ust_version_minor, [LTTng UST minor version]) +AC_DEFINE([LTTNG_UST_PATCHLEVEL_VERSION], ust_version_patch, [LTTng UST patch version]) +AC_DEFINE([LTTNG_UST_VERSION], ["]ust_version["], [LTTng UST version string]) +AC_DEFINE([LTTNG_UST_LIB_SONAME_MAJOR], [ust_lib_version_current], [Major SONAME number of liblttng-ust]) +AC_DEFINE([LTTNG_UST_CTL_LIB_SONAME_MAJOR], [ust_ctl_lib_version_current], [Major SONAME number of liblttng-ust-ctl]) + + AM_CFLAGS="-Wall $URCU_CFLAGS $PTHREAD_CFLAGS" AC_SUBST(AM_CFLAGS) @@ -480,13 +498,18 @@ AC_SUBST(AM_CPPFLAGS) AC_SUBST(JNI_CPPFLAGS) + +## ## +## Output files generated by configure ## +## ## + +# List of files to be generated from '.in' templates by AC_OUTPUT AC_CONFIG_FILES([ Makefile doc/Makefile doc/examples/Makefile doc/man/Makefile include/Makefile - include/lttng/ust-version.h snprintf/Makefile libcounter/Makefile libmsgpack/Makefile @@ -539,21 +562,32 @@ AC_CONFIG_FILES([ AC_OUTPUT -# -# Mini-report on what will be built. -# +## ## +## Mini-report on what will be built. ## +## ## PPRINT_INIT PPRINT_SET_INDENT(1) PPRINT_SET_TS(38) AS_ECHO -AS_ECHO("${PPRINT_COLOR_BLDBLU}LTTng-ust $PACKAGE_VERSION \"V_NAME\"$PPRINT_COLOR_RST") +AS_IF([test -n "ust_version_name"], [ + AS_ECHO("${PPRINT_COLOR_BLDBLU}LTTng-ust $PACKAGE_VERSION \"ust_version_name\"$PPRINT_COLOR_RST") +], [ + AS_ECHO("${PPRINT_COLOR_BLDBLU}LTTng-ust $PACKAGE_VERSION") +]) + AS_ECHO -AS_ECHO("V_DESC") +AS_IF([test -n "ust_version_description"], [ + AS_IF([test -n "$FOLD"], [ + AS_ECHO("`AS_ECHO("ust_version_description") | $FOLD -s`") + ], [ + AS_ECHO("ust_version_description") + ]) + AS_ECHO +]) -AS_ECHO PPRINT_SUBTITLE([System]) PPRINT_PROP_STRING([Target architecture], $host_cpu) diff --git a/include/lttng/ust-version.h.in b/include/lttng/ust-version.h.in index 5e9d17fc..cac1a182 100644 --- a/include/lttng/ust-version.h.in +++ b/include/lttng/ust-version.h.in @@ -9,9 +9,13 @@ #ifndef _LTTNG_UST_VERSION_H #define _LTTNG_UST_VERSION_H -#define LTTNG_UST_MAJOR_VERSION @MAJOR_VERSION@ -#define LTTNG_UST_MINOR_VERSION @MINOR_VERSION@ -#define LTTNG_UST_PATCHLEVEL_VERSION @PATCHLEVEL_VERSION@ -#define LTTNG_UST_VERSION @PACKAGE_VERSION@ +#undef LTTNG_UST_MAJOR_VERSION +#undef LTTNG_UST_MINOR_VERSION +#undef LTTNG_UST_PATCHLEVEL_VERSION + +#undef LTTNG_UST_VERSION + +#undef LTTNG_UST_LIB_SONAME_MAJOR +#undef LTTNG_UST_CTL_LIB_SONAME_MAJOR #endif /* _LTTNG_UST_VERSION_H */ -- 2.34.1