]> www.infradead.org Git - users/borneoa/openocd-next.git/commitdiff
Make bootstrap more robust
authorR. Diez <rdiezmail-openocd@yahoo.de>
Fri, 1 Nov 2024 08:46:05 +0000 (09:46 +0100)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 16 Nov 2024 14:20:48 +0000 (14:20 +0000)
Change-Id: I67cc22752b34dd49c277e247f0b648047927a02b
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8532
Reviewed-by: R. Diez <rdiez-2006@rd10.de>
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
bootstrap

index 7d4ca37bd87fd8d7e5f28850d7ec3e3f967132dc..9dfdc41acac2f679a68ce0db1c66275367cdef49 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -3,8 +3,8 @@
 
 # Run the autotools bootstrap sequence to create the configure script
 
-# Abort execution on error
-set -e
+set -e  # Abort execution on error.
+set -u  # Abort if you reference an undefined variable.
 
 if which libtoolize > /dev/null; then
     libtoolize="libtoolize"
@@ -15,13 +15,21 @@ else
     exit 1
 fi
 
-if [ "$1" = "nosubmodule" ]; then
-    SKIP_SUBMODULE=1
-elif [ -n "$1" ]; then
-    echo "$0: Illegal argument $1"
-    echo "USAGE: $0 [nosubmodule]"
-    exit 1
-fi
+SKIP_SUBMODULE=0
+
+case "$#" in
+    0) ;;
+    1) if [ "$1" = "nosubmodule" ]; then
+           SKIP_SUBMODULE=1
+       else
+           echo "$0: Illegal argument $1" >&2
+           echo "USAGE: $0 [nosubmodule]" >&2
+           exit 1
+       fi;;
+   *)  echo "$0: Wrong number of command-line arguments." >&2
+       echo "USAGE: $0 [nosubmodule]" >&2
+       exit 1;;
+esac
 
 # bootstrap the autotools
 (
@@ -34,7 +42,7 @@ autoheader --warnings=all
 automake --warnings=all --gnu --add-missing --copy
 )
 
-if [ -n "$SKIP_SUBMODULE" ]; then
+if [ "$SKIP_SUBMODULE" -ne 0 ]; then
     echo "Skipping submodule setup"
 else
     echo "Setting up submodules"