diff --git a/configure b/configure
index f280928442ac2aaea313d99400b480dc9845fb2f..fd47e53af02a856d809d3fff42570d5b766bac27 100755
--- a/configure
+++ b/configure
@@ -489,8 +489,13 @@ enable_deep(){
 }
 
 enable_deep_weak(){
-    do_enable_deep $*
-    enable_weak $*
+    for var; do
+        disabled $var && continue
+        pushvar var
+        do_enable_deep $var
+        popvar var
+        enable_weak $var
+    done
 }
 
 enabled(){