autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/3] Generate version.m4 from config.status, in lib/ not lib/m4su


From: Zack Weinberg
Subject: [PATCH 1/3] Generate version.m4 from config.status, in lib/ not lib/m4sugar/.
Date: Fri, 5 Feb 2021 10:34:33 -0500

This simplifies the Makefile a bit and also paves the way for a
bootstrap script (replacing the process of re-running autoreconf with
the just-built autoconf) which will be able to cope with generated
files that get installed in @pkgdatadir@ but not in @pkgdatadir@/m4sugar.

* lib/version.in: New file, contents extracted from lib/local.mk.
* lib/local.mk: Do not generate version.m4 here.
* configure.ac: Generate lib/version.m4 from lib/version.in via
  config.status.

* lib/freeze.mk, lib/local.mk, lib/m4sugar/m4sugar.m4:
  version.m4 now lives in @pkgdatadir@ rather than @pkgdatadir@/m4sugar.
---
 configure.ac           |  1 +
 lib/freeze.mk          |  2 +-
 lib/local.mk           | 25 +++----------------------
 lib/m4sugar/m4sugar.m4 |  6 +++---
 lib/version.in         | 12 ++++++++++++
 5 files changed, 20 insertions(+), 26 deletions(-)
 create mode 100644 lib/version.in

diff --git a/configure.ac b/configure.ac
index e6750473..18f04447 100644
--- a/configure.ac
+++ b/configure.ac
@@ -227,6 +227,7 @@ dnl Allow maintainer rules under GNU make even in VPATH 
builds.
 AC_CONFIG_LINKS([GNUmakefile:GNUmakefile])
 
 AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([lib/version.m4:lib/version.in])
 
 AC_OUTPUT
 # Report the state of this version of Autoconf if this is a beta.
diff --git a/lib/freeze.mk b/lib/freeze.mk
index b7d4bdc1..c1ea3ab9 100644
--- a/lib/freeze.mk
+++ b/lib/freeze.mk
@@ -62,7 +62,7 @@ m4f_dependencies = $(top_build_prefix)bin/autom4te 
$(AUTOM4TE_CFG)
 m4sugar_m4f_dependencies =                     \
        $(m4f_dependencies)                     \
        $(src_libdir)/m4sugar/m4sugar.m4        \
-       $(build_libdir)/m4sugar/version.m4
+       $(build_libdir)/version.m4
 
 m4sh_m4f_dependencies =                                \
        $(m4sugar_m4f_dependencies)             \
diff --git a/lib/local.mk b/lib/local.mk
index affe946b..501aa9dd 100644
--- a/lib/local.mk
+++ b/lib/local.mk
@@ -144,32 +144,13 @@ dist_m4sugarlib_DATA = \
   lib/m4sugar/m4sh.m4
 
 nodist_m4sugarlib_DATA = \
-  lib/m4sugar/version.m4 \
   lib/m4sugar/m4sugar.m4f \
   lib/m4sugar/m4sh.m4f
 
-CLEANFILES += $(nodist_m4sugarlib_DATA)
-
-# The ':;' in the second line of the recipe works around a redirected
-# compound command bash exit status bug.
-lib/m4sugar/version.m4: Makefile
-       $(MKDIR_P) $(@D)
-       :;{ \
-         echo '# This file is part of -*- Autoconf -*-.' && \
-         echo '# Version of Autoconf.' && \
-         echo '# Copyright (C) 1999, 2000, 2001, 2002, 2006, 2007, 2009' && \
-         echo '# Free Software Foundation, Inc.' && \
-         echo  &&\
-         echo 'm4_define([m4_PACKAGE_NAME],      [$(PACKAGE_NAME)])' && \
-         echo 'm4_define([m4_PACKAGE_TARNAME],   [$(PACKAGE_TARNAME)])' && \
-         echo 'm4_define([m4_PACKAGE_VERSION],   [$(PACKAGE_VERSION)])' && \
-         echo 'm4_define([m4_PACKAGE_STRING],    [$(PACKAGE_STRING)])' && \
-         echo 'm4_define([m4_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])' && \
-         echo 'm4_define([m4_PACKAGE_URL],       [$(PACKAGE_URL)])' && \
-         echo 'm4_define([m4_PACKAGE_YEAR],      [$(RELEASE_YEAR)])'; \
-       } > $@-t
-       mv $@-t $@
+nodist_pkgdata_DATA += \
+  lib/version.m4
 
+CLEANFILES += $(nodist_m4sugarlib_DATA) $(nodist_pkgdata_DATA)
 TAGS_FILES += $(dist_m4sugarlib_DATA)
 
 forbidden_patterns_files += $(dist_m4sugarlib_DATA)
diff --git a/lib/m4sugar/m4sugar.m4 b/lib/m4sugar/m4sugar.m4
index 0ea671d7..021fb2ed 100644
--- a/lib/m4sugar/m4sugar.m4
+++ b/lib/m4sugar/m4sugar.m4
@@ -2899,9 +2899,9 @@ m4_define([m4_version_compare],
 # m4_PACKAGE_STRING
 # m4_PACKAGE_BUGREPORT
 # --------------------
-# If m4sugar/version.m4 is present, then define version strings.  This
+# If version.m4 is present, then define version strings.  This
 # file is optional, provided by Autoconf but absent in Bison.
-m4_sinclude([m4sugar/version.m4])
+m4_sinclude([version.m4])
 
 
 # m4_version_prereq(VERSION, [IF-OK], [IF-NOT = FAIL])
@@ -2915,7 +2915,7 @@ m4_ifdef([m4_PACKAGE_VERSION],
                    [m4_fatal([Autoconf version $1 or higher is required],
                              [63])])],
        [$2])]],
-[[m4_fatal([m4sugar/version.m4 not found])]]))
+[[m4_fatal([version.m4 not found])]]))
 
 
 ## ------------------ ##
diff --git a/lib/version.in b/lib/version.in
new file mode 100644
index 00000000..3c0e0263
--- /dev/null
+++ b/lib/version.in
@@ -0,0 +1,12 @@
+# Version information for -*- Autoconf -*-.
+# @configure_input@
+# Copyright (C) 1999-2002, 2006-2007, 2009, 2021
+# Free Software Foundation, Inc.
+
+m4_define([m4_PACKAGE_NAME],      [@PACKAGE_NAME@])
+m4_define([m4_PACKAGE_TARNAME],   [@PACKAGE_TARNAME@])
+m4_define([m4_PACKAGE_VERSION],   [@PACKAGE_VERSION@])
+m4_define([m4_PACKAGE_STRING],    [@PACKAGE_STRING@])
+m4_define([m4_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])
+m4_define([m4_PACKAGE_URL],       [@PACKAGE_URL@])
+m4_define([m4_PACKAGE_YEAR],      [@RELEASE_YEAR@])
-- 
2.30.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]