[FFmpeg-devel] [PATCH] Implement CPP condition check support in configure

Måns Rullgård mans
Wed Sep 24 20:55:20 CEST 2008


Stefano Sabatini <stefano.sabatini-lala at poste.it> writes:

> On date Sunday 2008-09-21 21:18:22 +0200, Stefano Sabatini encoded:
>> On date Sunday 2008-09-21 18:44:23 +0100, M?ns Rullg?rd encoded:
> [...]
>> > Furthermore, the test could be made more generic.
>> 
>> Tell if you like the patch below.
>
> Small fix and ping.
>
> Example output:
>
> stefano at geppetto ~/s/ffmpeg> configure --enable-libx264 --enable-gpl
> ERROR: x264 does not satisfies CPP condition: X264_BUILD >= 63
> If you think configure made a mistake, make sure you are using the latest
> version from SVN. ...
>
> Regards.
> -- 
> FFmpeg = Forgiving Fiendish Merciless Problematic EnGraver
>
> Index: configure
> ===================================================================
> --- configure	(revision 15400)
> +++ configure	(working copy)
> @@ -521,6 +521,24 @@
>  EOF
>  }
>  
> +check_cpp_condition(){
> +    log check_cpp_condition "$@"
> +    headers=$1
> +    condition=$2
> +    shift 3

shift 2

> +    incs=""
> +    for hdr in $headers; do
> +        incs="$incs
> +#include <$hdr>"
> +    done
> +    check_cpp <<EOF
> +$incs
> +#if !($condition)
> +#error "unsatisfied condition: $condition"
> +#endif
> +EOF
> +}

This is more or less what I had in mind.

>  check_lib(){
>      log check_lib "$@"
>      header="$1"
> @@ -608,6 +626,16 @@
>      check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
>  }
>  
> +require3(){
> +    name="$1"
> +    headers="$2"
> +    func="$3"
> +    cpp_condition="$4"
> +    shift 4
> +    check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
> +    check_cpp_condition "$headers" "$cpp_condition" "$@" || die "ERROR: $name does not satisfies CPP condition: $cpp_condition"
> +}

I'm not entirely happy with this.

>  check_foo_config(){
>      cfg=$1
>      pkg=$2
> @@ -1714,7 +1742,7 @@
>                          && require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
>  enabled libtheora  && require  libtheora theora/theora.h theora_info_init -ltheora -logg
>  enabled libvorbis  && require  libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
> -enabled libx264    && require  x264 x264.h x264_encoder_open -lx264 -lm
> +enabled libx264    && require3 x264 "stdint.h x264.h" x264_encoder_open "X264_BUILD >= 63" -lx264 -lm

No need to include stdint.h.  The preprocessor doesn't care if there
are undefined things in x264.h.

Now I'm still not convinced we need to check the x264 version.  We
have always required a reasonably recent version, and have had few, if
any, complaints in the past.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list