configure: Set CFG_<FOO>_PROVIDED if it was supplied

This allows you to distinguish between an option that defaulted, and an
option selected by the user
This commit is contained in:
Richo Healey 2015-04-14 00:43:59 -07:00
parent 71a4ea56c2
commit 87efd2cd74

12
configure vendored
View File

@ -192,6 +192,7 @@ valopt_core() {
then then
local UOP=$(echo $OP | tr '[:lower:]' '[:upper:]' | tr '\-' '\_') local UOP=$(echo $OP | tr '[:lower:]' '[:upper:]' | tr '\-' '\_')
local V="CFG_${UOP}" local V="CFG_${UOP}"
local V_PROVIDED="${V}_PROVIDED"
eval $V="$DEFAULT" eval $V="$DEFAULT"
for arg in $CFG_CONFIGURE_ARGS for arg in $CFG_CONFIGURE_ARGS
do do
@ -199,6 +200,7 @@ valopt_core() {
then then
val=$(echo "$arg" | cut -f2 -d=) val=$(echo "$arg" | cut -f2 -d=)
eval $V=$val eval $V=$val
eval $V_PROVIDED=1
fi fi
done done
if [ "$SAVE" = "save" ] if [ "$SAVE" = "save" ]
@ -247,8 +249,10 @@ opt_core() {
if [ $DEFAULT -eq 0 ] if [ $DEFAULT -eq 0 ]
then then
FLAG="enable" FLAG="enable"
DEFAULT_FLAG="disable"
else else
FLAG="disable" FLAG="disable"
DEFAULT_FLAG="enable"
DOC="don't $DOC" DOC="don't $DOC"
fi fi
@ -261,11 +265,19 @@ opt_core() {
OP=$(echo $OP | tr 'a-z-' 'A-Z_') OP=$(echo $OP | tr 'a-z-' 'A-Z_')
FLAG=$(echo $FLAG | tr 'a-z' 'A-Z') FLAG=$(echo $FLAG | tr 'a-z' 'A-Z')
local V="CFG_${FLAG}_${OP}" local V="CFG_${FLAG}_${OP}"
local V_PROVIDED="CFG_${FLAG}_${OP}_PROVIDED"
eval $V=1 eval $V=1
eval $V_PROVIDED=1
if [ "$SAVE" = "save" ] if [ "$SAVE" = "save" ]
then then
putvar $V putvar $V
fi fi
elif [ "$arg" = "--${DEFAULT_FLAG}-${OP}" ]
then
OP=$(echo $OP | tr 'a-z-' 'A-Z_')
DEFAULT_FLAG=$(echo $DEFAULT_FLAG | tr 'a-z' 'A-Z')
local V_PROVIDED="CFG_${DEFAULT_FLAG}_${OP}_PROVIDED"
eval $V_PROVIDED=1
fi fi
done done
else else