git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 5/7] autoconf: use AC_CONFIG_COMMANDS instead of ad-hoc 'config.mak.append'

From
Stefano Lattarini <stefano.lattarini@gmail.com>
Date
Jul 19, 2012, 07:50 UTC
Message-ID
<3f038563bcf4aea6bc882e4d565c02976c460cef.1342683786.git.stefano.lattarini@gmail.com>
In-Reply-To
<cover.1342683786.git.stefano.lattarini@gmail.com>

This will allow "./config.status --recheck; ./config.status" to work correctly as a mean of reconfiguring the tree with the same configure argument used in the previous "./configure" invocation.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
---
 configure.ac | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/configure.ac b/configure.ac
index b453ba5..a63fe77 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,9 +5,22 @@
 
 # GIT_CONF_SUBST(VAL, VAR)
 # ------------------------
-# Append the line "VAR=VAL" to file ${config_append}
-AC_DEFUN([GIT_CONF_APPEND_LINE],
-         [echo "$1=$2" >> "${config_append}"])
+# Cause the line "VAR=VAL" to be eventually appended to ${config_file}.
+AC_DEFUN([GIT_CONF_SUBST],
+   [AC_REQUIRE([GIT_CONF_SUBST_INIT])
+   config_appended_defs="$config_appended_defs${newline}$1=$2"])
+
+# GIT_CONF_SUBST_INIT
+# -------------------
+# Prepare shell variables and autoconf machine required by later calls
+# to GIT_CONF_SUBST.
+AC_DEFUN([GIT_CONF_SUBST_INIT],
+    [config_appended_defs=; newline='
+'
+    AC_CONFIG_COMMANDS([$config_file],
+                       [echo "$config_appended_defs" >> "$config_file"],
+                       [config_file=$config_file
+                        config_appended_defs="$config_appended_defs"])])
 
 # GIT_ARG_SET_PATH(PROGRAM)
 # -------------------------
@@ -133,11 +146,8 @@ AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org])
 AC_CONFIG_SRCDIR([git.c])
 
 config_file=config.mak.autogen
-config_append=config.mak.append
 config_in=config.mak.in
 
-echo "# ${config_append}.  Generated by configure." > "${config_append}"
-
 # Directories holding "saner" versions of common or POSIX binaries.
 AC_ARG_WITH([sane-tool-path],
   [AS_HELP_STRING(
@@ -1041,9 +1051,5 @@ AC_SUBST(PTHREAD_LIBS)
 AC_SUBST(NO_PTHREADS)
 
 ## Output files
-AC_CONFIG_FILES(["${config_file}":"${config_in}":"${config_append}"])
+AC_CONFIG_FILES(["${config_file}":"${config_in}"])
 AC_OUTPUT
-
-
-## Cleanup
-rm -f "${config_append}"
-- 
1.7.10.2.1067.g553d16e
Previous: Stefano LattariniNext: Stefano Lattarini
Message 26 of 31 in “build system: support automatic reconfiguration for autotools user”
  1. 0/7 build system: support automatic reconfiguration for autotools userStefano Lattarini, Jul 18, 2012
  2. 1/7 autoconf: GIT_CONF_APPEND_LINE: change signatureStefano Lattarini, Jul 18, 2012
  3. 2/7 autoconf: GIT_CONF_APPEND_LINE -> GIT_CONF_SUBSTStefano Lattarini, Jul 18, 2012
  4. Junio C HamanoJul 19, 2012
  5. Stefano LattariniJul 19, 2012
  6. 3/7 autoconf: remove some redundant shell indirectionsStefano Lattarini, Jul 18, 2012
  7. Junio C HamanoJul 19, 2012
  8. Stefano LattariniJul 19, 2012
  9. Junio C HamanoJul 19, 2012
  10. Stefano LattariniJul 19, 2012
  11. 4/7 autoconf: remove few redundant semicolonsStefano Lattarini, Jul 18, 2012
  12. 5/7 autoconf: use AC_CONFIG_COMMANDS instead of ad-hoc 'config.mak.append'Stefano Lattarini, Jul 18, 2012
  13. 6/7 build: "make clean" should not remove configure-generated filesStefano Lattarini, Jul 18, 2012
  14. Matthieu MoyJul 19, 2012
  15. Stefano LattariniJul 19, 2012
  16. Matthieu MoyJul 19, 2012
  17. Stefano LattariniJul 19, 2012
  18. Junio C HamanoJul 19, 2012
  19. 7/7 build: reconfigure automatically if configure.ac changesStefano Lattarini, Jul 18, 2012
  20. Junio C HamanoJul 19, 2012
  21. 0/7 build system: support automatic reconfiguration for autotools userStefano Lattarini, Jul 19, 2012
  22. 1/7 autoconf: GIT_CONF_APPEND_LINE: change signatureStefano Lattarini, Jul 19, 2012
  23. 2/7 autoconf: GIT_CONF_APPEND_LINE -> GIT_CONF_SUBSTStefano Lattarini, Jul 19, 2012
  24. 3/7 autoconf: remove some redundant shell indirectionsStefano Lattarini, Jul 19, 2012
  25. 4/7 autoconf: remove few redundant semicolonsStefano Lattarini, Jul 19, 2012
  26. 5/7 autoconf: use AC_CONFIG_COMMANDS instead of ad-hoc 'config.mak.append'Stefano Lattarini, Jul 19, 2012
  27. 6/7 build: "make clean" should not remove configure-generated filesStefano Lattarini, Jul 19, 2012
  28. Stefano LattariniJul 23, 2012
  29. Junio C HamanoJul 23, 2012
  30. 7/7 build: reconfigure automatically if configure.ac changesStefano Lattarini, Jul 19, 2012
  31. Stefano LattariniJul 23, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.