]> git.lizzy.rs Git - rust.git/commitdiff
configure: add support for --prefix=<prefix>
authorElly Jones <elly@leptoquark.net>
Wed, 2 Nov 2011 22:58:21 +0000 (18:58 -0400)
committerBrian Anderson <banderson@mozilla.com>
Wed, 2 Nov 2011 23:10:40 +0000 (16:10 -0700)
Signed-off-by: Elly Jones <elly@leptoquark.net>
configure

index 34861581283f30ca55c427b3699e7883ea4c361f..8b568eabb34080ccbf93d5dde1df89ee600cde66 100755 (executable)
--- a/configure
+++ b/configure
@@ -77,6 +77,32 @@ probe_need() {
     fi
 }
 
+valopt() {
+    local OP=$1
+    local DEFAULT=$2
+    shift
+    shift
+    local DOC="$*"
+    if [ $HELP -eq 0 ]
+    then
+       local UOP=$(echo $OP | tr 'a-z-' 'A-Z_')
+       local V="CFG_${UOP}"
+       eval $V="$DEFAULT"
+        for arg in $CFG_CONFIGURE_ARGS
+        do
+            if echo "$arg" | grep -q -- "--$OP="
+            then
+                val=$(echo "$arg" | cut -f2 -d=)
+                eval $V=$val
+            fi
+        done
+        putvar $V
+    else
+       local OPDEF="${OP}=[${DEFAULT}]"
+        printf "    --%-30s %s\n" "$OPDEF" "$DOC"
+    fi
+}
+
 opt() {
     local OP=$1
     local DEFAULT=$2
@@ -219,7 +245,7 @@ opt valgrind 1 "run tests with valgrind"
 opt docs     1 "build documentation"
 opt optimize 1 "build optimized rust code"
 opt mingw-cross 0 "cross-compile for win32 using mingw"
-
+valopt prefix "/usr/local" "set installation prefix"
 
 if [ $HELP -eq 1 ]
 then