[DTrace-devel] [PATCH 3/9] build: track configured vars

Nick Alcock nick.alcock at oracle.com
Fri May 31 18:59:22 UTC 2024


This lets the build system determine whether a variable was
explicitly set via ./configure (the assumption being that
if you set something explicitly, you knew what you were doing,
so e.g. if you set the --systemd-unit-dir to /foo/bar, you
have also arranged for systemd to look there for unit files,
so the build system can install the systemd unit files there
on the assumption that they will work).

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
---
 configure | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 462548bcc69c9..fb9a45cda1b77 100755
--- a/configure
+++ b/configure
@@ -17,13 +17,12 @@ write_make_var()
 {
     local val="$(printf "%s" "$2" | sed 's,^.*=,,')"
 
-    [[ ! -d build ]] && mkdir -p build
-
     if [[ ! -f build/.config-vars.mk.new ]]; then
         echo '# This file is automatically generated.' > build/.config-vars.mk.new
     fi
 
     printf '%s=%s\n' $1 "$val" >> build/.config-vars.mk.new
+    printf "override CONFIGURED_VARS+=%s\n" $1 >> build/.config-vars.mk.new
 }
 
 # Write out build/.config/*.mk and build/.config/*.h, which are the same
@@ -115,7 +114,9 @@ above stick for future make invocations until "make clean".
 EOF
 }
 
+[[ ! -d build ]] && mkdir -p build
 rm -rf build/.config.new build/.config-vars.mk.new
+echo 'override CONFIGURED_VARS=' > build/.config-vars.mk.new
 trap 'rm -rf build/.config.new build/.config-vars.mk.new' ERR
 
 for option in "$@"; do
@@ -173,8 +174,6 @@ done
 
 echo 'Writing build/config-vars.mk'
 rm -f build/config-vars.mk
-[[ ! -f build/.config-vars.mk.new ]] && \
-  touch build/config-vars.mk
 mv -f build/.config-vars.mk.new build/config-vars.mk
 
 rm -rf build/.config
-- 
2.45.1.275.g567cb0950c




More information about the DTrace-devel mailing list