651-package-version-simplify.patch 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. From bb0f82be83d43db9cd77049be32ffd0b92ab5bb7 Mon Sep 17 00:00:00 2001
  2. From: Bruno Haible <[email protected]>
  3. Date: Fri, 24 Jan 2025 22:03:29 +0100
  4. Subject: package-version: Simplify its use.
  5. Reported by Basil L. Contovounesios <[email protected]> in
  6. <https://lists.gnu.org/archive/html/bug-gnulib/2025-01/msg00195.html>.
  7. * doc/package-version.texi (Propagating the package version): Recommend
  8. to pass the usual arguments to AC_INIT.
  9. * m4/init-package-version.m4: Likewise.
  10. (gl_INIT_PACKAGE): Define PACKAGE_VERSION and PACKAGE_STRING as needed.
  11. (gl_RPL_INIT_AUTOMAKE): Improve quoting.
  12. ---
  13. ChangeLog | 11 +++++++++++
  14. doc/package-version.texi | 2 +-
  15. m4/init-package-version.m4 | 20 ++++++++++++++------
  16. 3 files changed, 26 insertions(+), 7 deletions(-)
  17. --- a/m4/init-package-version.m4
  18. +++ b/m4/init-package-version.m4
  19. @@ -1,5 +1,5 @@
  20. # init-package-version.m4
  21. -# serial 3
  22. +# serial 4
  23. dnl Copyright (C) 1992-2025 Free Software Foundation, Inc.
  24. dnl This file is free software, distributed under the terms of the GNU
  25. dnl General Public License. As a special exception to the GNU General
  26. @@ -57,7 +57,7 @@ dnl the same distribution terms as the r
  27. #
  28. # With the macro defined in this file, the approach can be coded like this:
  29. #
  30. -# AC_INIT
  31. +# AC_INIT(PACKAGE, [dummy], [MORE OPTIONS])
  32. # AC_CONFIG_SRCDIR(WITNESS)
  33. # . $srcdir/../version.sh
  34. # gl_INIT_PACKAGE(PACKAGE, $VERSION_NUMBER)
  35. @@ -102,8 +102,16 @@ AC_DEFUN([gl_INIT_PACKAGE],
  36. [AC_PACKAGE_NAME], [gl_INIT_DUMMY])),
  37. [AC_PACKAGE_TARNAME], [gl_INIT_EMPTY])),
  38. [AC_PACKAGE_VERSION], [gl_INIT_DUMMY])
  39. - [AC_SUBST([PACKAGE], [$1])
  40. - AC_SUBST([VERSION], [$2])
  41. + [dnl Set variables documented in Automake.
  42. + AC_SUBST([PACKAGE], [$1])
  43. + AC_SUBST([VERSION], ["$2"])
  44. + dnl Set variables documented in Autoconf.
  45. + AC_SUBST([PACKAGE_VERSION], ["$2"])
  46. + AC_SUBST([PACKAGE_STRING], ["$1 $2"])
  47. + AC_DEFINE_UNQUOTED([PACKAGE_VERSION], ["$2"],
  48. + [Define to the version of this package.])
  49. + AC_DEFINE_UNQUOTED([PACKAGE_STRING], ["$1 $2"],
  50. + [Define to the full name and version of this package.])
  51. ])
  52. m4_define([AM_INIT_AUTOMAKE],
  53. m4_defn([gl_RPL_INIT_AUTOMAKE]))
  54. @@ -118,7 +126,7 @@ AC_DEFUN([gl_RPL_INIT_AUTOMAKE], [
  55. [m4_fatal([After gl_INIT_PACKAGE, the two-argument form of AM_INIT_AUTOMAKE cannot be used.])])
  56. gl_AM_INIT_AUTOMAKE([$1 no-define])
  57. m4_if(m4_index([ $1 ], [ no-define ]), [-1],
  58. - [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
  59. - AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])
  60. + [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
  61. + AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])
  62. ])
  63. ])