[FFmpeg-devel] [PATCH] configure: add check for pkg-config return value

Stefano Sabatini stefano.sabatini-lala
Thu Feb 24 23:11:07 CET 2011


Add check_pkgconfig_flags() function. This ensures that the result of
pkg-config is correct. Avoid spurious success during configuration,
which may lead to compilation errors.

In particular prevents the compilation error I was getting with
--enable-librtmp --enable-libopencv, which was due to a missing
libssl.
---
 configure |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 5011387..15c86ec 100755
--- a/configure
+++ b/configure
@@ -773,6 +773,11 @@ int main(void){
 EOF
 }
 
+check_pkgconfig_flags(){
+    pkg-config --cflags "$@" > /dev/null || die
+    pkg-config --libs   "$@" > /dev/null || die
+}
+
 check_type(){
     log check_type "$@"
     headers=$1
@@ -2821,7 +2826,7 @@ check_mathfunc truncf
 # these are off by default, so fail if requested and not available
 enabled avisynth   && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
 enabled frei0r     && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
-enabled libdirac   && add_cflags $(pkg-config --cflags dirac) &&
+enabled libdirac   && check_pkgconfig_flags dirac && add_cflags $(pkg-config --cflags dirac) &&
                       require  libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init $(pkg-config --libs dirac) &&
                       require  libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init $(pkg-config --libs dirac)
 enabled libfaac    && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
@@ -2830,12 +2835,14 @@ enabled libmp3lame && require  "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_q
 enabled libnut     && require  libnut libnut.h nut_demuxer_init -lnut
 enabled libopencore_amrnb  && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
 enabled libopencore_amrwb  && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
-enabled libopencv  && { check_lib opencv/cv.h cvCreateImageHeader $(pkg-config --libs opencv) ||
+enabled libopencv  && check_pkgconfig_flags opencv &&
+                      { check_lib opencv/cv.h cvCreateImageHeader $(pkg-config --libs opencv) ||
                         die "ERROR: libopencv not found"; }
 enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
-enabled librtmp    && { check_lib librtmp/rtmp.h RTMP_Socket $(pkg-config --libs librtmp) ||
+enabled librtmp    && check_pkgconfig_flags librtmp &&
+                      { check_lib librtmp/rtmp.h RTMP_Socket $(pkg-config --libs librtmp) ||
                         die "ERROR: librtmp not found or RTMP_Socket() missing, librtmp version must be >= 2.2.f"; }
-enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
+enabled libschroedinger && check_pkgconfig_flags shroedinger-1.0 && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
                            require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
 enabled libspeex   && require  libspeex speex/speex.h speex_decoder_init -lspeex
 enabled libtheora  && require  libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
-- 
1.7.2.3




More information about the ffmpeg-devel mailing list