]> Savannah Git Hosting - gnulib.git/commitdiff
New module 'version-stamp'.
authorBruno Haible <bruno@clisp.org>
Wed, 22 Jan 2025 20:25:27 +0000 (21:25 +0100)
committerBruno Haible <bruno@clisp.org>
Wed, 22 Jan 2025 20:25:27 +0000 (21:25 +0100)
* m4/version-stamp.m4: New file.
* modules/version-stamp: New file.

ChangeLog
m4/version-stamp.m4 [new file with mode: 0644]
modules/version-stamp [new file with mode: 0644]

index 87087d2d3b1f7bb4258d0ebd3cde6b1b34998c66..ef6f39e3a90181f340aa8a94057d75d62e6e8afd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-01-22  Bruno Haible  <bruno@clisp.org>
+
+       New module 'version-stamp'.
+       * m4/version-stamp.m4: New file.
+       * modules/version-stamp: New file.
+
 2025-01-22  Bruno Haible  <bruno@clisp.org>
 
        New module 'package-version'.
diff --git a/m4/version-stamp.m4 b/m4/version-stamp.m4
new file mode 100644 (file)
index 0000000..81e9f15
--- /dev/null
@@ -0,0 +1,35 @@
+# version-stamp.m4
+# serial 1
+dnl Copyright (C) 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
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+# Manages a stamp file, that keeps track when $(VERSION) was last changed.
+#
+# gl_CONFIG_VERSION_STAMP
+# needs to be invoked near the end of the package's top-level configure.ac,
+# before AC_OUTPUT.
+# It makes sure that during the build,
+#   - $(top_srcdir)/.version exists, and
+#   - when $(VERSION) is changed, $(top_srcdir)/.version gets modified.
+#
+# $(top_srcdir)/.version is a stamp file. Its contents wouldn't matter,
+# except that for detecting the change, we store the value of $(VERSION)
+# in it (but we could just as well store it in a different file).
+AC_DEFUN([gl_CONFIG_VERSION_STAMP],
+[
+  AC_CONFIG_COMMANDS([version-timestamp],
+    [if test -f "$ac_top_srcdir/.version" \
+        && test `cat "$ac_top_srcdir/.version"` = "$gl_version"; then
+       # The value of $(VERSION) is the same as last time.
+       :
+     else
+       # The value of $(VERSION) has changed. Update the stamp.
+       echo "$gl_version" > "$ac_top_srcdir/.version"
+     fi
+    ],
+    [gl_version="$VERSION"])
+])
diff --git a/modules/version-stamp b/modules/version-stamp
new file mode 100644 (file)
index 0000000..6257221
--- /dev/null
@@ -0,0 +1,19 @@
+Description:
+Optimized rebuilding of artifacts that depend on $(VERSION).
+
+Files:
+m4/version-stamp.m4
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+
+Include:
+
+License:
+GPLed build tool
+
+Maintainer:
+Bruno Haible