[FFmpeg-devel] [PATCH] configure: improve logic and checks for nvenc
Timo Rothenpieler
timo at rothenpieler.org
Tue Aug 30 14:00:40 EEST 2016
---
configure | 37 +++++++++++++++++++++++++------------
1 file changed, 25 insertions(+), 12 deletions(-)
diff --git a/configure b/configure
index 52931c3..bcfc9a8 100755
--- a/configure
+++ b/configure
@@ -5992,20 +5992,33 @@ enabled vdpau && enabled xlib &&
check_lib2 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau &&
enable vdpau_x11
-case $target_os in
- mingw32*|mingw64*|win32|win64|linux|cygwin*)
- disabled nvenc || enable nvenc
- ;;
- *)
- disable nvenc
- ;;
-esac
-
-if enabled nvenc; then
+if ! enabled x86; then
+ enabled nvenc && die "NVENC is only supported on x86"
+ disable nvenc
+elif ! disabled nvenc; then
{
echo '#include "compat/nvenc/nvEncodeAPI.h"'
- echo 'int main(void) { return 0; }'
- } | check_cc -I$source_path || disable nvenc
+ echo 'NV_ENCODE_API_FUNCTION_LIST flist;'
+ echo 'void f(void) { struct { const GUID guid; } s[] = { { NV_ENC_PRESET_HQ_GUID } }; }'
+ echo 'int main(void) { f(); return 0; }'
+ } | check_cc -I$source_path
+ nvenc_check_res=$?
+
+ if [ $nvenc_check_res != 0 ] && enabled nvenc; then
+ die "NVENC enabled but test-compile failed"
+ fi
+
+ case $target_os in
+ mingw32*|mingw64*|win32|win64|linux|cygwin*)
+ [ $nvenc_check_res = 0 ] && enable nvenc
+ ;;
+ *)
+ enabled nvenc && die "NVENC is only supported on Windows and Linux"
+ disable nvenc
+ ;;
+ esac
+
+ unset nvenc_check_res
fi
# Funny iconv installations are not unusual, so check it after all flags have been set
--
2.9.2
More information about the ffmpeg-devel
mailing list