Skip to contentSkip to conversation

configure: Don't exit until all errors have been detected

PATCH In review Juan Quintela 2 participants 2 messages May 8, 2015 – May 21, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configure: Don't exit until all errors have been detected

Currently, it exits until each error, so if you are installing on a new machine, it requires lots of configure runs until you get all the dependencies that you need. With this change, it shows all the errors with the selected configured options.

---
 configure | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
configure +10 -1
index b18aa9e..1d7966b 100755
@@ -38,6 +38,8 @@ printf " '%s'" "$0" "$@" >> config.log
 echo >> config.log
 echo "#" >> config.log
 
+has_errors="no"
+
 error_exit() {
     echo
     echo "ERROR: $1"
@@ -46,7 +48,7 @@ error_exit() {
         shift
     done
     echo
-    exit 1
+    has_errors="yes"
 }
 
 do_compiler() {
@@ -5254,6 +5256,13 @@ case "$target_name" in
     error_exit "Unsupported target CPU"
   ;;
 esac
+
+
+if [ "x$has_errors" == "xyes" ]; then
+    echo "There are errors with this configuration.  Exiting."
+    exit 1;
+fi
+
 # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
 if [ "$TARGET_BASE_ARCH" = "" ]; then
   TARGET_BASE_ARCH=$TARGET_ARCH
Signature · 1 line
2.4.0
#1 lore raw
Quoted 24 lines · Juan Quintela

Currently, it exits until each error, so if you are installing on a new machine, it requires lots of configure runs until you get all the dependencies that you need. With this change, it shows all the errors with the selected configured options.

---
 configure | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
configure +2 -0
index b18aa9e..1d7966b 100755
@@ -38,6 +38,8 @@ printf " '%s'" "$0" "$@" >> config.log
 echo >> config.log
 echo "#" >> config.log
 
+has_errors="no"
+
 error_exit() {
     echo
     echo "ERROR: $1"

configure error_exit() { · line 52

Quoted 6 lines
configure +1 -1
@@ -46,7 +48,7 @@ error_exit() {
         shift
     done
     echo
-    exit 1
+    has_errors="yes"
 }

This will cause problems in some cases which assume that they're protected by an error_exit, or which at least will cause a lot of spurious errors later on:

* python version check assumes python exists
* you really want to bail out early if the C compiler test fails
* not having pkg-config is going to cause a lot of follow-on errors

Also it makes the function name pretty misleading. I would suggest changing this function to just error, and having error_exit for the few cases where we really do want to bail out early.

configure error_exit() { · line 54

Quoted 2 lines
configure +2 -0
+
+if [ "x$has_errors" == "xyes" ]; then

The POSIX shell string equality operator is "=". "==" is a bashism and won't work on other shells. Also, you don't need the 'x' here, so

    if [ "$has_errors" = "yes" ]; then

will do.

configure case "$target_name" in · line 5264

Quoted 3 lines
configure +3 -0
+    echo "There are errors with this configuration.  Exiting."
+    exit 1;
+fi

As per discussion on IRC, this should go further up.

thanks
-- PMM