From 68542490435f728bca701c9c7c33a42b07b29036 Mon Sep 17 00:00:00 2001 From: Kitae Kim Date: Thu, 8 Jan 2015 16:30:19 +0900 Subject: [PATCH] configure: use libav, vappi and dxva2 feature depending on the below cases. If libav option is set and configure cannot find libav, configure will be terminated abnormally. If libav option is not set and configure cannot detect libav, configure will not be terminated abnormally. Otherwise, it will enable libav feature. Change-Id: I52f55f15da315cc4ccb2c2275df760e90c4c3613 Signed-off-by: Kitae Kim --- configure | 163 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 93 insertions(+), 70 deletions(-) diff --git a/configure b/configure index 177a759b13..0a54bb8fb3 100755 --- a/configure +++ b/configure @@ -4146,9 +4146,8 @@ fi ######################################## # check if dxva2 is available. -if test "$dxva2" = "yes" ; then - dxva2="no" -if test "$mingw32" = "yes" ; then +check_dxva2() { + cat > $TMPC << EOF #include #include @@ -4162,92 +4161,116 @@ int main(void) { EOF if compile_prog "" "" ; then dxva2="yes" -fi else - error_exit "DXVA2 is supported only on Windows" + dxva2="no" fi + +} + +if test "$dxva2" != "no" ; then + if test "$mingw32" != "no" ; then + check_dxva2 + if test "$dxva2" != "yes" ; then + feature_not_found "dxva2" + fi + else + error_exit "DXVA2 is supported only on Windows" + fi +else + check_dxva2 fi ######################################## # check if vaapi is available. -if test "$vaapi" = "yes" ; then - vaapi="no" -if test "$linux" = "yes" ; then - if $pkg_config libva --exists; then - if $pkg_config libva-x11 --exists; then - libva_cflags=`$pkg_config --cflags libva` - libva_libs=`$pkg_config --libs libva` - libva_x11_cflags=`$pkg_config --cflags libva-x11` - libva_x11_libs=`$pkg_config --libs libva-x11` - - libs_softmmu="$libva_libs $libva_x11_libs $libs_softmmu" - vaapi="yes" - fi - fi +check_vaapi() { + +if $pkg_config libva --exists; then + libva_cflags=`$pkg_config --cflags libva` + libva_libs=`$pkg_config --libs libva` + vaapi="yes" else - error_exit "VAAPI is supported only on Linux" + vaapi="no" fi + +if $pkg_config libva-x11 --exists; then + libva_x11_cflags=`$pkg_config --cflags libva-x11` + libva_x11_libs=`$pkg_config --libs libva-x11` + libs_softmmu="$libva_libs $libva_x11_libs $libs_softmmu" + vaapi="yes" +else + vaapi="no" +fi + +} + +if test "$vaapi" != "no" ; then + if test "$linux" != "no" ; then + check_vaapi + if test "$vaapi" != "yes" ; then + feature_not_found "vaapi" + fi + else + error_exit "VAAPI is supported only on Linux" + fi +else + check_vappi fi ########################################## # libav probe +libavcodec_package="libavcodec" +libavcodec_version="54.35.0" +libavutil_package="libavutil" +libavutil_version="52.3.0" +libavformat_package="libavformat" +libavformat_version="54.20.3" +libavresample_package="libavresample" +libavresample_version="1.0.1" + +check_libav() { +echo "check $1" + +if $pkg_config --exists "$1 >= $2" ; then + libav_cflags=`$pkg_config --cflags $1` + libav_libs=`$pkg_config --libs $1` + libs_softmmu="$libav_libs $libs_softmmu" + libav="yes" +else + libav="no" +fi + +} + if test "$libav" != "no"; then - libavcodec_package="libavcodec" - libavcodec_version="54.35.0" - libavutil_package="libavutil" - libavutil_version="52.3.0" - libavformat_package="libavformat" - libavformat_version="54.20.3" - libavresample_package="libavresample" - libavresample_version="1.0.1" - - if $pkg_config --exists "$libavcodec_package >= $libavcodec_version" ; then - libav_cflags=`$pkg_config --cflags $libavcodec_package` - libav_libs=`$pkg_config --libs $libavcodec_package` - libs_softmmu="$libav_libs $libs_softmmu" - libav="yes" - else - #if test "$libav" = "yes" ; then - # feature_not_found "libav" - #fi - libav="no" - fi + check_libav $libavcodec_package $libavcodec_version + if test "$libav" != "yes"; then + feature_not_found "libav" + fi - if $pkg_config --exists "$libavutil_package >= $libavutil_version" ; then - libav_libs=`$pkg_config --libs-only-l $libavutil_package` - libs_softmmu="$libav_libs $libs_softmmu" - libav="yes" - else - #if test "$libav" = "yes" ; then - # feature_not_found "libav" - #fi - libav="no" - fi + check_libav $libavformat_package $libavformat_version + if test "$libav" != "yes"; then + feature_not_found "libav" + fi - if $pkg_config --exists "$libavformat_package >= $libavformat_version" ; then - libav_libs=`$pkg_config --libs-only-l $libavformat_package` - libs_softmmu="$libav_libs $libs_softmmu" - libav="yes" - else - #if test "$libav" = "yes" ; then - # feature_not_found "libav" - #fi - libav="no" - fi + check_libav $libavutil_package $libavutil_version + if test "$libav" != "yes"; then + feature_not_found "libav" + fi - if $pkg_config --exists "$libavresample_package >= $libavresample_version" ; then - libav_libs=`$pkg_config --libs-only-l $libavresample_package` - libs_softmmu="$libav_libs $libs_softmmu" - libav="yes" - else - #if test "$libav" = "yes" ; then - # feature_not_found "libav" - #fi - libav="no" - fi + check_libav $libavresample_package $libavresample_version + if test "$libav" != "yes"; then + feature_not_found "libav" + fi +else + check_libav $libavcodec_package $libavcodec_version + + check_libav $libavformat_package $libavformat_version + + check_libav $libavutil_package $libavutil_version + check_libav $libavresample_package $libavresample_version fi ########################################## -- 2.34.1