about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRicho Healey <richo@psych0tik.net>2015-04-14 00:43:59 -0700
committerRicho Healey <richo@psych0tik.net>2015-04-14 00:58:51 -0700
commit87efd2cd744aa9547e902d8acb5473ed3d1f9b7a (patch)
treefbee1e0c4e9d61f5047f8701d5f1b1dd0396d550
parent71a4ea56c2ff2711cc5c88f063e8f5a213247e31 (diff)
downloadrust-87efd2cd744aa9547e902d8acb5473ed3d1f9b7a.tar.gz
rust-87efd2cd744aa9547e902d8acb5473ed3d1f9b7a.zip
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
-rwxr-xr-xconfigure12
1 files changed, 12 insertions, 0 deletions
diff --git a/configure b/configure
index a3ae7dc73d0..4d576323f00 100755
--- a/configure
+++ b/configure
@@ -192,6 +192,7 @@ valopt_core() {
     then
         local UOP=$(echo $OP | tr '[:lower:]' '[:upper:]' | tr '\-' '\_')
         local V="CFG_${UOP}"
+        local V_PROVIDED="${V}_PROVIDED"
         eval $V="$DEFAULT"
         for arg in $CFG_CONFIGURE_ARGS
         do
@@ -199,6 +200,7 @@ valopt_core() {
             then
                 val=$(echo "$arg" | cut -f2 -d=)
                 eval $V=$val
+                eval $V_PROVIDED=1
             fi
         done
         if [ "$SAVE" = "save" ]
@@ -247,8 +249,10 @@ opt_core() {
     if [ $DEFAULT -eq 0 ]
     then
         FLAG="enable"
+        DEFAULT_FLAG="disable"
     else
         FLAG="disable"
+        DEFAULT_FLAG="enable"
         DOC="don't $DOC"
     fi
 
@@ -261,11 +265,19 @@ opt_core() {
                 OP=$(echo $OP | tr 'a-z-' 'A-Z_')
                 FLAG=$(echo $FLAG | tr 'a-z' 'A-Z')
                 local V="CFG_${FLAG}_${OP}"
+                local V_PROVIDED="CFG_${FLAG}_${OP}_PROVIDED"
                 eval $V=1
+                eval $V_PROVIDED=1
                 if [ "$SAVE" = "save" ]
                 then
                    putvar $V
                 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
         done
     else