]> Savannah Git Hosting - gnulib.git/commitdiff
package-version: Simplify further.
authorBruno Haible <bruno@clisp.org>
Sat, 25 Jan 2025 03:07:32 +0000 (04:07 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 25 Jan 2025 03:07:32 +0000 (04:07 +0100)
* 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.

ChangeLog
build-aux/git-version-gen
doc/package-version.texi
m4/init-package-version.m4

index f7f26982311f29563bba160a2a9717108ff0138d..fd7ce7288c174d86746b917bc25e8789451dd3b7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2025-01-24  Bruno Haible  <bruno@clisp.org>
 
+       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 <basil@contovou.net> in
        <https://lists.gnu.org/archive/html/bug-gnulib/2025-01/msg00195.html>.
index db4976c8406f38bcfd8c0d0fcbe37f2f83a4b343..32c14e996d8bec3a3f3f98f9704fb59667dcc6fa 100755 (executable)
@@ -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
index 4075b98d03b1f7fe2c1a4ac3b2df1ece41210dfb..dc8c8e8c55be68123f1dfcf67e3c221c002bdec6 100644 (file)
@@ -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
index 69f7764892bc235839835899c98a55fa318ebf25..cd68547051545a2e4e864d69f3166d1c6fe32703 100644 (file)
@@ -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])