build-sys/autogen: don't use bashisms (#4489)
authorEvgeny Vereshchagin <evvers@ya.ru>
Tue, 25 Oct 2016 23:39:48 +0000 (02:39 +0300)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 25 Oct 2016 23:39:48 +0000 (19:39 -0400)
Fixes:
$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Feb 17  2016 /bin/sh -> dash

$ ./autogen.sh c
./autogen.sh: 22: ./autogen.sh: [[: not found
...
checking whether make supports nested variables... (cached) yes
checking build system type... Invalid configuration `c': machine `c' not
recognized
configure: error: /bin/bash build-aux/config.sub c failed

this is a follow-up for a5e739a570081231

autogen.sh

index fa8d291..1897e23 100755 (executable)
@@ -19,13 +19,11 @@ set -e
 
 verb="$1"
 
-if [[ -n "$verb" ]]; then
-        if [[ "$verb" != [cgals] ]]; then
-                echo "Unexpected argument: $verb" >&2
-                exit 1
-        fi
-        shift
-fi
+case "$verb" in
+"") ;;
+[cgals]) shift ;;
+*) echo "Unexpected argument: $verb" >&2; exit 1 ;;
+esac
 
 oldpwd=$(pwd)
 topdir=$(dirname $0)