Tell Autoconf to get the version from ddclient.in

This avoids the need to maintain the same version string in two
different places.
This commit is contained in:
Richard Hansen 2024-03-06 23:05:51 -08:00
parent c9cec591f0
commit 0806363b57
4 changed files with 18 additions and 2 deletions

6
.autom4te.cfg Normal file
View file

@ -0,0 +1,6 @@
# Disable autom4te cache to ensure that any change to ddclient.in triggers a
# rebuild of the configure script (which gets the version of ddclient from
# ddclient.in). See <https://lists.gnu.org/r/automake/2019-10/msg00002.html>.
begin-language: "Autoconf-without-aclocal-m4"
args: --no-cache
end-language: "Autoconf-without-aclocal-m4"

View file

@ -76,6 +76,7 @@ generated_tests = \
TESTS = $(handwritten_tests) $(generated_tests)
$(TESTS): ddclient
EXTRA_DIST += $(handwritten_tests) \
.autom4te.cfg \
t/lib/Devel/Autoflush.pm \
t/lib/Test/Builder.pm \
t/lib/Test/Builder/Formatter.pm \

View file

@ -1,5 +1,14 @@
AC_PREREQ([2.63])
AC_INIT([ddclient], [3.11.3_0])
# Get the version from ddclient.in so that the same version string
# doesn't have to be maintained in two places. The m4_dquote macro is
# used instead of quote characters to ensure that the command is only
# run once. The command outputs quote characters to prevent
# incidental expansion (the m4_esyscmd macro does not quote the
# command output itself, so the command output is subject to
# expansion).
AC_INIT([ddclient], m4_dquote(m4_esyscmd([printf '[%s]' "$(./ddclient.in --version=short)"])))
# Needed because of the above invocation of ddclient.in.
AC_SUBST([CONFIGURE_DEPENDENCIES], ['$(top_srcdir)/ddclient.in'])
AC_CONFIG_SRCDIR([ddclient.in])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])

View file

@ -4,6 +4,6 @@ use version;
SKIP: { eval { require Test::Warnings; } or skip($@, 1); }
eval { require 'ddclient'; } or BAIL_OUT($@);
is(ddclient->VERSION(), version->parse('v@PACKAGE_VERSION@'), "version matches Autoconf config");
is($ddclient::version, '@PACKAGE_VERSION@', "version matches version in Autoconf");
done_testing();