diff mbox

[FFmpeg-devel,3/3] configure: fail if autodetect-libraries are requested but not found

Message ID 53432ffc-ccd2-d935-d535-63dffaacbc99@googlemail.com
State Superseded
Headers show

Commit Message

Andreas Cadhalpun Nov. 30, 2016, 11:22 p.m. UTC
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
---
 configure | 72 ++++++++++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 53 insertions(+), 19 deletions(-)

Comments

Michael Niedermayer Dec. 1, 2016, 12:34 a.m. UTC | #1
On Thu, Dec 01, 2016 at 12:22:50AM +0100, Andreas Cadhalpun wrote:
> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
> ---
>  configure | 72 ++++++++++++++++++++++++++++++++++++++++++++++-----------------
>  1 file changed, 53 insertions(+), 19 deletions(-)
> 
> diff --git a/configure b/configure
> index 28c78ef..0e9695b 100755
> --- a/configure
> +++ b/configure
> @@ -597,6 +597,13 @@ popvar(){
>      done
>  }
>  
> +request(){
> +    for var in $*; do
> +        eval ${var}_requested=yes
> +        eval $var=
> +    done
> +}
> +
>  enable(){
>      set_all yes $*
>  }
> @@ -653,6 +660,11 @@ enable_deep_weak(){
>      done
>  }
>  
> +requested(){
> +    test "${1#!}" = "$1" && op='=' || op=!=
> +    eval test "x\$${1#!}_requested" $op "xyes"
> +}
> +
>  enabled(){
>      test "${1#!}" = "$1" && op='=' || op=!=
>      eval test "x\$${1#!}" $op "xyes"
> @@ -1481,10 +1493,25 @@ EXAMPLE_LIST="
>      transcode_aac_example
>      transcoding_example
>  "
> +EXTERNAL_AUTODETECT_LIBRARY_LIST="
> +    bzlib
> +    iconv
> +    libxcb
> +    libxcb_shm
> +    libxcb_shape
> +    libxcb_xfixes
> +    lzma
> +    schannel
> +    sdl
> +    sdl2
> +    securetransport
> +    xlib
> +    zlib
> +"
>  
>  EXTERNAL_LIBRARY_LIST="
> +    $EXTERNAL_AUTODETECT_LIBRARY_LIST
>      avisynth
> -    bzlib
>      chromaprint
>      crystalhd
>      decklink
> @@ -1492,7 +1519,6 @@ EXTERNAL_LIBRARY_LIST="
>      gcrypt
>      gmp
>      gnutls
> -    iconv
>      jni
>      ladspa
>      libass
> @@ -1545,42 +1571,26 @@ EXTERNAL_LIBRARY_LIST="
>      libx264
>      libx265
>      libxavs
> -    libxcb
> -    libxcb_shm
> -    libxcb_shape
> -    libxcb_xfixes
>      libxvid
>      libzimg
>      libzmq
>      libzvbi
> -    lzma
>      mediacodec
>      netcdf
>      openal
>      opencl
>      opengl
>      openssl
> -    schannel
> -    sdl
> -    sdl2
> -    securetransport
>      videotoolbox
>      x11grab
> -    xlib
> -    zlib
>  "
> -
> -HWACCEL_LIBRARY_LIST="
> +HWACCEL_AUTODETECT_LIBRARY_LIST="
>      audiotoolbox
>      cuda
>      cuvid
>      d3d11va
>      dxva2
> -    libmfx
> -    libnpp
> -    mmal
>      nvenc
> -    omx
>      vaapi
>      vda
>      vdpau
> @@ -1588,6 +1598,14 @@ HWACCEL_LIBRARY_LIST="
>      xvmc
>  "
>  
> +HWACCEL_LIBRARY_LIST="
> +    $HWACCEL_AUTODETECT_LIBRARY_LIST
> +    libmfx
> +    libnpp
> +    mmal
> +    omx
> +"
> +
>  DOCUMENT_LIST="
>      doc
>      htmlpages
> @@ -1684,6 +1702,12 @@ ATOMICS_LIST="
>      atomics_win32
>  "
>  
> +AUTODETECT_LIBS="
> +    $EXTERNAL_AUTODETECT_LIBRARY_LIST
> +    $HWACCEL_AUTODETECT_LIBRARY_LIST
> +    $THREADS_LIST
> +"
> +
>  ARCH_LIST="
>      aarch64
>      alpha
> @@ -3482,6 +3506,11 @@ for e in $env; do
>      eval "export $e"
>  done
>  
> +# Mark specifically enabled, but normally autodetected libraries as requested.
> +for lib in $AUTODETECT_LIBS; do
> +    enabled $lib && request $lib
> +done
> +
>  # Enable platform codecs by default.
>  enable audiotoolbox
>  

> @@ -6381,6 +6410,11 @@ for thread in $THREADS_LIST; do
>      fi
>  done
>  
> +# Check if requested libraries were found.
> +for lib in $AUTODETECT_LIBS; do
> +    requested $lib && ! enabled $lib && die "ERROR: $lib requested but not found";
> +done

This must be after check_deps as that can disable vaapi unless i miss
something
also in the same light i think things like:

enabled vaapi &&
    check_lib va/va.h vaInitialize -lva ||
    disable vaapi

should disable vaapi through having a entry in vaapi_deps= ...

And then check_deps should check for requested when disabling things
that way it should be possible to print why something is being disabled
If that works that extra information should be quite usefull

also off topic but this can eventually be extended to cover more
things than just these libs

actually i wanted to cleanup configure and that stuff but
its one of these things that kept sliding down on my todo ..

[...]
Carl Eugen Hoyos Dec. 1, 2016, 8:48 a.m. UTC | #2
2016-12-01 0:22 GMT+01:00 Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>:
> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
> ---
>  configure | 72 ++++++++++++++++++++++++++++++++++++++++++++++-----------------

Needs a Changelog and a NEWS entry.

Have you tested the patch? It was tried before and the result were
different regressions iirc.

Carl Eugen
diff mbox

Patch

diff --git a/configure b/configure
index 28c78ef..0e9695b 100755
--- a/configure
+++ b/configure
@@ -597,6 +597,13 @@  popvar(){
     done
 }
 
+request(){
+    for var in $*; do
+        eval ${var}_requested=yes
+        eval $var=
+    done
+}
+
 enable(){
     set_all yes $*
 }
@@ -653,6 +660,11 @@  enable_deep_weak(){
     done
 }
 
+requested(){
+    test "${1#!}" = "$1" && op='=' || op=!=
+    eval test "x\$${1#!}_requested" $op "xyes"
+}
+
 enabled(){
     test "${1#!}" = "$1" && op='=' || op=!=
     eval test "x\$${1#!}" $op "xyes"
@@ -1481,10 +1493,25 @@  EXAMPLE_LIST="
     transcode_aac_example
     transcoding_example
 "
+EXTERNAL_AUTODETECT_LIBRARY_LIST="
+    bzlib
+    iconv
+    libxcb
+    libxcb_shm
+    libxcb_shape
+    libxcb_xfixes
+    lzma
+    schannel
+    sdl
+    sdl2
+    securetransport
+    xlib
+    zlib
+"
 
 EXTERNAL_LIBRARY_LIST="
+    $EXTERNAL_AUTODETECT_LIBRARY_LIST
     avisynth
-    bzlib
     chromaprint
     crystalhd
     decklink
@@ -1492,7 +1519,6 @@  EXTERNAL_LIBRARY_LIST="
     gcrypt
     gmp
     gnutls
-    iconv
     jni
     ladspa
     libass
@@ -1545,42 +1571,26 @@  EXTERNAL_LIBRARY_LIST="
     libx264
     libx265
     libxavs
-    libxcb
-    libxcb_shm
-    libxcb_shape
-    libxcb_xfixes
     libxvid
     libzimg
     libzmq
     libzvbi
-    lzma
     mediacodec
     netcdf
     openal
     opencl
     opengl
     openssl
-    schannel
-    sdl
-    sdl2
-    securetransport
     videotoolbox
     x11grab
-    xlib
-    zlib
 "
-
-HWACCEL_LIBRARY_LIST="
+HWACCEL_AUTODETECT_LIBRARY_LIST="
     audiotoolbox
     cuda
     cuvid
     d3d11va
     dxva2
-    libmfx
-    libnpp
-    mmal
     nvenc
-    omx
     vaapi
     vda
     vdpau
@@ -1588,6 +1598,14 @@  HWACCEL_LIBRARY_LIST="
     xvmc
 "
 
+HWACCEL_LIBRARY_LIST="
+    $HWACCEL_AUTODETECT_LIBRARY_LIST
+    libmfx
+    libnpp
+    mmal
+    omx
+"
+
 DOCUMENT_LIST="
     doc
     htmlpages
@@ -1684,6 +1702,12 @@  ATOMICS_LIST="
     atomics_win32
 "
 
+AUTODETECT_LIBS="
+    $EXTERNAL_AUTODETECT_LIBRARY_LIST
+    $HWACCEL_AUTODETECT_LIBRARY_LIST
+    $THREADS_LIST
+"
+
 ARCH_LIST="
     aarch64
     alpha
@@ -3482,6 +3506,11 @@  for e in $env; do
     eval "export $e"
 done
 
+# Mark specifically enabled, but normally autodetected libraries as requested.
+for lib in $AUTODETECT_LIBS; do
+    enabled $lib && request $lib
+done
+
 # Enable platform codecs by default.
 enable audiotoolbox
 
@@ -6381,6 +6410,11 @@  for thread in $THREADS_LIST; do
     fi
 done
 
+# Check if requested libraries were found.
+for lib in $AUTODETECT_LIBS; do
+    requested $lib && ! enabled $lib && die "ERROR: $lib requested but not found";
+done
+
 enabled zlib && add_cppflags -DZLIB_CONST
 
 # conditional library dependencies, in linking order