From: Bruno Haible Date: Sat, 25 Jan 2025 03:07:32 +0000 (+0100) Subject: package-version: Simplify further. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=48648b4b9b3fd79a5c68913deb28678bd9d8eb34;p=gnulib.git package-version: Simplify further. * doc/package-version.texi (Propagating the package version): Recommend use of gl_INIT_PACKAGE_VERSION instead of gl_INIT_PACKAGE. * build-aux/git-version-gen: Likewise. * m4/init-package-version.m4: Likewise. (gl_INIT_PACKAGE_VERSION): Renamed from gl_INIT_PACKAGE. Take only one argument. Don't fiddle with AC_PACKAGE_NAME, AC_PACKAGE_TARNAME, PACKAGE. (gl_RPL_INIT_AUTOMAKE): Update. --- diff --git a/ChangeLog b/ChangeLog index f7f2698231..fd7ce7288c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2025-01-24 Bruno Haible + package-version: Simplify further. + * doc/package-version.texi (Propagating the package version): Recommend + use of gl_INIT_PACKAGE_VERSION instead of gl_INIT_PACKAGE. + * build-aux/git-version-gen: Likewise. + * m4/init-package-version.m4: Likewise. + (gl_INIT_PACKAGE_VERSION): Renamed from gl_INIT_PACKAGE. Take only one + argument. Don't fiddle with AC_PACKAGE_NAME, AC_PACKAGE_TARNAME, + PACKAGE. + (gl_RPL_INIT_AUTOMAKE): Update. + package-version: Simplify its use. Reported by Basil L. Contovounesios in . diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen index db4976c840..32c14e996d 100755 --- a/build-aux/git-version-gen +++ b/build-aux/git-version-gen @@ -55,13 +55,13 @@ scriptversion=2025-01-22.18; # UTC # since configure.ac no longer includes a version string, Makefile rules # should not depend on configure.ac for version updates). # -# AC_INIT +# AC_INIT([@var{package}], [dummy]) # AC_CONFIG_SRCDIR([@var{unique-file-in-source-dir}]) # AC_CONFIG_AUX_DIR([build-aux]) # VERSION_NUMBER=`cd $srcdir \ # && build-aux/git-version-gen .tarball-version \ # | sed -e 's/dirty$/modified/'` -# gl_INIT_PACKAGE([@var{package}], [$VERSION_NUMBER]) +# gl_INIT_PACKAGE_VERSION([$VERSION_NUMBER]) # AM_INIT_AUTOMAKE([@var{options}]) # # Then use the following lines in your Makefile.am, so that diff --git a/doc/package-version.texi b/doc/package-version.texi index 4075b98d03..dc8c8e8c55 100644 --- a/doc/package-version.texi +++ b/doc/package-version.texi @@ -124,7 +124,7 @@ AC_CONFIG_AUX_DIR([build-aux]) VERSION_NUMBER=`cd $srcdir \ && build-aux/git-version-gen .tarball-version \ | sed -e 's/dirty$/modified/'` -gl_INIT_PACKAGE([@var{package}], [$VERSION_NUMBER]) +gl_INIT_PACKAGE_VERSION([$VERSION_NUMBER]) AM_INIT_AUTOMAKE([@var{options}]) @end example @noindent @@ -159,7 +159,7 @@ AM_INIT_AUTOMAKE([@var{options}]) @end example @mindex package-version -The macro @code{gl_INIT_PACKAGE} +The macro @code{gl_INIT_PACKAGE_VERSION} is defined in the Gnulib module @code{package-version}. @node Using the package version diff --git a/m4/init-package-version.m4 b/m4/init-package-version.m4 index 69f7764892..cd68547051 100644 --- a/m4/init-package-version.m4 +++ b/m4/init-package-version.m4 @@ -1,5 +1,5 @@ # init-package-version.m4 -# serial 4 +# serial 5 dnl Copyright (C) 1992-2025 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General @@ -60,7 +60,7 @@ dnl the same distribution terms as the rest of that program. # AC_INIT(PACKAGE, [dummy], [MORE OPTIONS]) # AC_CONFIG_SRCDIR(WITNESS) # . $srcdir/../version.sh -# gl_INIT_PACKAGE(PACKAGE, $VERSION_NUMBER) +# gl_INIT_PACKAGE_VERSION($VERSION_NUMBER) # AM_INIT_AUTOMAKE([OPTIONS]) # # and after changing version.sh, the developer can directly configure and build: @@ -85,32 +85,26 @@ dnl the same distribution terms as the rest of that program. # make # -# gl_INIT_PACKAGE(PACKAGE-NAME, VERSION) -# -------------------------------------- +# gl_INIT_PACKAGE_VERSION(VERSION) +# -------------------------------- # followed by an AM_INIT_AUTOMAKE invocation, # is like calling AM_INIT_AUTOMAKE(PACKAGE-NAME, VERSION) # except that it can use computed non-literal arguments. -AC_DEFUN([gl_INIT_PACKAGE], +AC_DEFUN([gl_INIT_PACKAGE_VERSION], [ AC_BEFORE([$0], [AM_INIT_AUTOMAKE]) dnl Redefine AM_INIT_AUTOMAKE. m4_define([gl_AM_INIT_AUTOMAKE], - m4_bpatsubst(m4_dquote( - m4_bpatsubst(m4_dquote( - m4_bpatsubst(m4_dquote( - m4_defn([AM_INIT_AUTOMAKE])), - [AC_PACKAGE_NAME], [gl_INIT_DUMMY])), - [AC_PACKAGE_TARNAME], [gl_INIT_EMPTY])), + m4_bpatsubst(m4_dquote(m4_defn([AM_INIT_AUTOMAKE])), [AC_PACKAGE_VERSION], [gl_INIT_DUMMY]) [dnl Set variables documented in Automake. - AC_SUBST([PACKAGE], [$1]) - AC_SUBST([VERSION], ["$2"]) + AC_SUBST([VERSION], ["$1"]) dnl Set variables documented in Autoconf. - AC_SUBST([PACKAGE_VERSION], ["$2"]) - AC_SUBST([PACKAGE_STRING], ["$1 $2"]) - AC_DEFINE_UNQUOTED([PACKAGE_VERSION], ["$2"], + AC_SUBST([PACKAGE_VERSION], ["$1"]) + AC_SUBST([PACKAGE_STRING], ["AC_PACKAGE_NAME $1"]) + AC_DEFINE_UNQUOTED([PACKAGE_VERSION], ["$1"], [Define to the version of this package.]) - AC_DEFINE_UNQUOTED([PACKAGE_STRING], ["$1 $2"], + AC_DEFINE_UNQUOTED([PACKAGE_STRING], ["AC_PACKAGE_NAME $1"], [Define to the full name and version of this package.]) ]) m4_define([AM_INIT_AUTOMAKE], @@ -123,7 +117,7 @@ m4_define([gl_INIT_DUMMY], [gl_INIT_DUMMY2]) m4_define([gl_INIT_DUMMY2], []) AC_DEFUN([gl_RPL_INIT_AUTOMAKE], [ m4_ifval([$2], - [m4_fatal([After gl_INIT_PACKAGE, the two-argument form of AM_INIT_AUTOMAKE cannot be used.])]) + [m4_fatal([After gl_INIT_PACKAGE_VERSION, the two-argument form of AM_INIT_AUTOMAKE cannot be used.])]) gl_AM_INIT_AUTOMAKE([$1 no-define]) m4_if(m4_index([ $1 ], [ no-define ]), [-1], [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])