Hi,

sending to both lists as Mans is listed as configure maintainer in
FFmpeg, and I believe the patch is useful for whatever side of the
fork.

Take care
>From 02899171d5c81f55460d59a40b68e65fecff493a Mon Sep 17 00:00:00 2001
From: Stefano Sabatini <[email protected]>
Date: Sat, 2 Apr 2011 17:02:54 +0200
Subject: [PATCH] configure: fail if an element is explicitely configured but dependencies are not

Make configure fail if an element is eplicitely configured but one of
its dependencies are not. This allows configure to explicitely warns
the user and fail, rather than silently disabling an explicitely
enabled element, which some users find confusing.

For example now you have:
./configure --enable-filter=ocv
Element 'ocv_filter' explicitely enabled but dependencies 'libopencv' are not enabled.

previously, the ocv filter was silently disabled with no warning.

Signed-off-by: Stefano Sabatini <[email protected]>
---
 configure |   33 +++++++++++++++++++++++++++++----
 1 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 88b9058..fd38d4f 100755
--- a/configure
+++ b/configure
@@ -390,10 +390,19 @@ enable(){
     set_all yes $*
 }
 
+enable_strong(){
+    set_all yes+ $*
+}
+
 disable(){
     set_all no $*
 }
 
+# same as disable
+disable_strong(){
+    set_all no $*
+}
+
 enable_weak(){
     set_weak yes $*
 }
@@ -437,9 +446,14 @@ enable_deep_weak(){
     enable_weak $*
 }
 
+enabled_strong(){
+    test "${1#!}" = "$1" && op== || op=!=
+    eval test "x\$${1#!}" $op "xyes+"
+}
+
 enabled(){
     test "${1#!}" = "$1" && op== || op=!=
-    eval test "x\$${1#!}" $op "xyes"
+    enabled_strong $1 || eval test "x\$${1#!}" $op "xyes"
 }
 
 disabled(){
@@ -505,6 +519,7 @@ check_deps(){
         check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
         popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
 
+        eval ${cfg}_precheck=\$$cfg
         [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
         [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
         enabled_all  $dep_all || disable $cfg
@@ -518,6 +533,16 @@ check_deps(){
             enable_deep_weak $dep_sgs
         fi
 
+        if enabled_strong ${cfg}_precheck && disabled $cfg; then
+            eval cfg_deps=\$${cfg}_deps
+            sep=""
+            for dep in $cfg_deps; do
+                ! enabled $dep && not_enabled_deps="${not_enabled_deps}${sep}${dep}"
+                sep=" "
+            done
+            die "Element '$cfg' explicitely enabled but its dependencies '$not_enabled_deps' are not enabled".
+        fi
+
         disable ${cfg}_checking
     done
 }
@@ -1782,15 +1807,15 @@ for opt do
     is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
     eval list=\$$(toupper $thing)_LIST
     name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
-    $action $(filter "$name" $list)
+    ${action}_strong $(filter "$name" $list)
     ;;
     --enable-?*|--disable-?*)
     eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
     if is_in $option $COMPONENT_LIST; then
         test $action = disable && action=unset
-        eval $action \$$(toupper ${option%s})_LIST
+        eval ${action}_strong \$$(toupper ${option%s})_LIST
     elif is_in $option $CMDLINE_SELECT; then
-        $action $option
+        ${action}_strong $option
     else
         die_unknown $opt
     fi
-- 
1.7.2.3

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to