Patchwork msrtool: posix-ify configure script

login
register
about
Submitter Andriy Gapon
Date 2009-11-26 12:32:52
Message ID <4B0E7574.7070805@icyb.net.ua>
Download mbox | patch
Permalink /patch/602/
State Accepted
Headers show

Comments

Andriy Gapon - 2009-11-26 12:32:52
Please review the following patch.
It changes 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>
Peter Stuge - 2009-11-28 05:00:58
Andriy Gapon wrote:
> 
> Please review the following patch.
> It changes 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>

I rebased the patch to current trunk and committed as r4964.


//Peter

Patch

Index: configure
===================================================================
--- configure	(revision 4776)
+++ configure	(working copy)
@@ -1,4 +1,4 @@ 
-#!/bin/bash
+#!/bin/sh
 #
 # This file is part of msrtool.
 #
@@ -25,7 +25,7 @@ 
 REV="`svnversion -c . 2>/dev/null | sed 's,.*:,,' 2>/dev/null`"
 VERSION="${VERSION:-$REV}"

-function findprog {
+findprog() {
 	NPARMS=$#
 	WHAT="${1}"
 	shift
@@ -41,7 +41,7 @@ 
 	while test $i -lt $NPARMS; do
 		test -z "${1}" && {
 			shift
-			i=$[$i+1]
+			i=$(($i+1))
 			continue
 		}
 		FILE="`which "${1}" 2>/dev/null`"
@@ -50,7 +50,7 @@ 
 			break
 		}
 		shift
-		i=$[$i+1]
+		i=$(($i+1))
 	done
 	test -z "${1}" && {
 		echo "  not found!" 1>&2
@@ -62,7 +62,7 @@ 
 	exit 0
 }

-function trycompile {
+trycompile() {
 	NPARMS=$#
 	WHAT="${1}"
 	shift
@@ -84,7 +84,7 @@ 
 			exit 0
 		}
 		shift
-		i=$[$i+1]
+		i=$(($i+1))
 	done
 	echo "failed!" 1>&2
 	echo 1>&2
@@ -99,7 +99,7 @@ 
 	exit 1
 }

-function trylink {
+trylink() {
 	NPARMS=$#
 	WHAT="${1}"
 	shift
@@ -121,7 +121,7 @@ 
 			exit 0
 		}
 		shift
-		i=$[$i+1]
+		i=$(($i+1))
 	done
 	echo "failed!" 1>&2
 	echo 1>&2