[FFmpeg-devel] [PATCH] Implement CPP condition check support in configure
Stefano Sabatini
stefano.sabatini-lala
Wed Sep 24 22:40:26 CEST 2008
On date Wednesday 2008-09-24 19:55:20 +0100, M?ns Rullg?rd encoded:
> Stefano Sabatini <stefano.sabatini-lala at poste.it> writes:
[...]
> > 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
Fixed.
> > + 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.
I think I improved it a little, please check it now.
> > 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.
It is needed if using check_lib2, changed require3 which now uses
check_lib.
> 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 ;-)).
Regards.
--
FFmpeg = Foolish & Frenzy Martial Powered Erudite God
-------------- next part --------------
A non-text attachment was scrubbed...
Name: check-cpp-condition-01.patch
Type: text/x-diff
Size: 1534 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080924/24ca45c3/attachment.patch>
More information about the ffmpeg-devel
mailing list