@@ -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