Skip to content

Commit a26554d

Browse files
Elly Jonesbrson
authored andcommitted
configure: add support for --prefix=<prefix>
Signed-off-by: Elly Jones <[email protected]>
1 parent 5970e9c commit a26554d

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

configure

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,32 @@ probe_need() {
7777
fi
7878
}
7979

80+
valopt() {
81+
local OP=$1
82+
local DEFAULT=$2
83+
shift
84+
shift
85+
local DOC="$*"
86+
if [ $HELP -eq 0 ]
87+
then
88+
local UOP=$(echo $OP | tr 'a-z-' 'A-Z_')
89+
local V="CFG_${UOP}"
90+
eval $V="$DEFAULT"
91+
for arg in $CFG_CONFIGURE_ARGS
92+
do
93+
if echo "$arg" | grep -q -- "--$OP="
94+
then
95+
val=$(echo "$arg" | cut -f2 -d=)
96+
eval $V=$val
97+
fi
98+
done
99+
putvar $V
100+
else
101+
local OPDEF="${OP}=[${DEFAULT}]"
102+
printf " --%-30s %s\n" "$OPDEF" "$DOC"
103+
fi
104+
}
105+
80106
opt() {
81107
local OP=$1
82108
local DEFAULT=$2
@@ -219,7 +245,7 @@ opt valgrind 1 "run tests with valgrind"
219245
opt docs 1 "build documentation"
220246
opt optimize 1 "build optimized rust code"
221247
opt mingw-cross 0 "cross-compile for win32 using mingw"
222-
248+
valopt prefix "/usr/local" "set installation prefix"
223249

224250
if [ $HELP -eq 1 ]
225251
then

0 commit comments

Comments
 (0)