msrtool: Make configure more POSIX sh friendly

Change a few bash-specific constructs to more portable syntax specified by
POSIX.  After the change the script keeps working with bash interpreter and
can also be interpreted by FreeBSD /bin/sh.

Signed-off-by: Andriy Gapon <avg@icyb.net.ua>
Acked-by: Peter Stuge <peter@stuge.se>


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4964 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Andriy Gapon
2009-11-28 04:54:33 +00:00
committed by Peter Stuge
parent be89c41ae3
commit 7df17af13b

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/sh
# #
# This file is part of msrtool. # This file is part of msrtool.
# #
@@ -25,7 +25,7 @@ VERSION=""
REV="`svnversion -c . 2>/dev/null | sed 's,.*:,,' 2>/dev/null`" REV="`svnversion -c . 2>/dev/null | sed 's,.*:,,' 2>/dev/null`"
VERSION="${VERSION:-$REV}" VERSION="${VERSION:-$REV}"
function findprog { findprog() {
NPARMS=$# NPARMS=$#
WHAT="${1}" WHAT="${1}"
shift shift
@@ -41,7 +41,7 @@ function findprog {
while test $i -lt $NPARMS; do while test $i -lt $NPARMS; do
test -z "${1}" && { test -z "${1}" && {
shift shift
i=$[$i+1] i=$(($i+1))
continue continue
} }
FILE="`which "${1}" 2>/dev/null`" FILE="`which "${1}" 2>/dev/null`"
@@ -50,7 +50,7 @@ function findprog {
break break
} }
shift shift
i=$[$i+1] i=$(($i+1))
done done
test -z "${1}" && { test -z "${1}" && {
echo " not found!" 1>&2 echo " not found!" 1>&2
@@ -62,7 +62,7 @@ function findprog {
exit 0 exit 0
} }
function trycompile { trycompile() {
NPARMS=$# NPARMS=$#
WHAT="${1}" WHAT="${1}"
shift shift
@@ -84,7 +84,7 @@ function trycompile {
exit 0 exit 0
} }
shift shift
i=$[$i+1] i=$(($i+1))
done done
echo "failed!" 1>&2 echo "failed!" 1>&2
echo 1>&2 echo 1>&2
@@ -99,7 +99,7 @@ function trycompile {
exit 1 exit 1
} }
function trylink { trylink {
NPARMS=$# NPARMS=$#
WHAT="${1}" WHAT="${1}"
shift shift
@@ -121,7 +121,7 @@ function trylink {
exit 0 exit 0
} }
shift shift
i=$[$i+1] i=$(($i+1))
done done
echo "failed!" 1>&2 echo "failed!" 1>&2
echo 1>&2 echo 1>&2