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

Stefano Sabatini stefano.sabatini-lala
Sun Sep 28 19:07:49 CEST 2008


On date Wednesday 2008-09-24 22:40:26 +0200, Stefano Sabatini encoded:
> On date Wednesday 2008-09-24 19:55:20 +0100, M?ns Rullg?rd encoded:
[...]
> > 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.
> 
> I remember at least two users on ffmpeg-user hitting their head on
> this.
> 
> Also in principle I think programs should strive hard to provide clear
> and precise error messages, I also like the idea of me trying to
> compile ffmpeg 20 years from now on an old machine and still get
> ffmpeg behave as a nice guy and say me what the problem is with my
> configuration (for that time I think I'll have forgotten that I need
> latest libx264 ;-)).
[...]
> Index: configure
> ===================================================================
> --- configure	(revision 15400)
> +++ configure	(working copy)
> @@ -521,6 +521,18 @@
>  EOF
>  }
>  
> +check_cpp_condition(){
> +    log check_cpp_condition "$@"
> +    header=$1
> +    condition=$2
> +    check_cpp <<EOF
> +#include <$header>
> +#if !($condition)
> +#error "unsatisfied condition: $condition"
> +#endif
> +EOF
> +}
> +
>  check_lib(){
>      log check_lib "$@"
>      header="$1"
> @@ -608,6 +620,16 @@
>      check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
>  }
>  
> +require3(){
> +    name="$1"
> +    header="$2"
> +    func="$3"
> +    cpp_condition="$4"
> +    shift 4
> +    check_lib $header $func "$@" || die "ERROR: $name not found"
> +    check_cpp_condition $header "$cpp_condition" || die "ERROR: $name does not satisfies CPP condition: $cpp_condition"
> +}
> +
>  check_foo_config(){
>      cfg=$1
>      pkg=$2
> @@ -1714,7 +1736,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 x264.h x264_encoder_open "X264_BUILD >= 63" -lx264 -lm
>  enabled libxvid    && require  Xvid xvid.h xvid_global -lxvidcore
>  enabled mlib       && require  mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib

Ping, regards.
-- 
FFmpeg = Fostering Freak Mastering Powered Ecletic Gem




More information about the ffmpeg-devel mailing list