summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2005-05-25 07:06:54 +0000
committerrillig <rillig@pkgsrc.org>2005-05-25 07:06:54 +0000
commit8aedb701775dab3c96020cf6f97213e94dbbc1b7 (patch)
tree7ef8d75e35333c6e766717e5f5a504a24f6c8c44
parent3d9cc4a8f50eb48ffd8b72bd11bc0dc3368ceca0 (diff)
downloadpkgsrc-8aedb701775dab3c96020cf6f97213e94dbbc1b7.tar.gz
Added a function get_optarg that avoids code duplication in the option
parsing code. For maximum portability it uses the expr(1) command instead of sed(1), the same way as it is done in the core of the latest GNU configure scripts.
-rwxr-xr-xbootstrap/bootstrap15
1 files changed, 10 insertions, 5 deletions
diff --git a/bootstrap/bootstrap b/bootstrap/bootstrap
index f989c101c0e..a2843ab8831 100755
--- a/bootstrap/bootstrap
+++ b/bootstrap/bootstrap
@@ -1,6 +1,6 @@
#! /bin/sh
-# $NetBSD: bootstrap,v 1.37 2005/05/14 02:12:48 rillig Exp $
+# $NetBSD: bootstrap,v 1.38 2005/05/25 07:06:54 rillig Exp $
#
#
# Copyright (c) 2001-2002 Alistair G. Crooks. All rights reserved.
@@ -225,21 +225,26 @@ copy_src()
$cpprog -R $_src/* $wrkdir/$_dst
}
+get_optarg()
+{
+ expr "x$1" : "x[^=]*=\\(.*\\)"
+}
+
build_start=`date`
echo_msg "bootstrap command: $0 $@"
echo_msg "bootstrap started: $build_start"
while [ $# -gt 0 ]; do
case $1 in
- --workdir=*) wrkdir=`echo x"$1" | sed 's,^[^=]*=,,'` ;;
+ --workdir=*) wrkdir=`get_optarg "$1"` ;;
--workdir) wrkdir="$2"; shift ;;
- --prefix=*) prefix=`echo x"$1" | sed 's,^[^=]*=,,'`;
+ --prefix=*) prefix=`get_optarg "$1"`;
sysconfdir=${prefix}/etc ;;
--prefix) prefix="$2"; shift;
sysconfdir=${prefix}/etc ;;
- --pkgdbdir=*) pkgdbdir=`echo x"$1" | sed 's,^[^=]*=,,'` ;;
+ --pkgdbdir=*) pkgdbdir=`get_optarg "$1"` ;;
--pkgdbdir) pkgdbdir="$2"; shift ;;
- --sysconfdir=*) sysconfdir=`echo x"$1" | sed 's,^[^=]*=,,'` ;;
+ --sysconfdir=*) sysconfdir=`get_optarg "$1"` ;;
--sysconfdir) sysconfdir="$2"; shift ;;
--ignore-case-check) ignorecasecheck=yes ;;
--ignore-user-check) ignoreusercheck=yes ;;