On 2016-11-24 17:24:01 +0100, Diego Biurrun wrote:
> ---
> 
> This works as advertised.
> 
> Issues:
> 
> - Maybe keeping _extralibs as suffix is better than _lbs, dunno.
> - Possibly I should investigate Janne's idea of using the function
>   name as variable name instead of adding a library name parameter
>   to things like check_lib().
> - The case statement in check_deps that adds the flags to the right
>   component is ugly. I don't have a better idea yet, but I was also
>   busy getting the rest of the patch to work at all.
>   Janne?
> 
>  configure | 305 
> ++++++++++++++++++++++++++++++++++++++++++++++++--------------
>  1 file changed, 237 insertions(+), 68 deletions(-)
> 
> diff --git a/configure b/configure
> index 27fb6ea..233bad4 100755
> --- a/configure
> +++ b/configure
> @@ -650,8 +650,31 @@ check_deps(){
>  
>      for cfg in $allopts; do
>          enabled $cfg || continue
> -        eval dep_extralibs="\$${cfg}_extralibs"
> -        test -n "$dep_extralibs" && add_extralibs $dep_extralibs
> +        eval dep_lbs="\$${cfg}_lbs"
> +        for lib in $dep_lbs; do
> +            eval append dep_libs "\$${lib}"
> +        done
> +        if test -n "$dep_libs"; then
> +            case $cfg in
> +                *coder|*parser|*bsf|*hwaccel)
> +                    add_extralibs_lib avcodec  $dep_libs ;;
> +                *muxer|*protocol)
> +                    add_extralibs_lib avformat $dep_libs ;;
> +                *filter)
> +                    add_extralibs_lib avfilter $dep_libs ;;
> +                *indev|*outdev)
> +                    add_extralibs_lib avdevice $dep_libs ;;
> +                avutil)
> +                    add_extralibs_lib avutil   $dep_libs ;;
> +                avconv)
> +                    add_extralibs_lib avconv   $dep_libs ;;
> +                avplay)
> +                    add_extralibs_lib avplay   $dep_libs ;;
> +                avprobe)
> +                    add_extralibs_lib avprobe  $dep_libs ;;
> +            esac
> +            unset dep_libs
> +        fi

Since we already have nice separated lists for all this it's probably 
nicer to add the extralibs separately after check_deps()

set_component_extralibs(){
    linkunit=$1
    shift 1
    for cfg in $@; do
        enabled $cfg || continue
        eval dep_lbs="\$${cfg}_lbs"
        for lib in $dep_lbs; do
            eval append dep_libs "\$${lib}"
        done
        if test -n "$dep_libs"; then
            add_extralibs_lib $linkunit $dep_libs
        fi
     done
}

set_component_extralibs avcodec $BSF_LIST $DECODER_LIST ...

proof of concept, see disable_components() how to get all component 
lists for a given library and integrate it into the loop below

for linkunit in $LIBRARY_LIST $PROGRAM_LIST; do
    set_component_extralibs $linkunit $linkunit
done

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

Reply via email to