add option validation to configure, now it will error out on undefined options
This commit is contained in:
parent
54ae377ec2
commit
b17b3d9c12
1 changed files with 40 additions and 0 deletions
40
configure
vendored
40
configure
vendored
|
@ -114,7 +114,38 @@ probe_need() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
validate_opt () {
|
||||||
|
for arg in $CFG_CONFIGURE_ARGS
|
||||||
|
do
|
||||||
|
isArgValid=0
|
||||||
|
for option in $BOOL_OPTIONS
|
||||||
|
do
|
||||||
|
if test --disable-$option = $arg
|
||||||
|
then
|
||||||
|
isArgValid=1
|
||||||
|
fi
|
||||||
|
if test --enable-$option = $arg
|
||||||
|
then
|
||||||
|
isArgValid=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
for option in $VAL_OPTIONS
|
||||||
|
do
|
||||||
|
if echo "$arg" | grep -q -- "--$option="
|
||||||
|
then
|
||||||
|
isArgValid=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if test $isArgValid -eq 0
|
||||||
|
then
|
||||||
|
err "Option '$arg' is not recognized"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
valopt() {
|
valopt() {
|
||||||
|
VAL_OPTIONS="$VAL_OPTIONS $1"
|
||||||
|
|
||||||
local OP=$1
|
local OP=$1
|
||||||
local DEFAULT=$2
|
local DEFAULT=$2
|
||||||
shift
|
shift
|
||||||
|
@ -145,6 +176,8 @@ valopt() {
|
||||||
}
|
}
|
||||||
|
|
||||||
opt() {
|
opt() {
|
||||||
|
BOOL_OPTIONS="$BOOL_OPTIONS $1"
|
||||||
|
|
||||||
local OP=$1
|
local OP=$1
|
||||||
local DEFAULT=$2
|
local DEFAULT=$2
|
||||||
shift
|
shift
|
||||||
|
@ -293,6 +326,9 @@ else
|
||||||
step_msg "processing $CFG_SELF args"
|
step_msg "processing $CFG_SELF args"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
BOOL_OPTIONS=""
|
||||||
|
VAL_OPTIONS=""
|
||||||
|
|
||||||
opt sharedstd 1 "build libstd as a shared library"
|
opt sharedstd 1 "build libstd as a shared library"
|
||||||
opt valgrind 0 "run tests with valgrind (memcheck by default)"
|
opt valgrind 0 "run tests with valgrind (memcheck by default)"
|
||||||
opt helgrind 0 "run tests with helgrind instead of memcheck"
|
opt helgrind 0 "run tests with helgrind instead of memcheck"
|
||||||
|
@ -313,6 +349,10 @@ valopt llvm-root "" "set LLVM root"
|
||||||
valopt host-triple "${DEFAULT_HOST_TRIPLE}" "LLVM host triple"
|
valopt host-triple "${DEFAULT_HOST_TRIPLE}" "LLVM host triple"
|
||||||
valopt target-triples "${CFG_HOST_TRIPLE}" "LLVM target triples"
|
valopt target-triples "${CFG_HOST_TRIPLE}" "LLVM target triples"
|
||||||
|
|
||||||
|
# Validate Options
|
||||||
|
step_msg "validating $CFG_SELF args"
|
||||||
|
validate_opt
|
||||||
|
|
||||||
if [ $HELP -eq 1 ]
|
if [ $HELP -eq 1 ]
|
||||||
then
|
then
|
||||||
echo ""
|
echo ""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue