Skip to contentSkip to conversation

configure: Avoid error messages about missing *-config-*.h files

PATCH Superseded Thomas Huth 2 participants 3 messages May 19, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configure: Avoid error messages about missing *-config-*.h files

When compiling with --disable-system there is a harmless yet still annoying error message at the end of the "configure" step:

sed: can't read *-config-devices.h: No such file or directory

When only building the tools or docs, without any emulator at all, there is even an additional message about missing *-config-target.h files.

Fix it by checking whether any of these files are available before using them.

Fixes e0447a834d ("configure: Poison all current target-specific #defines")
---
 configure | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
configure +8 -4
index 963e35b9a7..a8a9e78c61 100755
@@ -6458,10 +6458,14 @@ fi
 
 # Create list of config switches that should be poisoned in common code...
 # but filter out CONFIG_TCG and CONFIG_USER_ONLY which are special.
-sed -n -e '/CONFIG_TCG/d' -e '/CONFIG_USER_ONLY/d' \
-    -e '/^#define / { s///; s/ .*//; s/^/#pragma GCC poison /p; }' \
-    *-config-devices.h *-config-target.h | \
-    sort -u > config-poison.h
+target_configs_h=$(ls *-config-devices.h *-config-target.h 2>/dev/null)
+if test -n "$target_configs_h" ; then
+    sed -n -e '/CONFIG_TCG/d' -e '/CONFIG_USER_ONLY/d' \
+        -e '/^#define / { s///; s/ .*//; s/^/#pragma GCC poison /p; }' \
+        $target_configs_h | sort -u > config-poison.h
+else
+    touch config-poison.h
+fi
 
 # Save the configure command line for later reuse.
 cat <<EOD >config.status
Signature · 1 line
2.27.0
#1 lore raw
Quoted 28 lines · Thomas Huth

When compiling with --disable-system there is a harmless yet still annoying error message at the end of the "configure" step:

sed: can't read *-config-devices.h: No such file or directory

When only building the tools or docs, without any emulator at all, there is even an additional message about missing *-config-target.h files.

Fix it by checking whether any of these files are available before using them.

Fixes e0447a834d ("configure: Poison all current target-specific #defines")
---
 configure | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
configure +0 -1
index 963e35b9a7..a8a9e78c61 100755
@@ -6458,10 +6458,14 @@ fi
 
 # Create list of config switches that should be poisoned in common code...
 # but filter out CONFIG_TCG and CONFIG_USER_ONLY which are special.
-sed -n -e '/CONFIG_TCG/d' -e '/CONFIG_USER_ONLY/d' \

configure fi · line 6467

Quoted 10 lines
configure +7 -3
-    -e '/^#define / { s///; s/ .*//; s/^/#pragma GCC poison /p; }' \
-    *-config-devices.h *-config-target.h | \
-    sort -u > config-poison.h
+target_configs_h=$(ls *-config-devices.h *-config-target.h 2>/dev/null)
+if test -n "$target_configs_h" ; then
+    sed -n -e '/CONFIG_TCG/d' -e '/CONFIG_USER_ONLY/d' \
+        -e '/^#define / { s///; s/ .*//; s/^/#pragma GCC poison /p; }' \
+        $target_configs_h | sort -u > config-poison.h
+else
+    touch config-poison.h

:> config-poison.h is safer.

Quoted 5 lines
configure +1 -0
+fi
 
 # Save the configure command line for later reuse.
 cat <<EOD >config.status
#2 lore raw
Quoted 26 lines · Philippe Mathieu-Daudé
Quoted 25 lines · Thomas Huth

When compiling with --disable-system there is a harmless yet still annoying error message at the end of the "configure" step:

sed: can't read *-config-devices.h: No such file or directory

When only building the tools or docs, without any emulator at all, there is even an additional message about missing *-config-target.h files.

Fix it by checking whether any of these files are available before using them.

Fixes e0447a834d ("configure: Poison all current target-specific #defines")
---
  configure | 12 ++++++++----
  1 file changed, 8 insertions(+), 4 deletions(-)
configure +0 -0
index 963e35b9a7..a8a9e78c61 100755
@@ -6458,10 +6458,14 @@ fi
 
Quoted 15 lines

configure fi · line 6467

Quoted 13 lines
configure +7 -4
  # Create list of config switches that should be poisoned in common code...
  # but filter out CONFIG_TCG and CONFIG_USER_ONLY which are special.
-sed -n -e '/CONFIG_TCG/d' -e '/CONFIG_USER_ONLY/d' \
-    -e '/^#define / { s///; s/ .*//; s/^/#pragma GCC poison /p; }' \
-    *-config-devices.h *-config-target.h | \
-    sort -u > config-poison.h
+target_configs_h=$(ls *-config-devices.h *-config-target.h 2>/dev/null)
+if test -n "$target_configs_h" ; then
+    sed -n -e '/CONFIG_TCG/d' -e '/CONFIG_USER_ONLY/d' \
+        -e '/^#define / { s///; s/ .*//; s/^/#pragma GCC poison /p; }' \
+        $target_configs_h | sort -u > config-poison.h
+else
+    touch config-poison.h

:> config-poison.h is safer.

True, I'll send a v2.

Thomas