[FFmpeg-devel] [PATCH] Implement CPP condition check support in configure
Stefano Sabatini
stefano.sabatini-lala
Mon Oct 6 23:19:10 CEST 2008
On date Thursday 2008-10-02 23:36:49 +0200, Stefano Sabatini encoded:
> On date Wednesday 2008-10-01 12:25:11 +0200, Dominik 'Rathann' Mierzejewski encoded:
> > On Wednesday, 01 October 2008 at 10:35, M?ns Rullg?rd wrote:
> > > Diego Biurrun <diego at biurrun.de> writes:
> > >
> > > > On Wed, Sep 24, 2008 at 10:40:26PM +0200, Stefano Sabatini wrote:
> > > >> --- configure (revision 15400)
> > > >> +++ configure (working copy)
> > > >> @@ -608,6 +620,16 @@
> > > >>
> > > >> +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"
> > > >> +}
> > > >
> > > > I wonder if another require function is necessary. You could simply run
> > > > two checks for libx264...
> > >
> > > Yes, this is getting a bit specialised, and it would only be used in
> > > one place.
>
> Check the patch below, I also considered to have just a single
> require_cpp_condition but then it would be inconsistent with the other
> require functions (as far as I can see log is only used in check_*
> functions), also it would look less modular.
>
> > > That said, I'm still not convinced of the need to test the x264 version.
> >
> > It's always better to tell the user that their x264 is too old as soon as we
> > can determine that rather than failing in the middle of compilation.
>
> +1, that's the point of it.
>
> Regards.
> --
> FFmpeg = Forgiving and Freak Majestic Picky Evangelical Guru
> Index: configure
> ===================================================================
> --- configure (revision 15522)
> +++ configure (working copy)
> @@ -526,6 +526,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"
> @@ -613,6 +625,14 @@
> check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
> }
>
> +require_cpp_condition(){
> + name="$1"
> + header="$2"
> + cpp_condition="$3"
> + shift 3
> + check_cpp_condition $header "$cpp_condition" || die "ERROR: $name does not satisfies CPP condition: $cpp_condition"
> +}
> +
> check_foo_config(){
> cfg=$1
> pkg=$2
> @@ -1720,7 +1740,8 @@
> && 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 && require x264 x264.h x264_encoder_open -lx264 -lm \
> + && require_cpp_condition x264 x264.h "X264_BUILD >= 65"
> enabled libxvid && require Xvid xvid.h xvid_global -lxvidcore
> enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
Ping? If that's OK I'll apply it on the weekend.
Regards.
--
FFmpeg = Freak & Fast Minimal Purposeless Evil Gadget
More information about the ffmpeg-devel
mailing list