[FFmpeg-devel] [PATCH] configure: Factor out some pkg-config hacks.

Clément Bœsch u at pkh.me
Thu Jan 1 12:04:18 CET 2015


On Thu, Jan 01, 2015 at 11:40:25AM +0100, Reimar Döffinger wrote:
> Make require_pkg_config check for extra argument that should not be
> there.
> Change use_pkg_config to allow specifying fallback libs and cflags.
> 
> Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
> ---
>  configure | 22 +++++++++++++++-------
>  1 file changed, 15 insertions(+), 7 deletions(-)
> 
> diff --git a/configure b/configure
> index 1aaadd4..f4513f7 100755
> --- a/configure
> +++ b/configure
> @@ -1211,14 +1211,25 @@ require_cpp(){
>      check_lib_cpp "$headers" "$classes" "$@" || die "ERROR: $name not found"
>  }
>  
> +check_pkg_config_fallback(){
> +    test -n "$4" || return 1
> +    check_func_headers "$2" "$3" "$4" "$5" || return
> +    set_safe ${pkg}_extralibs $4
> +    set_safe ${pkg}_cflags $5
> +    warn "using $pkg without pkg-config"
> +}
> +
>  use_pkg_config(){
>      pkg="$1"
> -    check_pkg_config "$@" || return 1
> +    test -z "$6" || die "ERROR: too many arguments to require_pkg_config for $pkg"
> +    check_pkg_config "$1" "$2" "$3" ||
> +        check_pkg_config_fallback "$@" || return 1
>      add_cflags    $(get_safe ${pkg}_cflags)
>      add_extralibs $(get_safe ${pkg}_libs)
>  }
>  
>  require_pkg_config(){
> +    test -z "$4" || die "ERROR: too many arguments to require_pkg_config for $1"
>      use_pkg_config "$@" || die "ERROR: $pkg not found using pkg-config$pkg_config_fail_message"
>  }
>  
> @@ -4903,11 +4914,10 @@ enabled libquvi           && require_pkg_config libquvi quvi/quvi.h quvi_init
>  enabled librtmp           && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
>  enabled libschroedinger   && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
>  enabled libshine          && require_pkg_config shine shine/layer3.h shine_encode_buffer
> -enabled libsmbclient      && { use_pkg_config smbclient libsmbclient.h smbc_init ||
> -                               require smbclient libsmbclient.h smbc_init -lsmbclient; }
> +enabled libsmbclient      && use_pkg_config smbclient libsmbclient.h smbc_init -lsmbclient
>  enabled libsoxr           && require libsoxr soxr.h soxr_create -lsoxr
>  enabled libssh            && require_pkg_config libssh libssh/sftp.h sftp_init
> -enabled libspeex          && require_pkg_config speex speex/speex.h speex_decoder_init -lspeex
> +enabled libspeex          && require_pkg_config speex speex/speex.h speex_decoder_init
>  enabled libstagefright_h264 && require_cpp libstagefright_h264 "binder/ProcessState.h media/stagefright/MetaData.h
>      media/stagefright/MediaBufferGroup.h media/stagefright/MediaDebug.h media/stagefright/MediaDefs.h
>      media/stagefright/OMXClient.h media/stagefright/OMXCodec.h" android::OMXClient -lstagefright -lmedia -lutils -lbinder -lgnustl_static
> @@ -4930,9 +4940,7 @@ enabled libvpx            && {
>      enabled libvpx_vp9_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VP9E_SET_AQ_MODE" -lvpx || disable libvpx_vp9_encoder; } }
>  enabled libwavpack        && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput  -lwavpack
>  enabled libwebp           && require_pkg_config "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion
> -enabled libx264           && { use_pkg_config x264 "stdint.h x264.h" x264_encoder_encode ||
> -                               { require libx264 x264.h x264_encoder_encode -lx264 &&
> -                                 warn "using libx264 without pkg-config"; } } &&
> +enabled libx264           && use_pkg_config x264 "stdint.h x264.h" x264_encoder_encode -lx264 &&
>                               { check_cpp_condition x264.h "X264_BUILD >= 118" ||
>                                 die "ERROR: libx264 must be installed and version must be >= 0.118."; }
>  enabled libx265           && require_pkg_config x265 x265.h x265_encoder_encode &&

Does it work if there is also a version check?

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150101/721b524f/attachment.asc>


More information about the ffmpeg-devel mailing list