You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

7631 lines
250KB

  1. #!/bin/sh
  2. #
  3. # FFmpeg configure script
  4. #
  5. # Copyright (c) 2000-2002 Fabrice Bellard
  6. # Copyright (c) 2005-2008 Diego Biurrun
  7. # Copyright (c) 2005-2008 Mans Rullgard
  8. #
  9. # Prevent locale nonsense from breaking basic text processing.
  10. LC_ALL=C
  11. export LC_ALL
  12. # make sure we are running under a compatible shell
  13. # try to make this part work with most shells
  14. try_exec(){
  15. echo "Trying shell $1"
  16. type "$1" > /dev/null 2>&1 && exec "$@"
  17. }
  18. unset foo
  19. (: ${foo%%bar}) 2> /dev/null
  20. E1="$?"
  21. (: ${foo?}) 2> /dev/null
  22. E2="$?"
  23. if test "$E1" != 0 || test "$E2" = 0; then
  24. echo "Broken shell detected. Trying alternatives."
  25. export FF_CONF_EXEC
  26. if test "0$FF_CONF_EXEC" -lt 1; then
  27. FF_CONF_EXEC=1
  28. try_exec bash "$0" "$@"
  29. fi
  30. if test "0$FF_CONF_EXEC" -lt 2; then
  31. FF_CONF_EXEC=2
  32. try_exec ksh "$0" "$@"
  33. fi
  34. if test "0$FF_CONF_EXEC" -lt 3; then
  35. FF_CONF_EXEC=3
  36. try_exec /usr/xpg4/bin/sh "$0" "$@"
  37. fi
  38. echo "No compatible shell script interpreter found."
  39. echo "This configure script requires a POSIX-compatible shell"
  40. echo "such as bash or ksh."
  41. echo "THIS IS NOT A BUG IN FFMPEG, DO NOT REPORT IT AS SUCH."
  42. echo "Instead, install a working POSIX-compatible shell."
  43. echo "Disabling this configure test will create a broken FFmpeg."
  44. if test "$BASH_VERSION" = '2.04.0(1)-release'; then
  45. echo "This bash version ($BASH_VERSION) is broken on your platform."
  46. echo "Upgrade to a later version if available."
  47. fi
  48. exit 1
  49. fi
  50. test -d /usr/xpg4/bin && PATH=/usr/xpg4/bin:$PATH
  51. show_help(){
  52. cat <<EOF
  53. Usage: configure [options]
  54. Options: [defaults in brackets after descriptions]
  55. Help options:
  56. --help print this message
  57. --quiet Suppress showing informative output
  58. --list-decoders show all available decoders
  59. --list-encoders show all available encoders
  60. --list-hwaccels show all available hardware accelerators
  61. --list-demuxers show all available demuxers
  62. --list-muxers show all available muxers
  63. --list-parsers show all available parsers
  64. --list-protocols show all available protocols
  65. --list-bsfs show all available bitstream filters
  66. --list-indevs show all available input devices
  67. --list-outdevs show all available output devices
  68. --list-filters show all available filters
  69. Standard options:
  70. --logfile=FILE log tests and output to FILE [ffbuild/config.log]
  71. --disable-logging do not log configure debug information
  72. --fatal-warnings fail if any configure warning is generated
  73. --prefix=PREFIX install in PREFIX [$prefix_default]
  74. --bindir=DIR install binaries in DIR [PREFIX/bin]
  75. --datadir=DIR install data files in DIR [PREFIX/share/ffmpeg]
  76. --docdir=DIR install documentation in DIR [PREFIX/share/doc/ffmpeg]
  77. --libdir=DIR install libs in DIR [PREFIX/lib]
  78. --shlibdir=DIR install shared libs in DIR [LIBDIR]
  79. --incdir=DIR install includes in DIR [PREFIX/include]
  80. --mandir=DIR install man page in DIR [PREFIX/share/man]
  81. --pkgconfigdir=DIR install pkg-config files in DIR [LIBDIR/pkgconfig]
  82. --enable-rpath use rpath to allow installing libraries in paths
  83. not part of the dynamic linker search path
  84. use rpath when linking programs (USE WITH CARE)
  85. --install-name-dir=DIR Darwin directory name for installed targets
  86. Licensing options:
  87. --enable-gpl allow use of GPL code, the resulting libs
  88. and binaries will be under GPL [no]
  89. --enable-version3 upgrade (L)GPL to version 3 [no]
  90. --enable-nonfree allow use of nonfree code, the resulting libs
  91. and binaries will be unredistributable [no]
  92. Configuration options:
  93. --disable-static do not build static libraries [no]
  94. --enable-shared build shared libraries [no]
  95. --enable-small optimize for size instead of speed
  96. --disable-runtime-cpudetect disable detecting CPU capabilities at runtime (smaller binary)
  97. --enable-gray enable full grayscale support (slower color)
  98. --disable-swscale-alpha disable alpha channel support in swscale
  99. --disable-all disable building components, libraries and programs
  100. --disable-autodetect disable automatically detected external libraries [no]
  101. Program options:
  102. --disable-programs do not build command line programs
  103. --disable-ffmpeg disable ffmpeg build
  104. --disable-ffplay disable ffplay build
  105. --disable-ffprobe disable ffprobe build
  106. Documentation options:
  107. --disable-doc do not build documentation
  108. --disable-htmlpages do not build HTML documentation pages
  109. --disable-manpages do not build man documentation pages
  110. --disable-podpages do not build POD documentation pages
  111. --disable-txtpages do not build text documentation pages
  112. Component options:
  113. --disable-avdevice disable libavdevice build
  114. --disable-avcodec disable libavcodec build
  115. --disable-avformat disable libavformat build
  116. --disable-swresample disable libswresample build
  117. --disable-swscale disable libswscale build
  118. --disable-postproc disable libpostproc build
  119. --disable-avfilter disable libavfilter build
  120. --enable-avresample enable libavresample build (deprecated) [no]
  121. --disable-pthreads disable pthreads [autodetect]
  122. --disable-w32threads disable Win32 threads [autodetect]
  123. --disable-os2threads disable OS/2 threads [autodetect]
  124. --disable-network disable network support [no]
  125. --disable-dct disable DCT code
  126. --disable-dwt disable DWT code
  127. --disable-error-resilience disable error resilience code
  128. --disable-lsp disable LSP code
  129. --disable-lzo disable LZO decoder code
  130. --disable-mdct disable MDCT code
  131. --disable-rdft disable RDFT code
  132. --disable-fft disable FFT code
  133. --disable-faan disable floating point AAN (I)DCT code
  134. --disable-pixelutils disable pixel utils in libavutil
  135. Individual component options:
  136. --disable-everything disable all components listed below
  137. --disable-encoder=NAME disable encoder NAME
  138. --enable-encoder=NAME enable encoder NAME
  139. --disable-encoders disable all encoders
  140. --disable-decoder=NAME disable decoder NAME
  141. --enable-decoder=NAME enable decoder NAME
  142. --disable-decoders disable all decoders
  143. --disable-hwaccel=NAME disable hwaccel NAME
  144. --enable-hwaccel=NAME enable hwaccel NAME
  145. --disable-hwaccels disable all hwaccels
  146. --disable-muxer=NAME disable muxer NAME
  147. --enable-muxer=NAME enable muxer NAME
  148. --disable-muxers disable all muxers
  149. --disable-demuxer=NAME disable demuxer NAME
  150. --enable-demuxer=NAME enable demuxer NAME
  151. --disable-demuxers disable all demuxers
  152. --enable-parser=NAME enable parser NAME
  153. --disable-parser=NAME disable parser NAME
  154. --disable-parsers disable all parsers
  155. --enable-bsf=NAME enable bitstream filter NAME
  156. --disable-bsf=NAME disable bitstream filter NAME
  157. --disable-bsfs disable all bitstream filters
  158. --enable-protocol=NAME enable protocol NAME
  159. --disable-protocol=NAME disable protocol NAME
  160. --disable-protocols disable all protocols
  161. --enable-indev=NAME enable input device NAME
  162. --disable-indev=NAME disable input device NAME
  163. --disable-indevs disable input devices
  164. --enable-outdev=NAME enable output device NAME
  165. --disable-outdev=NAME disable output device NAME
  166. --disable-outdevs disable output devices
  167. --disable-devices disable all devices
  168. --enable-filter=NAME enable filter NAME
  169. --disable-filter=NAME disable filter NAME
  170. --disable-filters disable all filters
  171. External library support:
  172. Using any of the following switches will allow FFmpeg to link to the
  173. corresponding external library. All the components depending on that library
  174. will become enabled, if all their other dependencies are met and they are not
  175. explicitly disabled. E.g. --enable-libwavpack will enable linking to
  176. libwavpack and allow the libwavpack encoder to be built, unless it is
  177. specifically disabled with --disable-encoder=libwavpack.
  178. Note that only the system libraries are auto-detected. All the other external
  179. libraries must be explicitly enabled.
  180. Also note that the following help text describes the purpose of the libraries
  181. themselves, not all their features will necessarily be usable by FFmpeg.
  182. --disable-alsa disable ALSA support [autodetect]
  183. --disable-appkit disable Apple AppKit framework [autodetect]
  184. --disable-avfoundation disable Apple AVFoundation framework [autodetect]
  185. --enable-avisynth enable reading of AviSynth script files [no]
  186. --disable-bzlib disable bzlib [autodetect]
  187. --disable-coreimage disable Apple CoreImage framework [autodetect]
  188. --enable-chromaprint enable audio fingerprinting with chromaprint [no]
  189. --enable-frei0r enable frei0r video filtering [no]
  190. --enable-gcrypt enable gcrypt, needed for rtmp(t)e support
  191. if openssl, librtmp or gmp is not used [no]
  192. --enable-gmp enable gmp, needed for rtmp(t)e support
  193. if openssl or librtmp is not used [no]
  194. --enable-gnutls enable gnutls, needed for https support
  195. if openssl, libtls or mbedtls is not used [no]
  196. --disable-iconv disable iconv [autodetect]
  197. --enable-jni enable JNI support [no]
  198. --enable-ladspa enable LADSPA audio filtering [no]
  199. --enable-libaom enable AV1 video encoding/decoding via libaom [no]
  200. --enable-libaribb24 enable ARIB text and caption decoding via libaribb24 [no]
  201. --enable-libass enable libass subtitles rendering,
  202. needed for subtitles and ass filter [no]
  203. --enable-libbluray enable BluRay reading using libbluray [no]
  204. --enable-libbs2b enable bs2b DSP library [no]
  205. --enable-libcaca enable textual display using libcaca [no]
  206. --enable-libcelt enable CELT decoding via libcelt [no]
  207. --enable-libcdio enable audio CD grabbing with libcdio [no]
  208. --enable-libcodec2 enable codec2 en/decoding using libcodec2 [no]
  209. --enable-libdav1d enable AV1 decoding via libdav1d [no]
  210. --enable-libdavs2 enable AVS2 decoding via libdavs2 [no]
  211. --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
  212. and libraw1394 [no]
  213. --enable-libfdk-aac enable AAC de/encoding via libfdk-aac [no]
  214. --enable-libflite enable flite (voice synthesis) support via libflite [no]
  215. --enable-libfontconfig enable libfontconfig, useful for drawtext filter [no]
  216. --enable-libfreetype enable libfreetype, needed for drawtext filter [no]
  217. --enable-libfribidi enable libfribidi, improves drawtext filter [no]
  218. --enable-libglslang enable GLSL->SPIRV compilation via libglslang [no]
  219. --enable-libgme enable Game Music Emu via libgme [no]
  220. --enable-libgsm enable GSM de/encoding via libgsm [no]
  221. --enable-libiec61883 enable iec61883 via libiec61883 [no]
  222. --enable-libilbc enable iLBC de/encoding via libilbc [no]
  223. --enable-libjack enable JACK audio sound server [no]
  224. --enable-libklvanc enable Kernel Labs VANC processing [no]
  225. --enable-libkvazaar enable HEVC encoding via libkvazaar [no]
  226. --enable-liblensfun enable lensfun lens correction [no]
  227. --enable-libmodplug enable ModPlug via libmodplug [no]
  228. --enable-libmp3lame enable MP3 encoding via libmp3lame [no]
  229. --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
  230. --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
  231. --enable-libopencv enable video filtering via libopencv [no]
  232. --enable-libopenh264 enable H.264 encoding via OpenH264 [no]
  233. --enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no]
  234. --enable-libopenmpt enable decoding tracked files via libopenmpt [no]
  235. --enable-libopus enable Opus de/encoding via libopus [no]
  236. --enable-libpulse enable Pulseaudio input via libpulse [no]
  237. --enable-librabbitmq enable RabbitMQ library [no]
  238. --enable-librav1e enable AV1 encoding via rav1e [no]
  239. --enable-librsvg enable SVG rasterization via librsvg [no]
  240. --enable-librubberband enable rubberband needed for rubberband filter [no]
  241. --enable-librtmp enable RTMP[E] support via librtmp [no]
  242. --enable-libshine enable fixed-point MP3 encoding via libshine [no]
  243. --enable-libsmbclient enable Samba protocol via libsmbclient [no]
  244. --enable-libsnappy enable Snappy compression, needed for hap encoding [no]
  245. --enable-libsoxr enable Include libsoxr resampling [no]
  246. --enable-libspeex enable Speex de/encoding via libspeex [no]
  247. --enable-libsrt enable Haivision SRT protocol via libsrt [no]
  248. --enable-libssh enable SFTP protocol via libssh [no]
  249. --enable-libtensorflow enable TensorFlow as a DNN module backend
  250. for DNN based filters like sr [no]
  251. --enable-libtesseract enable Tesseract, needed for ocr filter [no]
  252. --enable-libtheora enable Theora encoding via libtheora [no]
  253. --enable-libtls enable LibreSSL (via libtls), needed for https support
  254. if openssl, gnutls or mbedtls is not used [no]
  255. --enable-libtwolame enable MP2 encoding via libtwolame [no]
  256. --enable-libv4l2 enable libv4l2/v4l-utils [no]
  257. --enable-libvidstab enable video stabilization using vid.stab [no]
  258. --enable-libvmaf enable vmaf filter via libvmaf [no]
  259. --enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no]
  260. --enable-libvorbis enable Vorbis en/decoding via libvorbis,
  261. native implementation exists [no]
  262. --enable-libvpx enable VP8 and VP9 de/encoding via libvpx [no]
  263. --enable-libwavpack enable wavpack encoding via libwavpack [no]
  264. --enable-libwebp enable WebP encoding via libwebp [no]
  265. --enable-libx264 enable H.264 encoding via x264 [no]
  266. --enable-libx265 enable HEVC encoding via x265 [no]
  267. --enable-libxavs enable AVS encoding via xavs [no]
  268. --enable-libxavs2 enable AVS2 encoding via xavs2 [no]
  269. --enable-libxcb enable X11 grabbing using XCB [autodetect]
  270. --enable-libxcb-shm enable X11 grabbing shm communication [autodetect]
  271. --enable-libxcb-xfixes enable X11 grabbing mouse rendering [autodetect]
  272. --enable-libxcb-shape enable X11 grabbing shape rendering [autodetect]
  273. --enable-libxvid enable Xvid encoding via xvidcore,
  274. native MPEG-4/Xvid encoder exists [no]
  275. --enable-libxml2 enable XML parsing using the C library libxml2, needed
  276. for dash demuxing support [no]
  277. --enable-libzimg enable z.lib, needed for zscale filter [no]
  278. --enable-libzmq enable message passing via libzmq [no]
  279. --enable-libzvbi enable teletext support via libzvbi [no]
  280. --enable-lv2 enable LV2 audio filtering [no]
  281. --disable-lzma disable lzma [autodetect]
  282. --enable-decklink enable Blackmagic DeckLink I/O support [no]
  283. --enable-mbedtls enable mbedTLS, needed for https support
  284. if openssl, gnutls or libtls is not used [no]
  285. --enable-mediacodec enable Android MediaCodec support [no]
  286. --enable-libmysofa enable libmysofa, needed for sofalizer filter [no]
  287. --enable-openal enable OpenAL 1.1 capture support [no]
  288. --enable-opencl enable OpenCL processing [no]
  289. --enable-opengl enable OpenGL rendering [no]
  290. --enable-openssl enable openssl, needed for https support
  291. if gnutls, libtls or mbedtls is not used [no]
  292. --enable-pocketsphinx enable PocketSphinx, needed for asr filter [no]
  293. --disable-sndio disable sndio support [autodetect]
  294. --disable-schannel disable SChannel SSP, needed for TLS support on
  295. Windows if openssl and gnutls are not used [autodetect]
  296. --disable-sdl2 disable sdl2 [autodetect]
  297. --disable-securetransport disable Secure Transport, needed for TLS support
  298. on OSX if openssl and gnutls are not used [autodetect]
  299. --enable-vapoursynth enable VapourSynth demuxer [no]
  300. --enable-vulkan enable Vulkan code [no]
  301. --disable-xlib disable xlib [autodetect]
  302. --disable-zlib disable zlib [autodetect]
  303. The following libraries provide various hardware acceleration features:
  304. --disable-amf disable AMF video encoding code [autodetect]
  305. --disable-audiotoolbox disable Apple AudioToolbox code [autodetect]
  306. --enable-cuda-nvcc enable Nvidia CUDA compiler [no]
  307. --disable-cuda-llvm disable CUDA compilation using clang [autodetect]
  308. --disable-cuvid disable Nvidia CUVID support [autodetect]
  309. --disable-d3d11va disable Microsoft Direct3D 11 video acceleration code [autodetect]
  310. --disable-dxva2 disable Microsoft DirectX 9 video acceleration code [autodetect]
  311. --disable-ffnvcodec disable dynamically linked Nvidia code [autodetect]
  312. --enable-libdrm enable DRM code (Linux) [no]
  313. --enable-libmfx enable Intel MediaSDK (AKA Quick Sync Video) code via libmfx [no]
  314. --enable-libnpp enable Nvidia Performance Primitives-based code [no]
  315. --enable-mmal enable Broadcom Multi-Media Abstraction Layer (Raspberry Pi) via MMAL [no]
  316. --disable-nvdec disable Nvidia video decoding acceleration (via hwaccel) [autodetect]
  317. --disable-nvenc disable Nvidia video encoding code [autodetect]
  318. --enable-omx enable OpenMAX IL code [no]
  319. --enable-omx-rpi enable OpenMAX IL code for Raspberry Pi [no]
  320. --enable-rkmpp enable Rockchip Media Process Platform code [no]
  321. --disable-v4l2-m2m disable V4L2 mem2mem code [autodetect]
  322. --disable-vaapi disable Video Acceleration API (mainly Unix/Intel) code [autodetect]
  323. --disable-vdpau disable Nvidia Video Decode and Presentation API for Unix code [autodetect]
  324. --disable-videotoolbox disable VideoToolbox code [autodetect]
  325. Toolchain options:
  326. --arch=ARCH select architecture [$arch]
  327. --cpu=CPU select the minimum required CPU (affects
  328. instruction selection, may crash on older CPUs)
  329. --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
  330. --progs-suffix=SUFFIX program name suffix []
  331. --enable-cross-compile assume a cross-compiler is used
  332. --sysroot=PATH root of cross-build tree
  333. --sysinclude=PATH location of cross-build system headers
  334. --target-os=OS compiler targets OS [$target_os]
  335. --target-exec=CMD command to run executables on target
  336. --target-path=DIR path to view of build directory on target
  337. --target-samples=DIR path to samples directory on target
  338. --tempprefix=PATH force fixed dir/prefix instead of mktemp for checks
  339. --toolchain=NAME set tool defaults according to NAME
  340. (gcc-asan, clang-asan, gcc-msan, clang-msan,
  341. gcc-tsan, clang-tsan, gcc-usan, clang-usan,
  342. valgrind-massif, valgrind-memcheck,
  343. msvc, icl, gcov, llvm-cov, hardened)
  344. --nm=NM use nm tool NM [$nm_default]
  345. --ar=AR use archive tool AR [$ar_default]
  346. --as=AS use assembler AS [$as_default]
  347. --ln_s=LN_S use symbolic link tool LN_S [$ln_s_default]
  348. --strip=STRIP use strip tool STRIP [$strip_default]
  349. --windres=WINDRES use windows resource compiler WINDRES [$windres_default]
  350. --x86asmexe=EXE use nasm-compatible assembler EXE [$x86asmexe_default]
  351. --cc=CC use C compiler CC [$cc_default]
  352. --cxx=CXX use C compiler CXX [$cxx_default]
  353. --objcc=OCC use ObjC compiler OCC [$cc_default]
  354. --dep-cc=DEPCC use dependency generator DEPCC [$cc_default]
  355. --nvcc=NVCC use Nvidia CUDA compiler NVCC or clang [$nvcc_default]
  356. --ld=LD use linker LD [$ld_default]
  357. --pkg-config=PKGCONFIG use pkg-config tool PKGCONFIG [$pkg_config_default]
  358. --pkg-config-flags=FLAGS pass additional flags to pkgconf []
  359. --ranlib=RANLIB use ranlib RANLIB [$ranlib_default]
  360. --doxygen=DOXYGEN use DOXYGEN to generate API doc [$doxygen_default]
  361. --host-cc=HOSTCC use host C compiler HOSTCC
  362. --host-cflags=HCFLAGS use HCFLAGS when compiling for host
  363. --host-cppflags=HCPPFLAGS use HCPPFLAGS when compiling for host
  364. --host-ld=HOSTLD use host linker HOSTLD
  365. --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
  366. --host-extralibs=HLIBS use libs HLIBS when linking for host
  367. --host-os=OS compiler host OS [$target_os]
  368. --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
  369. --extra-cxxflags=ECFLAGS add ECFLAGS to CXXFLAGS [$CXXFLAGS]
  370. --extra-objcflags=FLAGS add FLAGS to OBJCFLAGS [$CFLAGS]
  371. --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
  372. --extra-ldexeflags=ELDFLAGS add ELDFLAGS to LDEXEFLAGS [$LDEXEFLAGS]
  373. --extra-ldsoflags=ELDFLAGS add ELDFLAGS to LDSOFLAGS [$LDSOFLAGS]
  374. --extra-libs=ELIBS add ELIBS [$ELIBS]
  375. --extra-version=STRING version string suffix []
  376. --optflags=OPTFLAGS override optimization-related compiler flags
  377. --nvccflags=NVCCFLAGS override nvcc flags [$nvccflags_default]
  378. --build-suffix=SUFFIX library name suffix []
  379. --enable-pic build position-independent code
  380. --enable-thumb compile for Thumb instruction set
  381. --enable-lto use link-time optimization
  382. --env="ENV=override" override the environment variables
  383. Advanced options (experts only):
  384. --malloc-prefix=PREFIX prefix malloc and related names with PREFIX
  385. --custom-allocator=NAME use a supported custom allocator
  386. --disable-symver disable symbol versioning
  387. --enable-hardcoded-tables use hardcoded tables instead of runtime generation
  388. --disable-safe-bitstream-reader
  389. disable buffer boundary checking in bitreaders
  390. (faster, but may crash)
  391. --sws-max-filter-size=N the max filter size swscale uses [$sws_max_filter_size_default]
  392. Optimization options (experts only):
  393. --disable-asm disable all assembly optimizations
  394. --disable-altivec disable AltiVec optimizations
  395. --disable-vsx disable VSX optimizations
  396. --disable-power8 disable POWER8 optimizations
  397. --disable-amd3dnow disable 3DNow! optimizations
  398. --disable-amd3dnowext disable 3DNow! extended optimizations
  399. --disable-mmx disable MMX optimizations
  400. --disable-mmxext disable MMXEXT optimizations
  401. --disable-sse disable SSE optimizations
  402. --disable-sse2 disable SSE2 optimizations
  403. --disable-sse3 disable SSE3 optimizations
  404. --disable-ssse3 disable SSSE3 optimizations
  405. --disable-sse4 disable SSE4 optimizations
  406. --disable-sse42 disable SSE4.2 optimizations
  407. --disable-avx disable AVX optimizations
  408. --disable-xop disable XOP optimizations
  409. --disable-fma3 disable FMA3 optimizations
  410. --disable-fma4 disable FMA4 optimizations
  411. --disable-avx2 disable AVX2 optimizations
  412. --disable-avx512 disable AVX-512 optimizations
  413. --disable-aesni disable AESNI optimizations
  414. --disable-armv5te disable armv5te optimizations
  415. --disable-armv6 disable armv6 optimizations
  416. --disable-armv6t2 disable armv6t2 optimizations
  417. --disable-vfp disable VFP optimizations
  418. --disable-neon disable NEON optimizations
  419. --disable-inline-asm disable use of inline assembly
  420. --disable-x86asm disable use of standalone x86 assembly
  421. --disable-mipsdsp disable MIPS DSP ASE R1 optimizations
  422. --disable-mipsdspr2 disable MIPS DSP ASE R2 optimizations
  423. --disable-msa disable MSA optimizations
  424. --disable-msa2 disable MSA2 optimizations
  425. --disable-mipsfpu disable floating point MIPS optimizations
  426. --disable-mmi disable Loongson SIMD optimizations
  427. --disable-fast-unaligned consider unaligned accesses slow
  428. Developer options (useful when working on FFmpeg itself):
  429. --disable-debug disable debugging symbols
  430. --enable-debug=LEVEL set the debug level [$debuglevel]
  431. --disable-optimizations disable compiler optimizations
  432. --enable-extra-warnings enable more compiler warnings
  433. --disable-stripping disable stripping of executables and shared libraries
  434. --assert-level=level 0(default), 1 or 2, amount of assertion testing,
  435. 2 causes a slowdown at runtime.
  436. --enable-memory-poisoning fill heap uninitialized allocated space with arbitrary data
  437. --valgrind=VALGRIND run "make fate" tests through valgrind to detect memory
  438. leaks and errors, using the specified valgrind binary.
  439. Cannot be combined with --target-exec
  440. --enable-ftrapv Trap arithmetic overflows
  441. --samples=PATH location of test samples for FATE, if not set use
  442. \$FATE_SAMPLES at make invocation time.
  443. --enable-neon-clobber-test check NEON registers for clobbering (should be
  444. used only for debugging purposes)
  445. --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only;
  446. should be used only for debugging purposes)
  447. --enable-random randomly enable/disable components
  448. --disable-random
  449. --enable-random=LIST randomly enable/disable specific components or
  450. --disable-random=LIST component groups. LIST is a comma-separated list
  451. of NAME[:PROB] entries where NAME is a component
  452. (group) and PROB the probability associated with
  453. NAME (default 0.5).
  454. --random-seed=VALUE seed value for --enable/disable-random
  455. --disable-valgrind-backtrace do not print a backtrace under Valgrind
  456. (only applies to --disable-optimizations builds)
  457. --enable-ossfuzz Enable building fuzzer tool
  458. --libfuzzer=PATH path to libfuzzer
  459. --ignore-tests=TESTS comma-separated list (without "fate-" prefix
  460. in the name) of tests whose result is ignored
  461. --enable-linux-perf enable Linux Performance Monitor API
  462. --disable-large-tests disable tests that use a large amount of memory
  463. NOTE: Object files are built at the place where configure is launched.
  464. EOF
  465. exit 0
  466. }
  467. if test -t 1 && which tput >/dev/null 2>&1; then
  468. ncolors=$(tput colors)
  469. if test -n "$ncolors" && test $ncolors -ge 8; then
  470. bold_color=$(tput bold)
  471. warn_color=$(tput setaf 3)
  472. error_color=$(tput setaf 1)
  473. reset_color=$(tput sgr0)
  474. fi
  475. # 72 used instead of 80 since that's the default of pr
  476. ncols=$(tput cols)
  477. fi
  478. : ${ncols:=72}
  479. log(){
  480. echo "$@" >> $logfile
  481. }
  482. log_file(){
  483. log BEGIN "$1"
  484. log_file_i=1
  485. while IFS= read -r log_file_line; do
  486. printf '%5d\t%s\n' "$log_file_i" "$log_file_line"
  487. log_file_i=$(($log_file_i+1))
  488. done < "$1" >> "$logfile"
  489. log END "$1"
  490. }
  491. warn(){
  492. log "WARNING: $*"
  493. WARNINGS="${WARNINGS}WARNING: $*\n"
  494. }
  495. die(){
  496. log "$@"
  497. echo "$error_color$bold_color$@$reset_color"
  498. cat <<EOF
  499. If you think configure made a mistake, make sure you are using the latest
  500. version from Git. If the latest version fails, report the problem to the
  501. ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
  502. EOF
  503. if disabled logging; then
  504. cat <<EOF
  505. Rerun configure with logging enabled (do not use --disable-logging), and
  506. include the log this produces with your report.
  507. EOF
  508. else
  509. cat <<EOF
  510. Include the log file "$logfile" produced by configure as this will help
  511. solve the problem.
  512. EOF
  513. fi
  514. exit 1
  515. }
  516. # Avoid locale weirdness, besides we really just want to translate ASCII.
  517. toupper(){
  518. echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
  519. }
  520. tolower(){
  521. echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
  522. }
  523. c_escape(){
  524. echo "$*" | sed 's/["\\]/\\\0/g'
  525. }
  526. sh_quote(){
  527. v=$(echo "$1" | sed "s/'/'\\\\''/g")
  528. test "x$v" = "x${v#*[!A-Za-z0-9_/.+-]}" || v="'$v'"
  529. echo "$v"
  530. }
  531. cleanws(){
  532. echo "$@" | sed 's/^ *//;s/[[:space:]][[:space:]]*/ /g;s/ *$//'
  533. }
  534. filter(){
  535. pat=$1
  536. shift
  537. for v; do
  538. eval "case '$v' in $pat) printf '%s ' '$v' ;; esac"
  539. done
  540. }
  541. filter_out(){
  542. pat=$1
  543. shift
  544. for v; do
  545. eval "case '$v' in $pat) ;; *) printf '%s ' '$v' ;; esac"
  546. done
  547. }
  548. map(){
  549. m=$1
  550. shift
  551. for v; do eval $m; done
  552. }
  553. add_suffix(){
  554. suffix=$1
  555. shift
  556. for v; do echo ${v}${suffix}; done
  557. }
  558. remove_suffix(){
  559. suffix=$1
  560. shift
  561. for v; do echo ${v%$suffix}; done
  562. }
  563. set_all(){
  564. value=$1
  565. shift
  566. for var in $*; do
  567. eval $var=$value
  568. done
  569. }
  570. set_weak(){
  571. value=$1
  572. shift
  573. for var; do
  574. eval : \${$var:=$value}
  575. done
  576. }
  577. sanitize_var_name(){
  578. echo $@ | sed 's/[^A-Za-z0-9_]/_/g'
  579. }
  580. set_sanitized(){
  581. var=$1
  582. shift
  583. eval $(sanitize_var_name "$var")='$*'
  584. }
  585. get_sanitized(){
  586. eval echo \$$(sanitize_var_name "$1")
  587. }
  588. pushvar(){
  589. for pvar in $*; do
  590. eval level=\${${pvar}_level:=0}
  591. eval ${pvar}_${level}="\$$pvar"
  592. eval ${pvar}_level=$(($level+1))
  593. done
  594. }
  595. popvar(){
  596. for pvar in $*; do
  597. eval level=\${${pvar}_level:-0}
  598. test $level = 0 && continue
  599. eval level=$(($level-1))
  600. eval $pvar="\${${pvar}_${level}}"
  601. eval ${pvar}_level=$level
  602. eval unset ${pvar}_${level}
  603. done
  604. }
  605. request(){
  606. for var in $*; do
  607. eval ${var}_requested=yes
  608. eval $var=
  609. done
  610. }
  611. warn_if_gets_disabled(){
  612. for var in $*; do
  613. WARN_IF_GETS_DISABLED_LIST="$WARN_IF_GETS_DISABLED_LIST $var"
  614. done
  615. }
  616. enable(){
  617. set_all yes $*
  618. }
  619. disable(){
  620. set_all no $*
  621. }
  622. disable_with_reason(){
  623. disable $1
  624. eval "${1}_disable_reason=\"$2\""
  625. if requested $1; then
  626. die "ERROR: $1 requested, but $2"
  627. fi
  628. }
  629. enable_weak(){
  630. set_weak yes $*
  631. }
  632. disable_weak(){
  633. set_weak no $*
  634. }
  635. enable_sanitized(){
  636. for var; do
  637. enable $(sanitize_var_name $var)
  638. done
  639. }
  640. disable_sanitized(){
  641. for var; do
  642. disable $(sanitize_var_name $var)
  643. done
  644. }
  645. do_enable_deep(){
  646. for var; do
  647. enabled $var && continue
  648. set -- $var
  649. eval enable_deep \$${var}_select
  650. var=$1
  651. eval enable_deep_weak \$${var}_suggest
  652. done
  653. }
  654. enable_deep(){
  655. do_enable_deep $*
  656. enable $*
  657. }
  658. enable_deep_weak(){
  659. for var; do
  660. disabled $var && continue
  661. set -- $var
  662. do_enable_deep $var
  663. var=$1
  664. enable_weak $var
  665. done
  666. }
  667. requested(){
  668. test "${1#!}" = "$1" && op="=" || op="!="
  669. eval test "x\$${1#!}_requested" $op "xyes"
  670. }
  671. enabled(){
  672. test "${1#!}" = "$1" && op="=" || op="!="
  673. eval test "x\$${1#!}" $op "xyes"
  674. }
  675. disabled(){
  676. test "${1#!}" = "$1" && op="=" || op="!="
  677. eval test "x\$${1#!}" $op "xno"
  678. }
  679. enabled_all(){
  680. for opt; do
  681. enabled $opt || return 1
  682. done
  683. }
  684. disabled_all(){
  685. for opt; do
  686. disabled $opt || return 1
  687. done
  688. }
  689. enabled_any(){
  690. for opt; do
  691. enabled $opt && return 0
  692. done
  693. }
  694. disabled_any(){
  695. for opt; do
  696. disabled $opt && return 0
  697. done
  698. return 1
  699. }
  700. set_default(){
  701. for opt; do
  702. eval : \${$opt:=\$${opt}_default}
  703. done
  704. }
  705. is_in(){
  706. value=$1
  707. shift
  708. for var in $*; do
  709. [ $var = $value ] && return 0
  710. done
  711. return 1
  712. }
  713. # The cfg loop is very hot (several thousands iterations), and in bash also
  714. # potentialy quite slow. Try to abort the iterations early, preferably without
  715. # calling functions. 70%+ of the time cfg is already done or without deps.
  716. check_deps(){
  717. for cfg; do
  718. eval [ x\$${cfg}_checking = xdone ] && continue
  719. eval [ x\$${cfg}_checking = xinprogress ] && die "Circular dependency for $cfg."
  720. eval "
  721. dep_all=\$${cfg}_deps
  722. dep_any=\$${cfg}_deps_any
  723. dep_con=\$${cfg}_conflict
  724. dep_sel=\$${cfg}_select
  725. dep_sgs=\$${cfg}_suggest
  726. dep_ifa=\$${cfg}_if
  727. dep_ifn=\$${cfg}_if_any
  728. "
  729. # most of the time here $cfg has no deps - avoid costly no-op work
  730. if [ "$dep_all$dep_any$dep_con$dep_sel$dep_sgs$dep_ifa$dep_ifn" ]; then
  731. eval ${cfg}_checking=inprogress
  732. set -- $cfg "$dep_all" "$dep_any" "$dep_con" "$dep_sel" "$dep_sgs" "$dep_ifa" "$dep_ifn"
  733. check_deps $dep_all $dep_any $dep_con $dep_sel $dep_sgs $dep_ifa $dep_ifn
  734. cfg=$1; dep_all=$2; dep_any=$3; dep_con=$4; dep_sel=$5 dep_sgs=$6; dep_ifa=$7; dep_ifn=$8
  735. [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
  736. [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
  737. enabled_all $dep_all || { disable_with_reason $cfg "not all dependencies are satisfied: $dep_all"; }
  738. enabled_any $dep_any || { disable_with_reason $cfg "not any dependency is satisfied: $dep_any"; }
  739. disabled_all $dep_con || { disable_with_reason $cfg "some conflicting dependencies are unsatisfied: $dep_con"; }
  740. disabled_any $dep_sel && { disable_with_reason $cfg "some selected dependency is unsatisfied: $dep_sel"; }
  741. enabled $cfg && enable_deep_weak $dep_sel $dep_sgs
  742. for dep in $dep_all $dep_any $dep_sel $dep_sgs; do
  743. # filter out library deps, these do not belong in extralibs
  744. is_in $dep $LIBRARY_LIST && continue
  745. enabled $dep && eval append ${cfg}_extralibs ${dep}_extralibs
  746. done
  747. fi
  748. eval ${cfg}_checking=done
  749. done
  750. }
  751. print_config(){
  752. pfx=$1
  753. files=$2
  754. shift 2
  755. map 'eval echo "$v \${$v:-no}"' "$@" |
  756. awk "BEGIN { split(\"$files\", files) }
  757. {
  758. c = \"$pfx\" toupper(\$1);
  759. v = \$2;
  760. sub(/yes/, 1, v);
  761. sub(/no/, 0, v);
  762. for (f in files) {
  763. file = files[f];
  764. if (file ~ /\\.h\$/) {
  765. printf(\"#define %s %d\\n\", c, v) >>file;
  766. } else if (file ~ /\\.asm\$/) {
  767. printf(\"%%define %s %d\\n\", c, v) >>file;
  768. } else if (file ~ /\\.mak\$/) {
  769. n = -v ? \"\" : \"!\";
  770. printf(\"%s%s=yes\\n\", n, c) >>file;
  771. } else if (file ~ /\\.texi\$/) {
  772. pre = -v ? \"\" : \"@c \";
  773. yesno = \$2;
  774. c2 = tolower(c);
  775. gsub(/_/, \"-\", c2);
  776. printf(\"%s@set %s %s\\n\", pre, c2, yesno) >>file;
  777. }
  778. }
  779. }"
  780. }
  781. print_enabled(){
  782. suf=$1
  783. shift
  784. for v; do
  785. enabled $v && printf "%s\n" ${v%$suf}
  786. done
  787. }
  788. append(){
  789. var=$1
  790. shift
  791. eval "$var=\"\$$var $*\""
  792. }
  793. prepend(){
  794. var=$1
  795. shift
  796. eval "$var=\"$* \$$var\""
  797. }
  798. reverse () {
  799. eval '
  800. reverse_out=
  801. for v in $'$1'; do
  802. reverse_out="$v $reverse_out"
  803. done
  804. '$1'=$reverse_out
  805. '
  806. }
  807. # keeps the last occurence of each non-unique item
  808. unique(){
  809. unique_out=
  810. eval unique_in=\$$1
  811. reverse unique_in
  812. for v in $unique_in; do
  813. # " $unique_out" +space such that every item is surrounded with spaces
  814. case " $unique_out" in *" $v "*) continue; esac # already in list
  815. unique_out="$unique_out$v "
  816. done
  817. reverse unique_out
  818. eval $1=\$unique_out
  819. }
  820. resolve(){
  821. resolve_out=
  822. eval resolve_in=\$$1
  823. for v in $resolve_in; do
  824. eval 'resolve_out="$resolve_out$'$v' "'
  825. done
  826. eval $1=\$resolve_out
  827. }
  828. add_cppflags(){
  829. append CPPFLAGS "$@"
  830. }
  831. add_cflags(){
  832. append CFLAGS $($cflags_filter "$@")
  833. }
  834. add_cflags_headers(){
  835. append CFLAGS_HEADERS $($cflags_filter "$@")
  836. }
  837. add_cxxflags(){
  838. append CXXFLAGS $($cflags_filter "$@")
  839. }
  840. add_objcflags(){
  841. append OBJCFLAGS $($objcflags_filter "$@")
  842. }
  843. add_asflags(){
  844. append ASFLAGS $($asflags_filter "$@")
  845. }
  846. add_ldflags(){
  847. append LDFLAGS $($ldflags_filter "$@")
  848. }
  849. add_ldexeflags(){
  850. append LDEXEFLAGS $($ldflags_filter "$@")
  851. }
  852. add_ldsoflags(){
  853. append LDSOFLAGS $($ldflags_filter "$@")
  854. }
  855. add_extralibs(){
  856. prepend extralibs $($ldflags_filter "$@")
  857. }
  858. add_stripflags(){
  859. append ASMSTRIPFLAGS "$@"
  860. }
  861. add_host_cppflags(){
  862. append host_cppflags "$@"
  863. }
  864. add_host_cflags(){
  865. append host_cflags $($host_cflags_filter "$@")
  866. }
  867. add_host_ldflags(){
  868. append host_ldflags $($host_ldflags_filter "$@")
  869. }
  870. add_compat(){
  871. append compat_objs $1
  872. shift
  873. map 'add_cppflags -D$v' "$@"
  874. }
  875. test_cmd(){
  876. log "$@"
  877. "$@" >> $logfile 2>&1
  878. }
  879. test_stat(){
  880. log test_stat "$@"
  881. stat "$1" >> $logfile 2>&1
  882. }
  883. cc_e(){
  884. eval printf '%s\\n' $CC_E
  885. }
  886. cc_o(){
  887. eval printf '%s\\n' $CC_O
  888. }
  889. as_o(){
  890. eval printf '%s\\n' $AS_O
  891. }
  892. x86asm_o(){
  893. eval printf '%s\\n' $X86ASM_O
  894. }
  895. ld_o(){
  896. eval printf '%s\\n' $LD_O
  897. }
  898. hostcc_e(){
  899. eval printf '%s\\n' $HOSTCC_E
  900. }
  901. hostcc_o(){
  902. eval printf '%s\\n' $HOSTCC_O
  903. }
  904. nvcc_o(){
  905. eval printf '%s\\n' $NVCC_O
  906. }
  907. test_cc(){
  908. log test_cc "$@"
  909. cat > $TMPC
  910. log_file $TMPC
  911. test_cmd $cc $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPC
  912. }
  913. test_cxx(){
  914. log test_cxx "$@"
  915. cat > $TMPCPP
  916. log_file $TMPCPP
  917. test_cmd $cxx $CPPFLAGS $CFLAGS $CXXFLAGS "$@" $CXX_C -o $TMPO $TMPCPP
  918. }
  919. test_objcc(){
  920. log test_objcc "$@"
  921. cat > $TMPM
  922. log_file $TMPM
  923. test_cmd $objcc -Werror=missing-prototypes $CPPFLAGS $CFLAGS $OBJCFLAGS "$@" $OBJCC_C $(cc_o $TMPO) $TMPM
  924. }
  925. test_nvcc(){
  926. log test_nvcc "$@"
  927. cat > $TMPCU
  928. log_file $TMPCU
  929. tmpcu_=$TMPCU
  930. tmpo_=$TMPO
  931. [ -x "$(command -v cygpath)" ] && tmpcu_=$(cygpath -m $tmpcu_) && tmpo_=$(cygpath -m $tmpo_)
  932. test_cmd $nvcc $nvccflags "$@" $NVCC_C $(nvcc_o $tmpo_) $tmpcu_
  933. }
  934. check_nvcc() {
  935. log check_nvcc "$@"
  936. name=$1
  937. shift 1
  938. disabled $name && return
  939. disable $name
  940. test_nvcc "$@" <<EOF && enable $name
  941. extern "C" {
  942. __global__ void hello(unsigned char *data) {}
  943. }
  944. EOF
  945. }
  946. test_cpp(){
  947. log test_cpp "$@"
  948. cat > $TMPC
  949. log_file $TMPC
  950. test_cmd $cc $CPPFLAGS $CFLAGS "$@" $(cc_e $TMPO) $TMPC
  951. }
  952. test_as(){
  953. log test_as "$@"
  954. cat > $TMPS
  955. log_file $TMPS
  956. test_cmd $as $CPPFLAGS $ASFLAGS "$@" $AS_C $(as_o $TMPO) $TMPS
  957. }
  958. test_x86asm(){
  959. log test_x86asm "$@"
  960. echo "$1" > $TMPASM
  961. log_file $TMPASM
  962. shift
  963. test_cmd $x86asmexe $X86ASMFLAGS -Werror "$@" $(x86asm_o $TMPO) $TMPASM
  964. }
  965. check_cmd(){
  966. log check_cmd "$@"
  967. cmd=$1
  968. disabled $cmd && return
  969. disable $cmd
  970. test_cmd $@ && enable $cmd
  971. }
  972. check_as(){
  973. log check_as "$@"
  974. name=$1
  975. code=$2
  976. shift 2
  977. disable $name
  978. test_as $@ <<EOF && enable $name
  979. $code
  980. EOF
  981. }
  982. check_inline_asm(){
  983. log check_inline_asm "$@"
  984. name="$1"
  985. code="$2"
  986. shift 2
  987. disable $name
  988. test_cc "$@" <<EOF && enable $name
  989. void foo(void){ __asm__ volatile($code); }
  990. EOF
  991. }
  992. check_inline_asm_flags(){
  993. log check_inline_asm_flags "$@"
  994. name="$1"
  995. code="$2"
  996. flags=''
  997. shift 2
  998. while [ "$1" != "" ]; do
  999. append flags $1
  1000. shift
  1001. done;
  1002. disable $name
  1003. cat > $TMPC <<EOF
  1004. void foo(void){ __asm__ volatile($code); }
  1005. EOF
  1006. log_file $TMPC
  1007. test_cmd $cc $CPPFLAGS $CFLAGS $flags "$@" $CC_C $(cc_o $TMPO) $TMPC &&
  1008. enable $name && add_cflags $flags && add_asflags $flags && add_ldflags $flags
  1009. }
  1010. check_insn(){
  1011. log check_insn "$@"
  1012. check_inline_asm ${1}_inline "\"$2\""
  1013. check_as ${1}_external "$2"
  1014. }
  1015. check_x86asm(){
  1016. log check_x86asm "$@"
  1017. name=$1
  1018. shift
  1019. disable $name
  1020. test_x86asm "$@" && enable $name
  1021. }
  1022. test_ld(){
  1023. log test_ld "$@"
  1024. type=$1
  1025. shift 1
  1026. flags=$(filter_out '-l*|*.so' $@)
  1027. libs=$(filter '-l*|*.so' $@)
  1028. test_$type $($cflags_filter $flags) || return
  1029. flags=$($ldflags_filter $flags)
  1030. libs=$($ldflags_filter $libs)
  1031. test_cmd $ld $LDFLAGS $LDEXEFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs
  1032. }
  1033. check_ld(){
  1034. log check_ld "$@"
  1035. type=$1
  1036. name=$2
  1037. shift 2
  1038. disable $name
  1039. test_ld $type $@ && enable $name
  1040. }
  1041. print_include(){
  1042. hdr=$1
  1043. test "${hdr%.h}" = "${hdr}" &&
  1044. echo "#include $hdr" ||
  1045. echo "#include <$hdr>"
  1046. }
  1047. test_code(){
  1048. log test_code "$@"
  1049. check=$1
  1050. headers=$2
  1051. code=$3
  1052. shift 3
  1053. {
  1054. for hdr in $headers; do
  1055. print_include $hdr
  1056. done
  1057. echo "int main(void) { $code; return 0; }"
  1058. } | test_$check "$@"
  1059. }
  1060. check_cppflags(){
  1061. log check_cppflags "$@"
  1062. test_cpp "$@" <<EOF && append CPPFLAGS "$@"
  1063. #include <stdlib.h>
  1064. EOF
  1065. }
  1066. test_cflags(){
  1067. log test_cflags "$@"
  1068. set -- $($cflags_filter "$@")
  1069. test_cc "$@" <<EOF
  1070. int x;
  1071. EOF
  1072. }
  1073. check_cflags(){
  1074. log check_cflags "$@"
  1075. test_cflags "$@" && add_cflags "$@"
  1076. }
  1077. check_cxxflags(){
  1078. log check_cxxflags "$@"
  1079. set -- $($cflags_filter "$@")
  1080. test_cxx "$@" <<EOF && append CXXFLAGS "$@"
  1081. int x;
  1082. EOF
  1083. }
  1084. test_objcflags(){
  1085. log test_objcflags "$@"
  1086. set -- $($objcflags_filter "$@")
  1087. test_objcc "$@" <<EOF
  1088. int x;
  1089. EOF
  1090. }
  1091. check_objcflags(){
  1092. log check_objcflags "$@"
  1093. test_objcflags "$@" && add_objcflags "$@"
  1094. }
  1095. test_ldflags(){
  1096. log test_ldflags "$@"
  1097. set -- $($ldflags_filter "$@")
  1098. test_ld "cc" "$@" <<EOF
  1099. int main(void){ return 0; }
  1100. EOF
  1101. }
  1102. check_ldflags(){
  1103. log check_ldflags "$@"
  1104. test_ldflags "$@" && add_ldflags "$@"
  1105. }
  1106. test_stripflags(){
  1107. log test_stripflags "$@"
  1108. # call test_cc to get a fresh TMPO
  1109. test_cc <<EOF
  1110. int main(void) { return 0; }
  1111. EOF
  1112. test_cmd $strip $ASMSTRIPFLAGS "$@" $TMPO
  1113. }
  1114. check_stripflags(){
  1115. log check_stripflags "$@"
  1116. test_stripflags "$@" && add_stripflags "$@"
  1117. }
  1118. check_headers(){
  1119. log check_headers "$@"
  1120. headers=$1
  1121. shift
  1122. disable_sanitized $headers
  1123. {
  1124. for hdr in $headers; do
  1125. print_include $hdr
  1126. done
  1127. echo "int x;"
  1128. } | test_cpp "$@" && enable_sanitized $headers
  1129. }
  1130. check_header_objcc(){
  1131. log check_header_objcc "$@"
  1132. rm -f -- "$TMPO"
  1133. header=$1
  1134. shift
  1135. disable_sanitized $header
  1136. {
  1137. echo "#include <$header>"
  1138. echo "int main(void) { return 0; }"
  1139. } | test_objcc && test_stat "$TMPO" && enable_sanitized $header
  1140. }
  1141. check_apple_framework(){
  1142. log check_apple_framework "$@"
  1143. framework="$1"
  1144. name="$(tolower $framework)"
  1145. header="${framework}/${framework}.h"
  1146. disable $name
  1147. check_header_objcc $header &&
  1148. enable $name && eval ${name}_extralibs='"-framework $framework"'
  1149. }
  1150. check_func(){
  1151. log check_func "$@"
  1152. func=$1
  1153. shift
  1154. disable $func
  1155. test_ld "cc" "$@" <<EOF && enable $func
  1156. extern int $func();
  1157. int main(void){ $func(); }
  1158. EOF
  1159. }
  1160. check_complexfunc(){
  1161. log check_complexfunc "$@"
  1162. func=$1
  1163. narg=$2
  1164. shift 2
  1165. test $narg = 2 && args="f, g" || args="f * I"
  1166. disable $func
  1167. test_ld "cc" "$@" <<EOF && enable $func
  1168. #include <complex.h>
  1169. #include <math.h>
  1170. float foo(complex float f, complex float g) { return $func($args); }
  1171. int main(void){ return (int) foo; }
  1172. EOF
  1173. }
  1174. check_mathfunc(){
  1175. log check_mathfunc "$@"
  1176. func=$1
  1177. narg=$2
  1178. shift 2
  1179. test $narg = 2 && args="f, g" || args="f"
  1180. disable $func
  1181. test_ld "cc" "$@" <<EOF && enable $func
  1182. #include <math.h>
  1183. float foo(float f, float g) { return $func($args); }
  1184. int main(void){ return (int) foo; }
  1185. EOF
  1186. }
  1187. check_func_headers(){
  1188. log check_func_headers "$@"
  1189. headers=$1
  1190. funcs=$2
  1191. shift 2
  1192. {
  1193. for hdr in $headers; do
  1194. print_include $hdr
  1195. done
  1196. echo "#include <stdint.h>"
  1197. for func in $funcs; do
  1198. echo "long check_$func(void) { return (long) $func; }"
  1199. done
  1200. echo "int main(void) { int ret = 0;"
  1201. # LTO could optimize out the test functions without this
  1202. for func in $funcs; do
  1203. echo " ret |= ((intptr_t)check_$func) & 0xFFFF;"
  1204. done
  1205. echo "return ret; }"
  1206. } | test_ld "cc" "$@" && enable $funcs && enable_sanitized $headers
  1207. }
  1208. check_class_headers_cpp(){
  1209. log check_class_headers_cpp "$@"
  1210. headers=$1
  1211. classes=$2
  1212. shift 2
  1213. {
  1214. for hdr in $headers; do
  1215. echo "#include <$hdr>"
  1216. done
  1217. echo "int main(void) { "
  1218. i=1
  1219. for class in $classes; do
  1220. echo "$class obj$i;"
  1221. i=$(expr $i + 1)
  1222. done
  1223. echo "return 0; }"
  1224. } | test_ld "cxx" "$@" && enable $funcs && enable_sanitized $headers
  1225. }
  1226. test_cpp_condition(){
  1227. log test_cpp_condition "$@"
  1228. header=$1
  1229. condition=$2
  1230. shift 2
  1231. test_cpp "$@" <<EOF
  1232. #include <$header>
  1233. #if !($condition)
  1234. #error "unsatisfied condition: $condition"
  1235. #endif
  1236. EOF
  1237. }
  1238. check_cpp_condition(){
  1239. log check_cpp_condition "$@"
  1240. name=$1
  1241. shift 1
  1242. disable $name
  1243. test_cpp_condition "$@" && enable $name
  1244. }
  1245. test_cflags_cc(){
  1246. log test_cflags_cc "$@"
  1247. flags=$1
  1248. header=$2
  1249. condition=$3
  1250. shift 3
  1251. set -- $($cflags_filter "$flags")
  1252. test_cc "$@" <<EOF
  1253. #include <$header>
  1254. #if !($condition)
  1255. #error "unsatisfied condition: $condition"
  1256. #endif
  1257. EOF
  1258. }
  1259. check_lib(){
  1260. log check_lib "$@"
  1261. name="$1"
  1262. headers="$2"
  1263. funcs="$3"
  1264. shift 3
  1265. disable $name
  1266. check_func_headers "$headers" "$funcs" "$@" &&
  1267. enable $name && eval ${name}_extralibs="\$@"
  1268. }
  1269. check_lib_cpp(){
  1270. log check_lib_cpp "$@"
  1271. name="$1"
  1272. headers="$2"
  1273. classes="$3"
  1274. shift 3
  1275. disable $name
  1276. check_class_headers_cpp "$headers" "$classes" "$@" &&
  1277. enable $name && eval ${name}_extralibs="\$@"
  1278. }
  1279. test_pkg_config(){
  1280. log test_pkg_config "$@"
  1281. name="$1"
  1282. pkg_version="$2"
  1283. pkg="${2%% *}"
  1284. headers="$3"
  1285. funcs="$4"
  1286. shift 4
  1287. disable $name
  1288. test_cmd $pkg_config --exists --print-errors $pkg_version || return
  1289. pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg)
  1290. pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg)
  1291. check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
  1292. enable $name &&
  1293. set_sanitized "${name}_cflags" $pkg_cflags &&
  1294. set_sanitized "${name}_extralibs" $pkg_libs
  1295. }
  1296. check_pkg_config(){
  1297. log check_pkg_config "$@"
  1298. name="$1"
  1299. test_pkg_config "$@" &&
  1300. eval add_cflags \$${name}_cflags
  1301. }
  1302. test_exec(){
  1303. test_ld "cc" "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
  1304. }
  1305. check_exec_crash(){
  1306. log check_exec_crash "$@"
  1307. code=$(cat)
  1308. # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
  1309. # are safe but may not be available everywhere. Thus we use
  1310. # raise(SIGTERM) instead. The check is run in a subshell so we
  1311. # can redirect the "Terminated" message from the shell. SIGBUS
  1312. # is not defined by standard C so it is used conditionally.
  1313. (test_exec "$@") >> $logfile 2>&1 <<EOF
  1314. #include <signal.h>
  1315. static void sighandler(int sig){
  1316. raise(SIGTERM);
  1317. }
  1318. int foo(void){
  1319. $code
  1320. }
  1321. int (*func_ptr)(void) = foo;
  1322. int main(void){
  1323. signal(SIGILL, sighandler);
  1324. signal(SIGFPE, sighandler);
  1325. signal(SIGSEGV, sighandler);
  1326. #ifdef SIGBUS
  1327. signal(SIGBUS, sighandler);
  1328. #endif
  1329. return func_ptr();
  1330. }
  1331. EOF
  1332. }
  1333. check_type(){
  1334. log check_type "$@"
  1335. headers=$1
  1336. type=$2
  1337. shift 2
  1338. disable_sanitized "$type"
  1339. test_code cc "$headers" "$type v" "$@" && enable_sanitized "$type"
  1340. }
  1341. check_struct(){
  1342. log check_struct "$@"
  1343. headers=$1
  1344. struct=$2
  1345. member=$3
  1346. shift 3
  1347. disable_sanitized "${struct}_${member}"
  1348. test_code cc "$headers" "const void *p = &(($struct *)0)->$member" "$@" &&
  1349. enable_sanitized "${struct}_${member}"
  1350. }
  1351. check_builtin(){
  1352. log check_builtin "$@"
  1353. name=$1
  1354. headers=$2
  1355. builtin=$3
  1356. shift 3
  1357. disable "$name"
  1358. test_code ld "$headers" "$builtin" "cc" "$@" && enable "$name"
  1359. }
  1360. check_compile_assert(){
  1361. log check_compile_assert "$@"
  1362. name=$1
  1363. headers=$2
  1364. condition=$3
  1365. shift 3
  1366. disable "$name"
  1367. test_code cc "$headers" "char c[2 * !!($condition) - 1]" "$@" && enable "$name"
  1368. }
  1369. check_cc(){
  1370. log check_cc "$@"
  1371. name=$1
  1372. shift
  1373. disable "$name"
  1374. test_code cc "$@" && enable "$name"
  1375. }
  1376. require(){
  1377. log require "$@"
  1378. name_version="$1"
  1379. name="${1%% *}"
  1380. shift
  1381. check_lib $name "$@" || die "ERROR: $name_version not found"
  1382. }
  1383. require_cc(){
  1384. log require_cc "$@"
  1385. name="$1"
  1386. check_cc "$@" || die "ERROR: $name failed"
  1387. }
  1388. require_cpp(){
  1389. log require_cpp "$@"
  1390. name_version="$1"
  1391. name="${1%% *}"
  1392. shift
  1393. check_lib_cpp "$name" "$@" || die "ERROR: $name_version not found"
  1394. }
  1395. require_headers(){
  1396. log require_headers "$@"
  1397. headers="$1"
  1398. check_headers "$@" || die "ERROR: $headers not found"
  1399. }
  1400. require_cpp_condition(){
  1401. log require_cpp_condition "$@"
  1402. condition="$3"
  1403. check_cpp_condition "$@" || die "ERROR: $condition not satisfied"
  1404. }
  1405. require_pkg_config(){
  1406. log require_pkg_config "$@"
  1407. pkg_version="$2"
  1408. check_pkg_config "$@" || die "ERROR: $pkg_version not found using pkg-config$pkg_config_fail_message"
  1409. }
  1410. test_host_cc(){
  1411. log test_host_cc "$@"
  1412. cat > $TMPC
  1413. log_file $TMPC
  1414. test_cmd $host_cc $host_cflags "$@" $HOSTCC_C $(hostcc_o $TMPO) $TMPC
  1415. }
  1416. test_host_cpp(){
  1417. log test_host_cpp "$@"
  1418. cat > $TMPC
  1419. log_file $TMPC
  1420. test_cmd $host_cc $host_cppflags $host_cflags "$@" $(hostcc_e $TMPO) $TMPC
  1421. }
  1422. check_host_cppflags(){
  1423. log check_host_cppflags "$@"
  1424. test_host_cpp "$@" <<EOF && append host_cppflags "$@"
  1425. #include <stdlib.h>
  1426. EOF
  1427. }
  1428. check_host_cflags(){
  1429. log check_host_cflags "$@"
  1430. set -- $($host_cflags_filter "$@")
  1431. test_host_cc "$@" <<EOF && append host_cflags "$@"
  1432. int x;
  1433. EOF
  1434. }
  1435. test_host_cpp_condition(){
  1436. log test_host_cpp_condition "$@"
  1437. header=$1
  1438. condition=$2
  1439. shift 2
  1440. test_host_cpp "$@" <<EOF
  1441. #include <$header>
  1442. #if !($condition)
  1443. #error "unsatisfied condition: $condition"
  1444. #endif
  1445. EOF
  1446. }
  1447. check_host_cpp_condition(){
  1448. log check_host_cpp_condition "$@"
  1449. name=$1
  1450. shift 1
  1451. disable $name
  1452. test_host_cpp_condition "$@" && enable $name
  1453. }
  1454. cp_if_changed(){
  1455. cmp -s "$1" "$2" && { test "$quiet" != "yes" && echo "$2 is unchanged"; } && return
  1456. mkdir -p "$(dirname $2)"
  1457. cp -f "$1" "$2"
  1458. }
  1459. # CONFIG_LIST contains configurable options, while HAVE_LIST is for
  1460. # system-dependent things.
  1461. AVCODEC_COMPONENTS="
  1462. bsfs
  1463. decoders
  1464. encoders
  1465. hwaccels
  1466. parsers
  1467. "
  1468. AVDEVICE_COMPONENTS="
  1469. indevs
  1470. outdevs
  1471. "
  1472. AVFILTER_COMPONENTS="
  1473. filters
  1474. "
  1475. AVFORMAT_COMPONENTS="
  1476. demuxers
  1477. muxers
  1478. protocols
  1479. "
  1480. COMPONENT_LIST="
  1481. $AVCODEC_COMPONENTS
  1482. $AVDEVICE_COMPONENTS
  1483. $AVFILTER_COMPONENTS
  1484. $AVFORMAT_COMPONENTS
  1485. "
  1486. EXAMPLE_LIST="
  1487. avio_list_dir_example
  1488. avio_reading_example
  1489. decode_audio_example
  1490. decode_video_example
  1491. demuxing_decoding_example
  1492. encode_audio_example
  1493. encode_video_example
  1494. extract_mvs_example
  1495. filter_audio_example
  1496. filtering_audio_example
  1497. filtering_video_example
  1498. http_multiclient_example
  1499. hw_decode_example
  1500. metadata_example
  1501. muxing_example
  1502. qsvdec_example
  1503. remuxing_example
  1504. resampling_audio_example
  1505. scaling_video_example
  1506. transcode_aac_example
  1507. transcoding_example
  1508. vaapi_encode_example
  1509. vaapi_transcode_example
  1510. "
  1511. EXTERNAL_AUTODETECT_LIBRARY_LIST="
  1512. alsa
  1513. appkit
  1514. avfoundation
  1515. bzlib
  1516. coreimage
  1517. iconv
  1518. libxcb
  1519. libxcb_shm
  1520. libxcb_shape
  1521. libxcb_xfixes
  1522. lzma
  1523. schannel
  1524. sdl2
  1525. securetransport
  1526. sndio
  1527. xlib
  1528. zlib
  1529. "
  1530. EXTERNAL_LIBRARY_GPL_LIST="
  1531. avisynth
  1532. frei0r
  1533. libcdio
  1534. libdavs2
  1535. librubberband
  1536. libvidstab
  1537. libx264
  1538. libx265
  1539. libxavs
  1540. libxavs2
  1541. libxvid
  1542. "
  1543. EXTERNAL_LIBRARY_NONFREE_LIST="
  1544. decklink
  1545. libfdk_aac
  1546. openssl
  1547. libtls
  1548. "
  1549. EXTERNAL_LIBRARY_VERSION3_LIST="
  1550. gmp
  1551. libaribb24
  1552. liblensfun
  1553. libopencore_amrnb
  1554. libopencore_amrwb
  1555. libvmaf
  1556. libvo_amrwbenc
  1557. mbedtls
  1558. rkmpp
  1559. "
  1560. EXTERNAL_LIBRARY_GPLV3_LIST="
  1561. libsmbclient
  1562. "
  1563. EXTERNAL_LIBRARY_LIST="
  1564. $EXTERNAL_LIBRARY_GPL_LIST
  1565. $EXTERNAL_LIBRARY_NONFREE_LIST
  1566. $EXTERNAL_LIBRARY_VERSION3_LIST
  1567. $EXTERNAL_LIBRARY_GPLV3_LIST
  1568. chromaprint
  1569. gcrypt
  1570. gnutls
  1571. jni
  1572. ladspa
  1573. libaom
  1574. libass
  1575. libbluray
  1576. libbs2b
  1577. libcaca
  1578. libcelt
  1579. libcodec2
  1580. libdav1d
  1581. libdc1394
  1582. libdrm
  1583. libflite
  1584. libfontconfig
  1585. libfreetype
  1586. libfribidi
  1587. libglslang
  1588. libgme
  1589. libgsm
  1590. libiec61883
  1591. libilbc
  1592. libjack
  1593. libklvanc
  1594. libkvazaar
  1595. libmodplug
  1596. libmp3lame
  1597. libmysofa
  1598. libopencv
  1599. libopenh264
  1600. libopenjpeg
  1601. libopenmpt
  1602. libopus
  1603. libpulse
  1604. librabbitmq
  1605. librav1e
  1606. librsvg
  1607. librtmp
  1608. libshine
  1609. libsmbclient
  1610. libsnappy
  1611. libsoxr
  1612. libspeex
  1613. libsrt
  1614. libssh
  1615. libtensorflow
  1616. libtesseract
  1617. libtheora
  1618. libtwolame
  1619. libv4l2
  1620. libvorbis
  1621. libvpx
  1622. libwavpack
  1623. libwebp
  1624. libxml2
  1625. libzimg
  1626. libzmq
  1627. libzvbi
  1628. lv2
  1629. mediacodec
  1630. openal
  1631. opengl
  1632. pocketsphinx
  1633. vapoursynth
  1634. "
  1635. HWACCEL_AUTODETECT_LIBRARY_LIST="
  1636. amf
  1637. audiotoolbox
  1638. crystalhd
  1639. cuda
  1640. cuda_llvm
  1641. cuvid
  1642. d3d11va
  1643. dxva2
  1644. ffnvcodec
  1645. nvdec
  1646. nvenc
  1647. vaapi
  1648. vdpau
  1649. videotoolbox
  1650. v4l2_m2m
  1651. xvmc
  1652. "
  1653. # catchall list of things that require external libs to link
  1654. EXTRALIBS_LIST="
  1655. cpu_init
  1656. cws2fws
  1657. "
  1658. HWACCEL_LIBRARY_NONFREE_LIST="
  1659. cuda_nvcc
  1660. cuda_sdk
  1661. libnpp
  1662. "
  1663. HWACCEL_LIBRARY_LIST="
  1664. $HWACCEL_LIBRARY_NONFREE_LIST
  1665. libmfx
  1666. mmal
  1667. omx
  1668. opencl
  1669. vulkan
  1670. "
  1671. DOCUMENT_LIST="
  1672. doc
  1673. htmlpages
  1674. manpages
  1675. podpages
  1676. txtpages
  1677. "
  1678. FEATURE_LIST="
  1679. ftrapv
  1680. gray
  1681. hardcoded_tables
  1682. omx_rpi
  1683. runtime_cpudetect
  1684. safe_bitstream_reader
  1685. shared
  1686. small
  1687. static
  1688. swscale_alpha
  1689. "
  1690. # this list should be kept in linking order
  1691. LIBRARY_LIST="
  1692. avdevice
  1693. avfilter
  1694. swscale
  1695. postproc
  1696. avformat
  1697. avcodec
  1698. swresample
  1699. avresample
  1700. avutil
  1701. "
  1702. LICENSE_LIST="
  1703. gpl
  1704. nonfree
  1705. version3
  1706. "
  1707. PROGRAM_LIST="
  1708. ffplay
  1709. ffprobe
  1710. ffmpeg
  1711. "
  1712. SUBSYSTEM_LIST="
  1713. dct
  1714. dwt
  1715. error_resilience
  1716. faan
  1717. fast_unaligned
  1718. fft
  1719. lsp
  1720. lzo
  1721. mdct
  1722. pixelutils
  1723. network
  1724. rdft
  1725. "
  1726. # COMPONENT_LIST needs to come last to ensure correct dependency checking
  1727. CONFIG_LIST="
  1728. $DOCUMENT_LIST
  1729. $EXAMPLE_LIST
  1730. $EXTERNAL_LIBRARY_LIST
  1731. $EXTERNAL_AUTODETECT_LIBRARY_LIST
  1732. $HWACCEL_LIBRARY_LIST
  1733. $HWACCEL_AUTODETECT_LIBRARY_LIST
  1734. $FEATURE_LIST
  1735. $LICENSE_LIST
  1736. $LIBRARY_LIST
  1737. $PROGRAM_LIST
  1738. $SUBSYSTEM_LIST
  1739. autodetect
  1740. fontconfig
  1741. large_tests
  1742. linux_perf
  1743. memory_poisoning
  1744. neon_clobber_test
  1745. ossfuzz
  1746. pic
  1747. thumb
  1748. valgrind_backtrace
  1749. xmm_clobber_test
  1750. $COMPONENT_LIST
  1751. "
  1752. THREADS_LIST="
  1753. pthreads
  1754. os2threads
  1755. w32threads
  1756. "
  1757. ATOMICS_LIST="
  1758. atomics_gcc
  1759. atomics_suncc
  1760. atomics_win32
  1761. "
  1762. AUTODETECT_LIBS="
  1763. $EXTERNAL_AUTODETECT_LIBRARY_LIST
  1764. $HWACCEL_AUTODETECT_LIBRARY_LIST
  1765. $THREADS_LIST
  1766. "
  1767. ARCH_LIST="
  1768. aarch64
  1769. alpha
  1770. arm
  1771. avr32
  1772. avr32_ap
  1773. avr32_uc
  1774. bfin
  1775. ia64
  1776. m68k
  1777. mips
  1778. mips64
  1779. parisc
  1780. ppc
  1781. ppc64
  1782. s390
  1783. sh4
  1784. sparc
  1785. sparc64
  1786. tilegx
  1787. tilepro
  1788. tomi
  1789. x86
  1790. x86_32
  1791. x86_64
  1792. "
  1793. ARCH_EXT_LIST_ARM="
  1794. armv5te
  1795. armv6
  1796. armv6t2
  1797. armv8
  1798. neon
  1799. vfp
  1800. vfpv3
  1801. setend
  1802. "
  1803. ARCH_EXT_LIST_MIPS="
  1804. mipsfpu
  1805. mips32r2
  1806. mips32r5
  1807. mips64r2
  1808. mips32r6
  1809. mips64r6
  1810. mipsdsp
  1811. mipsdspr2
  1812. msa
  1813. msa2
  1814. "
  1815. ARCH_EXT_LIST_LOONGSON="
  1816. loongson2
  1817. loongson3
  1818. mmi
  1819. "
  1820. ARCH_EXT_LIST_X86_SIMD="
  1821. aesni
  1822. amd3dnow
  1823. amd3dnowext
  1824. avx
  1825. avx2
  1826. avx512
  1827. fma3
  1828. fma4
  1829. mmx
  1830. mmxext
  1831. sse
  1832. sse2
  1833. sse3
  1834. sse4
  1835. sse42
  1836. ssse3
  1837. xop
  1838. "
  1839. ARCH_EXT_LIST_PPC="
  1840. altivec
  1841. dcbzl
  1842. ldbrx
  1843. power8
  1844. ppc4xx
  1845. vsx
  1846. "
  1847. ARCH_EXT_LIST_X86="
  1848. $ARCH_EXT_LIST_X86_SIMD
  1849. cpunop
  1850. i686
  1851. "
  1852. ARCH_EXT_LIST="
  1853. $ARCH_EXT_LIST_ARM
  1854. $ARCH_EXT_LIST_PPC
  1855. $ARCH_EXT_LIST_X86
  1856. $ARCH_EXT_LIST_MIPS
  1857. $ARCH_EXT_LIST_LOONGSON
  1858. "
  1859. ARCH_FEATURES="
  1860. aligned_stack
  1861. fast_64bit
  1862. fast_clz
  1863. fast_cmov
  1864. local_aligned
  1865. simd_align_16
  1866. simd_align_32
  1867. simd_align_64
  1868. "
  1869. BUILTIN_LIST="
  1870. atomic_cas_ptr
  1871. machine_rw_barrier
  1872. MemoryBarrier
  1873. mm_empty
  1874. rdtsc
  1875. sem_timedwait
  1876. sync_val_compare_and_swap
  1877. "
  1878. HAVE_LIST_CMDLINE="
  1879. inline_asm
  1880. symver
  1881. x86asm
  1882. "
  1883. HAVE_LIST_PUB="
  1884. bigendian
  1885. fast_unaligned
  1886. "
  1887. HEADERS_LIST="
  1888. arpa_inet_h
  1889. asm_types_h
  1890. cdio_paranoia_h
  1891. cdio_paranoia_paranoia_h
  1892. cuda_h
  1893. dispatch_dispatch_h
  1894. dev_bktr_ioctl_bt848_h
  1895. dev_bktr_ioctl_meteor_h
  1896. dev_ic_bt8xx_h
  1897. dev_video_bktr_ioctl_bt848_h
  1898. dev_video_meteor_ioctl_meteor_h
  1899. direct_h
  1900. dirent_h
  1901. dxgidebug_h
  1902. dxva_h
  1903. ES2_gl_h
  1904. gsm_h
  1905. io_h
  1906. linux_perf_event_h
  1907. machine_ioctl_bt848_h
  1908. machine_ioctl_meteor_h
  1909. malloc_h
  1910. opencv2_core_core_c_h
  1911. OpenGL_gl3_h
  1912. poll_h
  1913. sys_param_h
  1914. sys_resource_h
  1915. sys_select_h
  1916. sys_soundcard_h
  1917. sys_time_h
  1918. sys_un_h
  1919. sys_videoio_h
  1920. termios_h
  1921. udplite_h
  1922. unistd_h
  1923. valgrind_valgrind_h
  1924. windows_h
  1925. winsock2_h
  1926. "
  1927. INTRINSICS_LIST="
  1928. intrinsics_neon
  1929. "
  1930. COMPLEX_FUNCS="
  1931. cabs
  1932. cexp
  1933. "
  1934. MATH_FUNCS="
  1935. atanf
  1936. atan2f
  1937. cbrt
  1938. cbrtf
  1939. copysign
  1940. cosf
  1941. erf
  1942. exp2
  1943. exp2f
  1944. expf
  1945. hypot
  1946. isfinite
  1947. isinf
  1948. isnan
  1949. ldexpf
  1950. llrint
  1951. llrintf
  1952. log2
  1953. log2f
  1954. log10f
  1955. lrint
  1956. lrintf
  1957. powf
  1958. rint
  1959. round
  1960. roundf
  1961. sinf
  1962. trunc
  1963. truncf
  1964. "
  1965. SYSTEM_FEATURES="
  1966. dos_paths
  1967. libc_msvcrt
  1968. MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS
  1969. section_data_rel_ro
  1970. threads
  1971. uwp
  1972. winrt
  1973. "
  1974. SYSTEM_FUNCS="
  1975. access
  1976. aligned_malloc
  1977. arc4random
  1978. clock_gettime
  1979. closesocket
  1980. CommandLineToArgvW
  1981. fcntl
  1982. getaddrinfo
  1983. gethrtime
  1984. getopt
  1985. GetModuleHandle
  1986. GetProcessAffinityMask
  1987. GetProcessMemoryInfo
  1988. GetProcessTimes
  1989. getrusage
  1990. GetStdHandle
  1991. GetSystemTimeAsFileTime
  1992. gettimeofday
  1993. glob
  1994. glXGetProcAddress
  1995. gmtime_r
  1996. inet_aton
  1997. isatty
  1998. kbhit
  1999. localtime_r
  2000. lstat
  2001. lzo1x_999_compress
  2002. mach_absolute_time
  2003. MapViewOfFile
  2004. memalign
  2005. mkstemp
  2006. mmap
  2007. mprotect
  2008. nanosleep
  2009. PeekNamedPipe
  2010. posix_memalign
  2011. pthread_cancel
  2012. sched_getaffinity
  2013. SecItemImport
  2014. SetConsoleTextAttribute
  2015. SetConsoleCtrlHandler
  2016. SetDllDirectory
  2017. setmode
  2018. setrlimit
  2019. Sleep
  2020. strerror_r
  2021. sysconf
  2022. sysctl
  2023. usleep
  2024. UTGetOSTypeFromString
  2025. VirtualAlloc
  2026. wglGetProcAddress
  2027. "
  2028. SYSTEM_LIBRARIES="
  2029. bcrypt
  2030. vaapi_drm
  2031. vaapi_x11
  2032. vdpau_x11
  2033. "
  2034. TOOLCHAIN_FEATURES="
  2035. as_arch_directive
  2036. as_dn_directive
  2037. as_fpu_directive
  2038. as_func
  2039. as_object_arch
  2040. asm_mod_q
  2041. blocks_extension
  2042. ebp_available
  2043. ebx_available
  2044. gnu_as
  2045. gnu_windres
  2046. ibm_asm
  2047. inline_asm_direct_symbol_refs
  2048. inline_asm_labels
  2049. inline_asm_nonlocal_labels
  2050. pragma_deprecated
  2051. rsync_contimeout
  2052. symver_asm_label
  2053. symver_gnu_asm
  2054. vfp_args
  2055. xform_asm
  2056. xmm_clobbers
  2057. "
  2058. TYPES_LIST="
  2059. kCMVideoCodecType_HEVC
  2060. kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange
  2061. kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ
  2062. kCVImageBufferTransferFunction_ITU_R_2100_HLG
  2063. kCVImageBufferTransferFunction_Linear
  2064. socklen_t
  2065. struct_addrinfo
  2066. struct_group_source_req
  2067. struct_ip_mreq_source
  2068. struct_ipv6_mreq
  2069. struct_msghdr_msg_flags
  2070. struct_pollfd
  2071. struct_rusage_ru_maxrss
  2072. struct_sctp_event_subscribe
  2073. struct_sockaddr_in6
  2074. struct_sockaddr_sa_len
  2075. struct_sockaddr_storage
  2076. struct_stat_st_mtim_tv_nsec
  2077. struct_v4l2_frmivalenum_discrete
  2078. "
  2079. HAVE_LIST="
  2080. $ARCH_EXT_LIST
  2081. $(add_suffix _external $ARCH_EXT_LIST)
  2082. $(add_suffix _inline $ARCH_EXT_LIST)
  2083. $ARCH_FEATURES
  2084. $BUILTIN_LIST
  2085. $COMPLEX_FUNCS
  2086. $HAVE_LIST_CMDLINE
  2087. $HAVE_LIST_PUB
  2088. $HEADERS_LIST
  2089. $INTRINSICS_LIST
  2090. $MATH_FUNCS
  2091. $SYSTEM_FEATURES
  2092. $SYSTEM_FUNCS
  2093. $SYSTEM_LIBRARIES
  2094. $THREADS_LIST
  2095. $TOOLCHAIN_FEATURES
  2096. $TYPES_LIST
  2097. makeinfo
  2098. makeinfo_html
  2099. opencl_d3d11
  2100. opencl_drm_arm
  2101. opencl_drm_beignet
  2102. opencl_dxva2
  2103. opencl_vaapi_beignet
  2104. opencl_vaapi_intel_media
  2105. perl
  2106. pod2man
  2107. texi2html
  2108. "
  2109. # options emitted with CONFIG_ prefix but not available on the command line
  2110. CONFIG_EXTRA="
  2111. aandcttables
  2112. ac3dsp
  2113. adts_header
  2114. audio_frame_queue
  2115. audiodsp
  2116. blockdsp
  2117. bswapdsp
  2118. cabac
  2119. cbs
  2120. cbs_av1
  2121. cbs_h264
  2122. cbs_h265
  2123. cbs_jpeg
  2124. cbs_mpeg2
  2125. cbs_vp9
  2126. dirac_parse
  2127. dnn
  2128. dvprofile
  2129. exif
  2130. faandct
  2131. faanidct
  2132. fdctdsp
  2133. flacdsp
  2134. fmtconvert
  2135. frame_thread_encoder
  2136. g722dsp
  2137. golomb
  2138. gplv3
  2139. h263dsp
  2140. h264chroma
  2141. h264dsp
  2142. h264parse
  2143. h264pred
  2144. h264qpel
  2145. hevcparse
  2146. hpeldsp
  2147. huffman
  2148. huffyuvdsp
  2149. huffyuvencdsp
  2150. idctdsp
  2151. iirfilter
  2152. mdct15
  2153. intrax8
  2154. iso_media
  2155. ividsp
  2156. jpegtables
  2157. lgplv3
  2158. libx262
  2159. llauddsp
  2160. llviddsp
  2161. llvidencdsp
  2162. lpc
  2163. lzf
  2164. me_cmp
  2165. mpeg_er
  2166. mpegaudio
  2167. mpegaudiodsp
  2168. mpegaudioheader
  2169. mpegvideo
  2170. mpegvideoenc
  2171. mss34dsp
  2172. pixblockdsp
  2173. qpeldsp
  2174. qsv
  2175. qsvdec
  2176. qsvenc
  2177. qsvvpp
  2178. rangecoder
  2179. riffdec
  2180. riffenc
  2181. rtpdec
  2182. rtpenc_chain
  2183. rv34dsp
  2184. scene_sad
  2185. sinewin
  2186. snappy
  2187. srtp
  2188. startcode
  2189. texturedsp
  2190. texturedspenc
  2191. tpeldsp
  2192. vaapi_1
  2193. vaapi_encode
  2194. vc1dsp
  2195. videodsp
  2196. vp3dsp
  2197. vp56dsp
  2198. vp8dsp
  2199. wma_freqs
  2200. wmv2dsp
  2201. "
  2202. CMDLINE_SELECT="
  2203. $ARCH_EXT_LIST
  2204. $CONFIG_LIST
  2205. $HAVE_LIST_CMDLINE
  2206. $THREADS_LIST
  2207. asm
  2208. cross_compile
  2209. debug
  2210. extra_warnings
  2211. logging
  2212. lto
  2213. optimizations
  2214. rpath
  2215. stripping
  2216. "
  2217. PATHS_LIST="
  2218. bindir
  2219. datadir
  2220. docdir
  2221. incdir
  2222. libdir
  2223. mandir
  2224. pkgconfigdir
  2225. prefix
  2226. shlibdir
  2227. install_name_dir
  2228. "
  2229. CMDLINE_SET="
  2230. $PATHS_LIST
  2231. ar
  2232. arch
  2233. as
  2234. assert_level
  2235. build_suffix
  2236. cc
  2237. objcc
  2238. cpu
  2239. cross_prefix
  2240. custom_allocator
  2241. cxx
  2242. dep_cc
  2243. doxygen
  2244. env
  2245. extra_version
  2246. gas
  2247. host_cc
  2248. host_cflags
  2249. host_extralibs
  2250. host_ld
  2251. host_ldflags
  2252. host_os
  2253. ignore_tests
  2254. install
  2255. ld
  2256. ln_s
  2257. logfile
  2258. malloc_prefix
  2259. nm
  2260. optflags
  2261. nvcc
  2262. nvccflags
  2263. pkg_config
  2264. pkg_config_flags
  2265. progs_suffix
  2266. random_seed
  2267. ranlib
  2268. samples
  2269. strip
  2270. sws_max_filter_size
  2271. sysinclude
  2272. sysroot
  2273. target_exec
  2274. target_os
  2275. target_path
  2276. target_samples
  2277. tempprefix
  2278. toolchain
  2279. valgrind
  2280. windres
  2281. x86asmexe
  2282. "
  2283. CMDLINE_APPEND="
  2284. extra_cflags
  2285. extra_cxxflags
  2286. extra_objcflags
  2287. host_cppflags
  2288. "
  2289. # code dependency declarations
  2290. # architecture extensions
  2291. armv5te_deps="arm"
  2292. armv6_deps="arm"
  2293. armv6t2_deps="arm"
  2294. armv8_deps="aarch64"
  2295. neon_deps_any="aarch64 arm"
  2296. intrinsics_neon_deps="neon"
  2297. vfp_deps_any="aarch64 arm"
  2298. vfpv3_deps="vfp"
  2299. setend_deps="arm"
  2300. map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
  2301. altivec_deps="ppc"
  2302. dcbzl_deps="ppc"
  2303. ldbrx_deps="ppc"
  2304. ppc4xx_deps="ppc"
  2305. vsx_deps="altivec"
  2306. power8_deps="vsx"
  2307. loongson2_deps="mips"
  2308. loongson3_deps="mips"
  2309. mips32r2_deps="mips"
  2310. mips32r5_deps="mips"
  2311. mips32r6_deps="mips"
  2312. mips64r2_deps="mips"
  2313. mips64r6_deps="mips"
  2314. mipsfpu_deps="mips"
  2315. mipsdsp_deps="mips"
  2316. mipsdspr2_deps="mips"
  2317. mmi_deps="mips"
  2318. msa_deps="mipsfpu"
  2319. msa2_deps="msa"
  2320. cpunop_deps="i686"
  2321. x86_64_select="i686"
  2322. x86_64_suggest="fast_cmov"
  2323. amd3dnow_deps="mmx"
  2324. amd3dnowext_deps="amd3dnow"
  2325. i686_deps="x86"
  2326. mmx_deps="x86"
  2327. mmxext_deps="mmx"
  2328. sse_deps="mmxext"
  2329. sse2_deps="sse"
  2330. sse3_deps="sse2"
  2331. ssse3_deps="sse3"
  2332. sse4_deps="ssse3"
  2333. sse42_deps="sse4"
  2334. aesni_deps="sse42"
  2335. avx_deps="sse42"
  2336. xop_deps="avx"
  2337. fma3_deps="avx"
  2338. fma4_deps="avx"
  2339. avx2_deps="avx"
  2340. avx512_deps="avx2"
  2341. mmx_external_deps="x86asm"
  2342. mmx_inline_deps="inline_asm x86"
  2343. mmx_suggest="mmx_external mmx_inline"
  2344. for ext in $(filter_out mmx $ARCH_EXT_LIST_X86_SIMD); do
  2345. eval dep=\$${ext}_deps
  2346. eval ${ext}_external_deps='"${dep}_external"'
  2347. eval ${ext}_inline_deps='"${dep}_inline"'
  2348. eval ${ext}_suggest='"${ext}_external ${ext}_inline"'
  2349. done
  2350. aligned_stack_if_any="aarch64 ppc x86"
  2351. fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
  2352. fast_clz_if_any="aarch64 alpha avr32 mips ppc x86"
  2353. fast_unaligned_if_any="aarch64 ppc x86"
  2354. simd_align_16_if_any="altivec neon sse"
  2355. simd_align_32_if_any="avx"
  2356. simd_align_64_if_any="avx512"
  2357. # system capabilities
  2358. linux_perf_deps="linux_perf_event_h"
  2359. symver_if_any="symver_asm_label symver_gnu_asm"
  2360. valgrind_backtrace_conflict="optimizations"
  2361. valgrind_backtrace_deps="valgrind_valgrind_h"
  2362. # threading support
  2363. atomics_gcc_if="sync_val_compare_and_swap"
  2364. atomics_suncc_if="atomic_cas_ptr machine_rw_barrier"
  2365. atomics_win32_if="MemoryBarrier"
  2366. atomics_native_if_any="$ATOMICS_LIST"
  2367. w32threads_deps="atomics_native"
  2368. threads_if_any="$THREADS_LIST"
  2369. # subsystems
  2370. cbs_av1_select="cbs"
  2371. cbs_h264_select="cbs"
  2372. cbs_h265_select="cbs"
  2373. cbs_jpeg_select="cbs"
  2374. cbs_mpeg2_select="cbs"
  2375. cbs_vp9_select="cbs"
  2376. dct_select="rdft"
  2377. dirac_parse_select="golomb"
  2378. dnn_suggest="libtensorflow"
  2379. error_resilience_select="me_cmp"
  2380. faandct_deps="faan"
  2381. faandct_select="fdctdsp"
  2382. faanidct_deps="faan"
  2383. faanidct_select="idctdsp"
  2384. h264dsp_select="startcode"
  2385. hevcparse_select="golomb"
  2386. frame_thread_encoder_deps="encoders threads"
  2387. intrax8_select="blockdsp idctdsp"
  2388. mdct_select="fft"
  2389. mdct15_select="fft"
  2390. me_cmp_select="fdctdsp idctdsp pixblockdsp"
  2391. mpeg_er_select="error_resilience"
  2392. mpegaudio_select="mpegaudiodsp mpegaudioheader"
  2393. mpegaudiodsp_select="dct"
  2394. mpegvideo_select="blockdsp h264chroma hpeldsp idctdsp me_cmp mpeg_er videodsp"
  2395. mpegvideoenc_select="aandcttables me_cmp mpegvideo pixblockdsp qpeldsp"
  2396. vc1dsp_select="h264chroma qpeldsp startcode"
  2397. rdft_select="fft"
  2398. # decoders / encoders
  2399. aac_decoder_select="adts_header mdct15 mdct sinewin"
  2400. aac_fixed_decoder_select="adts_header mdct sinewin"
  2401. aac_encoder_select="audio_frame_queue iirfilter lpc mdct sinewin"
  2402. aac_latm_decoder_select="aac_decoder aac_latm_parser"
  2403. ac3_decoder_select="ac3_parser ac3dsp bswapdsp fmtconvert mdct"
  2404. ac3_fixed_decoder_select="ac3_parser ac3dsp bswapdsp mdct"
  2405. ac3_encoder_select="ac3dsp audiodsp mdct me_cmp"
  2406. ac3_fixed_encoder_select="ac3dsp audiodsp mdct me_cmp"
  2407. acelp_kelvin_decoder_select="audiodsp"
  2408. adpcm_g722_decoder_select="g722dsp"
  2409. adpcm_g722_encoder_select="g722dsp"
  2410. aic_decoder_select="golomb idctdsp"
  2411. alac_encoder_select="lpc"
  2412. als_decoder_select="bswapdsp"
  2413. amrnb_decoder_select="lsp"
  2414. amrwb_decoder_select="lsp"
  2415. amv_decoder_select="sp5x_decoder exif"
  2416. amv_encoder_select="jpegtables mpegvideoenc"
  2417. ape_decoder_select="bswapdsp llauddsp"
  2418. apng_decoder_deps="zlib"
  2419. apng_encoder_deps="zlib"
  2420. apng_encoder_select="llvidencdsp"
  2421. aptx_decoder_select="audio_frame_queue"
  2422. aptx_encoder_select="audio_frame_queue"
  2423. aptx_hd_decoder_select="audio_frame_queue"
  2424. aptx_hd_encoder_select="audio_frame_queue"
  2425. asv1_decoder_select="blockdsp bswapdsp idctdsp"
  2426. asv1_encoder_select="aandcttables bswapdsp fdctdsp pixblockdsp"
  2427. asv2_decoder_select="blockdsp bswapdsp idctdsp"
  2428. asv2_encoder_select="aandcttables bswapdsp fdctdsp pixblockdsp"
  2429. atrac1_decoder_select="mdct sinewin"
  2430. atrac3_decoder_select="mdct"
  2431. atrac3al_decoder_select="mdct"
  2432. atrac3p_decoder_select="mdct sinewin"
  2433. atrac3pal_decoder_select="mdct sinewin"
  2434. atrac9_decoder_select="mdct"
  2435. avrn_decoder_select="exif jpegtables"
  2436. bink_decoder_select="blockdsp hpeldsp"
  2437. binkaudio_dct_decoder_select="mdct rdft dct sinewin wma_freqs"
  2438. binkaudio_rdft_decoder_select="mdct rdft sinewin wma_freqs"
  2439. cavs_decoder_select="blockdsp golomb h264chroma idctdsp qpeldsp videodsp"
  2440. clearvideo_decoder_select="idctdsp"
  2441. cllc_decoder_select="bswapdsp"
  2442. comfortnoise_encoder_select="lpc"
  2443. cook_decoder_select="audiodsp mdct sinewin"
  2444. cscd_decoder_select="lzo"
  2445. cscd_decoder_suggest="zlib"
  2446. dca_decoder_select="mdct"
  2447. dca_encoder_select="mdct"
  2448. dds_decoder_select="texturedsp"
  2449. dirac_decoder_select="dirac_parse dwt golomb videodsp mpegvideoenc"
  2450. dnxhd_decoder_select="blockdsp idctdsp"
  2451. dnxhd_encoder_select="blockdsp fdctdsp idctdsp mpegvideoenc pixblockdsp"
  2452. dolby_e_decoder_select="mdct"
  2453. dvvideo_decoder_select="dvprofile idctdsp"
  2454. dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp"
  2455. dxa_decoder_deps="zlib"
  2456. dxv_decoder_select="lzf texturedsp"
  2457. eac3_decoder_select="ac3_decoder"
  2458. eac3_encoder_select="ac3_encoder"
  2459. eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpegvideo"
  2460. eatgq_decoder_select="aandcttables"
  2461. eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp"
  2462. exr_decoder_deps="zlib"
  2463. ffv1_decoder_select="rangecoder"
  2464. ffv1_encoder_select="rangecoder"
  2465. ffvhuff_decoder_select="huffyuv_decoder"
  2466. ffvhuff_encoder_select="huffyuv_encoder"
  2467. fic_decoder_select="golomb"
  2468. flac_decoder_select="flacdsp"
  2469. flac_encoder_select="bswapdsp flacdsp lpc"
  2470. flashsv2_decoder_deps="zlib"
  2471. flashsv2_encoder_deps="zlib"
  2472. flashsv_decoder_deps="zlib"
  2473. flashsv_encoder_deps="zlib"
  2474. flv_decoder_select="h263_decoder"
  2475. flv_encoder_select="h263_encoder"
  2476. fourxm_decoder_select="blockdsp bswapdsp"
  2477. fraps_decoder_select="bswapdsp huffman"
  2478. g2m_decoder_deps="zlib"
  2479. g2m_decoder_select="blockdsp idctdsp jpegtables"
  2480. g729_decoder_select="audiodsp"
  2481. h261_decoder_select="mpegvideo"
  2482. h261_encoder_select="mpegvideoenc"
  2483. h263_decoder_select="h263_parser h263dsp mpegvideo qpeldsp"
  2484. h263_encoder_select="h263dsp mpegvideoenc"
  2485. h263i_decoder_select="h263_decoder"
  2486. h263p_decoder_select="h263_decoder"
  2487. h263p_encoder_select="h263_encoder"
  2488. h264_decoder_select="cabac golomb h264chroma h264dsp h264parse h264pred h264qpel videodsp"
  2489. h264_decoder_suggest="error_resilience"
  2490. hap_decoder_select="snappy texturedsp"
  2491. hap_encoder_deps="libsnappy"
  2492. hap_encoder_select="texturedspenc"
  2493. hevc_decoder_select="bswapdsp cabac golomb hevcparse videodsp"
  2494. huffyuv_decoder_select="bswapdsp huffyuvdsp llviddsp"
  2495. huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llvidencdsp"
  2496. hymt_decoder_select="huffyuv_decoder"
  2497. iac_decoder_select="imc_decoder"
  2498. imc_decoder_select="bswapdsp fft mdct sinewin"
  2499. imm4_decoder_select="bswapdsp"
  2500. imm5_decoder_select="h264_decoder hevc_decoder"
  2501. indeo3_decoder_select="hpeldsp"
  2502. indeo4_decoder_select="ividsp"
  2503. indeo5_decoder_select="ividsp"
  2504. interplay_video_decoder_select="hpeldsp"
  2505. jpegls_decoder_select="mjpeg_decoder"
  2506. jv_decoder_select="blockdsp"
  2507. lagarith_decoder_select="llviddsp"
  2508. ljpeg_encoder_select="idctdsp jpegtables mpegvideoenc"
  2509. lscr_decoder_deps="zlib"
  2510. magicyuv_decoder_select="llviddsp"
  2511. magicyuv_encoder_select="llvidencdsp"
  2512. mdec_decoder_select="blockdsp bswapdsp idctdsp mpegvideo"
  2513. metasound_decoder_select="lsp mdct sinewin"
  2514. mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp"
  2515. mjpeg_decoder_select="blockdsp hpeldsp exif idctdsp jpegtables"
  2516. mjpeg_encoder_select="jpegtables mpegvideoenc"
  2517. mjpegb_decoder_select="mjpeg_decoder"
  2518. mlp_decoder_select="mlp_parser"
  2519. mlp_encoder_select="lpc audio_frame_queue"
  2520. motionpixels_decoder_select="bswapdsp"
  2521. mp1_decoder_select="mpegaudio"
  2522. mp1float_decoder_select="mpegaudio"
  2523. mp2_decoder_select="mpegaudio"
  2524. mp2float_decoder_select="mpegaudio"
  2525. mp3_decoder_select="mpegaudio"
  2526. mp3adu_decoder_select="mpegaudio"
  2527. mp3adufloat_decoder_select="mpegaudio"
  2528. mp3float_decoder_select="mpegaudio"
  2529. mp3on4_decoder_select="mpegaudio"
  2530. mp3on4float_decoder_select="mpegaudio"
  2531. mpc7_decoder_select="bswapdsp mpegaudiodsp"
  2532. mpc8_decoder_select="mpegaudiodsp"
  2533. mpegvideo_decoder_select="mpegvideo"
  2534. mpeg1video_decoder_select="mpegvideo"
  2535. mpeg1video_encoder_select="mpegvideoenc h263dsp"
  2536. mpeg2video_decoder_select="mpegvideo"
  2537. mpeg2video_encoder_select="mpegvideoenc h263dsp"
  2538. mpeg4_decoder_select="h263_decoder mpeg4video_parser"
  2539. mpeg4_encoder_select="h263_encoder"
  2540. msa1_decoder_select="mss34dsp"
  2541. mscc_decoder_deps="zlib"
  2542. msmpeg4v1_decoder_select="h263_decoder"
  2543. msmpeg4v2_decoder_select="h263_decoder"
  2544. msmpeg4v2_encoder_select="h263_encoder"
  2545. msmpeg4v3_decoder_select="h263_decoder"
  2546. msmpeg4v3_encoder_select="h263_encoder"
  2547. mss2_decoder_select="mpegvideo qpeldsp vc1_decoder"
  2548. mts2_decoder_select="mss34dsp"
  2549. mv30_decoder_select="blockdsp"
  2550. mvha_decoder_deps="zlib"
  2551. mvha_decoder_select="llviddsp"
  2552. mwsc_decoder_deps="zlib"
  2553. mxpeg_decoder_select="mjpeg_decoder"
  2554. nellymoser_decoder_select="mdct sinewin"
  2555. nellymoser_encoder_select="audio_frame_queue mdct sinewin"
  2556. nuv_decoder_select="idctdsp lzo"
  2557. on2avc_decoder_select="mdct"
  2558. opus_decoder_deps="swresample"
  2559. opus_decoder_select="mdct15"
  2560. opus_encoder_select="audio_frame_queue mdct15"
  2561. png_decoder_deps="zlib"
  2562. png_encoder_deps="zlib"
  2563. png_encoder_select="llvidencdsp"
  2564. prores_decoder_select="blockdsp idctdsp"
  2565. prores_encoder_select="fdctdsp"
  2566. qcelp_decoder_select="lsp"
  2567. qdm2_decoder_select="mdct rdft mpegaudiodsp"
  2568. ra_144_decoder_select="audiodsp"
  2569. ra_144_encoder_select="audio_frame_queue lpc audiodsp"
  2570. ralf_decoder_select="golomb"
  2571. rasc_decoder_deps="zlib"
  2572. rawvideo_decoder_select="bswapdsp"
  2573. rscc_decoder_deps="zlib"
  2574. rtjpeg_decoder_select="me_cmp"
  2575. rv10_decoder_select="h263_decoder"
  2576. rv10_encoder_select="h263_encoder"
  2577. rv20_decoder_select="h263_decoder"
  2578. rv20_encoder_select="h263_encoder"
  2579. rv30_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp"
  2580. rv40_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp"
  2581. screenpresso_decoder_deps="zlib"
  2582. shorten_decoder_select="bswapdsp"
  2583. sipr_decoder_select="lsp"
  2584. snow_decoder_select="dwt h264qpel hpeldsp me_cmp rangecoder videodsp"
  2585. snow_encoder_select="dwt h264qpel hpeldsp me_cmp mpegvideoenc rangecoder"
  2586. sonic_decoder_select="golomb rangecoder"
  2587. sonic_encoder_select="golomb rangecoder"
  2588. sonic_ls_encoder_select="golomb rangecoder"
  2589. sp5x_decoder_select="mjpeg_decoder"
  2590. speedhq_decoder_select="mpegvideo"
  2591. srgc_decoder_deps="zlib"
  2592. svq1_decoder_select="hpeldsp"
  2593. svq1_encoder_select="hpeldsp me_cmp mpegvideoenc"
  2594. svq3_decoder_select="golomb h264dsp h264parse h264pred hpeldsp tpeldsp videodsp"
  2595. svq3_decoder_suggest="zlib"
  2596. tak_decoder_select="audiodsp"
  2597. tdsc_decoder_deps="zlib"
  2598. tdsc_decoder_select="mjpeg_decoder"
  2599. theora_decoder_select="vp3_decoder"
  2600. thp_decoder_select="mjpeg_decoder"
  2601. tiff_decoder_select="mjpeg_decoder"
  2602. tiff_decoder_suggest="zlib lzma"
  2603. tiff_encoder_suggest="zlib"
  2604. truehd_decoder_select="mlp_parser"
  2605. truehd_encoder_select="lpc audio_frame_queue"
  2606. truemotion2_decoder_select="bswapdsp"
  2607. truespeech_decoder_select="bswapdsp"
  2608. tscc_decoder_deps="zlib"
  2609. twinvq_decoder_select="mdct lsp sinewin"
  2610. txd_decoder_select="texturedsp"
  2611. utvideo_decoder_select="bswapdsp llviddsp"
  2612. utvideo_encoder_select="bswapdsp huffman llvidencdsp"
  2613. vble_decoder_select="llviddsp"
  2614. vc1_decoder_select="blockdsp h263_decoder h264qpel intrax8 mpegvideo vc1dsp"
  2615. vc1image_decoder_select="vc1_decoder"
  2616. vorbis_decoder_select="mdct"
  2617. vorbis_encoder_select="audio_frame_queue mdct"
  2618. vp3_decoder_select="hpeldsp vp3dsp videodsp"
  2619. vp4_decoder_select="vp3_decoder"
  2620. vp5_decoder_select="h264chroma hpeldsp videodsp vp3dsp vp56dsp"
  2621. vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp vp56dsp"
  2622. vp6a_decoder_select="vp6_decoder"
  2623. vp6f_decoder_select="vp6_decoder"
  2624. vp7_decoder_select="h264pred videodsp vp8dsp"
  2625. vp8_decoder_select="h264pred videodsp vp8dsp"
  2626. vp9_decoder_select="videodsp vp9_parser vp9_superframe_split_bsf"
  2627. wcmv_decoder_deps="zlib"
  2628. webp_decoder_select="vp8_decoder exif"
  2629. wmalossless_decoder_select="llauddsp"
  2630. wmapro_decoder_select="mdct sinewin wma_freqs"
  2631. wmav1_decoder_select="mdct sinewin wma_freqs"
  2632. wmav1_encoder_select="mdct sinewin wma_freqs"
  2633. wmav2_decoder_select="mdct sinewin wma_freqs"
  2634. wmav2_encoder_select="mdct sinewin wma_freqs"
  2635. wmavoice_decoder_select="lsp rdft dct mdct sinewin"
  2636. wmv1_decoder_select="h263_decoder"
  2637. wmv1_encoder_select="h263_encoder"
  2638. wmv2_decoder_select="blockdsp error_resilience h263_decoder idctdsp intrax8 videodsp wmv2dsp"
  2639. wmv2_encoder_select="h263_encoder wmv2dsp"
  2640. wmv3_decoder_select="vc1_decoder"
  2641. wmv3image_decoder_select="wmv3_decoder"
  2642. xma1_decoder_select="wmapro_decoder"
  2643. xma2_decoder_select="wmapro_decoder"
  2644. ylc_decoder_select="bswapdsp"
  2645. zerocodec_decoder_deps="zlib"
  2646. zlib_decoder_deps="zlib"
  2647. zlib_encoder_deps="zlib"
  2648. zmbv_decoder_deps="zlib"
  2649. zmbv_encoder_deps="zlib"
  2650. # hardware accelerators
  2651. crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
  2652. cuda_deps="ffnvcodec"
  2653. cuvid_deps="ffnvcodec"
  2654. d3d11va_deps="dxva_h ID3D11VideoDecoder ID3D11VideoContext"
  2655. dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode ole32 user32"
  2656. ffnvcodec_deps_any="libdl LoadLibrary"
  2657. nvdec_deps="ffnvcodec"
  2658. vaapi_x11_deps="xlib"
  2659. videotoolbox_hwaccel_deps="videotoolbox pthreads"
  2660. videotoolbox_hwaccel_extralibs="-framework QuartzCore"
  2661. xvmc_deps="X11_extensions_XvMClib_h"
  2662. h263_vaapi_hwaccel_deps="vaapi"
  2663. h263_vaapi_hwaccel_select="h263_decoder"
  2664. h263_videotoolbox_hwaccel_deps="videotoolbox"
  2665. h263_videotoolbox_hwaccel_select="h263_decoder"
  2666. h264_d3d11va_hwaccel_deps="d3d11va"
  2667. h264_d3d11va_hwaccel_select="h264_decoder"
  2668. h264_d3d11va2_hwaccel_deps="d3d11va"
  2669. h264_d3d11va2_hwaccel_select="h264_decoder"
  2670. h264_dxva2_hwaccel_deps="dxva2"
  2671. h264_dxva2_hwaccel_select="h264_decoder"
  2672. h264_nvdec_hwaccel_deps="nvdec"
  2673. h264_nvdec_hwaccel_select="h264_decoder"
  2674. h264_vaapi_hwaccel_deps="vaapi"
  2675. h264_vaapi_hwaccel_select="h264_decoder"
  2676. h264_vdpau_hwaccel_deps="vdpau"
  2677. h264_vdpau_hwaccel_select="h264_decoder"
  2678. h264_videotoolbox_hwaccel_deps="videotoolbox"
  2679. h264_videotoolbox_hwaccel_select="h264_decoder"
  2680. hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
  2681. hevc_d3d11va_hwaccel_select="hevc_decoder"
  2682. hevc_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
  2683. hevc_d3d11va2_hwaccel_select="hevc_decoder"
  2684. hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
  2685. hevc_dxva2_hwaccel_select="hevc_decoder"
  2686. hevc_nvdec_hwaccel_deps="nvdec"
  2687. hevc_nvdec_hwaccel_select="hevc_decoder"
  2688. hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC"
  2689. hevc_vaapi_hwaccel_select="hevc_decoder"
  2690. hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC"
  2691. hevc_vdpau_hwaccel_select="hevc_decoder"
  2692. hevc_videotoolbox_hwaccel_deps="videotoolbox"
  2693. hevc_videotoolbox_hwaccel_select="hevc_decoder"
  2694. mjpeg_nvdec_hwaccel_deps="nvdec"
  2695. mjpeg_nvdec_hwaccel_select="mjpeg_decoder"
  2696. mjpeg_vaapi_hwaccel_deps="vaapi"
  2697. mjpeg_vaapi_hwaccel_select="mjpeg_decoder"
  2698. mpeg_xvmc_hwaccel_deps="xvmc"
  2699. mpeg_xvmc_hwaccel_select="mpeg2video_decoder"
  2700. mpeg1_nvdec_hwaccel_deps="nvdec"
  2701. mpeg1_nvdec_hwaccel_select="mpeg1video_decoder"
  2702. mpeg1_vdpau_hwaccel_deps="vdpau"
  2703. mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
  2704. mpeg1_videotoolbox_hwaccel_deps="videotoolbox"
  2705. mpeg1_videotoolbox_hwaccel_select="mpeg1video_decoder"
  2706. mpeg1_xvmc_hwaccel_deps="xvmc"
  2707. mpeg1_xvmc_hwaccel_select="mpeg1video_decoder"
  2708. mpeg2_d3d11va_hwaccel_deps="d3d11va"
  2709. mpeg2_d3d11va_hwaccel_select="mpeg2video_decoder"
  2710. mpeg2_d3d11va2_hwaccel_deps="d3d11va"
  2711. mpeg2_d3d11va2_hwaccel_select="mpeg2video_decoder"
  2712. mpeg2_dxva2_hwaccel_deps="dxva2"
  2713. mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
  2714. mpeg2_nvdec_hwaccel_deps="nvdec"
  2715. mpeg2_nvdec_hwaccel_select="mpeg2video_decoder"
  2716. mpeg2_vaapi_hwaccel_deps="vaapi"
  2717. mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
  2718. mpeg2_vdpau_hwaccel_deps="vdpau"
  2719. mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
  2720. mpeg2_videotoolbox_hwaccel_deps="videotoolbox"
  2721. mpeg2_videotoolbox_hwaccel_select="mpeg2video_decoder"
  2722. mpeg2_xvmc_hwaccel_deps="xvmc"
  2723. mpeg2_xvmc_hwaccel_select="mpeg2video_decoder"
  2724. mpeg4_nvdec_hwaccel_deps="nvdec"
  2725. mpeg4_nvdec_hwaccel_select="mpeg4_decoder"
  2726. mpeg4_vaapi_hwaccel_deps="vaapi"
  2727. mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
  2728. mpeg4_vdpau_hwaccel_deps="vdpau"
  2729. mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
  2730. mpeg4_videotoolbox_hwaccel_deps="videotoolbox"
  2731. mpeg4_videotoolbox_hwaccel_select="mpeg4_decoder"
  2732. vc1_d3d11va_hwaccel_deps="d3d11va"
  2733. vc1_d3d11va_hwaccel_select="vc1_decoder"
  2734. vc1_d3d11va2_hwaccel_deps="d3d11va"
  2735. vc1_d3d11va2_hwaccel_select="vc1_decoder"
  2736. vc1_dxva2_hwaccel_deps="dxva2"
  2737. vc1_dxva2_hwaccel_select="vc1_decoder"
  2738. vc1_nvdec_hwaccel_deps="nvdec"
  2739. vc1_nvdec_hwaccel_select="vc1_decoder"
  2740. vc1_vaapi_hwaccel_deps="vaapi"
  2741. vc1_vaapi_hwaccel_select="vc1_decoder"
  2742. vc1_vdpau_hwaccel_deps="vdpau"
  2743. vc1_vdpau_hwaccel_select="vc1_decoder"
  2744. vp8_nvdec_hwaccel_deps="nvdec"
  2745. vp8_nvdec_hwaccel_select="vp8_decoder"
  2746. vp8_vaapi_hwaccel_deps="vaapi"
  2747. vp8_vaapi_hwaccel_select="vp8_decoder"
  2748. vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
  2749. vp9_d3d11va_hwaccel_select="vp9_decoder"
  2750. vp9_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
  2751. vp9_d3d11va2_hwaccel_select="vp9_decoder"
  2752. vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9"
  2753. vp9_dxva2_hwaccel_select="vp9_decoder"
  2754. vp9_nvdec_hwaccel_deps="nvdec"
  2755. vp9_nvdec_hwaccel_select="vp9_decoder"
  2756. vp9_vaapi_hwaccel_deps="vaapi VADecPictureParameterBufferVP9_bit_depth"
  2757. vp9_vaapi_hwaccel_select="vp9_decoder"
  2758. vp9_vdpau_hwaccel_deps="vdpau VdpPictureInfoVP9"
  2759. vp9_vdpau_hwaccel_select="vp9_decoder"
  2760. wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
  2761. wmv3_d3d11va2_hwaccel_select="vc1_d3d11va2_hwaccel"
  2762. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  2763. wmv3_nvdec_hwaccel_select="vc1_nvdec_hwaccel"
  2764. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  2765. wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
  2766. # hardware-accelerated codecs
  2767. omx_deps="libdl pthreads"
  2768. omx_rpi_select="omx"
  2769. qsv_deps="libmfx"
  2770. qsvdec_select="qsv"
  2771. qsvenc_select="qsv"
  2772. qsvvpp_select="qsv"
  2773. vaapi_encode_deps="vaapi"
  2774. v4l2_m2m_deps="linux_videodev2_h sem_timedwait"
  2775. hwupload_cuda_filter_deps="ffnvcodec"
  2776. scale_npp_filter_deps="ffnvcodec libnpp"
  2777. scale_cuda_filter_deps="ffnvcodec"
  2778. scale_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
  2779. thumbnail_cuda_filter_deps="ffnvcodec"
  2780. thumbnail_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
  2781. transpose_npp_filter_deps="ffnvcodec libnpp"
  2782. overlay_cuda_filter_deps="ffnvcodec"
  2783. overlay_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
  2784. amf_deps_any="libdl LoadLibrary"
  2785. nvenc_deps="ffnvcodec"
  2786. nvenc_deps_any="libdl LoadLibrary"
  2787. nvenc_encoder_deps="nvenc"
  2788. h263_v4l2m2m_decoder_deps="v4l2_m2m h263_v4l2_m2m"
  2789. h263_v4l2m2m_encoder_deps="v4l2_m2m h263_v4l2_m2m"
  2790. h264_amf_encoder_deps="amf"
  2791. h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
  2792. h264_cuvid_decoder_deps="cuvid"
  2793. h264_cuvid_decoder_select="h264_mp4toannexb_bsf"
  2794. h264_mediacodec_decoder_deps="mediacodec"
  2795. h264_mediacodec_decoder_select="h264_mp4toannexb_bsf h264_parser"
  2796. h264_mmal_decoder_deps="mmal"
  2797. h264_nvenc_encoder_deps="nvenc"
  2798. h264_omx_encoder_deps="omx"
  2799. h264_qsv_decoder_select="h264_mp4toannexb_bsf qsvdec"
  2800. h264_qsv_encoder_select="qsvenc"
  2801. h264_rkmpp_decoder_deps="rkmpp"
  2802. h264_rkmpp_decoder_select="h264_mp4toannexb_bsf"
  2803. h264_vaapi_encoder_select="cbs_h264 vaapi_encode"
  2804. h264_v4l2m2m_decoder_deps="v4l2_m2m h264_v4l2_m2m"
  2805. h264_v4l2m2m_decoder_select="h264_mp4toannexb_bsf"
  2806. h264_v4l2m2m_encoder_deps="v4l2_m2m h264_v4l2_m2m"
  2807. hevc_amf_encoder_deps="amf"
  2808. hevc_cuvid_decoder_deps="cuvid"
  2809. hevc_cuvid_decoder_select="hevc_mp4toannexb_bsf"
  2810. hevc_mediacodec_decoder_deps="mediacodec"
  2811. hevc_mediacodec_decoder_select="hevc_mp4toannexb_bsf hevc_parser"
  2812. hevc_nvenc_encoder_deps="nvenc"
  2813. hevc_qsv_decoder_select="hevc_mp4toannexb_bsf qsvdec"
  2814. hevc_qsv_encoder_select="hevcparse qsvenc"
  2815. hevc_rkmpp_decoder_deps="rkmpp"
  2816. hevc_rkmpp_decoder_select="hevc_mp4toannexb_bsf"
  2817. hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC"
  2818. hevc_vaapi_encoder_select="cbs_h265 vaapi_encode"
  2819. hevc_v4l2m2m_decoder_deps="v4l2_m2m hevc_v4l2_m2m"
  2820. hevc_v4l2m2m_decoder_select="hevc_mp4toannexb_bsf"
  2821. hevc_v4l2m2m_encoder_deps="v4l2_m2m hevc_v4l2_m2m"
  2822. mjpeg_cuvid_decoder_deps="cuvid"
  2823. mjpeg_qsv_decoder_select="qsvdec"
  2824. mjpeg_qsv_encoder_deps="libmfx"
  2825. mjpeg_qsv_encoder_select="qsvenc"
  2826. mjpeg_vaapi_encoder_deps="VAEncPictureParameterBufferJPEG"
  2827. mjpeg_vaapi_encoder_select="cbs_jpeg jpegtables vaapi_encode"
  2828. mpeg1_cuvid_decoder_deps="cuvid"
  2829. mpeg1_v4l2m2m_decoder_deps="v4l2_m2m mpeg1_v4l2_m2m"
  2830. mpeg2_crystalhd_decoder_select="crystalhd"
  2831. mpeg2_cuvid_decoder_deps="cuvid"
  2832. mpeg2_mmal_decoder_deps="mmal"
  2833. mpeg2_mediacodec_decoder_deps="mediacodec"
  2834. mpeg2_qsv_decoder_select="qsvdec"
  2835. mpeg2_qsv_encoder_select="qsvenc"
  2836. mpeg2_vaapi_encoder_select="cbs_mpeg2 vaapi_encode"
  2837. mpeg2_v4l2m2m_decoder_deps="v4l2_m2m mpeg2_v4l2_m2m"
  2838. mpeg4_crystalhd_decoder_select="crystalhd"
  2839. mpeg4_cuvid_decoder_deps="cuvid"
  2840. mpeg4_mediacodec_decoder_deps="mediacodec"
  2841. mpeg4_mmal_decoder_deps="mmal"
  2842. mpeg4_omx_encoder_deps="omx"
  2843. mpeg4_v4l2m2m_decoder_deps="v4l2_m2m mpeg4_v4l2_m2m"
  2844. mpeg4_v4l2m2m_encoder_deps="v4l2_m2m mpeg4_v4l2_m2m"
  2845. msmpeg4_crystalhd_decoder_select="crystalhd"
  2846. nvenc_h264_encoder_select="h264_nvenc_encoder"
  2847. nvenc_hevc_encoder_select="hevc_nvenc_encoder"
  2848. vc1_crystalhd_decoder_select="crystalhd"
  2849. vc1_cuvid_decoder_deps="cuvid"
  2850. vc1_mmal_decoder_deps="mmal"
  2851. vc1_qsv_decoder_select="qsvdec"
  2852. vc1_v4l2m2m_decoder_deps="v4l2_m2m vc1_v4l2_m2m"
  2853. vp8_cuvid_decoder_deps="cuvid"
  2854. vp8_mediacodec_decoder_deps="mediacodec"
  2855. vp8_qsv_decoder_select="qsvdec"
  2856. vp8_rkmpp_decoder_deps="rkmpp"
  2857. vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8"
  2858. vp8_vaapi_encoder_select="vaapi_encode"
  2859. vp8_v4l2m2m_decoder_deps="v4l2_m2m vp8_v4l2_m2m"
  2860. vp8_v4l2m2m_encoder_deps="v4l2_m2m vp8_v4l2_m2m"
  2861. vp9_cuvid_decoder_deps="cuvid"
  2862. vp9_mediacodec_decoder_deps="mediacodec"
  2863. vp9_qsv_decoder_select="qsvdec"
  2864. vp9_rkmpp_decoder_deps="rkmpp"
  2865. vp9_vaapi_encoder_deps="VAEncPictureParameterBufferVP9"
  2866. vp9_vaapi_encoder_select="vaapi_encode"
  2867. vp9_qsv_encoder_deps="libmfx MFX_CODEC_VP9"
  2868. vp9_qsv_encoder_select="qsvenc"
  2869. vp9_v4l2m2m_decoder_deps="v4l2_m2m vp9_v4l2_m2m"
  2870. wmv3_crystalhd_decoder_select="crystalhd"
  2871. # parsers
  2872. aac_parser_select="adts_header"
  2873. av1_parser_select="cbs_av1"
  2874. h264_parser_select="golomb h264dsp h264parse"
  2875. hevc_parser_select="hevcparse"
  2876. mpegaudio_parser_select="mpegaudioheader"
  2877. mpegvideo_parser_select="mpegvideo"
  2878. mpeg4video_parser_select="h263dsp mpegvideo qpeldsp"
  2879. vc1_parser_select="vc1dsp"
  2880. # bitstream_filters
  2881. aac_adtstoasc_bsf_select="adts_header"
  2882. av1_frame_merge_bsf_select="cbs_av1"
  2883. av1_frame_split_bsf_select="cbs_av1"
  2884. av1_metadata_bsf_select="cbs_av1"
  2885. eac3_core_bsf_select="ac3_parser"
  2886. filter_units_bsf_select="cbs"
  2887. h264_metadata_bsf_deps="const_nan"
  2888. h264_metadata_bsf_select="cbs_h264"
  2889. h264_redundant_pps_bsf_select="cbs_h264"
  2890. hevc_metadata_bsf_select="cbs_h265"
  2891. mjpeg2jpeg_bsf_select="jpegtables"
  2892. mpeg2_metadata_bsf_select="cbs_mpeg2"
  2893. trace_headers_bsf_select="cbs"
  2894. vp9_metadata_bsf_select="cbs_vp9"
  2895. # external libraries
  2896. aac_at_decoder_deps="audiotoolbox"
  2897. aac_at_decoder_select="aac_adtstoasc_bsf"
  2898. ac3_at_decoder_deps="audiotoolbox"
  2899. ac3_at_decoder_select="ac3_parser"
  2900. adpcm_ima_qt_at_decoder_deps="audiotoolbox"
  2901. alac_at_decoder_deps="audiotoolbox"
  2902. amr_nb_at_decoder_deps="audiotoolbox"
  2903. avisynth_deps_any="libdl LoadLibrary"
  2904. avisynth_demuxer_deps="avisynth"
  2905. avisynth_demuxer_select="riffdec"
  2906. eac3_at_decoder_deps="audiotoolbox"
  2907. eac3_at_decoder_select="ac3_parser"
  2908. gsm_ms_at_decoder_deps="audiotoolbox"
  2909. ilbc_at_decoder_deps="audiotoolbox"
  2910. mp1_at_decoder_deps="audiotoolbox"
  2911. mp2_at_decoder_deps="audiotoolbox"
  2912. mp3_at_decoder_deps="audiotoolbox"
  2913. mp1_at_decoder_select="mpegaudioheader"
  2914. mp2_at_decoder_select="mpegaudioheader"
  2915. mp3_at_decoder_select="mpegaudioheader"
  2916. pcm_alaw_at_decoder_deps="audiotoolbox"
  2917. pcm_mulaw_at_decoder_deps="audiotoolbox"
  2918. qdmc_decoder_select="fft"
  2919. qdmc_at_decoder_deps="audiotoolbox"
  2920. qdm2_at_decoder_deps="audiotoolbox"
  2921. aac_at_encoder_deps="audiotoolbox"
  2922. aac_at_encoder_select="audio_frame_queue"
  2923. alac_at_encoder_deps="audiotoolbox"
  2924. alac_at_encoder_select="audio_frame_queue"
  2925. ilbc_at_encoder_deps="audiotoolbox"
  2926. ilbc_at_encoder_select="audio_frame_queue"
  2927. pcm_alaw_at_encoder_deps="audiotoolbox"
  2928. pcm_alaw_at_encoder_select="audio_frame_queue"
  2929. pcm_mulaw_at_encoder_deps="audiotoolbox"
  2930. pcm_mulaw_at_encoder_select="audio_frame_queue"
  2931. chromaprint_muxer_deps="chromaprint"
  2932. h264_videotoolbox_encoder_deps="pthreads"
  2933. h264_videotoolbox_encoder_select="videotoolbox_encoder"
  2934. hevc_videotoolbox_encoder_deps="pthreads"
  2935. hevc_videotoolbox_encoder_select="videotoolbox_encoder"
  2936. libaom_av1_decoder_deps="libaom"
  2937. libaom_av1_encoder_deps="libaom"
  2938. libaom_av1_encoder_select="extract_extradata_bsf"
  2939. libaribb24_decoder_deps="libaribb24"
  2940. libcelt_decoder_deps="libcelt"
  2941. libcodec2_decoder_deps="libcodec2"
  2942. libcodec2_encoder_deps="libcodec2"
  2943. libdav1d_decoder_deps="libdav1d"
  2944. libdavs2_decoder_deps="libdavs2"
  2945. libfdk_aac_decoder_deps="libfdk_aac"
  2946. libfdk_aac_encoder_deps="libfdk_aac"
  2947. libfdk_aac_encoder_select="audio_frame_queue"
  2948. libgme_demuxer_deps="libgme"
  2949. libgsm_decoder_deps="libgsm"
  2950. libgsm_encoder_deps="libgsm"
  2951. libgsm_ms_decoder_deps="libgsm"
  2952. libgsm_ms_encoder_deps="libgsm"
  2953. libilbc_decoder_deps="libilbc"
  2954. libilbc_encoder_deps="libilbc"
  2955. libkvazaar_encoder_deps="libkvazaar"
  2956. libmodplug_demuxer_deps="libmodplug"
  2957. libmp3lame_encoder_deps="libmp3lame"
  2958. libmp3lame_encoder_select="audio_frame_queue mpegaudioheader"
  2959. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  2960. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  2961. libopencore_amrnb_encoder_select="audio_frame_queue"
  2962. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  2963. libopenh264_decoder_deps="libopenh264"
  2964. libopenh264_decoder_select="h264_mp4toannexb_bsf"
  2965. libopenh264_encoder_deps="libopenh264"
  2966. libopenjpeg_decoder_deps="libopenjpeg"
  2967. libopenjpeg_encoder_deps="libopenjpeg"
  2968. libopenmpt_demuxer_deps="libopenmpt"
  2969. libopus_decoder_deps="libopus"
  2970. libopus_encoder_deps="libopus"
  2971. libopus_encoder_select="audio_frame_queue"
  2972. librav1e_encoder_deps="librav1e"
  2973. librav1e_encoder_select="extract_extradata_bsf"
  2974. librsvg_decoder_deps="librsvg"
  2975. libshine_encoder_deps="libshine"
  2976. libshine_encoder_select="audio_frame_queue"
  2977. libspeex_decoder_deps="libspeex"
  2978. libspeex_encoder_deps="libspeex"
  2979. libspeex_encoder_select="audio_frame_queue"
  2980. libtheora_encoder_deps="libtheora"
  2981. libtwolame_encoder_deps="libtwolame"
  2982. libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
  2983. libvorbis_decoder_deps="libvorbis"
  2984. libvorbis_encoder_deps="libvorbis libvorbisenc"
  2985. libvorbis_encoder_select="audio_frame_queue"
  2986. libvpx_vp8_decoder_deps="libvpx"
  2987. libvpx_vp8_encoder_deps="libvpx"
  2988. libvpx_vp9_decoder_deps="libvpx"
  2989. libvpx_vp9_encoder_deps="libvpx"
  2990. libwavpack_encoder_deps="libwavpack"
  2991. libwavpack_encoder_select="audio_frame_queue"
  2992. libwebp_encoder_deps="libwebp"
  2993. libwebp_anim_encoder_deps="libwebp"
  2994. libx262_encoder_deps="libx262"
  2995. libx264_encoder_deps="libx264"
  2996. libx264rgb_encoder_deps="libx264 x264_csp_bgr"
  2997. libx264rgb_encoder_select="libx264_encoder"
  2998. libx265_encoder_deps="libx265"
  2999. libxavs_encoder_deps="libxavs"
  3000. libxavs2_encoder_deps="libxavs2"
  3001. libxvid_encoder_deps="libxvid"
  3002. libzvbi_teletext_decoder_deps="libzvbi"
  3003. vapoursynth_demuxer_deps="vapoursynth"
  3004. videotoolbox_suggest="coreservices"
  3005. videotoolbox_deps="corefoundation coremedia corevideo"
  3006. videotoolbox_encoder_deps="videotoolbox VTCompressionSessionPrepareToEncodeFrames"
  3007. # demuxers / muxers
  3008. ac3_demuxer_select="ac3_parser"
  3009. act_demuxer_select="riffdec"
  3010. aiff_muxer_select="iso_media"
  3011. asf_demuxer_select="riffdec"
  3012. asf_o_demuxer_select="riffdec"
  3013. asf_muxer_select="riffenc"
  3014. asf_stream_muxer_select="asf_muxer"
  3015. av1_demuxer_select="av1_frame_merge_bsf av1_parser"
  3016. avi_demuxer_select="iso_media riffdec exif"
  3017. avi_muxer_select="riffenc"
  3018. caf_demuxer_select="iso_media riffdec"
  3019. caf_muxer_select="iso_media"
  3020. dash_muxer_select="mp4_muxer"
  3021. dash_demuxer_deps="libxml2"
  3022. dirac_demuxer_select="dirac_parser"
  3023. dts_demuxer_select="dca_parser"
  3024. dtshd_demuxer_select="dca_parser"
  3025. dv_demuxer_select="dvprofile"
  3026. dv_muxer_select="dvprofile"
  3027. dxa_demuxer_select="riffdec"
  3028. eac3_demuxer_select="ac3_parser"
  3029. f4v_muxer_select="mov_muxer"
  3030. fifo_muxer_deps="threads"
  3031. flac_demuxer_select="flac_parser"
  3032. hds_muxer_select="flv_muxer"
  3033. hls_muxer_select="mpegts_muxer"
  3034. hls_muxer_suggest="gcrypt openssl"
  3035. image2_alias_pix_demuxer_select="image2_demuxer"
  3036. image2_brender_pix_demuxer_select="image2_demuxer"
  3037. ipod_muxer_select="mov_muxer"
  3038. ismv_muxer_select="mov_muxer"
  3039. ivf_muxer_select="av1_metadata_bsf vp9_superframe_bsf"
  3040. matroska_audio_muxer_select="matroska_muxer"
  3041. matroska_demuxer_select="iso_media riffdec"
  3042. matroska_demuxer_suggest="bzlib lzo zlib"
  3043. matroska_muxer_select="iso_media riffenc"
  3044. mmf_muxer_select="riffenc"
  3045. mov_demuxer_select="iso_media riffdec"
  3046. mov_demuxer_suggest="zlib"
  3047. mov_muxer_select="iso_media riffenc rtpenc_chain"
  3048. mp3_demuxer_select="mpegaudio_parser"
  3049. mp3_muxer_select="mpegaudioheader"
  3050. mp4_muxer_select="mov_muxer"
  3051. mpegts_demuxer_select="iso_media"
  3052. mpegts_muxer_select="adts_muxer latm_muxer"
  3053. mpegtsraw_demuxer_select="mpegts_demuxer"
  3054. mxf_muxer_select="golomb"
  3055. mxf_d10_muxer_select="mxf_muxer"
  3056. mxf_opatom_muxer_select="mxf_muxer"
  3057. nut_muxer_select="riffenc"
  3058. nuv_demuxer_select="riffdec"
  3059. oga_muxer_select="ogg_muxer"
  3060. ogg_demuxer_select="dirac_parse"
  3061. ogv_muxer_select="ogg_muxer"
  3062. opus_muxer_select="ogg_muxer"
  3063. psp_muxer_select="mov_muxer"
  3064. rtp_demuxer_select="sdp_demuxer"
  3065. rtp_muxer_select="golomb jpegtables"
  3066. rtpdec_select="asf_demuxer jpegtables mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol srtp"
  3067. rtsp_demuxer_select="http_protocol rtpdec"
  3068. rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
  3069. sap_demuxer_select="sdp_demuxer"
  3070. sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
  3071. sdp_demuxer_select="rtpdec"
  3072. smoothstreaming_muxer_select="ismv_muxer"
  3073. spdif_demuxer_select="adts_header"
  3074. spdif_muxer_select="adts_header"
  3075. spx_muxer_select="ogg_muxer"
  3076. swf_demuxer_suggest="zlib"
  3077. tak_demuxer_select="tak_parser"
  3078. tg2_muxer_select="mov_muxer"
  3079. tgp_muxer_select="mov_muxer"
  3080. vobsub_demuxer_select="mpegps_demuxer"
  3081. w64_demuxer_select="wav_demuxer"
  3082. w64_muxer_select="wav_muxer"
  3083. wav_demuxer_select="riffdec"
  3084. wav_muxer_select="riffenc"
  3085. webm_chunk_muxer_select="webm_muxer"
  3086. webm_muxer_select="iso_media riffenc"
  3087. webm_dash_manifest_demuxer_select="matroska_demuxer"
  3088. wtv_demuxer_select="mpegts_demuxer riffdec"
  3089. wtv_muxer_select="mpegts_muxer riffenc"
  3090. xmv_demuxer_select="riffdec"
  3091. xwma_demuxer_select="riffdec"
  3092. # indevs / outdevs
  3093. android_camera_indev_deps="android camera2ndk mediandk pthreads"
  3094. android_camera_indev_extralibs="-landroid -lcamera2ndk -lmediandk"
  3095. alsa_indev_deps="alsa"
  3096. alsa_outdev_deps="alsa"
  3097. avfoundation_indev_deps="avfoundation corevideo coremedia pthreads"
  3098. avfoundation_indev_suggest="coregraphics applicationservices"
  3099. avfoundation_indev_extralibs="-framework Foundation"
  3100. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  3101. caca_outdev_deps="libcaca"
  3102. decklink_deps_any="libdl LoadLibrary"
  3103. decklink_indev_deps="decklink threads"
  3104. decklink_indev_extralibs="-lstdc++"
  3105. decklink_outdev_deps="decklink threads"
  3106. decklink_outdev_suggest="libklvanc"
  3107. decklink_outdev_extralibs="-lstdc++"
  3108. dshow_indev_deps="IBaseFilter"
  3109. dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid -loleaut32 -lshlwapi"
  3110. fbdev_indev_deps="linux_fb_h"
  3111. fbdev_outdev_deps="linux_fb_h"
  3112. gdigrab_indev_deps="CreateDIBSection"
  3113. gdigrab_indev_extralibs="-lgdi32"
  3114. gdigrab_indev_select="bmp_decoder"
  3115. iec61883_indev_deps="libiec61883"
  3116. jack_indev_deps="libjack"
  3117. jack_indev_deps_any="sem_timedwait dispatch_dispatch_h"
  3118. kmsgrab_indev_deps="libdrm"
  3119. lavfi_indev_deps="avfilter"
  3120. libcdio_indev_deps="libcdio"
  3121. libdc1394_indev_deps="libdc1394"
  3122. openal_indev_deps="openal"
  3123. opengl_outdev_deps="opengl"
  3124. opengl_outdev_suggest="sdl2"
  3125. oss_indev_deps_any="sys_soundcard_h"
  3126. oss_outdev_deps_any="sys_soundcard_h"
  3127. pulse_indev_deps="libpulse"
  3128. pulse_outdev_deps="libpulse"
  3129. sdl2_outdev_deps="sdl2"
  3130. sndio_indev_deps="sndio"
  3131. sndio_outdev_deps="sndio"
  3132. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  3133. v4l2_indev_suggest="libv4l2"
  3134. v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h"
  3135. v4l2_outdev_suggest="libv4l2"
  3136. vfwcap_indev_deps="vfw32 vfwcap_defines"
  3137. xcbgrab_indev_deps="libxcb"
  3138. xcbgrab_indev_suggest="libxcb_shm libxcb_shape libxcb_xfixes"
  3139. xv_outdev_deps="xlib"
  3140. # protocols
  3141. async_protocol_deps="threads"
  3142. bluray_protocol_deps="libbluray"
  3143. ffrtmpcrypt_protocol_conflict="librtmp_protocol"
  3144. ffrtmpcrypt_protocol_deps_any="gcrypt gmp openssl mbedtls"
  3145. ffrtmpcrypt_protocol_select="tcp_protocol"
  3146. ffrtmphttp_protocol_conflict="librtmp_protocol"
  3147. ffrtmphttp_protocol_select="http_protocol"
  3148. ftp_protocol_select="tcp_protocol"
  3149. gopher_protocol_select="network"
  3150. http_protocol_select="tcp_protocol"
  3151. http_protocol_suggest="zlib"
  3152. httpproxy_protocol_select="tcp_protocol"
  3153. httpproxy_protocol_suggest="zlib"
  3154. https_protocol_select="tls_protocol"
  3155. https_protocol_suggest="zlib"
  3156. icecast_protocol_select="http_protocol"
  3157. mmsh_protocol_select="http_protocol"
  3158. mmst_protocol_select="network"
  3159. rtmp_protocol_conflict="librtmp_protocol"
  3160. rtmp_protocol_select="tcp_protocol"
  3161. rtmp_protocol_suggest="zlib"
  3162. rtmpe_protocol_select="ffrtmpcrypt_protocol"
  3163. rtmpe_protocol_suggest="zlib"
  3164. rtmps_protocol_conflict="librtmp_protocol"
  3165. rtmps_protocol_select="tls_protocol"
  3166. rtmps_protocol_suggest="zlib"
  3167. rtmpt_protocol_select="ffrtmphttp_protocol"
  3168. rtmpt_protocol_suggest="zlib"
  3169. rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
  3170. rtmpte_protocol_suggest="zlib"
  3171. rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
  3172. rtmpts_protocol_suggest="zlib"
  3173. rtp_protocol_select="udp_protocol"
  3174. schannel_conflict="openssl gnutls libtls mbedtls"
  3175. sctp_protocol_deps="struct_sctp_event_subscribe struct_msghdr_msg_flags"
  3176. sctp_protocol_select="network"
  3177. securetransport_conflict="openssl gnutls libtls mbedtls"
  3178. srtp_protocol_select="rtp_protocol srtp"
  3179. tcp_protocol_select="network"
  3180. tls_protocol_deps_any="gnutls openssl schannel securetransport libtls mbedtls"
  3181. tls_protocol_select="tcp_protocol"
  3182. udp_protocol_select="network"
  3183. udplite_protocol_select="network"
  3184. unix_protocol_deps="sys_un_h"
  3185. unix_protocol_select="network"
  3186. # external library protocols
  3187. libamqp_protocol_deps="librabbitmq"
  3188. libamqp_protocol_select="network"
  3189. librtmp_protocol_deps="librtmp"
  3190. librtmpe_protocol_deps="librtmp"
  3191. librtmps_protocol_deps="librtmp"
  3192. librtmpt_protocol_deps="librtmp"
  3193. librtmpte_protocol_deps="librtmp"
  3194. libsmbclient_protocol_deps="libsmbclient gplv3"
  3195. libsrt_protocol_deps="libsrt"
  3196. libsrt_protocol_select="network"
  3197. libssh_protocol_deps="libssh"
  3198. libtls_conflict="openssl gnutls mbedtls"
  3199. libzmq_protocol_deps="libzmq"
  3200. libzmq_protocol_select="network"
  3201. # filters
  3202. afftdn_filter_deps="avcodec"
  3203. afftdn_filter_select="fft"
  3204. afftfilt_filter_deps="avcodec"
  3205. afftfilt_filter_select="fft"
  3206. afir_filter_deps="avcodec"
  3207. afir_filter_select="rdft"
  3208. amovie_filter_deps="avcodec avformat"
  3209. aresample_filter_deps="swresample"
  3210. asr_filter_deps="pocketsphinx"
  3211. ass_filter_deps="libass"
  3212. atempo_filter_deps="avcodec"
  3213. atempo_filter_select="rdft"
  3214. avgblur_opencl_filter_deps="opencl"
  3215. avgblur_vulkan_filter_deps="vulkan libglslang"
  3216. azmq_filter_deps="libzmq"
  3217. blackframe_filter_deps="gpl"
  3218. bm3d_filter_deps="avcodec"
  3219. bm3d_filter_select="dct"
  3220. boxblur_filter_deps="gpl"
  3221. boxblur_opencl_filter_deps="opencl gpl"
  3222. bs2b_filter_deps="libbs2b"
  3223. chromaber_vulkan_filter_deps="vulkan libglslang"
  3224. colorkey_opencl_filter_deps="opencl"
  3225. colormatrix_filter_deps="gpl"
  3226. convolution_opencl_filter_deps="opencl"
  3227. convolve_filter_deps="avcodec"
  3228. convolve_filter_select="fft"
  3229. coreimage_filter_deps="coreimage appkit"
  3230. coreimage_filter_extralibs="-framework OpenGL"
  3231. coreimagesrc_filter_deps="coreimage appkit"
  3232. coreimagesrc_filter_extralibs="-framework OpenGL"
  3233. cover_rect_filter_deps="avcodec avformat gpl"
  3234. cropdetect_filter_deps="gpl"
  3235. deconvolve_filter_deps="avcodec"
  3236. deconvolve_filter_select="fft"
  3237. deinterlace_qsv_filter_deps="libmfx"
  3238. deinterlace_vaapi_filter_deps="vaapi"
  3239. delogo_filter_deps="gpl"
  3240. denoise_vaapi_filter_deps="vaapi"
  3241. derain_filter_select="dnn"
  3242. deshake_filter_select="pixelutils"
  3243. deshake_opencl_filter_deps="opencl"
  3244. dilation_opencl_filter_deps="opencl"
  3245. dnn_processing_filter_deps="swscale"
  3246. dnn_processing_filter_select="dnn"
  3247. drawtext_filter_deps="libfreetype"
  3248. drawtext_filter_suggest="libfontconfig libfribidi"
  3249. elbg_filter_deps="avcodec"
  3250. eq_filter_deps="gpl"
  3251. erosion_opencl_filter_deps="opencl"
  3252. fftfilt_filter_deps="avcodec"
  3253. fftfilt_filter_select="rdft"
  3254. fftdnoiz_filter_deps="avcodec"
  3255. fftdnoiz_filter_select="fft"
  3256. find_rect_filter_deps="avcodec avformat gpl"
  3257. firequalizer_filter_deps="avcodec"
  3258. firequalizer_filter_select="rdft"
  3259. flite_filter_deps="libflite"
  3260. framerate_filter_select="scene_sad"
  3261. freezedetect_filter_select="scene_sad"
  3262. frei0r_filter_deps="frei0r libdl"
  3263. frei0r_src_filter_deps="frei0r libdl"
  3264. fspp_filter_deps="gpl"
  3265. headphone_filter_select="fft"
  3266. histeq_filter_deps="gpl"
  3267. hqdn3d_filter_deps="gpl"
  3268. interlace_filter_deps="gpl"
  3269. kerndeint_filter_deps="gpl"
  3270. ladspa_filter_deps="ladspa libdl"
  3271. lensfun_filter_deps="liblensfun version3"
  3272. lv2_filter_deps="lv2"
  3273. mcdeint_filter_deps="avcodec gpl"
  3274. movie_filter_deps="avcodec avformat"
  3275. mpdecimate_filter_deps="gpl"
  3276. mpdecimate_filter_select="pixelutils"
  3277. minterpolate_filter_select="scene_sad"
  3278. mptestsrc_filter_deps="gpl"
  3279. negate_filter_deps="lut_filter"
  3280. nlmeans_opencl_filter_deps="opencl"
  3281. nnedi_filter_deps="gpl"
  3282. ocr_filter_deps="libtesseract"
  3283. ocv_filter_deps="libopencv"
  3284. openclsrc_filter_deps="opencl"
  3285. overlay_opencl_filter_deps="opencl"
  3286. overlay_qsv_filter_deps="libmfx"
  3287. overlay_qsv_filter_select="qsvvpp"
  3288. overlay_vulkan_filter_deps="vulkan libglslang"
  3289. owdenoise_filter_deps="gpl"
  3290. pad_opencl_filter_deps="opencl"
  3291. pan_filter_deps="swresample"
  3292. perspective_filter_deps="gpl"
  3293. phase_filter_deps="gpl"
  3294. pp7_filter_deps="gpl"
  3295. pp_filter_deps="gpl postproc"
  3296. prewitt_opencl_filter_deps="opencl"
  3297. procamp_vaapi_filter_deps="vaapi"
  3298. program_opencl_filter_deps="opencl"
  3299. pullup_filter_deps="gpl"
  3300. removelogo_filter_deps="avcodec avformat swscale"
  3301. repeatfields_filter_deps="gpl"
  3302. resample_filter_deps="avresample"
  3303. roberts_opencl_filter_deps="opencl"
  3304. rubberband_filter_deps="librubberband"
  3305. sab_filter_deps="gpl swscale"
  3306. scale2ref_filter_deps="swscale"
  3307. scale_filter_deps="swscale"
  3308. scale_qsv_filter_deps="libmfx"
  3309. select_filter_select="scene_sad"
  3310. sharpness_vaapi_filter_deps="vaapi"
  3311. showcqt_filter_deps="avcodec avformat swscale"
  3312. showcqt_filter_suggest="libfontconfig libfreetype"
  3313. showcqt_filter_select="fft"
  3314. showfreqs_filter_deps="avcodec"
  3315. showfreqs_filter_select="fft"
  3316. showspatial_filter_select="fft"
  3317. showspectrum_filter_deps="avcodec"
  3318. showspectrum_filter_select="fft"
  3319. showspectrumpic_filter_deps="avcodec"
  3320. showspectrumpic_filter_select="fft"
  3321. signature_filter_deps="gpl avcodec avformat"
  3322. sinc_filter_select="rdft"
  3323. smartblur_filter_deps="gpl swscale"
  3324. sobel_opencl_filter_deps="opencl"
  3325. sofalizer_filter_deps="libmysofa avcodec"
  3326. sofalizer_filter_select="fft"
  3327. spectrumsynth_filter_deps="avcodec"
  3328. spectrumsynth_filter_select="fft"
  3329. spp_filter_deps="gpl avcodec"
  3330. spp_filter_select="fft idctdsp fdctdsp me_cmp pixblockdsp"
  3331. sr_filter_deps="avformat swscale"
  3332. sr_filter_select="dnn"
  3333. stereo3d_filter_deps="gpl"
  3334. subtitles_filter_deps="avformat avcodec libass"
  3335. super2xsai_filter_deps="gpl"
  3336. pixfmts_super2xsai_test_deps="super2xsai_filter"
  3337. superequalizer_filter_select="rdft"
  3338. surround_filter_select="rdft"
  3339. tinterlace_filter_deps="gpl"
  3340. tinterlace_merge_test_deps="tinterlace_filter"
  3341. tinterlace_pad_test_deps="tinterlace_filter"
  3342. tonemap_filter_deps="const_nan"
  3343. tonemap_vaapi_filter_deps="vaapi VAProcFilterParameterBufferHDRToneMapping"
  3344. tonemap_opencl_filter_deps="opencl const_nan"
  3345. transpose_opencl_filter_deps="opencl"
  3346. transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags"
  3347. unsharp_opencl_filter_deps="opencl"
  3348. uspp_filter_deps="gpl avcodec"
  3349. vaguedenoiser_filter_deps="gpl"
  3350. vidstabdetect_filter_deps="libvidstab"
  3351. vidstabtransform_filter_deps="libvidstab"
  3352. libvmaf_filter_deps="libvmaf pthreads"
  3353. zmq_filter_deps="libzmq"
  3354. zoompan_filter_deps="swscale"
  3355. zscale_filter_deps="libzimg const_nan"
  3356. scale_vaapi_filter_deps="vaapi"
  3357. scale_vulkan_filter_deps="vulkan libglslang"
  3358. vpp_qsv_filter_deps="libmfx"
  3359. vpp_qsv_filter_select="qsvvpp"
  3360. xfade_opencl_filter_deps="opencl"
  3361. yadif_cuda_filter_deps="ffnvcodec"
  3362. yadif_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
  3363. # examples
  3364. avio_list_dir_deps="avformat avutil"
  3365. avio_reading_deps="avformat avcodec avutil"
  3366. decode_audio_example_deps="avcodec avutil"
  3367. decode_video_example_deps="avcodec avutil"
  3368. demuxing_decoding_example_deps="avcodec avformat avutil"
  3369. encode_audio_example_deps="avcodec avutil"
  3370. encode_video_example_deps="avcodec avutil"
  3371. extract_mvs_example_deps="avcodec avformat avutil"
  3372. filter_audio_example_deps="avfilter avutil"
  3373. filtering_audio_example_deps="avfilter avcodec avformat avutil"
  3374. filtering_video_example_deps="avfilter avcodec avformat avutil"
  3375. http_multiclient_example_deps="avformat avutil fork"
  3376. hw_decode_example_deps="avcodec avformat avutil"
  3377. metadata_example_deps="avformat avutil"
  3378. muxing_example_deps="avcodec avformat avutil swscale"
  3379. qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder"
  3380. remuxing_example_deps="avcodec avformat avutil"
  3381. resampling_audio_example_deps="avutil swresample"
  3382. scaling_video_example_deps="avutil swscale"
  3383. transcode_aac_example_deps="avcodec avformat swresample"
  3384. transcoding_example_deps="avfilter avcodec avformat avutil"
  3385. vaapi_encode_example_deps="avcodec avutil h264_vaapi_encoder"
  3386. vaapi_transcode_example_deps="avcodec avformat avutil h264_vaapi_encoder"
  3387. # EXTRALIBS_LIST
  3388. cpu_init_extralibs="pthreads_extralibs"
  3389. cws2fws_extralibs="zlib_extralibs"
  3390. # libraries, in any order
  3391. avcodec_deps="avutil"
  3392. avcodec_suggest="libm"
  3393. avcodec_select="null_bsf"
  3394. avdevice_deps="avformat avcodec avutil"
  3395. avdevice_suggest="libm"
  3396. avfilter_deps="avutil"
  3397. avfilter_suggest="libm"
  3398. avformat_deps="avcodec avutil"
  3399. avformat_suggest="libm network zlib"
  3400. avresample_deps="avutil"
  3401. avresample_suggest="libm"
  3402. avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx opencl user32 vaapi vulkan videotoolbox corefoundation corevideo coremedia bcrypt"
  3403. postproc_deps="avutil gpl"
  3404. postproc_suggest="libm"
  3405. swresample_deps="avutil"
  3406. swresample_suggest="libm libsoxr"
  3407. swscale_deps="avutil"
  3408. swscale_suggest="libm"
  3409. avcodec_extralibs="pthreads_extralibs iconv_extralibs dxva2_extralibs"
  3410. avfilter_extralibs="pthreads_extralibs"
  3411. avutil_extralibs="d3d11va_extralibs nanosleep_extralibs pthreads_extralibs vaapi_drm_extralibs vaapi_x11_extralibs vdpau_x11_extralibs"
  3412. # programs
  3413. ffmpeg_deps="avcodec avfilter avformat"
  3414. ffmpeg_select="aformat_filter anull_filter atrim_filter format_filter
  3415. hflip_filter null_filter
  3416. transpose_filter trim_filter vflip_filter"
  3417. ffmpeg_suggest="ole32 psapi shell32"
  3418. ffplay_deps="avcodec avformat swscale swresample sdl2"
  3419. ffplay_select="rdft crop_filter transpose_filter hflip_filter vflip_filter rotate_filter"
  3420. ffplay_suggest="shell32"
  3421. ffprobe_deps="avcodec avformat"
  3422. ffprobe_suggest="shell32"
  3423. # documentation
  3424. podpages_deps="perl"
  3425. manpages_deps="perl pod2man"
  3426. htmlpages_deps="perl"
  3427. htmlpages_deps_any="makeinfo_html texi2html"
  3428. txtpages_deps="perl makeinfo"
  3429. doc_deps_any="manpages htmlpages podpages txtpages"
  3430. # default parameters
  3431. logfile="ffbuild/config.log"
  3432. # installation paths
  3433. prefix_default="/usr/local"
  3434. bindir_default='${prefix}/bin'
  3435. datadir_default='${prefix}/share/ffmpeg'
  3436. docdir_default='${prefix}/share/doc/ffmpeg'
  3437. incdir_default='${prefix}/include'
  3438. libdir_default='${prefix}/lib'
  3439. mandir_default='${prefix}/share/man'
  3440. # toolchain
  3441. ar_default="ar"
  3442. cc_default="gcc"
  3443. cxx_default="g++"
  3444. host_cc_default="gcc"
  3445. doxygen_default="doxygen"
  3446. install="install"
  3447. ln_s_default="ln -s -f"
  3448. nm_default="nm -g"
  3449. pkg_config_default=pkg-config
  3450. ranlib_default="ranlib"
  3451. strip_default="strip"
  3452. version_script='--version-script'
  3453. objformat="elf32"
  3454. x86asmexe_default="nasm"
  3455. windres_default="windres"
  3456. striptype="direct"
  3457. # OS
  3458. target_os_default=$(tolower $(uname -s))
  3459. host_os=$target_os_default
  3460. # machine
  3461. if test "$target_os_default" = aix; then
  3462. arch_default=$(uname -p)
  3463. strip_default="strip -X32_64"
  3464. nm_default="nm -g -X32_64"
  3465. else
  3466. arch_default=$(uname -m)
  3467. fi
  3468. cpu="generic"
  3469. intrinsics="none"
  3470. # configurable options
  3471. enable $PROGRAM_LIST
  3472. enable $DOCUMENT_LIST
  3473. enable $EXAMPLE_LIST
  3474. enable $(filter_out avresample $LIBRARY_LIST)
  3475. enable stripping
  3476. enable asm
  3477. enable debug
  3478. enable doc
  3479. enable faan faandct faanidct
  3480. enable large_tests
  3481. enable optimizations
  3482. enable runtime_cpudetect
  3483. enable safe_bitstream_reader
  3484. enable static
  3485. enable swscale_alpha
  3486. enable valgrind_backtrace
  3487. sws_max_filter_size_default=256
  3488. set_default sws_max_filter_size
  3489. # internal components are enabled by default
  3490. enable $EXTRALIBS_LIST
  3491. # Avoid external, non-system, libraries getting enabled by dependency resolution
  3492. disable $EXTERNAL_LIBRARY_LIST $HWACCEL_LIBRARY_LIST
  3493. # build settings
  3494. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  3495. LIBPREF="lib"
  3496. LIBSUF=".a"
  3497. FULLNAME='$(NAME)$(BUILDSUF)'
  3498. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  3499. SLIBPREF="lib"
  3500. SLIBSUF=".so"
  3501. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  3502. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  3503. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  3504. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  3505. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
  3506. SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
  3507. VERSION_SCRIPT_POSTPROCESS_CMD="cat"
  3508. asflags_filter=echo
  3509. cflags_filter=echo
  3510. ldflags_filter=echo
  3511. AS_C='-c'
  3512. AS_O='-o $@'
  3513. CC_C='-c'
  3514. CC_E='-E -o $@'
  3515. CC_O='-o $@'
  3516. CXX_C='-c'
  3517. CXX_O='-o $@'
  3518. OBJCC_C='-c'
  3519. OBJCC_E='-E -o $@'
  3520. OBJCC_O='-o $@'
  3521. X86ASM_O='-o $@'
  3522. LD_O='-o $@'
  3523. LD_LIB='-l%'
  3524. LD_PATH='-L'
  3525. HOSTCC_C='-c'
  3526. HOSTCC_E='-E -o $@'
  3527. HOSTCC_O='-o $@'
  3528. HOSTLD_O='-o $@'
  3529. NVCC_C='-c'
  3530. NVCC_O='-o $@'
  3531. host_extralibs='-lm'
  3532. host_cflags_filter=echo
  3533. host_ldflags_filter=echo
  3534. target_path='$(CURDIR)'
  3535. # since the object filename is not given with the -MM flag, the compiler
  3536. # is only able to print the basename, and we must add the path ourselves
  3537. DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>/dev/null | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(@F),$(@D)/$(@F)," > $(@:.o=.d)'
  3538. DEPFLAGS='-MM'
  3539. mkdir -p ffbuild
  3540. # find source path
  3541. if test -f configure; then
  3542. source_path=.
  3543. elif test -f src/configure; then
  3544. source_path=src
  3545. else
  3546. source_path=$(cd $(dirname "$0"); pwd)
  3547. case "$source_path" in
  3548. *[[:blank:]]*) die "Out of tree builds are impossible with whitespace in source path." ;;
  3549. esac
  3550. test -e "$source_path/config.h" &&
  3551. die "Out of tree builds are impossible with config.h in source dir."
  3552. fi
  3553. for v in "$@"; do
  3554. r=${v#*=}
  3555. l=${v%"$r"}
  3556. r=$(sh_quote "$r")
  3557. FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
  3558. done
  3559. find_things_extern(){
  3560. thing=$1
  3561. pattern=$2
  3562. file=$source_path/$3
  3563. out=${4:-$thing}
  3564. sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$out/p" "$file"
  3565. }
  3566. find_filters_extern(){
  3567. file=$source_path/$1
  3568. sed -n 's/^extern AVFilter ff_[avfsinkrc]\{2,5\}_\([[:alnum:]_]\{1,\}\);/\1_filter/p' $file
  3569. }
  3570. FILTER_LIST=$(find_filters_extern libavfilter/allfilters.c)
  3571. OUTDEV_LIST=$(find_things_extern muxer AVOutputFormat libavdevice/alldevices.c outdev)
  3572. INDEV_LIST=$(find_things_extern demuxer AVInputFormat libavdevice/alldevices.c indev)
  3573. MUXER_LIST=$(find_things_extern muxer AVOutputFormat libavformat/allformats.c)
  3574. DEMUXER_LIST=$(find_things_extern demuxer AVInputFormat libavformat/allformats.c)
  3575. ENCODER_LIST=$(find_things_extern encoder AVCodec libavcodec/allcodecs.c)
  3576. DECODER_LIST=$(find_things_extern decoder AVCodec libavcodec/allcodecs.c)
  3577. CODEC_LIST="
  3578. $ENCODER_LIST
  3579. $DECODER_LIST
  3580. "
  3581. PARSER_LIST=$(find_things_extern parser AVCodecParser libavcodec/parsers.c)
  3582. BSF_LIST=$(find_things_extern bsf AVBitStreamFilter libavcodec/bitstream_filters.c)
  3583. HWACCEL_LIST=$(find_things_extern hwaccel AVHWAccel libavcodec/hwaccels.h)
  3584. PROTOCOL_LIST=$(find_things_extern protocol URLProtocol libavformat/protocols.c)
  3585. AVCODEC_COMPONENTS_LIST="
  3586. $BSF_LIST
  3587. $DECODER_LIST
  3588. $ENCODER_LIST
  3589. $HWACCEL_LIST
  3590. $PARSER_LIST
  3591. "
  3592. AVDEVICE_COMPONENTS_LIST="
  3593. $INDEV_LIST
  3594. $OUTDEV_LIST
  3595. "
  3596. AVFILTER_COMPONENTS_LIST="
  3597. $FILTER_LIST
  3598. "
  3599. AVFORMAT_COMPONENTS_LIST="
  3600. $DEMUXER_LIST
  3601. $MUXER_LIST
  3602. $PROTOCOL_LIST
  3603. "
  3604. ALL_COMPONENTS="
  3605. $AVCODEC_COMPONENTS_LIST
  3606. $AVDEVICE_COMPONENTS_LIST
  3607. $AVFILTER_COMPONENTS_LIST
  3608. $AVFORMAT_COMPONENTS_LIST
  3609. "
  3610. for n in $COMPONENT_LIST; do
  3611. v=$(toupper ${n%s})_LIST
  3612. eval enable \$$v
  3613. eval ${n}_if_any="\$$v"
  3614. done
  3615. enable $ARCH_EXT_LIST
  3616. die_unknown(){
  3617. echo "Unknown option \"$1\"."
  3618. echo "See $0 --help for available options."
  3619. exit 1
  3620. }
  3621. print_in_columns() {
  3622. tr ' ' '\n' | sort | tr '\r\n' ' ' | awk -v col_width=24 -v width="$ncols" '
  3623. {
  3624. num_cols = width > col_width ? int(width / col_width) : 1;
  3625. num_rows = int((NF + num_cols-1) / num_cols);
  3626. y = x = 1;
  3627. for (y = 1; y <= num_rows; y++) {
  3628. i = y;
  3629. for (x = 1; x <= num_cols; x++) {
  3630. if (i <= NF) {
  3631. line = sprintf("%s%-" col_width "s", line, $i);
  3632. }
  3633. i = i + num_rows;
  3634. }
  3635. print line; line = "";
  3636. }
  3637. }' | sed 's/ *$//'
  3638. }
  3639. show_list() {
  3640. suffix=_$1
  3641. shift
  3642. echo $* | sed s/$suffix//g | print_in_columns
  3643. exit 0
  3644. }
  3645. rand_list(){
  3646. IFS=', '
  3647. set -- $*
  3648. unset IFS
  3649. for thing; do
  3650. comp=${thing%:*}
  3651. prob=${thing#$comp}
  3652. prob=${prob#:}
  3653. is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
  3654. echo "prob ${prob:-0.5}"
  3655. printf '%s\n' $comp
  3656. done
  3657. }
  3658. do_random(){
  3659. action=$1
  3660. shift
  3661. random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
  3662. $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
  3663. }
  3664. for opt do
  3665. optval="${opt#*=}"
  3666. case "$opt" in
  3667. --extra-ldflags=*)
  3668. add_ldflags $optval
  3669. ;;
  3670. --extra-ldexeflags=*)
  3671. add_ldexeflags $optval
  3672. ;;
  3673. --extra-ldsoflags=*)
  3674. add_ldsoflags $optval
  3675. ;;
  3676. --extra-ldlibflags=*)
  3677. warn "The --extra-ldlibflags option is only provided for compatibility and will be\n"\
  3678. "removed in the future. Use --extra-ldsoflags instead."
  3679. add_ldsoflags $optval
  3680. ;;
  3681. --extra-libs=*)
  3682. add_extralibs $optval
  3683. ;;
  3684. --disable-devices)
  3685. disable $INDEV_LIST $OUTDEV_LIST
  3686. ;;
  3687. --enable-debug=*)
  3688. debuglevel="$optval"
  3689. ;;
  3690. --disable-programs)
  3691. disable $PROGRAM_LIST
  3692. ;;
  3693. --disable-everything)
  3694. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  3695. ;;
  3696. --disable-all)
  3697. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  3698. disable $LIBRARY_LIST $PROGRAM_LIST doc
  3699. enable avutil
  3700. ;;
  3701. --enable-random|--disable-random)
  3702. action=${opt%%-random}
  3703. do_random ${action#--} $COMPONENT_LIST
  3704. ;;
  3705. --enable-random=*|--disable-random=*)
  3706. action=${opt%%-random=*}
  3707. do_random ${action#--} $optval
  3708. ;;
  3709. --enable-sdl)
  3710. enable sdl2
  3711. ;;
  3712. --enable-*=*|--disable-*=*)
  3713. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  3714. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  3715. eval list=\$$(toupper $thing)_LIST
  3716. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  3717. list=$(filter "$name" $list)
  3718. [ "$list" = "" ] && warn "Option $opt did not match anything"
  3719. test $action = enable && warn_if_gets_disabled $list
  3720. $action $list
  3721. ;;
  3722. --enable-yasm|--disable-yasm)
  3723. warn "The ${opt} option is only provided for compatibility and will be\n"\
  3724. "removed in the future. Use --enable-x86asm / --disable-x86asm instead."
  3725. test $opt = --enable-yasm && x86asm=yes || x86asm=no
  3726. ;;
  3727. --yasmexe=*)
  3728. warn "The --yasmexe option is only provided for compatibility and will be\n"\
  3729. "removed in the future. Use --x86asmexe instead."
  3730. x86asmexe="$optval"
  3731. ;;
  3732. --enable-?*|--disable-?*)
  3733. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  3734. if is_in $option $COMPONENT_LIST; then
  3735. test $action = disable && action=unset
  3736. eval $action \$$(toupper ${option%s})_LIST
  3737. elif is_in $option $CMDLINE_SELECT; then
  3738. $action $option
  3739. else
  3740. die_unknown $opt
  3741. fi
  3742. ;;
  3743. --list-*)
  3744. NAME="${opt#--list-}"
  3745. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  3746. NAME=${NAME%s}
  3747. eval show_list $NAME \$$(toupper $NAME)_LIST
  3748. ;;
  3749. --help|-h) show_help
  3750. ;;
  3751. --quiet|-q) quiet=yes
  3752. ;;
  3753. --fatal-warnings) enable fatal_warnings
  3754. ;;
  3755. --libfuzzer=*)
  3756. libfuzzer_path="$optval"
  3757. ;;
  3758. *)
  3759. optname="${opt%%=*}"
  3760. optname="${optname#--}"
  3761. optname=$(echo "$optname" | sed 's/-/_/g')
  3762. if is_in $optname $CMDLINE_SET; then
  3763. eval $optname='$optval'
  3764. elif is_in $optname $CMDLINE_APPEND; then
  3765. append $optname "$optval"
  3766. else
  3767. die_unknown $opt
  3768. fi
  3769. ;;
  3770. esac
  3771. done
  3772. for e in $env; do
  3773. eval "export $e"
  3774. done
  3775. if disabled autodetect; then
  3776. # Unless iconv is explicitely disabled by the user, we still want to probe
  3777. # for the iconv from the libc.
  3778. disabled iconv || enable libc_iconv
  3779. disable_weak $EXTERNAL_AUTODETECT_LIBRARY_LIST
  3780. disable_weak $HWACCEL_AUTODETECT_LIBRARY_LIST
  3781. fi
  3782. # Mark specifically enabled, but normally autodetected libraries as requested.
  3783. for lib in $AUTODETECT_LIBS; do
  3784. enabled $lib && request $lib
  3785. done
  3786. #TODO: switch to $AUTODETECT_LIBS when $THREADS_LIST is supported the same way
  3787. enable_weak $EXTERNAL_AUTODETECT_LIBRARY_LIST
  3788. enable_weak $HWACCEL_AUTODETECT_LIBRARY_LIST
  3789. disabled logging && logfile=/dev/null
  3790. # command line configuration sanity checks
  3791. # we need to build at least one lib type
  3792. if ! enabled_any static shared; then
  3793. cat <<EOF
  3794. At least one library type must be built.
  3795. Specify --enable-static to build the static libraries or --enable-shared to
  3796. build the shared libraries as well. To only build the shared libraries specify
  3797. --disable-static in addition to --enable-shared.
  3798. EOF
  3799. exit 1
  3800. fi
  3801. die_license_disabled() {
  3802. enabled $1 || { enabled $v && die "$v is $1 and --enable-$1 is not specified."; }
  3803. }
  3804. die_license_disabled_gpl() {
  3805. enabled $1 || { enabled $v && die "$v is incompatible with the gpl and --enable-$1 is not specified."; }
  3806. }
  3807. map "die_license_disabled gpl" $EXTERNAL_LIBRARY_GPL_LIST $EXTERNAL_LIBRARY_GPLV3_LIST
  3808. map "die_license_disabled version3" $EXTERNAL_LIBRARY_VERSION3_LIST $EXTERNAL_LIBRARY_GPLV3_LIST
  3809. enabled gpl && map "die_license_disabled_gpl nonfree" $EXTERNAL_LIBRARY_NONFREE_LIST
  3810. map "die_license_disabled nonfree" $HWACCEL_LIBRARY_NONFREE_LIST
  3811. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  3812. if enabled nonfree; then
  3813. license="nonfree and unredistributable"
  3814. elif enabled gplv3; then
  3815. license="GPL version 3 or later"
  3816. elif enabled lgplv3; then
  3817. license="LGPL version 3 or later"
  3818. elif enabled gpl; then
  3819. license="GPL version 2 or later"
  3820. else
  3821. license="LGPL version 2.1 or later"
  3822. fi
  3823. enabled_all gnutls openssl &&
  3824. die "GnuTLS and OpenSSL must not be enabled at the same time."
  3825. enabled_all gnutls mbedtls &&
  3826. die "GnuTLS and mbedTLS must not be enabled at the same time."
  3827. enabled_all openssl mbedtls &&
  3828. die "OpenSSL and mbedTLS must not be enabled at the same time."
  3829. # Disable all the library-specific components if the library itself
  3830. # is disabled, see AVCODEC_LIST and following _LIST variables.
  3831. disable_components(){
  3832. disabled ${1} && disable $(
  3833. eval components="\$$(toupper ${1})_COMPONENTS"
  3834. map 'eval echo \${$(toupper ${v%s})_LIST}' $components
  3835. )
  3836. }
  3837. map 'disable_components $v' $LIBRARY_LIST
  3838. echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
  3839. set >> $logfile
  3840. test -n "$valgrind" && toolchain="valgrind-memcheck"
  3841. enabled ossfuzz && ! echo $CFLAGS | grep -q -- "-fsanitize=" && ! echo $CFLAGS | grep -q -- "-fcoverage-mapping" &&{
  3842. add_cflags -fsanitize=address,undefined -fsanitize-coverage=trace-pc-guard,trace-cmp -fno-omit-frame-pointer
  3843. add_ldflags -fsanitize=address,undefined -fsanitize-coverage=trace-pc-guard,trace-cmp
  3844. }
  3845. case "$toolchain" in
  3846. *-asan)
  3847. cc_default="${toolchain%-asan}"
  3848. add_cflags -fsanitize=address
  3849. add_ldflags -fsanitize=address
  3850. ;;
  3851. *-msan)
  3852. cc_default="${toolchain%-msan}"
  3853. add_cflags -fsanitize=memory -fsanitize-memory-track-origins
  3854. add_ldflags -fsanitize=memory
  3855. ;;
  3856. *-tsan)
  3857. cc_default="${toolchain%-tsan}"
  3858. add_cflags -fsanitize=thread
  3859. add_ldflags -fsanitize=thread
  3860. case "$toolchain" in
  3861. gcc-tsan)
  3862. add_cflags -fPIC
  3863. add_ldflags -fPIC
  3864. ;;
  3865. esac
  3866. ;;
  3867. *-usan)
  3868. cc_default="${toolchain%-usan}"
  3869. add_cflags -fsanitize=undefined
  3870. add_ldflags -fsanitize=undefined
  3871. ;;
  3872. valgrind-*)
  3873. target_exec_default="valgrind"
  3874. case "$toolchain" in
  3875. valgrind-massif)
  3876. target_exec_args="--tool=massif --alloc-fn=av_malloc --alloc-fn=av_mallocz --alloc-fn=av_calloc --alloc-fn=av_fast_padded_malloc --alloc-fn=av_fast_malloc --alloc-fn=av_realloc_f --alloc-fn=av_fast_realloc --alloc-fn=av_realloc"
  3877. ;;
  3878. valgrind-memcheck)
  3879. target_exec_args="--error-exitcode=1 --malloc-fill=0x2a --track-origins=yes --leak-check=full --gen-suppressions=all --suppressions=$source_path/tests/fate-valgrind.supp"
  3880. ;;
  3881. esac
  3882. ;;
  3883. msvc)
  3884. # Check whether the current MSVC version needs the C99 converter.
  3885. # From MSVC 2013 (compiler major version 18) onwards, it does actually
  3886. # support enough of C99 to build ffmpeg. Default to the new
  3887. # behaviour if the regexp was unable to match anything, since this
  3888. # successfully parses the version number of existing supported
  3889. # versions that require the converter (MSVC 2010 and 2012).
  3890. cl_major_ver=$(cl.exe 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
  3891. if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
  3892. cc_default="cl.exe"
  3893. cxx_default="cl.exe"
  3894. else
  3895. die "Unsupported MSVC version (2013 or newer required)"
  3896. fi
  3897. ld_default="$source_path/compat/windows/mslink"
  3898. nm_default="dumpbin.exe -symbols"
  3899. ar_default="lib.exe"
  3900. case "$arch" in
  3901. aarch64|arm64)
  3902. as_default="armasm64.exe"
  3903. ;;
  3904. arm*)
  3905. as_default="armasm.exe"
  3906. ;;
  3907. esac
  3908. target_os_default="win32"
  3909. # Use a relative path for TMPDIR. This makes sure all the
  3910. # ffconf temp files are written with a relative path, avoiding
  3911. # issues with msys/win32 path conversion for MSVC parameters
  3912. # such as -Fo<file> or -out:<file>.
  3913. TMPDIR=.
  3914. ;;
  3915. icl)
  3916. cc_default="icl"
  3917. ld_default="xilink"
  3918. nm_default="dumpbin -symbols"
  3919. ar_default="xilib"
  3920. target_os_default="win32"
  3921. TMPDIR=.
  3922. ;;
  3923. gcov)
  3924. add_cflags -fprofile-arcs -ftest-coverage
  3925. add_ldflags -fprofile-arcs -ftest-coverage
  3926. ;;
  3927. llvm-cov)
  3928. add_cflags -fprofile-arcs -ftest-coverage
  3929. add_ldflags --coverage
  3930. ;;
  3931. hardened)
  3932. add_cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
  3933. add_cflags -fno-strict-overflow -fstack-protector-all
  3934. add_ldflags -Wl,-z,relro -Wl,-z,now
  3935. add_cflags -fPIE
  3936. add_ldexeflags -fPIE -pie
  3937. ;;
  3938. ?*)
  3939. die "Unknown toolchain $toolchain"
  3940. ;;
  3941. esac
  3942. if test -n "$cross_prefix"; then
  3943. test -n "$arch" && test -n "$target_os" ||
  3944. die "Must specify target arch (--arch) and OS (--target-os) when cross-compiling"
  3945. enable cross_compile
  3946. fi
  3947. set_default target_os
  3948. if test "$target_os" = android; then
  3949. cc_default="clang"
  3950. fi
  3951. ar_default="${cross_prefix}${ar_default}"
  3952. cc_default="${cross_prefix}${cc_default}"
  3953. cxx_default="${cross_prefix}${cxx_default}"
  3954. nm_default="${cross_prefix}${nm_default}"
  3955. pkg_config_default="${cross_prefix}${pkg_config_default}"
  3956. if ${cross_prefix}${ranlib_default} 2>&1 | grep -q "\-D "; then
  3957. ranlib_default="${cross_prefix}${ranlib_default} -D"
  3958. else
  3959. ranlib_default="${cross_prefix}${ranlib_default}"
  3960. fi
  3961. strip_default="${cross_prefix}${strip_default}"
  3962. windres_default="${cross_prefix}${windres_default}"
  3963. sysinclude_default="${sysroot}/usr/include"
  3964. if enabled cuda_sdk; then
  3965. warn "Option --enable-cuda-sdk is deprecated. Use --enable-cuda-nvcc instead."
  3966. enable cuda_nvcc
  3967. fi
  3968. if enabled cuda_nvcc; then
  3969. nvcc_default="nvcc"
  3970. nvccflags_default="-gencode arch=compute_30,code=sm_30 -O2"
  3971. else
  3972. nvcc_default="clang"
  3973. nvccflags_default="--cuda-gpu-arch=sm_30 -O2"
  3974. NVCC_C=""
  3975. fi
  3976. set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \
  3977. target_exec x86asmexe nvcc
  3978. enabled cross_compile || host_cc_default=$cc
  3979. set_default host_cc
  3980. pkg_config_fail_message=""
  3981. if ! $pkg_config --version >/dev/null 2>&1; then
  3982. warn "$pkg_config not found, library detection may fail."
  3983. pkg_config=false
  3984. elif is_in -static $cc $LDFLAGS && ! is_in --static $pkg_config $pkg_config_flags; then
  3985. pkg_config_fail_message="
  3986. Note: When building a static binary, add --pkg-config-flags=\"--static\"."
  3987. fi
  3988. if test $doxygen != $doxygen_default && \
  3989. ! $doxygen --version >/dev/null 2>&1; then
  3990. warn "Specified doxygen \"$doxygen\" not found, API documentation will fail to build."
  3991. fi
  3992. exesuf() {
  3993. case $1 in
  3994. mingw32*|mingw64*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  3995. esac
  3996. }
  3997. EXESUF=$(exesuf $target_os)
  3998. HOSTEXESUF=$(exesuf $host_os)
  3999. # set temporary file name
  4000. : ${TMPDIR:=$TEMPDIR}
  4001. : ${TMPDIR:=$TMP}
  4002. : ${TMPDIR:=/tmp}
  4003. if [ -n "$tempprefix" ] ; then
  4004. mktemp(){
  4005. tmpname="$tempprefix.${HOSTNAME}.${UID}"
  4006. echo "$tmpname"
  4007. mkdir "$tmpname"
  4008. }
  4009. elif ! test_cmd mktemp -u XXXXXX; then
  4010. # simple replacement for missing mktemp
  4011. # NOT SAFE FOR GENERAL USE
  4012. mktemp(){
  4013. tmpname="${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  4014. echo "$tmpname"
  4015. mkdir "$tmpname"
  4016. }
  4017. fi
  4018. FFTMPDIR=$(mktemp -d "${TMPDIR}/ffconf.XXXXXXXX" 2> /dev/null) ||
  4019. die "Unable to create temporary directory in $TMPDIR."
  4020. tmpfile(){
  4021. tmp="${FFTMPDIR}/test"$2
  4022. (set -C; exec > $tmp) 2> /dev/null ||
  4023. die "Unable to create temporary file in $FFTMPDIR."
  4024. eval $1=$tmp
  4025. }
  4026. trap 'rm -rf -- "$FFTMPDIR"' EXIT
  4027. trap 'exit 2' INT
  4028. tmpfile TMPASM .asm
  4029. tmpfile TMPC .c
  4030. tmpfile TMPCPP .cpp
  4031. tmpfile TMPE $EXESUF
  4032. tmpfile TMPH .h
  4033. tmpfile TMPM .m
  4034. tmpfile TMPCU .cu
  4035. tmpfile TMPO .o
  4036. tmpfile TMPS .S
  4037. tmpfile TMPSH .sh
  4038. tmpfile TMPV .ver
  4039. unset -f mktemp
  4040. chmod +x $TMPE
  4041. # make sure we can execute files in $TMPDIR
  4042. cat > $TMPSH 2>> $logfile <<EOF
  4043. #! /bin/sh
  4044. EOF
  4045. chmod +x $TMPSH >> $logfile 2>&1
  4046. if ! $TMPSH >> $logfile 2>&1; then
  4047. cat <<EOF
  4048. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  4049. variable to another directory and make sure that it is not mounted noexec.
  4050. EOF
  4051. die "Sanity test failed."
  4052. fi
  4053. armasm_flags(){
  4054. for flag; do
  4055. case $flag in
  4056. # Filter out MSVC cl.exe options from cflags that shouldn't
  4057. # be passed to gas-preprocessor
  4058. -M[TD]*) ;;
  4059. *) echo $flag ;;
  4060. esac
  4061. done
  4062. }
  4063. cparser_flags(){
  4064. for flag; do
  4065. case $flag in
  4066. -Wno-switch) echo -Wno-switch-enum ;;
  4067. -Wno-format-zero-length) ;;
  4068. -Wdisabled-optimization) ;;
  4069. -Wno-pointer-sign) echo -Wno-other ;;
  4070. *) echo $flag ;;
  4071. esac
  4072. done
  4073. }
  4074. msvc_common_flags(){
  4075. for flag; do
  4076. case $flag in
  4077. # In addition to specifying certain flags under the compiler
  4078. # specific filters, they must be specified here as well or else the
  4079. # generic catch all at the bottom will print the original flag.
  4080. -Wall) ;;
  4081. -Wextra) ;;
  4082. -std=c*) ;;
  4083. # Common flags
  4084. -fomit-frame-pointer) ;;
  4085. -g) echo -Z7 ;;
  4086. -fno-math-errno) ;;
  4087. -fno-common) ;;
  4088. -fno-signed-zeros) ;;
  4089. -fPIC) ;;
  4090. -mthumb) ;;
  4091. -march=*) ;;
  4092. -lz) echo zlib.lib ;;
  4093. -lx264) echo libx264.lib ;;
  4094. -lstdc++) ;;
  4095. -l*) echo ${flag#-l}.lib ;;
  4096. -LARGEADDRESSAWARE) echo $flag ;;
  4097. -L*) echo -libpath:${flag#-L} ;;
  4098. -Wl,*) ;;
  4099. *) echo $flag ;;
  4100. esac
  4101. done
  4102. }
  4103. msvc_flags(){
  4104. msvc_common_flags "$@"
  4105. for flag; do
  4106. case $flag in
  4107. -Wall) echo -W3 -wd4018 -wd4146 -wd4244 -wd4305 \
  4108. -wd4554 ;;
  4109. -Wextra) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
  4110. -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
  4111. -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
  4112. -wd4307 \
  4113. -wd4273 -wd4554 -wd4701 -wd4703 ;;
  4114. esac
  4115. done
  4116. }
  4117. icl_flags(){
  4118. msvc_common_flags "$@"
  4119. for flag; do
  4120. case $flag in
  4121. # Despite what Intel's documentation says -Wall, which is supported
  4122. # on Windows, does enable remarks so disable them here.
  4123. -Wall) echo $flag -Qdiag-disable:remark ;;
  4124. -std=c99) echo -Qstd=c99 ;;
  4125. -flto) echo -ipo ;;
  4126. esac
  4127. done
  4128. }
  4129. icc_flags(){
  4130. for flag; do
  4131. case $flag in
  4132. -flto) echo -ipo ;;
  4133. *) echo $flag ;;
  4134. esac
  4135. done
  4136. }
  4137. suncc_flags(){
  4138. for flag; do
  4139. case $flag in
  4140. -march=*|-mcpu=*)
  4141. case "${flag#*=}" in
  4142. native) echo -xtarget=native ;;
  4143. v9|niagara) echo -xarch=sparc ;;
  4144. ultrasparc) echo -xarch=sparcvis ;;
  4145. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  4146. i586|pentium) echo -xchip=pentium ;;
  4147. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  4148. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  4149. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  4150. pentium4*) echo -xtarget=pentium4 ;;
  4151. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  4152. *-sse3) echo -xarch=sse3 ;;
  4153. core2) echo -xarch=ssse3 -xchip=core2 ;;
  4154. bonnell) echo -xarch=ssse3 ;;
  4155. corei7|nehalem) echo -xtarget=nehalem ;;
  4156. westmere) echo -xtarget=westmere ;;
  4157. silvermont) echo -xarch=sse4_2 ;;
  4158. corei7-avx|sandybridge) echo -xtarget=sandybridge ;;
  4159. core-avx*|ivybridge|haswell|broadwell|skylake*|knl)
  4160. echo -xarch=avx ;;
  4161. amdfam10|barcelona) echo -xtarget=barcelona ;;
  4162. btver1) echo -xarch=amdsse4a ;;
  4163. btver2|bdver*|znver*) echo -xarch=avx ;;
  4164. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  4165. k8|opteron|athlon64|athlon-fx)
  4166. echo -xarch=sse2a ;;
  4167. athlon*) echo -xarch=pentium_proa ;;
  4168. esac
  4169. ;;
  4170. -std=c99) echo -xc99 ;;
  4171. -fomit-frame-pointer) echo -xregs=frameptr ;;
  4172. -fPIC) echo -KPIC -xcode=pic32 ;;
  4173. -W*,*) echo $flag ;;
  4174. -f*-*|-W*|-mimpure-text) ;;
  4175. -shared) echo -G ;;
  4176. *) echo $flag ;;
  4177. esac
  4178. done
  4179. }
  4180. probe_cc(){
  4181. pfx=$1
  4182. _cc=$2
  4183. first=$3
  4184. unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
  4185. unset _ld_o _ldflags _ld_lib _ld_path
  4186. unset _depflags _DEPCMD _DEPFLAGS
  4187. _flags_filter=echo
  4188. if $_cc --version 2>&1 | grep -q '^GNU assembler'; then
  4189. true # no-op to avoid reading stdin in following checks
  4190. elif $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  4191. _type=llvm_gcc
  4192. gcc_extra_ver=$(expr "$($_cc --version 2>/dev/null | head -n1)" : '.*\((.*)\)')
  4193. _ident="llvm-gcc $($_cc -dumpversion 2>/dev/null) $gcc_extra_ver"
  4194. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  4195. _cflags_speed='-O3'
  4196. _cflags_size='-Os'
  4197. elif $_cc -v 2>&1 | grep -qi ^gcc; then
  4198. _type=gcc
  4199. gcc_version=$($_cc --version | head -n1)
  4200. gcc_basever=$($_cc -dumpversion)
  4201. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  4202. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  4203. _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  4204. case $gcc_basever in
  4205. 2) ;;
  4206. 2.*) ;;
  4207. *) _depflags='-MMD -MF $(@:.o=.d) -MT $@' ;;
  4208. esac
  4209. if [ "$first" = true ]; then
  4210. case $gcc_basever in
  4211. 4.2*)
  4212. warn "gcc 4.2 is outdated and may miscompile FFmpeg. Please use a newer compiler." ;;
  4213. esac
  4214. fi
  4215. _cflags_speed='-O3'
  4216. _cflags_size='-Os'
  4217. elif $_cc --version 2>/dev/null | grep -q ^icc; then
  4218. _type=icc
  4219. _ident=$($_cc --version | head -n1)
  4220. _depflags='-MMD'
  4221. _cflags_speed='-O3'
  4222. _cflags_size='-Os'
  4223. _cflags_noopt='-O1'
  4224. _flags_filter=icc_flags
  4225. elif $_cc -v 2>&1 | grep -q xlc; then
  4226. _type=xlc
  4227. _ident=$($_cc -qversion 2>/dev/null | head -n1)
  4228. _cflags_speed='-O5'
  4229. _cflags_size='-O5 -qcompact'
  4230. elif $_cc --vsn 2>/dev/null | grep -Eq "ARM (C/C\+\+ )?Compiler"; then
  4231. test -d "$sysroot" || die "No valid sysroot specified."
  4232. _type=armcc
  4233. _ident=$($_cc --vsn | grep -i build | head -n1 | sed 's/.*: //')
  4234. armcc_conf="$PWD/armcc.conf"
  4235. $_cc --arm_linux_configure \
  4236. --arm_linux_config_file="$armcc_conf" \
  4237. --configure_sysroot="$sysroot" \
  4238. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  4239. die "Error creating armcc configuration file."
  4240. $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  4241. _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
  4242. as_default="${cross_prefix}gcc"
  4243. _depflags='-MMD'
  4244. _cflags_speed='-O3'
  4245. _cflags_size='-Os'
  4246. elif $_cc -v 2>&1 | grep -q clang && ! $_cc -? > /dev/null 2>&1; then
  4247. _type=clang
  4248. _ident=$($_cc --version 2>/dev/null | head -n1)
  4249. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  4250. _cflags_speed='-O3'
  4251. _cflags_size='-Oz'
  4252. elif $_cc -V 2>&1 | grep -q Sun; then
  4253. _type=suncc
  4254. _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  4255. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  4256. _DEPFLAGS='-xM1 -xc99'
  4257. _ldflags='-std=c99'
  4258. _cflags_speed='-O5'
  4259. _cflags_size='-O5 -xspace'
  4260. _flags_filter=suncc_flags
  4261. elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  4262. _type=pathscale
  4263. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  4264. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  4265. _cflags_speed='-O2'
  4266. _cflags_size='-Os'
  4267. _flags_filter='filter_out -Wdisabled-optimization'
  4268. elif $_cc -v 2>&1 | grep -q Open64; then
  4269. _type=open64
  4270. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  4271. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  4272. _cflags_speed='-O2'
  4273. _cflags_size='-Os'
  4274. _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  4275. elif $_cc 2>&1 | grep -q 'Microsoft.*ARM.*Assembler'; then
  4276. _type=armasm
  4277. _ident=$($_cc | head -n1)
  4278. # 4509: "This form of conditional instruction is deprecated"
  4279. _flags="-nologo -ignore 4509"
  4280. _flags_filter=armasm_flags
  4281. elif $_cc 2>&1 | grep -q Intel; then
  4282. _type=icl
  4283. _ident=$($_cc 2>&1 | head -n1)
  4284. _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
  4285. # Not only is O3 broken on 13.x+ but it is slower on all previous
  4286. # versions (tested) as well.
  4287. _cflags_speed="-O2"
  4288. _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
  4289. if $_cc 2>&1 | grep -q Linker; then
  4290. _ld_o='-out:$@'
  4291. else
  4292. _ld_o='-Fe$@'
  4293. fi
  4294. _cc_o='-Fo$@'
  4295. _cc_e='-P'
  4296. _flags_filter=icl_flags
  4297. _ld_lib='lib%.a'
  4298. _ld_path='-libpath:'
  4299. # -Qdiag-error to make icl error when seeing certain unknown arguments
  4300. _flags='-nologo -Qdiag-error:4044,10157'
  4301. # -Qvec- -Qsimd- to prevent miscompilation, -GS, fp:precise for consistency
  4302. # with MSVC which enables it by default.
  4303. _cflags='-Qms0 -Qvec- -Qsimd- -GS -fp:precise'
  4304. disable stripping
  4305. elif $_cc -? 2>/dev/null | grep -q 'LLVM.*Linker'; then
  4306. # lld can emulate multiple different linkers; in ms link.exe mode,
  4307. # the -? parameter gives the help output which contains an identifyable
  4308. # string, while it gives an error in other modes.
  4309. _type=lld-link
  4310. # The link.exe mode doesn't have a switch for getting the version,
  4311. # but we can force it back to gnu mode and get the version from there.
  4312. _ident=$($_cc -flavor gnu --version 2>/dev/null)
  4313. _ld_o='-out:$@'
  4314. _flags_filter=msvc_flags
  4315. _ld_lib='lib%.a'
  4316. _ld_path='-libpath:'
  4317. elif $_cc -nologo- 2>&1 | grep -q Microsoft || { $_cc -v 2>&1 | grep -q clang && $_cc -? > /dev/null 2>&1; }; then
  4318. _type=msvc
  4319. if $_cc -nologo- 2>&1 | grep -q Microsoft; then
  4320. _ident=$($_cc 2>&1 | head -n1 | tr -d '\r')
  4321. else
  4322. _ident=$($_cc --version 2>/dev/null | head -n1 | tr -d '\r')
  4323. fi
  4324. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
  4325. _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
  4326. _cflags_speed="-O2"
  4327. _cflags_size="-O1"
  4328. _cflags_noopt="-O1"
  4329. if $_cc -nologo- 2>&1 | grep -q Linker; then
  4330. _ld_o='-out:$@'
  4331. else
  4332. _ld_o='-Fe$@'
  4333. fi
  4334. _cc_o='-Fo$@'
  4335. _cc_e='-P -Fi$@'
  4336. _flags_filter=msvc_flags
  4337. _ld_lib='lib%.a'
  4338. _ld_path='-libpath:'
  4339. _flags='-nologo'
  4340. disable stripping
  4341. elif $_cc --version 2>/dev/null | grep -q ^cparser; then
  4342. _type=cparser
  4343. _ident=$($_cc --version | head -n1)
  4344. _depflags='-MMD'
  4345. _cflags_speed='-O4'
  4346. _cflags_size='-O2'
  4347. _flags_filter=cparser_flags
  4348. fi
  4349. eval ${pfx}_type=\$_type
  4350. eval ${pfx}_ident=\$_ident
  4351. }
  4352. set_ccvars(){
  4353. eval ${1}_C=\${_cc_c-\${${1}_C}}
  4354. eval ${1}_E=\${_cc_e-\${${1}_E}}
  4355. eval ${1}_O=\${_cc_o-\${${1}_O}}
  4356. if [ -n "$_depflags" ]; then
  4357. eval ${1}_DEPFLAGS=\$_depflags
  4358. else
  4359. eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
  4360. eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
  4361. eval DEP${1}FLAGS=\$_flags
  4362. fi
  4363. }
  4364. probe_cc cc "$cc" "true"
  4365. cflags_filter=$_flags_filter
  4366. cflags_speed=$_cflags_speed
  4367. cflags_size=$_cflags_size
  4368. cflags_noopt=$_cflags_noopt
  4369. add_cflags $_flags $_cflags
  4370. cc_ldflags=$_ldflags
  4371. set_ccvars CC
  4372. set_ccvars CXX
  4373. probe_cc hostcc "$host_cc"
  4374. host_cflags_filter=$_flags_filter
  4375. host_cflags_speed=$_cflags_speed
  4376. add_host_cflags $_flags $_cflags
  4377. set_ccvars HOSTCC
  4378. test -n "$cc_type" && enable $cc_type ||
  4379. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  4380. : ${as_default:=$cc}
  4381. : ${objcc_default:=$cc}
  4382. : ${dep_cc_default:=$cc}
  4383. : ${ld_default:=$cc}
  4384. : ${host_ld_default:=$host_cc}
  4385. set_default ar as objcc dep_cc ld ln_s host_ld windres
  4386. probe_cc as "$as"
  4387. asflags_filter=$_flags_filter
  4388. add_asflags $_flags $_cflags
  4389. set_ccvars AS
  4390. probe_cc objcc "$objcc"
  4391. objcflags_filter=$_flags_filter
  4392. add_objcflags $_flags $_cflags
  4393. set_ccvars OBJC
  4394. probe_cc ld "$ld"
  4395. ldflags_filter=$_flags_filter
  4396. add_ldflags $_flags $_ldflags
  4397. test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
  4398. LD_O=${_ld_o-$LD_O}
  4399. LD_LIB=${_ld_lib-$LD_LIB}
  4400. LD_PATH=${_ld_path-$LD_PATH}
  4401. probe_cc hostld "$host_ld"
  4402. host_ldflags_filter=$_flags_filter
  4403. add_host_ldflags $_flags $_ldflags
  4404. HOSTLD_O=${_ld_o-$HOSTLD_O}
  4405. if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
  4406. probe_cc depcc "$dep_cc"
  4407. CCDEP=${_DEPCMD:-$DEPCMD}
  4408. CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
  4409. DEPCCFLAGS=$_flags
  4410. fi
  4411. if $ar 2>&1 | grep -q Microsoft; then
  4412. arflags="-nologo"
  4413. ar_o='-out:$@'
  4414. elif $ar 2>&1 | grep -q "\[D\] "; then
  4415. arflags="rcD"
  4416. ar_o='$@'
  4417. else
  4418. arflags="rc"
  4419. ar_o='$@'
  4420. fi
  4421. add_cflags $extra_cflags
  4422. add_cxxflags $extra_cxxflags
  4423. add_objcflags $extra_objcflags
  4424. add_asflags $extra_cflags
  4425. if test -n "$sysroot"; then
  4426. case "$cc_type" in
  4427. gcc|llvm_gcc|clang)
  4428. add_cppflags --sysroot="$sysroot"
  4429. add_ldflags --sysroot="$sysroot"
  4430. ;;
  4431. esac
  4432. fi
  4433. if test "$cpu" = host; then
  4434. enabled cross_compile &&
  4435. warn "--cpu=host makes no sense when cross-compiling."
  4436. case "$cc_type" in
  4437. gcc|llvm_gcc)
  4438. check_native(){
  4439. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  4440. sed -n "/cc1.*$1=/{
  4441. s/.*$1=\\([^ ]*\\).*/\\1/
  4442. p
  4443. q
  4444. }" $TMPE
  4445. }
  4446. cpu=$(check_native -march || check_native -mcpu)
  4447. ;;
  4448. clang)
  4449. check_native(){
  4450. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  4451. sed -n "/cc1.*-target-cpu /{
  4452. s/.*-target-cpu \\([^ ]*\\).*/\\1/
  4453. p
  4454. q
  4455. }" $TMPE
  4456. }
  4457. cpu=$(check_native -march)
  4458. ;;
  4459. esac
  4460. test "${cpu:-host}" = host &&
  4461. die "--cpu=host not supported with compiler $cc"
  4462. fi
  4463. # Deal with common $arch aliases
  4464. case "$arch" in
  4465. aarch64|arm64)
  4466. arch="aarch64"
  4467. ;;
  4468. arm*|iPad*|iPhone*)
  4469. arch="arm"
  4470. ;;
  4471. mips*|IP*)
  4472. case "$arch" in
  4473. *el)
  4474. add_cppflags -EL
  4475. add_ldflags -EL
  4476. ;;
  4477. *eb)
  4478. add_cppflags -EB
  4479. add_ldflags -EB
  4480. ;;
  4481. esac
  4482. arch="mips"
  4483. ;;
  4484. parisc*|hppa*)
  4485. arch="parisc"
  4486. ;;
  4487. "Power Macintosh"|ppc*|powerpc*)
  4488. arch="ppc"
  4489. ;;
  4490. s390|s390x)
  4491. arch="s390"
  4492. ;;
  4493. sh4|sh)
  4494. arch="sh4"
  4495. ;;
  4496. sun4*|sparc*)
  4497. arch="sparc"
  4498. ;;
  4499. tilegx|tile-gx)
  4500. arch="tilegx"
  4501. ;;
  4502. i[3-6]86*|i86pc|BePC|x86pc|x86_64|x86_32|amd64)
  4503. arch="x86"
  4504. ;;
  4505. esac
  4506. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  4507. enable $arch
  4508. # Add processor-specific flags
  4509. if enabled aarch64; then
  4510. case $cpu in
  4511. armv*)
  4512. cpuflags="-march=$cpu"
  4513. ;;
  4514. *)
  4515. cpuflags="-mcpu=$cpu"
  4516. ;;
  4517. esac
  4518. elif enabled alpha; then
  4519. cpuflags="-mcpu=$cpu"
  4520. elif enabled arm; then
  4521. check_arm_arch() {
  4522. test_cpp_condition stddef.h \
  4523. "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
  4524. $cpuflags
  4525. }
  4526. probe_arm_arch() {
  4527. if check_arm_arch 4; then echo armv4
  4528. elif check_arm_arch 4T; then echo armv4t
  4529. elif check_arm_arch 5; then echo armv5
  4530. elif check_arm_arch 5E; then echo armv5e
  4531. elif check_arm_arch 5T; then echo armv5t
  4532. elif check_arm_arch 5TE; then echo armv5te
  4533. elif check_arm_arch 5TEJ; then echo armv5te
  4534. elif check_arm_arch 6; then echo armv6
  4535. elif check_arm_arch 6J; then echo armv6j
  4536. elif check_arm_arch 6K; then echo armv6k
  4537. elif check_arm_arch 6Z; then echo armv6z
  4538. elif check_arm_arch 6KZ; then echo armv6zk
  4539. elif check_arm_arch 6ZK; then echo armv6zk
  4540. elif check_arm_arch 6T2; then echo armv6t2
  4541. elif check_arm_arch 7; then echo armv7
  4542. elif check_arm_arch 7A 7_A; then echo armv7-a
  4543. elif check_arm_arch 7S; then echo armv7-a
  4544. elif check_arm_arch 7R 7_R; then echo armv7-r
  4545. elif check_arm_arch 7M 7_M; then echo armv7-m
  4546. elif check_arm_arch 7EM 7E_M; then echo armv7-m
  4547. elif check_arm_arch 8A 8_A; then echo armv8-a
  4548. fi
  4549. }
  4550. [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
  4551. case $cpu in
  4552. armv*)
  4553. cpuflags="-march=$cpu"
  4554. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  4555. ;;
  4556. *)
  4557. cpuflags="-mcpu=$cpu"
  4558. case $cpu in
  4559. cortex-a*) subarch=armv7a ;;
  4560. cortex-r*) subarch=armv7r ;;
  4561. cortex-m*) enable thumb; subarch=armv7m ;;
  4562. arm11*) subarch=armv6 ;;
  4563. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  4564. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  4565. *) subarch=$(probe_arm_arch) ;;
  4566. esac
  4567. ;;
  4568. esac
  4569. case "$subarch" in
  4570. armv5t*) enable fast_clz ;;
  4571. armv[6-8]*)
  4572. enable fast_clz
  4573. disabled fast_unaligned || enable fast_unaligned
  4574. ;;
  4575. esac
  4576. elif enabled avr32; then
  4577. case $cpu in
  4578. ap7[02]0[0-2])
  4579. subarch="avr32_ap"
  4580. cpuflags="-mpart=$cpu"
  4581. ;;
  4582. ap)
  4583. subarch="avr32_ap"
  4584. cpuflags="-march=$cpu"
  4585. ;;
  4586. uc3[ab]*)
  4587. subarch="avr32_uc"
  4588. cpuflags="-mcpu=$cpu"
  4589. ;;
  4590. uc)
  4591. subarch="avr32_uc"
  4592. cpuflags="-march=$cpu"
  4593. ;;
  4594. esac
  4595. elif enabled bfin; then
  4596. cpuflags="-mcpu=$cpu"
  4597. elif enabled mips; then
  4598. cpuflags="-march=$cpu"
  4599. if [ "$cpu" != "generic" ]; then
  4600. disable mips32r2
  4601. disable mips32r5
  4602. disable mips64r2
  4603. disable mips32r6
  4604. disable mips64r6
  4605. disable loongson2
  4606. disable loongson3
  4607. case $cpu in
  4608. 24kc|24kf*|24kec|34kc|1004kc|24kef*|34kf*|1004kf*|74kc|74kf)
  4609. enable mips32r2
  4610. disable msa
  4611. ;;
  4612. p5600|i6400|p6600)
  4613. disable mipsdsp
  4614. disable mipsdspr2
  4615. ;;
  4616. loongson*)
  4617. enable loongson2
  4618. enable loongson3
  4619. enable local_aligned
  4620. enable simd_align_16
  4621. enable fast_64bit
  4622. enable fast_clz
  4623. enable fast_cmov
  4624. enable fast_unaligned
  4625. disable aligned_stack
  4626. disable mipsdsp
  4627. disable mipsdspr2
  4628. # When gcc version less than 5.3.0, add -fno-expensive-optimizations flag.
  4629. if [ $cc == gcc ]; then
  4630. gcc_version=$(gcc -dumpversion)
  4631. if [ "$(echo "$gcc_version 5.3.0" | tr " " "\n" | sort -rV | head -n 1)" == "$gcc_version" ]; then
  4632. expensive_optimization_flag=""
  4633. else
  4634. expensive_optimization_flag="-fno-expensive-optimizations"
  4635. fi
  4636. fi
  4637. case $cpu in
  4638. loongson3*)
  4639. cpuflags="-march=loongson3a -mhard-float $expensive_optimization_flag"
  4640. ;;
  4641. loongson2e)
  4642. cpuflags="-march=loongson2e -mhard-float $expensive_optimization_flag"
  4643. ;;
  4644. loongson2f)
  4645. cpuflags="-march=loongson2f -mhard-float $expensive_optimization_flag"
  4646. ;;
  4647. esac
  4648. ;;
  4649. *)
  4650. # Unknown CPU. Disable everything.
  4651. warn "unknown CPU. Disabling all MIPS optimizations."
  4652. disable mipsfpu
  4653. disable mipsdsp
  4654. disable mipsdspr2
  4655. disable msa
  4656. disable mmi
  4657. ;;
  4658. esac
  4659. case $cpu in
  4660. 24kc)
  4661. disable mipsfpu
  4662. disable mipsdsp
  4663. disable mipsdspr2
  4664. ;;
  4665. 24kf*)
  4666. disable mipsdsp
  4667. disable mipsdspr2
  4668. ;;
  4669. 24kec|34kc|1004kc)
  4670. disable mipsfpu
  4671. disable mipsdspr2
  4672. ;;
  4673. 24kef*|34kf*|1004kf*)
  4674. disable mipsdspr2
  4675. ;;
  4676. 74kc)
  4677. disable mipsfpu
  4678. ;;
  4679. p5600)
  4680. enable mips32r5
  4681. check_cflags "-mtune=p5600" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops"
  4682. ;;
  4683. i6400)
  4684. enable mips64r6
  4685. check_cflags "-mtune=i6400 -mabi=64" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
  4686. ;;
  4687. p6600)
  4688. enable mips64r6
  4689. check_cflags "-mtune=p6600 -mabi=64" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
  4690. ;;
  4691. esac
  4692. else
  4693. # We do not disable anything. Is up to the user to disable the unwanted features.
  4694. warn 'generic cpu selected'
  4695. fi
  4696. elif enabled ppc; then
  4697. disable ldbrx
  4698. case $(tolower $cpu) in
  4699. 601|ppc601|powerpc601)
  4700. cpuflags="-mcpu=601"
  4701. disable altivec
  4702. ;;
  4703. 603*|ppc603*|powerpc603*)
  4704. cpuflags="-mcpu=603"
  4705. disable altivec
  4706. ;;
  4707. 604*|ppc604*|powerpc604*)
  4708. cpuflags="-mcpu=604"
  4709. disable altivec
  4710. ;;
  4711. g3|75*|ppc75*|powerpc75*)
  4712. cpuflags="-mcpu=750"
  4713. disable altivec
  4714. ;;
  4715. g4|745*|ppc745*|powerpc745*)
  4716. cpuflags="-mcpu=7450"
  4717. disable vsx
  4718. ;;
  4719. 74*|ppc74*|powerpc74*)
  4720. cpuflags="-mcpu=7400"
  4721. disable vsx
  4722. ;;
  4723. g5|970|ppc970|powerpc970)
  4724. cpuflags="-mcpu=970"
  4725. disable vsx
  4726. ;;
  4727. power[3-6]*)
  4728. cpuflags="-mcpu=$cpu"
  4729. disable vsx
  4730. ;;
  4731. power[7-8]*)
  4732. cpuflags="-mcpu=$cpu"
  4733. ;;
  4734. cell)
  4735. cpuflags="-mcpu=cell"
  4736. enable ldbrx
  4737. disable vsx
  4738. ;;
  4739. e500mc)
  4740. cpuflags="-mcpu=e500mc"
  4741. disable altivec
  4742. ;;
  4743. e500v2)
  4744. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  4745. disable altivec
  4746. disable dcbzl
  4747. ;;
  4748. e500)
  4749. cpuflags="-mcpu=8540 -mhard-float"
  4750. disable altivec
  4751. disable dcbzl
  4752. ;;
  4753. esac
  4754. elif enabled sparc; then
  4755. case $cpu in
  4756. cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
  4757. cpuflags="-mcpu=$cpu"
  4758. ;;
  4759. ultrasparc*|niagara[234])
  4760. cpuflags="-mcpu=$cpu"
  4761. ;;
  4762. esac
  4763. elif enabled x86; then
  4764. case $cpu in
  4765. i[345]86|pentium)
  4766. cpuflags="-march=$cpu"
  4767. disable i686
  4768. disable mmx
  4769. ;;
  4770. # targets that do NOT support nopl and conditional mov (cmov)
  4771. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  4772. cpuflags="-march=$cpu"
  4773. disable i686
  4774. ;;
  4775. # targets that do support nopl and conditional mov (cmov)
  4776. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx\
  4777. |core*|atom|bonnell|nehalem|westmere|silvermont|sandybridge|ivybridge|haswell|broadwell|skylake*|knl\
  4778. |amdfam10|barcelona|b[dt]ver*|znver*)
  4779. cpuflags="-march=$cpu"
  4780. enable i686
  4781. enable fast_cmov
  4782. ;;
  4783. # targets that do support conditional mov but on which it's slow
  4784. pentium4|pentium4m|prescott|nocona)
  4785. cpuflags="-march=$cpu"
  4786. enable i686
  4787. disable fast_cmov
  4788. ;;
  4789. esac
  4790. fi
  4791. if [ "$cpu" != generic ]; then
  4792. add_cflags $cpuflags
  4793. add_asflags $cpuflags
  4794. test "$cc_type" = "$ld_type" && add_ldflags $cpuflags
  4795. fi
  4796. # compiler sanity check
  4797. test_exec <<EOF
  4798. int main(void){ return 0; }
  4799. EOF
  4800. if test "$?" != 0; then
  4801. echo "$cc is unable to create an executable file."
  4802. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  4803. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  4804. echo "Only do this if you know what cross compiling means."
  4805. fi
  4806. die "C compiler test failed."
  4807. fi
  4808. add_cppflags -D_ISOC99_SOURCE
  4809. add_cxxflags -D__STDC_CONSTANT_MACROS
  4810. check_cxxflags -std=c++11 || check_cxxflags -std=c++0x
  4811. # some compilers silently accept -std=c11, so we also need to check that the
  4812. # version macro is defined properly
  4813. test_cflags_cc -std=c11 ctype.h "__STDC_VERSION__ >= 201112L" &&
  4814. add_cflags -std=c11 ||
  4815. check_cflags -std=c99
  4816. check_cppflags -D_FILE_OFFSET_BITS=64
  4817. check_cppflags -D_LARGEFILE_SOURCE
  4818. add_host_cppflags -D_ISOC99_SOURCE
  4819. check_host_cflags -std=c99
  4820. check_host_cflags -Wall
  4821. check_host_cflags $host_cflags_speed
  4822. check_64bit(){
  4823. arch32=$1
  4824. arch64=$2
  4825. expr=${3:-'sizeof(void *) > 4'}
  4826. test_code cc "" "int test[2*($expr) - 1]" &&
  4827. subarch=$arch64 || subarch=$arch32
  4828. enable $subarch
  4829. }
  4830. case "$arch" in
  4831. aarch64|alpha|ia64)
  4832. enabled shared && enable_weak pic
  4833. ;;
  4834. mips)
  4835. check_64bit mips mips64 '_MIPS_SIM > 1'
  4836. enabled shared && enable_weak pic
  4837. ;;
  4838. parisc)
  4839. check_64bit parisc parisc64
  4840. enabled shared && enable_weak pic
  4841. ;;
  4842. ppc)
  4843. check_64bit ppc ppc64
  4844. enabled shared && enable_weak pic
  4845. ;;
  4846. s390)
  4847. check_64bit s390 s390x
  4848. enabled shared && enable_weak pic
  4849. ;;
  4850. sparc)
  4851. check_64bit sparc sparc64
  4852. enabled shared && enable_weak pic
  4853. ;;
  4854. x86)
  4855. check_64bit x86_32 x86_64
  4856. # Treat x32 as x64 for now. Note it also needs pic if shared
  4857. test "$subarch" = "x86_32" && test_cpp_condition stddef.h 'defined(__x86_64__)' &&
  4858. subarch=x86_64 && enable x86_64 && disable x86_32
  4859. if enabled x86_64; then
  4860. enabled shared && enable_weak pic
  4861. objformat=elf64
  4862. fi
  4863. ;;
  4864. esac
  4865. # OS specific
  4866. case $target_os in
  4867. aix)
  4868. SHFLAGS=-shared
  4869. add_cppflags '-I\$(SRC_PATH)/compat/aix'
  4870. enabled shared && add_ldflags -Wl,-brtl
  4871. arflags='-Xany -r -c'
  4872. striptype=""
  4873. ;;
  4874. android)
  4875. disable symver
  4876. enable section_data_rel_ro
  4877. add_cflags -fPIE
  4878. add_ldexeflags -fPIE -pie
  4879. SLIB_INSTALL_NAME='$(SLIBNAME)'
  4880. SLIB_INSTALL_LINKS=
  4881. SHFLAGS='-shared -Wl,-soname,$(SLIBNAME)'
  4882. ;;
  4883. haiku)
  4884. prefix_default="/boot/common"
  4885. network_extralibs="-lnetwork"
  4886. host_extralibs=
  4887. ;;
  4888. sunos)
  4889. SHFLAGS='-shared -Wl,-h,$$(@F)'
  4890. enabled x86 && append SHFLAGS -mimpure-text
  4891. network_extralibs="-lsocket -lnsl"
  4892. add_cppflags -D__EXTENSIONS__
  4893. # When using suncc to build, the Solaris linker will mark
  4894. # an executable with each instruction set encountered by
  4895. # the Solaris assembler. As our libraries contain their own
  4896. # guards for processor-specific code, instead suppress
  4897. # generation of the HWCAPS ELF section on Solaris x86 only.
  4898. enabled_all suncc x86 &&
  4899. echo "hwcap_1 = OVERRIDE;" > mapfile &&
  4900. add_ldflags -Wl,-M,mapfile
  4901. nm_default='nm -P -g'
  4902. striptype=""
  4903. version_script='-M'
  4904. VERSION_SCRIPT_POSTPROCESS_CMD='perl $(SRC_PATH)/compat/solaris/make_sunver.pl - $(OBJS)'
  4905. ;;
  4906. netbsd)
  4907. disable symver
  4908. oss_indev_extralibs="-lossaudio"
  4909. oss_outdev_extralibs="-lossaudio"
  4910. enabled gcc || check_ldflags -Wl,-zmuldefs
  4911. ;;
  4912. openbsd|bitrig)
  4913. disable symver
  4914. enable section_data_rel_ro
  4915. striptype=""
  4916. SHFLAGS='-shared'
  4917. SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
  4918. SLIB_INSTALL_LINKS=
  4919. oss_indev_extralibs="-lossaudio"
  4920. oss_outdev_extralibs="-lossaudio"
  4921. ;;
  4922. dragonfly)
  4923. disable symver
  4924. ;;
  4925. freebsd)
  4926. ;;
  4927. bsd/os)
  4928. add_extralibs -lpoll -lgnugetopt
  4929. strip="strip -d"
  4930. ;;
  4931. darwin)
  4932. enabled ppc && add_asflags -force_cpusubtype_ALL
  4933. install_name_dir_default='$(SHLIBDIR)'
  4934. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(INSTALL_NAME_DIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  4935. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  4936. strip="${strip} -x"
  4937. add_ldflags -Wl,-dynamic,-search_paths_first
  4938. check_cflags -Werror=partial-availability
  4939. SLIBSUF=".dylib"
  4940. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  4941. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  4942. enabled x86_64 && objformat="macho64" || objformat="macho32"
  4943. enabled_any pic shared x86_64 ||
  4944. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  4945. check_headers dispatch/dispatch.h &&
  4946. add_cppflags '-I\$(SRC_PATH)/compat/dispatch_semaphore'
  4947. if test -n "$sysroot"; then
  4948. is_in -isysroot $cc $CPPFLAGS $CFLAGS || check_cppflags -isysroot $sysroot
  4949. is_in -isysroot $ld $LDFLAGS || check_ldflags -isysroot $sysroot
  4950. fi
  4951. version_script='-exported_symbols_list'
  4952. VERSION_SCRIPT_POSTPROCESS_CMD='tr " " "\n" | sed -n /global:/,/local:/p | grep ";" | tr ";" "\n" | sed -E "s/(.+)/_\1/g" | sed -E "s/(.+[^*])$$$$/\1*/"'
  4953. ;;
  4954. msys*)
  4955. die "Native MSYS builds are discouraged, please use the MINGW environment."
  4956. ;;
  4957. mingw32*|mingw64*)
  4958. target_os=mingw32
  4959. LIBTARGET=i386
  4960. if enabled x86_64; then
  4961. LIBTARGET="i386:x86-64"
  4962. elif enabled arm; then
  4963. LIBTARGET="arm"
  4964. elif enabled aarch64; then
  4965. LIBTARGET="arm64"
  4966. fi
  4967. if enabled shared; then
  4968. # Cannot build both shared and static libs when using dllimport.
  4969. disable static
  4970. fi
  4971. enabled shared && ! enabled small && test_cmd $windres --version && enable gnu_windres
  4972. enabled x86_32 && check_ldflags -Wl,--large-address-aware
  4973. shlibdir_default="$bindir_default"
  4974. SLIBPREF=""
  4975. SLIBSUF=".dll"
  4976. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  4977. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  4978. if test_cmd lib.exe -list; then
  4979. SLIB_EXTRA_CMD=-'lib.exe -nologo -machine:$(LIBTARGET) -def:$$(@:$(SLIBSUF)=.def) -out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  4980. if enabled x86_64; then
  4981. LIBTARGET=x64
  4982. fi
  4983. else
  4984. SLIB_EXTRA_CMD=-'$(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
  4985. fi
  4986. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  4987. SLIB_INSTALL_LINKS=
  4988. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  4989. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  4990. SLIB_CREATE_DEF_CMD='EXTERN_PREFIX="$(EXTERN_PREFIX)" AR="$(AR_CMD)" NM="$(NM_CMD)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
  4991. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--disable-auto-image-base $$(@:$(SLIBSUF)=.def)'
  4992. enabled x86_64 && objformat="win64" || objformat="win32"
  4993. dlltool="${cross_prefix}dlltool"
  4994. ranlib=:
  4995. enable dos_paths
  4996. check_ldflags -Wl,--nxcompat,--dynamicbase
  4997. # Lets work around some stupidity in binutils.
  4998. # ld will strip relocations from executables even though we need them
  4999. # for dynamicbase (ASLR). Using -pie does retain the reloc section
  5000. # however ld then forgets what the entry point should be (oops) so we
  5001. # have to manually (re)set it.
  5002. if enabled x86_32; then
  5003. disabled debug && add_ldexeflags -Wl,--pic-executable,-e,_mainCRTStartup
  5004. elif enabled x86_64; then
  5005. disabled debug && add_ldexeflags -Wl,--pic-executable,-e,mainCRTStartup
  5006. check_ldflags -Wl,--high-entropy-va # binutils 2.25
  5007. # Set image base >4GB for extra entropy with HEASLR
  5008. add_ldexeflags -Wl,--image-base,0x140000000
  5009. append SHFLAGS -Wl,--image-base,0x180000000
  5010. fi
  5011. ;;
  5012. win32|win64)
  5013. disable symver
  5014. if enabled shared; then
  5015. # Link to the import library instead of the normal static library
  5016. # for shared libs.
  5017. LD_LIB='%.lib'
  5018. # Cannot build both shared and static libs with MSVC or icl.
  5019. disable static
  5020. fi
  5021. enabled x86_32 && check_ldflags -LARGEADDRESSAWARE
  5022. shlibdir_default="$bindir_default"
  5023. SLIBPREF=""
  5024. SLIBSUF=".dll"
  5025. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  5026. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  5027. SLIB_CREATE_DEF_CMD='EXTERN_PREFIX="$(EXTERN_PREFIX)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
  5028. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  5029. SLIB_INSTALL_LINKS=
  5030. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  5031. SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  5032. SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  5033. enabled x86_64 && objformat="win64" || objformat="win32"
  5034. ranlib=:
  5035. enable dos_paths
  5036. ;;
  5037. cygwin*)
  5038. target_os=cygwin
  5039. shlibdir_default="$bindir_default"
  5040. SLIBPREF="cyg"
  5041. SLIBSUF=".dll"
  5042. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  5043. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  5044. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  5045. SLIB_INSTALL_LINKS=
  5046. SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
  5047. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
  5048. enabled x86_64 && objformat="win64" || objformat="win32"
  5049. enable dos_paths
  5050. enabled shared && ! enabled small && test_cmd $windres --version && enable gnu_windres
  5051. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  5052. ;;
  5053. *-dos|freedos|opendos)
  5054. network_extralibs="-lsocket"
  5055. objformat="coff"
  5056. enable dos_paths
  5057. ;;
  5058. linux)
  5059. enable section_data_rel_ro
  5060. enabled_any arm aarch64 && enable_weak linux_perf
  5061. ;;
  5062. irix*)
  5063. target_os=irix
  5064. ranlib="echo ignoring ranlib"
  5065. ;;
  5066. os/2*)
  5067. strip="lxlite -CS"
  5068. striptype=""
  5069. objformat="aout"
  5070. add_cppflags -D_GNU_SOURCE
  5071. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zhigh-mem -Zmap
  5072. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  5073. LIBSUF="_s.a"
  5074. SLIBPREF=""
  5075. SLIBSUF=".dll"
  5076. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  5077. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(FULLNAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  5078. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(FULLNAME).def; \
  5079. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(FULLNAME).def; \
  5080. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(FULLNAME).def; \
  5081. echo EXPORTS >> $(SUBDIR)$(FULLNAME).def; \
  5082. emxexp $(OBJS) >> $(SUBDIR)$(FULLNAME).def'
  5083. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(FULLNAME)_dll.a $(SUBDIR)$(FULLNAME).def; \
  5084. emximp -o $(SUBDIR)$(LIBPREF)$(FULLNAME)_dll.lib $(SUBDIR)$(FULLNAME).def;'
  5085. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  5086. SLIB_INSTALL_LINKS=
  5087. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(FULLNAME)_dll.a $(LIBPREF)$(FULLNAME)_dll.lib'
  5088. enable dos_paths
  5089. enable_weak os2threads
  5090. ;;
  5091. gnu/kfreebsd)
  5092. add_cppflags -D_BSD_SOURCE
  5093. ;;
  5094. gnu)
  5095. ;;
  5096. qnx)
  5097. add_cppflags -D_QNX_SOURCE
  5098. network_extralibs="-lsocket"
  5099. ;;
  5100. symbian)
  5101. SLIBSUF=".dll"
  5102. enable dos_paths
  5103. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  5104. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  5105. add_ldflags -Wl,--target1-abs,--no-undefined \
  5106. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  5107. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  5108. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  5109. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  5110. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  5111. ;;
  5112. minix)
  5113. ;;
  5114. none)
  5115. ;;
  5116. *)
  5117. die "Unknown OS '$target_os'."
  5118. ;;
  5119. esac
  5120. # test if creating links works
  5121. link_dest=$(mktemp -u $TMPDIR/dest_XXXXXXXX)
  5122. link_name=$(mktemp -u $TMPDIR/name_XXXXXXXX)
  5123. mkdir "$link_dest"
  5124. $ln_s "$link_dest" "$link_name"
  5125. touch "$link_dest/test_file"
  5126. if [ "$source_path" != "." ] && [ "$source_path" != "src" ] && ([ ! -d src ] || [ -L src ]) && [ -e "$link_name/test_file" ]; then
  5127. # create link to source path
  5128. [ -e src ] && rm src
  5129. $ln_s "$source_path" src
  5130. source_link=src
  5131. else
  5132. # creating directory links doesn't work
  5133. # fall back to using the full source path
  5134. source_link="$source_path"
  5135. fi
  5136. # cleanup
  5137. rm -r "$link_dest"
  5138. rm -r "$link_name"
  5139. # determine libc flavour
  5140. probe_libc(){
  5141. pfx=$1
  5142. pfx_no_=${pfx%_}
  5143. # uclibc defines __GLIBC__, so it needs to be checked before glibc.
  5144. if test_${pfx}cpp_condition features.h "defined __UCLIBC__"; then
  5145. eval ${pfx}libc_type=uclibc
  5146. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  5147. elif test_${pfx}cpp_condition features.h "defined __GLIBC__"; then
  5148. eval ${pfx}libc_type=glibc
  5149. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  5150. # MinGW headers can be installed on Cygwin, so check for newlib first.
  5151. elif test_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
  5152. eval ${pfx}libc_type=newlib
  5153. add_${pfx}cppflags -U__STRICT_ANSI__ -D_XOPEN_SOURCE=600
  5154. # MinGW64 is backwards compatible with MinGW32, so check for it first.
  5155. elif test_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then
  5156. eval ${pfx}libc_type=mingw64
  5157. if test_${pfx}cpp_condition _mingw.h "__MINGW64_VERSION_MAJOR < 3"; then
  5158. add_compat msvcrt/snprintf.o
  5159. add_cflags "-include $source_path/compat/msvcrt/snprintf.h"
  5160. fi
  5161. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  5162. eval test \$${pfx_no_}cc_type = "gcc" &&
  5163. add_${pfx}cppflags -D__printf__=__gnu_printf__
  5164. test_${pfx}cpp_condition windows.h "!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600" &&
  5165. add_${pfx}cppflags -D_WIN32_WINNT=0x0600
  5166. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  5167. elif test_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION" ||
  5168. test_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then
  5169. eval ${pfx}libc_type=mingw32
  5170. test_${pfx}cpp_condition _mingw.h "__MINGW32_MAJOR_VERSION > 3 || \
  5171. (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  5172. die "ERROR: MinGW32 runtime version must be >= 3.15."
  5173. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  5174. test_${pfx}cpp_condition _mingw.h "__MSVCRT_VERSION__ < 0x0700" &&
  5175. add_${pfx}cppflags -D__MSVCRT_VERSION__=0x0700
  5176. test_${pfx}cpp_condition windows.h "!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600" &&
  5177. add_${pfx}cppflags -D_WIN32_WINNT=0x0600
  5178. eval test \$${pfx_no_}cc_type = "gcc" &&
  5179. add_${pfx}cppflags -D__printf__=__gnu_printf__
  5180. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  5181. elif test_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then
  5182. eval ${pfx}libc_type=msvcrt
  5183. if test_${pfx}cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION < 14"; then
  5184. if [ "$pfx" = host_ ]; then
  5185. add_host_cppflags -Dsnprintf=_snprintf
  5186. else
  5187. add_compat strtod.o strtod=avpriv_strtod
  5188. add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
  5189. _snprintf=avpriv_snprintf \
  5190. vsnprintf=avpriv_vsnprintf
  5191. fi
  5192. fi
  5193. add_${pfx}cppflags -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS
  5194. # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
  5195. # 0x601 by default unless something else is set by the user.
  5196. # This can easily lead to us detecting functions only present
  5197. # in such new versions and producing binaries requiring windows 7.0.
  5198. # Therefore explicitly set the default to Vista unless the user has
  5199. # set something else on the command line.
  5200. # Don't do this if WINAPI_FAMILY is set and is set to a non-desktop
  5201. # family. For these cases, configure is free to use any functions
  5202. # found in the SDK headers by default. (Alternatively, we could force
  5203. # _WIN32_WINNT to 0x0602 in that case.)
  5204. test_${pfx}cpp_condition stdlib.h "defined(_WIN32_WINNT)" ||
  5205. { test_${pfx}cpp <<EOF && add_${pfx}cppflags -D_WIN32_WINNT=0x0600; }
  5206. #ifdef WINAPI_FAMILY
  5207. #include <winapifamily.h>
  5208. #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  5209. #error not desktop
  5210. #endif
  5211. #endif
  5212. EOF
  5213. if [ "$pfx" = "" ]; then
  5214. check_func strtoll || add_cflags -Dstrtoll=_strtoi64
  5215. check_func strtoull || add_cflags -Dstrtoull=_strtoui64
  5216. fi
  5217. elif test_${pfx}cpp_condition stddef.h "defined __KLIBC__"; then
  5218. eval ${pfx}libc_type=klibc
  5219. elif test_${pfx}cpp_condition sys/cdefs.h "defined __BIONIC__"; then
  5220. eval ${pfx}libc_type=bionic
  5221. elif test_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then
  5222. eval ${pfx}libc_type=solaris
  5223. add_${pfx}cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
  5224. elif test_${pfx}cpp_condition sys/version.h "defined __DJGPP__"; then
  5225. eval ${pfx}libc_type=djgpp
  5226. add_cppflags -U__STRICT_ANSI__
  5227. add_cflags "-include $source_path/compat/djgpp/math.h"
  5228. add_compat djgpp/math.o
  5229. fi
  5230. test_${pfx}cc <<EOF
  5231. #include <time.h>
  5232. void *v = localtime_r;
  5233. EOF
  5234. test "$?" != 0 && test_${pfx}cc -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 <<EOF && add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  5235. #include <time.h>
  5236. void *v = localtime_r;
  5237. EOF
  5238. eval test -n "\${${pfx}libc_type}" && enable ${pfx}libc_${libc_type}
  5239. }
  5240. probe_libc
  5241. probe_libc host_
  5242. # hacks for compiler/libc/os combinations
  5243. case $libc_type in
  5244. bionic)
  5245. add_compat strtod.o strtod=avpriv_strtod
  5246. ;;
  5247. esac
  5248. check_compile_assert flt_lim "float.h limits.h" "DBL_MAX == (double)DBL_MAX" ||
  5249. add_cppflags '-I\$(SRC_PATH)/compat/float'
  5250. test_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic
  5251. set_default libdir
  5252. : ${shlibdir_default:="$libdir"}
  5253. : ${pkgconfigdir_default:="$libdir/pkgconfig"}
  5254. set_default $PATHS_LIST
  5255. set_default nm
  5256. disabled optimizations || enabled ossfuzz || check_cflags -fomit-frame-pointer
  5257. enable_weak_pic() {
  5258. disabled pic && return
  5259. enable pic
  5260. add_cppflags -DPIC
  5261. case "$target_os" in
  5262. mingw*|cygwin*|win*)
  5263. ;;
  5264. *)
  5265. add_cflags -fPIC
  5266. add_asflags -fPIC
  5267. ;;
  5268. esac
  5269. }
  5270. enabled pic && enable_weak_pic
  5271. test_cc <<EOF || die "Symbol mangling check failed."
  5272. int ff_extern;
  5273. EOF
  5274. sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  5275. extern_prefix=${sym%%ff_extern*}
  5276. ! disabled inline_asm && check_inline_asm inline_asm '"" ::'
  5277. for restrict_keyword in restrict __restrict__ __restrict ""; do
  5278. test_code cc "" "char * $restrict_keyword p" && break
  5279. done
  5280. check_cc pragma_deprecated "" '_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")'
  5281. # The global variable ensures the bits appear unchanged in the object file.
  5282. test_cc <<EOF || die "endian test failed"
  5283. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  5284. EOF
  5285. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  5286. check_cc const_nan math.h "struct { double d; } static const bar[] = { { NAN } }"
  5287. if ! enabled ppc64 || enabled bigendian; then
  5288. disable vsx
  5289. fi
  5290. check_gas() {
  5291. log "check_gas using '$as' as AS"
  5292. # :vararg is used on aarch64, arm and ppc altivec
  5293. check_as vararg "
  5294. .macro m n, y:vararg=0
  5295. \n: .int \y
  5296. .endm
  5297. m x" || return 1
  5298. # .altmacro is only used in arm asm
  5299. ! enabled arm || check_as gnu_as ".altmacro"
  5300. }
  5301. if enabled_any arm aarch64 || enabled_all ppc altivec && enabled asm; then
  5302. nogas=:
  5303. enabled_any arm aarch64 && nogas=die
  5304. enabled_all ppc altivec && [ $target_os_default != aix ] && nogas=warn
  5305. as_noop=-v
  5306. case $as_type in
  5307. arm*) gaspp_as_type=armasm; as_noop=-h ;;
  5308. gcc) gaspp_as_type=gas ;;
  5309. *) gaspp_as_type=$as_type ;;
  5310. esac
  5311. [ $target_os = "darwin" ] && gaspp_as_type="apple-$gaspp_as_type"
  5312. test "${as#*gas-preprocessor.pl}" != "$as" ||
  5313. test_cmd gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- ${as:=$cc} $as_noop &&
  5314. gas="${gas:=gas-preprocessor.pl} -arch $arch -as-type $gaspp_as_type -- ${as:=$cc}"
  5315. if ! check_gas ; then
  5316. as=${gas:=$as}
  5317. check_gas || \
  5318. $nogas "GNU assembler not found, install/update gas-preprocessor"
  5319. fi
  5320. check_as as_func ".func test
  5321. .endfunc"
  5322. fi
  5323. check_inline_asm inline_asm_labels '"1:\n"'
  5324. check_inline_asm inline_asm_nonlocal_labels '"Label:\n"'
  5325. if enabled aarch64; then
  5326. enabled armv8 && check_insn armv8 'prfm pldl1strm, [x0]'
  5327. # internal assembler in clang 3.3 does not support this instruction
  5328. enabled neon && check_insn neon 'ext v0.8B, v0.8B, v1.8B, #1'
  5329. enabled vfp && check_insn vfp 'fmadd d0, d0, d1, d2'
  5330. map 'enabled_any ${v}_external ${v}_inline || disable $v' $ARCH_EXT_LIST_ARM
  5331. elif enabled alpha; then
  5332. check_cflags -mieee
  5333. elif enabled arm; then
  5334. enabled msvc && check_cpp_condition thumb stddef.h "defined _M_ARMT"
  5335. test_cpp_condition stddef.h "defined __thumb__" && test_cc <<EOF && enable_weak thumb
  5336. float func(float a, float b){ return a+b; }
  5337. EOF
  5338. enabled thumb && check_cflags -mthumb || check_cflags -marm
  5339. if check_cpp_condition vfp_args stddef.h "defined __ARM_PCS_VFP"; then
  5340. :
  5341. elif check_cpp_condition vfp_args stddef.h "defined _M_ARM_FP && _M_ARM_FP >= 30"; then
  5342. :
  5343. elif ! test_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__" && [ $target_os != darwin ]; then
  5344. case "${cross_prefix:-$cc}" in
  5345. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  5346. *) check_ld "cc" vfp_args <<EOF && fpabi=vfp || fpabi=soft ;;
  5347. __asm__ (".eabi_attribute 28, 1");
  5348. int main(void) { return 0; }
  5349. EOF
  5350. esac
  5351. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  5352. fi
  5353. enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
  5354. enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
  5355. enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
  5356. enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
  5357. enabled vfp && check_insn vfp 'fadds s0, s0, s0'
  5358. enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
  5359. enabled setend && check_insn setend 'setend be'
  5360. [ $target_os = linux ] || [ $target_os = android ] ||
  5361. map 'enabled_any ${v}_external ${v}_inline || disable $v' \
  5362. $ARCH_EXT_LIST_ARM
  5363. check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
  5364. check_as as_arch_directive ".arch armv7-a"
  5365. check_as as_dn_directive "ra .dn d0.i16"
  5366. check_as as_fpu_directive ".fpu neon"
  5367. # llvm's integrated assembler supports .object_arch from llvm 3.5
  5368. [ "$objformat" = elf32 ] || [ "$objformat" = elf64 ] &&
  5369. check_as as_object_arch ".object_arch armv4"
  5370. # MS armasm fails to assemble our PIC constructs
  5371. [ $target_os != win32 ] && enabled_all armv6t2 shared !pic && enable_weak_pic
  5372. elif enabled mips; then
  5373. enabled loongson2 && check_inline_asm loongson2 '"dmult.g $8, $9, $10"'
  5374. enabled loongson3 && check_inline_asm loongson3 '"gsldxc1 $f0, 0($2, $3)"'
  5375. enabled mmi && check_inline_asm mmi '"punpcklhw $f0, $f0, $f0"'
  5376. # Enable minimum ISA based on selected options
  5377. if enabled mips64; then
  5378. enabled mips64r6 && check_inline_asm_flags mips64r6 '"dlsa $0, $0, $0, 1"' '-mips64r6'
  5379. enabled mips64r2 && check_inline_asm_flags mips64r2 '"dext $0, $0, 0, 1"' '-mips64r2'
  5380. disabled mips64r6 && disabled mips64r2 && check_inline_asm_flags mips64r1 '"daddi $0, $0, 0"' '-mips64'
  5381. else
  5382. enabled mips32r6 && check_inline_asm_flags mips32r6 '"aui $0, $0, 0"' '-mips32r6'
  5383. enabled mips32r5 && check_inline_asm_flags mips32r5 '"eretnc"' '-mips32r5'
  5384. enabled mips32r2 && check_inline_asm_flags mips32r2 '"ext $0, $0, 0, 1"' '-mips32r2'
  5385. disabled mips32r6 && disabled mips32r5 && disabled mips32r2 && check_inline_asm_flags mips32r1 '"addi $0, $0, 0"' '-mips32'
  5386. fi
  5387. enabled mipsfpu && check_inline_asm_flags mipsfpu '"cvt.d.l $f0, $f2"' '-mhard-float'
  5388. enabled mipsfpu && (enabled mips32r5 || enabled mips32r6 || enabled mips64r6) && check_inline_asm_flags mipsfpu '"cvt.d.l $f0, $f1"' '-mfp64'
  5389. enabled mipsfpu && enabled msa && check_inline_asm_flags msa '"addvi.b $w0, $w1, 1"' '-mmsa' && check_headers msa.h || disable msa
  5390. enabled mipsdsp && check_inline_asm_flags mipsdsp '"addu.qb $t0, $t1, $t2"' '-mdsp'
  5391. enabled mipsdspr2 && check_inline_asm_flags mipsdspr2 '"absq_s.qb $t0, $t1"' '-mdspr2'
  5392. enabled msa && enabled msa2 && check_inline_asm_flags msa2 '"nxbits.any.b $w0, $w0"' '-mmsa2' && check_headers msa2.h || disable msa2
  5393. if enabled bigendian && enabled msa; then
  5394. disable msa
  5395. fi
  5396. elif enabled parisc; then
  5397. if enabled gcc; then
  5398. case $($cc -dumpversion) in
  5399. 4.[3-9].*) check_cflags -fno-optimize-sibling-calls ;;
  5400. esac
  5401. fi
  5402. elif enabled ppc; then
  5403. enable local_aligned
  5404. check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  5405. check_inline_asm ibm_asm '"add 0, 0, 0"'
  5406. check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
  5407. check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  5408. if enabled altivec; then
  5409. check_cflags -maltivec -mabi=altivec
  5410. # check if our compiler supports Motorola AltiVec C API
  5411. check_cc altivec altivec.h "vector signed int v1 = (vector signed int) { 0 };
  5412. vector signed int v2 = (vector signed int) { 1 };
  5413. v1 = vec_add(v1, v2);"
  5414. enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
  5415. fi
  5416. if enabled vsx; then
  5417. check_cflags -mvsx &&
  5418. check_cc vsx altivec.h "int v[4] = { 0 };
  5419. vector signed int v1 = vec_vsx_ld(0, v);"
  5420. fi
  5421. if enabled power8; then
  5422. check_cpp_condition power8 "altivec.h" "defined(_ARCH_PWR8)"
  5423. fi
  5424. elif enabled x86; then
  5425. check_builtin rdtsc intrin.h "__rdtsc()"
  5426. check_builtin mm_empty mmintrin.h "_mm_empty()"
  5427. enable local_aligned
  5428. # check whether EBP is available on x86
  5429. # As 'i' is stored on the stack, this program will crash
  5430. # if the base pointer is used to access it because the
  5431. # base pointer is cleared in the inline assembly code.
  5432. check_exec_crash <<EOF && enable ebp_available
  5433. volatile int i=0;
  5434. __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
  5435. return i;
  5436. EOF
  5437. # check whether EBX is available on x86
  5438. check_inline_asm ebx_available '""::"b"(0)' &&
  5439. check_inline_asm ebx_available '"":::"%ebx"'
  5440. # check whether xmm clobbers are supported
  5441. check_inline_asm xmm_clobbers '"":::"%xmm0"'
  5442. check_inline_asm inline_asm_direct_symbol_refs '"movl '$extern_prefix'test, %eax"' ||
  5443. check_inline_asm inline_asm_direct_symbol_refs '"movl '$extern_prefix'test(%rip), %eax"'
  5444. # check whether binutils is new enough to compile SSSE3/MMXEXT
  5445. enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
  5446. enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
  5447. probe_x86asm(){
  5448. x86asmexe_probe=$1
  5449. if test_cmd $x86asmexe_probe -v; then
  5450. x86asmexe=$x86asmexe_probe
  5451. x86asm_type=nasm
  5452. x86asm_debug="-g -F dwarf"
  5453. X86ASMDEP=
  5454. X86ASM_DEPFLAGS='-MD $(@:.o=.d)'
  5455. elif test_cmd $x86asmexe_probe --version; then
  5456. x86asmexe=$x86asmexe_probe
  5457. x86asm_type=yasm
  5458. x86asm_debug="-g dwarf2"
  5459. X86ASMDEP='$(DEPX86ASM) $(X86ASMFLAGS) -M $(X86ASM_O) $< > $(@:.o=.d)'
  5460. X86ASM_DEPFLAGS=
  5461. fi
  5462. check_x86asm x86asm "movbe ecx, [5]"
  5463. }
  5464. if ! disabled_any asm mmx x86asm; then
  5465. disable x86asm
  5466. for program in $x86asmexe nasm yasm; do
  5467. probe_x86asm $program && break
  5468. done
  5469. disabled x86asm && die "nasm/yasm not found or too old. Use --disable-x86asm for a crippled build."
  5470. X86ASMFLAGS="-f $objformat"
  5471. enabled pic && append X86ASMFLAGS "-DPIC"
  5472. test -n "$extern_prefix" && append X86ASMFLAGS "-DPREFIX"
  5473. case "$objformat" in
  5474. elf*) enabled debug && append X86ASMFLAGS $x86asm_debug ;;
  5475. esac
  5476. enabled avx512 && check_x86asm avx512_external "vmovdqa32 [eax]{k1}{z}, zmm0"
  5477. enabled avx2 && check_x86asm avx2_external "vextracti128 xmm0, ymm0, 0"
  5478. enabled xop && check_x86asm xop_external "vpmacsdd xmm0, xmm1, xmm2, xmm3"
  5479. enabled fma4 && check_x86asm fma4_external "vfmaddps ymm0, ymm1, ymm2, ymm3"
  5480. check_x86asm cpunop "CPU amdnop"
  5481. fi
  5482. case "$cpu" in
  5483. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  5484. disable fast_clz
  5485. ;;
  5486. esac
  5487. fi
  5488. check_cc intrinsics_neon arm_neon.h "int16x8_t test = vdupq_n_s16(0)"
  5489. check_ldflags -Wl,--as-needed
  5490. check_ldflags -Wl,-z,noexecstack
  5491. if ! disabled network; then
  5492. check_func getaddrinfo $network_extralibs
  5493. check_func inet_aton $network_extralibs
  5494. check_type netdb.h "struct addrinfo"
  5495. check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
  5496. check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
  5497. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  5498. check_type poll.h "struct pollfd"
  5499. check_type netinet/sctp.h "struct sctp_event_subscribe"
  5500. check_struct "sys/socket.h" "struct msghdr" msg_flags
  5501. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  5502. check_type netinet/in.h "struct sockaddr_in6"
  5503. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  5504. check_type "sys/types.h sys/socket.h" socklen_t
  5505. # Prefer arpa/inet.h over winsock2
  5506. if check_headers arpa/inet.h ; then
  5507. check_func closesocket
  5508. elif check_headers winsock2.h ; then
  5509. check_func_headers winsock2.h closesocket -lws2 &&
  5510. network_extralibs="-lws2" ||
  5511. { check_func_headers winsock2.h closesocket -lws2_32 &&
  5512. network_extralibs="-lws2_32"; } || disable winsock2_h network
  5513. check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
  5514. check_type ws2tcpip.h socklen_t
  5515. check_type ws2tcpip.h "struct addrinfo"
  5516. check_type ws2tcpip.h "struct group_source_req"
  5517. check_type ws2tcpip.h "struct ip_mreq_source"
  5518. check_type ws2tcpip.h "struct ipv6_mreq"
  5519. check_type winsock2.h "struct pollfd"
  5520. check_struct winsock2.h "struct sockaddr" sa_len
  5521. check_type ws2tcpip.h "struct sockaddr_in6"
  5522. check_type ws2tcpip.h "struct sockaddr_storage"
  5523. else
  5524. disable network
  5525. fi
  5526. fi
  5527. check_builtin atomic_cas_ptr atomic.h "void **ptr; void *oldval, *newval; atomic_cas_ptr(ptr, oldval, newval)"
  5528. check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
  5529. check_builtin MemoryBarrier windows.h "MemoryBarrier()"
  5530. check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
  5531. check_builtin gmtime_r time.h "time_t *time; struct tm *tm; gmtime_r(time, tm)"
  5532. check_builtin localtime_r time.h "time_t *time; struct tm *tm; localtime_r(time, tm)"
  5533. check_builtin x264_csp_bgr "stdint.h x264.h" "X264_CSP_BGR"
  5534. case "$custom_allocator" in
  5535. jemalloc)
  5536. # jemalloc by default does not use a prefix
  5537. require libjemalloc jemalloc/jemalloc.h malloc -ljemalloc
  5538. ;;
  5539. tcmalloc)
  5540. require_pkg_config libtcmalloc libtcmalloc gperftools/tcmalloc.h tc_malloc
  5541. malloc_prefix=tc_
  5542. ;;
  5543. esac
  5544. check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
  5545. check_func ${malloc_prefix}memalign && enable memalign
  5546. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  5547. check_func access
  5548. check_func_headers stdlib.h arc4random
  5549. check_lib clock_gettime time.h clock_gettime || check_lib clock_gettime time.h clock_gettime -lrt
  5550. check_func fcntl
  5551. check_func fork
  5552. check_func gethrtime
  5553. check_func getopt
  5554. check_func getrusage
  5555. check_func gettimeofday
  5556. check_func isatty
  5557. check_func mkstemp
  5558. check_func mmap
  5559. check_func mprotect
  5560. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  5561. check_func_headers time.h nanosleep || check_lib nanosleep time.h nanosleep -lrt
  5562. check_func sched_getaffinity
  5563. check_func setrlimit
  5564. check_struct "sys/stat.h" "struct stat" st_mtim.tv_nsec -D_BSD_SOURCE
  5565. check_func strerror_r
  5566. check_func sysconf
  5567. check_func sysctl
  5568. check_func usleep
  5569. check_func_headers conio.h kbhit
  5570. check_func_headers io.h setmode
  5571. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  5572. check_func_headers mach/mach_time.h mach_absolute_time
  5573. check_func_headers stdlib.h getenv
  5574. check_func_headers sys/stat.h lstat
  5575. check_func_headers windows.h GetModuleHandle
  5576. check_func_headers windows.h GetProcessAffinityMask
  5577. check_func_headers windows.h GetProcessTimes
  5578. check_func_headers windows.h GetStdHandle
  5579. check_func_headers windows.h GetSystemTimeAsFileTime
  5580. check_func_headers windows.h LoadLibrary
  5581. check_func_headers windows.h MapViewOfFile
  5582. check_func_headers windows.h PeekNamedPipe
  5583. check_func_headers windows.h SetConsoleTextAttribute
  5584. check_func_headers windows.h SetConsoleCtrlHandler
  5585. check_func_headers windows.h SetDllDirectory
  5586. check_func_headers windows.h Sleep
  5587. check_func_headers windows.h VirtualAlloc
  5588. check_func_headers glob.h glob
  5589. enabled xlib &&
  5590. check_lib xlib "X11/Xlib.h X11/extensions/Xvlib.h" XvGetPortAttribute -lXv -lX11 -lXext
  5591. check_headers direct.h
  5592. check_headers dirent.h
  5593. check_headers dxgidebug.h
  5594. check_headers dxva.h
  5595. check_headers dxva2api.h -D_WIN32_WINNT=0x0600
  5596. check_headers io.h
  5597. check_headers linux/perf_event.h
  5598. check_headers libcrystalhd/libcrystalhd_if.h
  5599. check_headers malloc.h
  5600. check_headers net/udplite.h
  5601. check_headers poll.h
  5602. check_headers sys/param.h
  5603. check_headers sys/resource.h
  5604. check_headers sys/select.h
  5605. check_headers sys/time.h
  5606. check_headers sys/un.h
  5607. check_headers termios.h
  5608. check_headers unistd.h
  5609. check_headers valgrind/valgrind.h
  5610. check_func_headers VideoToolbox/VTCompressionSession.h VTCompressionSessionPrepareToEncodeFrames -framework VideoToolbox
  5611. check_headers windows.h
  5612. check_headers X11/extensions/XvMClib.h
  5613. check_headers asm/types.h
  5614. # it seems there are versions of clang in some distros that try to use the
  5615. # gcc headers, which explodes for stdatomic
  5616. # so we also check that atomics actually work here
  5617. check_builtin stdatomic stdatomic.h "atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0); foo += bar"
  5618. check_lib advapi32 "windows.h" RegCloseKey -ladvapi32
  5619. check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom -lbcrypt &&
  5620. check_cpp_condition bcrypt bcrypt.h "defined BCRYPT_RNG_ALGORITHM"
  5621. check_lib ole32 "windows.h" CoTaskMemFree -lole32
  5622. check_lib shell32 "windows.h shellapi.h" CommandLineToArgvW -lshell32
  5623. check_lib psapi "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  5624. check_lib android android/native_window.h ANativeWindow_acquire -landroid
  5625. check_lib mediandk "stdint.h media/NdkImage.h" AImage_delete -lmediandk
  5626. check_lib camera2ndk "stdbool.h stdint.h camera/NdkCameraManager.h" ACameraManager_create -lcamera2ndk
  5627. enabled appkit && check_apple_framework AppKit
  5628. enabled audiotoolbox && check_apple_framework AudioToolbox
  5629. enabled avfoundation && check_apple_framework AVFoundation
  5630. enabled coreimage && check_apple_framework CoreImage
  5631. enabled videotoolbox && check_apple_framework VideoToolbox
  5632. check_apple_framework CoreFoundation
  5633. check_apple_framework CoreMedia
  5634. check_apple_framework CoreVideo
  5635. enabled avfoundation && {
  5636. disable coregraphics applicationservices
  5637. check_lib coregraphics CoreGraphics/CoreGraphics.h CGGetActiveDisplayList "-framework CoreGraphics" ||
  5638. check_lib applicationservices ApplicationServices/ApplicationServices.h CGGetActiveDisplayList "-framework ApplicationServices"; }
  5639. enabled videotoolbox && {
  5640. check_lib coreservices CoreServices/CoreServices.h UTGetOSTypeFromString "-framework CoreServices"
  5641. check_func_headers CoreMedia/CMFormatDescription.h kCMVideoCodecType_HEVC "-framework CoreMedia"
  5642. check_func_headers CoreVideo/CVPixelBuffer.h kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange "-framework CoreVideo"
  5643. check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ "-framework CoreVideo"
  5644. check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_ITU_R_2100_HLG "-framework CoreVideo"
  5645. check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_Linear "-framework CoreVideo"
  5646. }
  5647. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  5648. check_type "windows.h dxva.h" "DXVA_PicParams_HEVC" -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_CRT_BUILD_DESKTOP_APP=0
  5649. check_type "windows.h dxva.h" "DXVA_PicParams_VP9" -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_CRT_BUILD_DESKTOP_APP=0
  5650. check_type "windows.h d3d11.h" "ID3D11VideoDecoder"
  5651. check_type "windows.h d3d11.h" "ID3D11VideoContext"
  5652. check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602
  5653. check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC"
  5654. check_type "vdpau/vdpau.h" "VdpPictureInfoVP9"
  5655. if [ -z "$nvccflags" ]; then
  5656. nvccflags=$nvccflags_default
  5657. fi
  5658. if enabled x86_64 || enabled ppc64 || enabled aarch64; then
  5659. nvccflags="$nvccflags -m64"
  5660. else
  5661. nvccflags="$nvccflags -m32"
  5662. fi
  5663. if enabled cuda_nvcc; then
  5664. nvccflags="$nvccflags -ptx"
  5665. else
  5666. nvccflags="$nvccflags -S -nocudalib -nocudainc --cuda-device-only -include ${source_link}/compat/cuda/cuda_runtime.h"
  5667. check_nvcc cuda_llvm
  5668. fi
  5669. if ! disabled ffnvcodec; then
  5670. ffnv_hdr_list="ffnvcodec/nvEncodeAPI.h ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h ffnvcodec/dynlink_nvcuvid.h"
  5671. check_pkg_config ffnvcodec "ffnvcodec >= 9.1.23.1" "$ffnv_hdr_list" "" || \
  5672. check_pkg_config ffnvcodec "ffnvcodec >= 9.0.18.3 ffnvcodec < 9.1" "$ffnv_hdr_list" "" || \
  5673. check_pkg_config ffnvcodec "ffnvcodec >= 8.2.15.10 ffnvcodec < 8.3" "$ffnv_hdr_list" "" || \
  5674. check_pkg_config ffnvcodec "ffnvcodec >= 8.1.24.11 ffnvcodec < 8.2" "$ffnv_hdr_list" ""
  5675. fi
  5676. check_cpp_condition winrt windows.h "!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)"
  5677. if ! disabled w32threads && ! enabled pthreads; then
  5678. check_func_headers "windows.h process.h" _beginthreadex &&
  5679. check_type "windows.h" CONDITION_VARIABLE &&
  5680. check_type "windows.h" INIT_ONCE &&
  5681. enable w32threads || disable w32threads
  5682. if ! enabled w32threads && enabled winrt; then
  5683. check_func_headers "windows.h" CreateThread &&
  5684. enable w32threads || disable w32threads
  5685. fi
  5686. fi
  5687. # check for some common methods of building with pthread support
  5688. # do this before the optional library checks as some of them require pthreads
  5689. if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then
  5690. if check_lib pthreads pthread.h pthread_join -pthread &&
  5691. check_lib pthreads pthread.h pthread_create -pthread; then
  5692. add_cflags -pthread
  5693. elif check_lib pthreads pthread.h pthread_join -pthreads &&
  5694. check_lib pthreads pthread.h pthread_create -pthreads; then
  5695. add_cflags -pthreads
  5696. elif check_lib pthreads pthread.h pthread_join -ldl -pthread &&
  5697. check_lib pthreads pthread.h pthread_create -ldl -pthread; then
  5698. add_cflags -ldl -pthread
  5699. elif check_lib pthreads pthread.h pthread_join -lpthreadGC2 &&
  5700. check_lib pthreads pthread.h pthread_create -lpthreadGC2; then
  5701. :
  5702. elif check_lib pthreads pthread.h pthread_join -lpthread &&
  5703. check_lib pthreads pthread.h pthread_create -lpthread; then
  5704. :
  5705. elif check_func pthread_join && check_func pthread_create; then
  5706. enable pthreads
  5707. fi
  5708. check_cc pthreads "pthread.h" "static pthread_mutex_t atomic_lock = PTHREAD_MUTEX_INITIALIZER"
  5709. if enabled pthreads; then
  5710. check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); sem_timedwait(s,0); sem_destroy(s)" $pthreads_extralibs
  5711. check_func pthread_cancel $pthreads_extralibs
  5712. fi
  5713. fi
  5714. enabled zlib && { check_pkg_config zlib zlib "zlib.h" zlibVersion ||
  5715. check_lib zlib zlib.h zlibVersion -lz; }
  5716. enabled bzlib && check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2
  5717. enabled lzma && check_lib lzma lzma.h lzma_version_number -llzma
  5718. # On some systems dynamic loading requires no extra linker flags
  5719. check_lib libdl dlfcn.h "dlopen dlsym" || check_lib libdl dlfcn.h "dlopen dlsym" -ldl
  5720. check_lib libm math.h sin -lm
  5721. atan2f_args=2
  5722. copysign_args=2
  5723. hypot_args=2
  5724. ldexpf_args=2
  5725. powf_args=2
  5726. for func in $MATH_FUNCS; do
  5727. eval check_mathfunc $func \${${func}_args:-1} $libm_extralibs
  5728. done
  5729. for func in $COMPLEX_FUNCS; do
  5730. eval check_complexfunc $func \${${func}_args:-1}
  5731. done
  5732. # these are off by default, so fail if requested and not available
  5733. enabled avisynth && require_headers "avisynth/avisynth_c.h"
  5734. enabled cuda_nvcc && { check_nvcc cuda_nvcc || die "ERROR: failed checking for nvcc."; }
  5735. enabled chromaprint && require chromaprint chromaprint.h chromaprint_get_version -lchromaprint
  5736. enabled decklink && { require_headers DeckLinkAPI.h &&
  5737. { test_cpp_condition DeckLinkAPIVersion.h "BLACKMAGIC_DECKLINK_API_VERSION >= 0x0a090500" || die "ERROR: Decklink API version must be >= 10.9.5."; } }
  5738. enabled frei0r && require_headers "frei0r.h dlfcn.h"
  5739. enabled gmp && require gmp gmp.h mpz_export -lgmp
  5740. enabled gnutls && require_pkg_config gnutls gnutls gnutls/gnutls.h gnutls_global_init
  5741. enabled jni && { [ $target_os = "android" ] && check_headers jni.h && enabled pthreads || die "ERROR: jni not found"; }
  5742. enabled ladspa && require_headers "ladspa.h dlfcn.h"
  5743. enabled libaom && require_pkg_config libaom "aom >= 1.0.0" aom/aom_codec.h aom_codec_version
  5744. enabled libaribb24 && { check_pkg_config libaribb24 "aribb24 > 1.0.3" "aribb24/aribb24.h" arib_instance_new ||
  5745. { enabled gpl && require_pkg_config libaribb24 aribb24 "aribb24/aribb24.h" arib_instance_new; } ||
  5746. die "ERROR: libaribb24 requires version higher than 1.0.3 or --enable-gpl."; }
  5747. enabled lv2 && require_pkg_config lv2 lilv-0 "lilv/lilv.h" lilv_world_new
  5748. enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
  5749. enabled libass && require_pkg_config libass libass ass/ass.h ass_library_init
  5750. enabled libbluray && require_pkg_config libbluray libbluray libbluray/bluray.h bd_open
  5751. enabled libbs2b && require_pkg_config libbs2b libbs2b bs2b.h bs2b_open
  5752. enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 &&
  5753. { check_lib libcelt celt/celt.h celt_decoder_create_custom -lcelt0 ||
  5754. die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
  5755. enabled libcaca && require_pkg_config libcaca caca caca.h caca_create_canvas
  5756. enabled libcodec2 && require libcodec2 codec2/codec2.h codec2_create -lcodec2
  5757. enabled libdav1d && require_pkg_config libdav1d "dav1d >= 0.4.0" "dav1d/dav1d.h" dav1d_version
  5758. enabled libdavs2 && require_pkg_config libdavs2 "davs2 >= 1.6.0" davs2.h davs2_decoder_open
  5759. enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new
  5760. enabled libdrm && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion
  5761. enabled libfdk_aac && { check_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen ||
  5762. { require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac &&
  5763. warn "using libfdk without pkg-config"; } }
  5764. flite_extralibs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite"
  5765. enabled libflite && require libflite "flite/flite.h" flite_init $flite_extralibs
  5766. enabled fontconfig && enable libfontconfig
  5767. enabled libfontconfig && require_pkg_config libfontconfig fontconfig "fontconfig/fontconfig.h" FcInit
  5768. enabled libfreetype && require_pkg_config libfreetype freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
  5769. enabled libfribidi && require_pkg_config libfribidi fribidi fribidi.h fribidi_version_info
  5770. enabled libglslang && require_cpp libglslang glslang/SPIRV/GlslangToSpv.h "glslang::TIntermediate*" -lglslang -lOSDependent -lHLSL -lOGLCompiler -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++
  5771. enabled libgme && { check_pkg_config libgme libgme gme/gme.h gme_new_emu ||
  5772. require libgme gme/gme.h gme_new_emu -lgme -lstdc++; }
  5773. enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
  5774. check_lib libgsm "${gsm_hdr}" gsm_create -lgsm && break;
  5775. done || die "ERROR: libgsm not found"; }
  5776. enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc $pthreads_extralibs
  5777. enabled libklvanc && require libklvanc libklvanc/vanc.h klvanc_context_create -lklvanc
  5778. enabled libkvazaar && require_pkg_config libkvazaar "kvazaar >= 0.8.1" kvazaar.h kvz_api_get
  5779. enabled liblensfun && require_pkg_config liblensfun lensfun lensfun.h lf_db_new
  5780. # While it may appear that require is being used as a pkg-config
  5781. # fallback for libmfx, it is actually being used to detect a different
  5782. # installation route altogether. If libmfx is installed via the Intel
  5783. # Media SDK or Intel Media Server Studio, these don't come with
  5784. # pkg-config support. Instead, users should make sure that the build
  5785. # can find the libraries and headers through other means.
  5786. enabled libmfx && { check_pkg_config libmfx libmfx "mfx/mfxvideo.h" MFXInit ||
  5787. { require libmfx "mfx/mfxvideo.h" MFXInit "-llibmfx $advapi32_extralibs" && warn "using libmfx without pkg-config"; } }
  5788. if enabled libmfx; then
  5789. check_cc MFX_CODEC_VP9 "mfx/mfxvp9.h mfx/mfxstructures.h" "MFX_CODEC_VP9"
  5790. fi
  5791. enabled libmodplug && require_pkg_config libmodplug libmodplug libmodplug/modplug.h ModPlug_Load
  5792. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame $libm_extralibs
  5793. enabled libmysofa && { check_pkg_config libmysofa libmysofa mysofa.h mysofa_neighborhood_init_withstepdefine ||
  5794. require libmysofa mysofa.h mysofa_neighborhood_init_withstepdefine -lmysofa $zlib_extralibs; }
  5795. enabled libnpp && { check_lib libnpp npp.h nppGetLibVersion -lnppig -lnppicc -lnppc -lnppidei ||
  5796. check_lib libnpp npp.h nppGetLibVersion -lnppi -lnppc -lnppidei ||
  5797. die "ERROR: libnpp not found"; }
  5798. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  5799. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  5800. enabled libopencv && { check_headers opencv2/core/core_c.h &&
  5801. { check_pkg_config libopencv opencv opencv2/core/core_c.h cvCreateImageHeader ||
  5802. require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
  5803. require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; }
  5804. enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion
  5805. enabled libopenjpeg && { check_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version ||
  5806. { require_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } }
  5807. enabled libopenmpt && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++"
  5808. enabled libopus && {
  5809. enabled libopus_decoder && {
  5810. require_pkg_config libopus opus opus_multistream.h opus_multistream_decoder_create
  5811. }
  5812. enabled libopus_encoder && {
  5813. require_pkg_config libopus opus opus_multistream.h opus_multistream_surround_encoder_create
  5814. }
  5815. }
  5816. enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new
  5817. enabled librabbitmq && require_pkg_config librabbitmq "librabbitmq >= 0.7.1" amqp.h amqp_new_connection
  5818. enabled librav1e && require_pkg_config librav1e "rav1e >= 0.1.0" rav1e.h rav1e_context_new
  5819. enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo
  5820. enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket
  5821. enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++"
  5822. enabled libshine && require_pkg_config libshine shine shine/layer3.h shine_encode_buffer
  5823. enabled libsmbclient && { check_pkg_config libsmbclient smbclient libsmbclient.h smbc_init ||
  5824. require libsmbclient libsmbclient.h smbc_init -lsmbclient; }
  5825. enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++
  5826. enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
  5827. enabled libssh && require_pkg_config libssh libssh libssh/sftp.h sftp_init
  5828. enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
  5829. enabled libsrt && require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket
  5830. enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow
  5831. enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate
  5832. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  5833. enabled libtls && require_pkg_config libtls libtls tls.h tls_configure
  5834. enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame &&
  5835. { check_lib libtwolame twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
  5836. die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; }
  5837. enabled libv4l2 && require_pkg_config libv4l2 libv4l2 libv4l2.h v4l2_ioctl
  5838. enabled libvidstab && require_pkg_config libvidstab "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit
  5839. enabled libvmaf && require_pkg_config libvmaf "libvmaf >= 1.3.9" libvmaf.h compute_vmaf
  5840. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  5841. enabled libvorbis && require_pkg_config libvorbis vorbis vorbis/codec.h vorbis_info_init &&
  5842. require_pkg_config libvorbisenc vorbisenc vorbis/vorbisenc.h vorbis_encode_init
  5843. enabled libvpx && {
  5844. enabled libvpx_vp8_decoder && {
  5845. check_pkg_config libvpx_vp8_decoder "vpx >= 1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx ||
  5846. check_lib libvpx_vp8_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp8_dx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs $pthreads_extralibs"
  5847. }
  5848. enabled libvpx_vp8_encoder && {
  5849. check_pkg_config libvpx_vp8_encoder "vpx >= 1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx ||
  5850. check_lib libvpx_vp8_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp8_cx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs $pthreads_extralibs"
  5851. }
  5852. enabled libvpx_vp9_decoder && {
  5853. check_pkg_config libvpx_vp9_decoder "vpx >= 1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx ||
  5854. check_lib libvpx_vp9_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs $pthreads_extralibs"
  5855. }
  5856. enabled libvpx_vp9_encoder && {
  5857. check_pkg_config libvpx_vp9_encoder "vpx >= 1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx ||
  5858. check_lib libvpx_vp9_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs $pthreads_extralibs"
  5859. }
  5860. if disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder; then
  5861. die "libvpx enabled but no supported decoders found"
  5862. fi
  5863. }
  5864. enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack
  5865. enabled libwebp && {
  5866. enabled libwebp_encoder && require_pkg_config libwebp "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion
  5867. enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
  5868. enabled libx264 && { check_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode ||
  5869. { require libx264 "stdint.h x264.h" x264_encoder_encode "-lx264 $pthreads_extralibs $libm_extralibs" &&
  5870. warn "using libx264 without pkg-config"; } } &&
  5871. require_cpp_condition libx264 x264.h "X264_BUILD >= 118" &&
  5872. check_cpp_condition libx262 x264.h "X264_MPEG2"
  5873. enabled libx265 && require_pkg_config libx265 x265 x265.h x265_api_get &&
  5874. require_cpp_condition libx265 x265.h "X265_BUILD >= 70"
  5875. enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"
  5876. enabled libxavs2 && require_pkg_config libxavs2 "xavs2 >= 1.3.0" "stdint.h xavs2.h" xavs2_api_get
  5877. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  5878. enabled libzimg && require_pkg_config libzimg "zimg >= 2.7.0" zimg.h zimg_get_api_version
  5879. enabled libzmq && require_pkg_config libzmq "libzmq >= 4.2.1" zmq.h zmq_ctx_new
  5880. enabled libzvbi && require_pkg_config libzvbi zvbi-0.2 libzvbi.h vbi_decoder_new &&
  5881. { test_cpp_condition libzvbi.h "VBI_VERSION_MAJOR > 0 || VBI_VERSION_MINOR > 2 || VBI_VERSION_MINOR == 2 && VBI_VERSION_MICRO >= 28" ||
  5882. enabled gpl || die "ERROR: libzvbi requires version 0.2.28 or --enable-gpl."; }
  5883. enabled libxml2 && require_pkg_config libxml2 libxml-2.0 libxml2/libxml/xmlversion.h xmlCheckVersion
  5884. enabled mbedtls && { check_pkg_config mbedtls mbedtls mbedtls/x509_crt.h mbedtls_x509_crt_init ||
  5885. check_pkg_config mbedtls mbedtls mbedtls/ssl.h mbedtls_ssl_init ||
  5886. check_lib mbedtls mbedtls/ssl.h mbedtls_ssl_init -lmbedtls -lmbedx509 -lmbedcrypto ||
  5887. die "ERROR: mbedTLS not found"; }
  5888. enabled mediacodec && { enabled jni || die "ERROR: mediacodec requires --enable-jni"; }
  5889. enabled mmal && { check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ||
  5890. { ! enabled cross_compile &&
  5891. add_cflags -isystem/opt/vc/include/ -isystem/opt/vc/include/interface/vmcs_host/linux -isystem/opt/vc/include/interface/vcos/pthreads -fgnu89-inline &&
  5892. add_ldflags -L/opt/vc/lib/ &&
  5893. check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host; } ||
  5894. die "ERROR: mmal not found" &&
  5895. check_func_headers interface/mmal/mmal.h "MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"; }
  5896. enabled openal && { { for al_extralibs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
  5897. check_lib openal 'AL/al.h' alGetError "${al_extralibs}" && break; done } ||
  5898. die "ERROR: openal not found"; } &&
  5899. { test_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
  5900. die "ERROR: openal must be installed and version must be 1.1 or compatible"; }
  5901. enabled opencl && { check_pkg_config opencl OpenCL CL/cl.h clEnqueueNDRangeKernel ||
  5902. check_lib opencl OpenCL/cl.h clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
  5903. check_lib opencl CL/cl.h clEnqueueNDRangeKernel -lOpenCL ||
  5904. die "ERROR: opencl not found"; } &&
  5905. { test_cpp_condition "OpenCL/cl.h" "defined(CL_VERSION_1_2)" ||
  5906. test_cpp_condition "CL/cl.h" "defined(CL_VERSION_1_2)" ||
  5907. die "ERROR: opencl must be installed and version must be 1.2 or compatible"; }
  5908. enabled opengl && { check_lib opengl GL/glx.h glXGetProcAddress "-lGL" ||
  5909. check_lib opengl windows.h wglGetProcAddress "-lopengl32 -lgdi32" ||
  5910. check_lib opengl OpenGL/gl3.h glGetError "-Wl,-framework,OpenGL" ||
  5911. check_lib opengl ES2/gl.h glGetError "-isysroot=${sysroot} -Wl,-framework,OpenGLES" ||
  5912. die "ERROR: opengl not found."
  5913. }
  5914. enabled omx_rpi && { test_code cc OMX_Core.h OMX_IndexConfigBrcmVideoRequestIFrame ||
  5915. { ! enabled cross_compile &&
  5916. add_cflags -isystem/opt/vc/include/IL &&
  5917. test_code cc OMX_Core.h OMX_IndexConfigBrcmVideoRequestIFrame; } ||
  5918. die "ERROR: OpenMAX IL headers from raspberrypi/firmware not found"; } &&
  5919. enable omx
  5920. enabled omx && require_headers OMX_Core.h
  5921. enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OPENSSL_init_ssl ||
  5922. check_pkg_config openssl openssl openssl/ssl.h SSL_library_init ||
  5923. check_lib openssl openssl/ssl.h OPENSSL_init_ssl -lssl -lcrypto ||
  5924. check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  5925. check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  5926. check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  5927. die "ERROR: openssl not found"; }
  5928. enabled pocketsphinx && require_pkg_config pocketsphinx pocketsphinx pocketsphinx/pocketsphinx.h ps_init
  5929. enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/rk_mpi.h mpp_create &&
  5930. require_pkg_config rockchip_mpp "rockchip_mpp >= 1.3.7" rockchip/rk_mpi.h mpp_create &&
  5931. { enabled libdrm ||
  5932. die "ERROR: rkmpp requires --enable-libdrm"; }
  5933. }
  5934. enabled vapoursynth && require_pkg_config vapoursynth "vapoursynth-script >= 42" VSScript.h vsscript_init
  5935. if enabled gcrypt; then
  5936. GCRYPT_CONFIG="${cross_prefix}libgcrypt-config"
  5937. if "${GCRYPT_CONFIG}" --version > /dev/null 2>&1; then
  5938. gcrypt_cflags=$("${GCRYPT_CONFIG}" --cflags)
  5939. gcrypt_extralibs=$("${GCRYPT_CONFIG}" --libs)
  5940. check_func_headers gcrypt.h gcry_mpi_new $gcrypt_cflags $gcrypt_extralibs ||
  5941. die "ERROR: gcrypt not found"
  5942. add_cflags $gcrypt_cflags
  5943. else
  5944. require gcrypt gcrypt.h gcry_mpi_new -lgcrypt
  5945. fi
  5946. fi
  5947. if enabled sdl2; then
  5948. SDL2_CONFIG="${cross_prefix}sdl2-config"
  5949. test_pkg_config sdl2 "sdl2 >= 2.0.1 sdl2 < 2.1.0" SDL_events.h SDL_PollEvent
  5950. if disabled sdl2 && "${SDL2_CONFIG}" --version > /dev/null 2>&1; then
  5951. sdl2_cflags=$("${SDL2_CONFIG}" --cflags)
  5952. sdl2_extralibs=$("${SDL2_CONFIG}" --libs)
  5953. test_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags &&
  5954. test_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags &&
  5955. check_func_headers SDL_events.h SDL_PollEvent $sdl2_extralibs $sdl2_cflags &&
  5956. enable sdl2
  5957. fi
  5958. if test $target_os = "mingw32"; then
  5959. sdl2_extralibs=$(filter_out '-mwindows' $sdl2_extralibs)
  5960. fi
  5961. fi
  5962. if enabled decklink; then
  5963. case $target_os in
  5964. mingw32*|mingw64*|win32|win64)
  5965. decklink_outdev_extralibs="$decklink_outdev_extralibs -lole32 -loleaut32"
  5966. decklink_indev_extralibs="$decklink_indev_extralibs -lole32 -loleaut32"
  5967. ;;
  5968. esac
  5969. fi
  5970. enabled securetransport &&
  5971. check_func SecIdentityCreate "-Wl,-framework,CoreFoundation -Wl,-framework,Security" &&
  5972. check_lib securetransport "Security/SecureTransport.h Security/Security.h" "SSLCreateContext" "-Wl,-framework,CoreFoundation -Wl,-framework,Security" ||
  5973. disable securetransport
  5974. enabled securetransport &&
  5975. check_func SecItemImport "-Wl,-framework,CoreFoundation -Wl,-framework,Security"
  5976. enabled schannel &&
  5977. check_func_headers "windows.h security.h" InitializeSecurityContext -DSECURITY_WIN32 -lsecur32 &&
  5978. test_cpp_condition winerror.h "defined(SEC_I_CONTEXT_EXPIRED)" &&
  5979. schannel_extralibs="-lsecur32" ||
  5980. disable schannel
  5981. makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo
  5982. enabled makeinfo \
  5983. && [ 0$(makeinfo --version | grep "texinfo" | sed 's/.*texinfo[^0-9]*\([0-9]*\)\..*/\1/') -ge 5 ] \
  5984. && enable makeinfo_html || disable makeinfo_html
  5985. disabled makeinfo_html && texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html
  5986. perl -v > /dev/null 2>&1 && enable perl || disable perl
  5987. pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
  5988. rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
  5989. # check V4L2 codecs available in the API
  5990. if enabled v4l2_m2m; then
  5991. check_headers linux/fb.h
  5992. check_headers linux/videodev2.h
  5993. test_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete
  5994. check_cc v4l2_m2m linux/videodev2.h "int i = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_M2M | V4L2_BUF_FLAG_LAST;"
  5995. check_cc vc1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VC1_ANNEX_G;"
  5996. check_cc mpeg1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG1;"
  5997. check_cc mpeg2_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG2;"
  5998. check_cc mpeg4_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG4;"
  5999. check_cc hevc_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_HEVC;"
  6000. check_cc h263_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_H263;"
  6001. check_cc h264_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_H264;"
  6002. check_cc vp8_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP8;"
  6003. check_cc vp9_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP9;"
  6004. fi
  6005. check_headers sys/videoio.h
  6006. test_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete
  6007. check_lib user32 "windows.h winuser.h" GetShellWindow -luser32
  6008. check_lib vfw32 "windows.h vfw.h" capCreateCaptureWindow -lvfw32
  6009. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  6010. # w32api 3.12 had it defined wrong
  6011. check_cpp_condition vfwcap_defines vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER"
  6012. check_type "dshow.h" IBaseFilter
  6013. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  6014. check_headers "dev/bktr/ioctl_meteor.h dev/bktr/ioctl_bt848.h" ||
  6015. check_headers "machine/ioctl_meteor.h machine/ioctl_bt848.h" ||
  6016. check_headers "dev/video/meteor/ioctl_meteor.h dev/video/bktr/ioctl_bt848.h" ||
  6017. check_headers "dev/ic/bt8xx.h"
  6018. if check_struct sys/soundcard.h audio_buf_info bytes; then
  6019. enable_sanitized sys/soundcard.h
  6020. else
  6021. test_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_sanitized sys/soundcard.h
  6022. #include <sys/soundcard.h>
  6023. audio_buf_info abc;
  6024. EOF
  6025. fi
  6026. enabled alsa && { check_pkg_config alsa alsa "alsa/asoundlib.h" snd_pcm_htimestamp ||
  6027. check_lib alsa alsa/asoundlib.h snd_pcm_htimestamp -lasound; }
  6028. enabled libjack &&
  6029. require_pkg_config libjack jack jack/jack.h jack_port_get_latency_range
  6030. enabled sndio && check_lib sndio sndio.h sio_open -lsndio
  6031. if enabled libcdio; then
  6032. check_pkg_config libcdio libcdio_paranoia "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open ||
  6033. check_pkg_config libcdio libcdio_paranoia "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open ||
  6034. check_lib libcdio "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  6035. check_lib libcdio "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  6036. die "ERROR: No usable libcdio/cdparanoia found"
  6037. fi
  6038. enabled libxcb && check_pkg_config libxcb "xcb >= 1.4" xcb/xcb.h xcb_connect ||
  6039. disable libxcb_shm libxcb_shape libxcb_xfixes
  6040. if enabled libxcb; then
  6041. enabled libxcb_shm && check_pkg_config libxcb_shm xcb-shm xcb/shm.h xcb_shm_attach
  6042. enabled libxcb_shape && check_pkg_config libxcb_shape xcb-shape xcb/shape.h xcb_shape_get_rectangles
  6043. enabled libxcb_xfixes && check_pkg_config libxcb_xfixes xcb-xfixes xcb/xfixes.h xcb_xfixes_get_cursor_image
  6044. fi
  6045. check_func_headers "windows.h" CreateDIBSection "$gdigrab_indev_extralibs"
  6046. # d3d11va requires linking directly to dxgi and d3d11 if not building for
  6047. # the desktop api partition
  6048. test_cpp <<EOF && enable uwp && d3d11va_extralibs="-ldxgi -ld3d11"
  6049. #ifdef WINAPI_FAMILY
  6050. #include <winapifamily.h>
  6051. #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  6052. #error desktop, not uwp
  6053. #else
  6054. // WINAPI_FAMILY_APP, WINAPI_FAMILY_PHONE_APP => UWP
  6055. #endif
  6056. #else
  6057. #error no family set
  6058. #endif
  6059. EOF
  6060. enabled vaapi &&
  6061. check_pkg_config vaapi "libva >= 0.35.0" "va/va.h" vaInitialize
  6062. if enabled vaapi; then
  6063. check_pkg_config vaapi_drm "libva-drm" "va/va_drm.h" vaGetDisplayDRM
  6064. if enabled xlib; then
  6065. check_pkg_config vaapi_x11 "libva-x11" "va/va_x11.h" vaGetDisplay
  6066. fi
  6067. check_cpp_condition vaapi_1 "va/va.h" "VA_CHECK_VERSION(1, 0, 0)"
  6068. check_type "va/va.h va/va_dec_hevc.h" "VAPictureParameterBufferHEVC"
  6069. check_struct "va/va.h" "VADecPictureParameterBufferVP9" bit_depth
  6070. check_type "va/va.h va/va_vpp.h" "VAProcFilterParameterBufferHDRToneMapping"
  6071. check_struct "va/va.h va/va_vpp.h" "VAProcPipelineCaps" rotation_flags
  6072. check_type "va/va.h va/va_enc_hevc.h" "VAEncPictureParameterBufferHEVC"
  6073. check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG"
  6074. check_type "va/va.h va/va_enc_vp8.h" "VAEncPictureParameterBufferVP8"
  6075. check_type "va/va.h va/va_enc_vp9.h" "VAEncPictureParameterBufferVP9"
  6076. fi
  6077. if enabled_all opencl libdrm ; then
  6078. check_type "CL/cl_intel.h" "clCreateImageFromFdINTEL_fn" &&
  6079. enable opencl_drm_beignet
  6080. check_func_headers "CL/cl_ext.h" clImportMemoryARM &&
  6081. enable opencl_drm_arm
  6082. fi
  6083. if enabled_all opencl vaapi ; then
  6084. if enabled opencl_drm_beignet ; then
  6085. enable opencl_vaapi_beignet
  6086. else
  6087. check_type "CL/cl.h CL/cl_va_api_media_sharing_intel.h" "clCreateFromVA_APIMediaSurfaceINTEL_fn" &&
  6088. enable opencl_vaapi_intel_media
  6089. fi
  6090. fi
  6091. if enabled_all opencl dxva2 ; then
  6092. check_type "CL/cl_dx9_media_sharing.h" cl_dx9_surface_info_khr &&
  6093. enable opencl_dxva2
  6094. fi
  6095. if enabled_all opencl d3d11va ; then
  6096. check_type "CL/cl_d3d11.h" clGetDeviceIDsFromD3D11KHR_fn &&
  6097. enable opencl_d3d11
  6098. fi
  6099. enabled vdpau &&
  6100. check_cpp_condition vdpau vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP"
  6101. enabled vdpau &&
  6102. check_lib vdpau_x11 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau -lX11
  6103. enabled crystalhd && check_lib crystalhd "stdint.h libcrystalhd/libcrystalhd_if.h" DtsCrystalHDVersion -lcrystalhd
  6104. enabled vulkan &&
  6105. require_pkg_config vulkan "vulkan >= 1.1.97" "vulkan/vulkan.h" vkCreateInstance
  6106. if enabled x86; then
  6107. case $target_os in
  6108. mingw32*|mingw64*|win32|win64|linux|cygwin*)
  6109. ;;
  6110. *)
  6111. disable ffnvcodec cuvid nvdec nvenc
  6112. ;;
  6113. esac
  6114. elif enabled ppc64 && ! enabled bigendian; then
  6115. case $target_os in
  6116. linux)
  6117. ;;
  6118. *)
  6119. disable ffnvcodec cuvid nvdec nvenc
  6120. ;;
  6121. esac
  6122. else
  6123. disable ffnvcodec cuvid nvdec nvenc
  6124. fi
  6125. enabled ffnvcodec && enable cuda
  6126. enabled nvenc &&
  6127. test_cc -I$source_path <<EOF || disable nvenc
  6128. #include <ffnvcodec/nvEncodeAPI.h>
  6129. NV_ENCODE_API_FUNCTION_LIST flist;
  6130. void f(void) { struct { const GUID guid; } s[] = { { NV_ENC_PRESET_HQ_GUID } }; }
  6131. int main(void) { return 0; }
  6132. EOF
  6133. enabled amf &&
  6134. check_cpp_condition amf "AMF/core/Version.h" \
  6135. "(AMF_VERSION_MAJOR << 48 | AMF_VERSION_MINOR << 32 | AMF_VERSION_RELEASE << 16 | AMF_VERSION_BUILD_NUM) >= 0x0001000400090000"
  6136. # Funny iconv installations are not unusual, so check it after all flags have been set
  6137. if enabled libc_iconv; then
  6138. check_func_headers iconv.h iconv
  6139. elif enabled iconv; then
  6140. check_func_headers iconv.h iconv || check_lib iconv iconv.h iconv -liconv
  6141. fi
  6142. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  6143. # add some useful compiler flags if supported
  6144. check_cflags -Wdeclaration-after-statement
  6145. check_cflags -Wall
  6146. check_cflags -Wdisabled-optimization
  6147. check_cflags -Wpointer-arith
  6148. check_cflags -Wredundant-decls
  6149. check_cflags -Wwrite-strings
  6150. check_cflags -Wtype-limits
  6151. check_cflags -Wundef
  6152. check_cflags -Wmissing-prototypes
  6153. check_cflags -Wno-pointer-to-int-cast
  6154. check_cflags -Wstrict-prototypes
  6155. check_cflags -Wempty-body
  6156. if enabled extra_warnings; then
  6157. check_cflags -Wcast-qual
  6158. check_cflags -Wextra
  6159. check_cflags -Wpedantic
  6160. fi
  6161. check_disable_warning(){
  6162. warning_flag=-W${1#-Wno-}
  6163. test_cflags $unknown_warning_flags $warning_flag && add_cflags $1
  6164. }
  6165. test_cflags -Werror=unused-command-line-argument &&
  6166. append unknown_warning_flags "-Werror=unused-command-line-argument"
  6167. test_cflags -Werror=unknown-warning-option &&
  6168. append unknown_warning_flags "-Werror=unknown-warning-option"
  6169. check_disable_warning -Wno-parentheses
  6170. check_disable_warning -Wno-switch
  6171. check_disable_warning -Wno-format-zero-length
  6172. check_disable_warning -Wno-pointer-sign
  6173. check_disable_warning -Wno-unused-const-variable
  6174. check_disable_warning -Wno-bool-operation
  6175. check_disable_warning -Wno-char-subscripts
  6176. check_disable_warning_headers(){
  6177. warning_flag=-W${1#-Wno-}
  6178. test_cflags $warning_flag && add_cflags_headers $1
  6179. }
  6180. check_disable_warning_headers -Wno-deprecated-declarations
  6181. check_disable_warning_headers -Wno-unused-variable
  6182. test_cc <<EOF && enable blocks_extension
  6183. void (^block)(void);
  6184. EOF
  6185. # add some linker flags
  6186. check_ldflags -Wl,--warn-common
  6187. check_ldflags -Wl,-rpath-link=:libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
  6188. enabled rpath && add_ldexeflags -Wl,-rpath,$libdir && add_ldsoflags -Wl,-rpath,$libdir
  6189. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  6190. # add some strip flags
  6191. check_stripflags -x
  6192. enabled neon_clobber_test &&
  6193. check_ldflags -Wl,--wrap,avcodec_open2 \
  6194. -Wl,--wrap,avcodec_decode_audio4 \
  6195. -Wl,--wrap,avcodec_decode_video2 \
  6196. -Wl,--wrap,avcodec_decode_subtitle2 \
  6197. -Wl,--wrap,avcodec_encode_audio2 \
  6198. -Wl,--wrap,avcodec_encode_video2 \
  6199. -Wl,--wrap,avcodec_encode_subtitle \
  6200. -Wl,--wrap,avcodec_send_packet \
  6201. -Wl,--wrap,avcodec_receive_packet \
  6202. -Wl,--wrap,avcodec_send_frame \
  6203. -Wl,--wrap,avcodec_receive_frame \
  6204. -Wl,--wrap,swr_convert \
  6205. -Wl,--wrap,avresample_convert ||
  6206. disable neon_clobber_test
  6207. enabled xmm_clobber_test &&
  6208. check_ldflags -Wl,--wrap,avcodec_open2 \
  6209. -Wl,--wrap,avcodec_decode_audio4 \
  6210. -Wl,--wrap,avcodec_decode_video2 \
  6211. -Wl,--wrap,avcodec_decode_subtitle2 \
  6212. -Wl,--wrap,avcodec_encode_audio2 \
  6213. -Wl,--wrap,avcodec_encode_video2 \
  6214. -Wl,--wrap,avcodec_encode_subtitle \
  6215. -Wl,--wrap,avcodec_send_packet \
  6216. -Wl,--wrap,avcodec_receive_packet \
  6217. -Wl,--wrap,avcodec_send_frame \
  6218. -Wl,--wrap,avcodec_receive_frame \
  6219. -Wl,--wrap,swr_convert \
  6220. -Wl,--wrap,avresample_convert \
  6221. -Wl,--wrap,sws_scale ||
  6222. disable xmm_clobber_test
  6223. check_ld "cc" proper_dce <<EOF
  6224. extern const int array[512];
  6225. static inline int func(void) { return array[0]; }
  6226. int main(void) { return 0; }
  6227. EOF
  6228. if enabled proper_dce; then
  6229. echo "X { local: *; };" > $TMPV
  6230. if test_ldflags -Wl,${version_script},$TMPV; then
  6231. append SHFLAGS '-Wl,${version_script},\$(SUBDIR)lib\$(NAME).ver'
  6232. quotes='""'
  6233. test_cc <<EOF && enable symver_asm_label
  6234. void ff_foo(void) __asm__ ("av_foo@VERSION");
  6235. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  6236. EOF
  6237. test_cc <<EOF && enable symver_gnu_asm
  6238. __asm__(".symver ff_foo,av_foo@VERSION");
  6239. void ff_foo(void) {}
  6240. EOF
  6241. fi
  6242. fi
  6243. if [ -z "$optflags" ]; then
  6244. if enabled small; then
  6245. optflags=$cflags_size
  6246. elif enabled optimizations; then
  6247. optflags=$cflags_speed
  6248. else
  6249. optflags=$cflags_noopt
  6250. fi
  6251. fi
  6252. check_optflags(){
  6253. check_cflags "$@"
  6254. enabled lto && check_ldflags "$@"
  6255. }
  6256. check_optflags $optflags
  6257. check_optflags -fno-math-errno
  6258. check_optflags -fno-signed-zeros
  6259. if enabled lto; then
  6260. test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
  6261. check_cflags -flto
  6262. check_ldflags -flto $cpuflags
  6263. disable inline_asm_direct_symbol_refs
  6264. fi
  6265. enabled ftrapv && check_cflags -ftrapv
  6266. test_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
  6267. int x;
  6268. EOF
  6269. if enabled icc; then
  6270. # Just warnings, no remarks
  6271. check_cflags -w1
  6272. # -wd: Disable following warnings
  6273. # 144, 167, 556: -Wno-pointer-sign
  6274. # 188: enumerated type mixed with another type
  6275. # 1292: attribute "foo" ignored
  6276. # 1419: external declaration in primary source file
  6277. # 10006: ignoring unknown option -fno-signed-zeros
  6278. # 10148: ignoring unknown option -Wno-parentheses
  6279. # 10156: ignoring option '-W'; no argument required
  6280. # 13200: No EMMS instruction before call to function
  6281. # 13203: No EMMS instruction before return from function
  6282. check_cflags -wd144,167,188,556,1292,1419,10006,10148,10156,13200,13203
  6283. # 11030: Warning unknown option --as-needed
  6284. # 10156: ignoring option '-export'; no argument required
  6285. check_ldflags -wd10156,11030
  6286. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  6287. enable ebp_available
  6288. # The test above does not test linking
  6289. enabled lto && disable symver_asm_label
  6290. if enabled x86_32; then
  6291. icc_version=$($cc -dumpversion)
  6292. test ${icc_version%%.*} -ge 11 &&
  6293. check_cflags -falign-stack=maintain-16-byte ||
  6294. disable aligned_stack
  6295. fi
  6296. elif enabled gcc; then
  6297. check_optflags -fno-tree-vectorize
  6298. check_cflags -Werror=format-security
  6299. check_cflags -Werror=implicit-function-declaration
  6300. check_cflags -Werror=missing-prototypes
  6301. check_cflags -Werror=return-type
  6302. check_cflags -Werror=vla
  6303. check_cflags -Wformat
  6304. check_cflags -fdiagnostics-color=auto
  6305. enabled extra_warnings || check_disable_warning -Wno-maybe-uninitialized
  6306. if enabled x86_32; then
  6307. case $target_os in
  6308. *bsd*)
  6309. # BSDs don't guarantee a 16 byte aligned stack, but we can
  6310. # request GCC to try to maintain 16 byte alignment throughout
  6311. # function calls. Library entry points that might call assembly
  6312. # functions align the stack. (The parameter means 2^4 bytes.)
  6313. check_cflags -mpreferred-stack-boundary=4
  6314. ;;
  6315. esac
  6316. fi
  6317. elif enabled llvm_gcc; then
  6318. check_cflags -mllvm -stack-alignment=16
  6319. elif enabled clang; then
  6320. if enabled x86_32; then
  6321. # Clang doesn't support maintaining alignment without assuming the
  6322. # same alignment in every function. If 16 byte alignment would be
  6323. # enabled, one would also have to either add attribute_align_arg on
  6324. # every single entry point into the libraries or enable -mstackrealign
  6325. # (doing stack realignment in every single function).
  6326. case $target_os in
  6327. mingw32|win32|*bsd*)
  6328. disable aligned_stack
  6329. ;;
  6330. *)
  6331. check_cflags -mllvm -stack-alignment=16
  6332. check_cflags -mstack-alignment=16
  6333. ;;
  6334. esac
  6335. else
  6336. check_cflags -mllvm -stack-alignment=16
  6337. check_cflags -mstack-alignment=16
  6338. fi
  6339. check_cflags -Qunused-arguments
  6340. check_cflags -Werror=implicit-function-declaration
  6341. check_cflags -Werror=missing-prototypes
  6342. check_cflags -Werror=return-type
  6343. elif enabled cparser; then
  6344. add_cflags -Wno-missing-variable-declarations
  6345. add_cflags -Wno-empty-statement
  6346. elif enabled armcc; then
  6347. add_cflags -W${armcc_opt},--diag_suppress=4343 # hardfp compat
  6348. add_cflags -W${armcc_opt},--diag_suppress=3036 # using . as system include dir
  6349. # 2523: use of inline assembly is deprecated
  6350. add_cflags -W${armcc_opt},--diag_suppress=2523
  6351. add_cflags -W${armcc_opt},--diag_suppress=1207
  6352. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  6353. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  6354. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  6355. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  6356. elif enabled pathscale; then
  6357. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  6358. disable inline_asm
  6359. elif enabled_any msvc icl; then
  6360. enabled x86_32 && disable aligned_stack
  6361. enabled_all x86_32 debug && add_cflags -Oy-
  6362. enabled debug && add_ldflags -debug
  6363. enable pragma_deprecated
  6364. if enabled icl; then
  6365. # -Qansi-alias is basically -fstrict-aliasing, but does not work
  6366. # (correctly) on icl 13.x.
  6367. test_cpp_condition "windows.h" "__ICL < 1300 || __ICL >= 1400" &&
  6368. add_cflags -Qansi-alias
  6369. # Some inline asm is not compilable in debug
  6370. if enabled debug; then
  6371. disable ebp_available
  6372. disable ebx_available
  6373. fi
  6374. fi
  6375. # msvcrt10 x64 incorrectly enables log2, only msvcrt12 (MSVC 2013) onwards actually has log2.
  6376. check_cpp_condition log2 crtversion.h "_VC_CRT_MAJOR_VERSION >= 12"
  6377. # The CRT headers contain __declspec(restrict) in a few places, but if redefining
  6378. # restrict, this might break. MSVC 2010 and 2012 fail with __declspec(__restrict)
  6379. # (as it ends up if the restrict redefine is done before including stdlib.h), while
  6380. # MSVC 2013 and newer can handle it fine.
  6381. # If this declspec fails, force including stdlib.h before the restrict redefinition
  6382. # happens in config.h.
  6383. if [ $restrict_keyword != restrict ]; then
  6384. test_cc <<EOF || add_cflags -FIstdlib.h
  6385. __declspec($restrict_keyword) void *foo(int);
  6386. EOF
  6387. fi
  6388. # the new SSA optimzer in VS2015 U3 is mis-optimizing some parts of the code
  6389. # Issue has been fixed in MSVC v19.00.24218.
  6390. test_cpp_condition windows.h "_MSC_FULL_VER >= 190024218" ||
  6391. check_cflags -d2SSAOptimizer-
  6392. # enable utf-8 source processing on VS2015 U2 and newer
  6393. test_cpp_condition windows.h "_MSC_FULL_VER >= 190023918" &&
  6394. add_cflags -utf-8
  6395. fi
  6396. for pfx in "" host_; do
  6397. varname=${pfx%_}cc_type
  6398. eval "type=\$$varname"
  6399. if [ "$type" = "msvc" ]; then
  6400. test_${pfx}cc <<EOF || add_${pfx}cflags -Dinline=__inline
  6401. static inline int foo(int a) { return a; }
  6402. EOF
  6403. fi
  6404. done
  6405. case $as_type in
  6406. clang)
  6407. add_asflags -Qunused-arguments
  6408. ;;
  6409. esac
  6410. case $ld_type in
  6411. clang)
  6412. check_ldflags -Qunused-arguments
  6413. ;;
  6414. esac
  6415. enable frame_thread_encoder
  6416. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  6417. check_deps $CONFIG_LIST \
  6418. $CONFIG_EXTRA \
  6419. $HAVE_LIST \
  6420. $ALL_COMPONENTS \
  6421. enabled threads && ! enabled pthreads && ! enabled atomics_native && die "non pthread threading without atomics not supported, try adding --enable-pthreads or --cpu=i486 or higher if you are on x86"
  6422. enabled avresample && warn "Building with deprecated library libavresample"
  6423. case $target_os in
  6424. haiku)
  6425. disable memalign
  6426. disable posix_memalign
  6427. ;;
  6428. *-dos|freedos|opendos)
  6429. if test_cpp_condition sys/version.h "defined(__DJGPP__) && __DJGPP__ == 2 && __DJGPP_MINOR__ == 5"; then
  6430. disable memalign
  6431. fi
  6432. ;;
  6433. esac
  6434. flatten_extralibs(){
  6435. nested_entries=
  6436. list_name=$1
  6437. eval list=\$${1}
  6438. for entry in $list; do
  6439. entry_copy=$entry
  6440. resolve entry_copy
  6441. flat_entries=
  6442. for e in $entry_copy; do
  6443. case $e in
  6444. *_extralibs) nested_entries="$nested_entries$e ";;
  6445. *) flat_entries="$flat_entries$e ";;
  6446. esac
  6447. done
  6448. eval $entry="\$flat_entries"
  6449. done
  6450. append $list_name "$nested_entries"
  6451. resolve nested_entries
  6452. if test -n "$(filter '*_extralibs' $nested_entries)"; then
  6453. flatten_extralibs $list_name
  6454. fi
  6455. }
  6456. flatten_extralibs_wrapper(){
  6457. list_name=$1
  6458. flatten_extralibs $list_name
  6459. unique $list_name
  6460. resolve $list_name
  6461. eval $list_name=\$\(\$ldflags_filter \$$list_name\)
  6462. eval printf \''%s'\' \""\$$list_name"\"
  6463. }
  6464. for linkunit in $LIBRARY_LIST; do
  6465. unset current_extralibs
  6466. eval components=\$$(toupper ${linkunit})_COMPONENTS_LIST
  6467. for comp in ${components}; do
  6468. enabled $comp || continue
  6469. comp_extralibs="${comp}_extralibs"
  6470. append current_extralibs $comp_extralibs
  6471. done
  6472. eval prepend ${linkunit}_extralibs $current_extralibs
  6473. done
  6474. for linkunit in $LIBRARY_LIST $PROGRAM_LIST $EXTRALIBS_LIST; do
  6475. eval ${linkunit}_extralibs=\$\(flatten_extralibs_wrapper ${linkunit}_extralibs\)
  6476. done
  6477. map 'enabled $v && intrinsics=${v#intrinsics_}' $INTRINSICS_LIST
  6478. for thread in $THREADS_LIST; do
  6479. if enabled $thread; then
  6480. test -n "$thread_type" &&
  6481. die "ERROR: Only one thread type must be selected." ||
  6482. thread_type="$thread"
  6483. fi
  6484. done
  6485. if disabled stdatomic; then
  6486. if enabled atomics_gcc; then
  6487. add_cppflags '-I\$(SRC_PATH)/compat/atomics/gcc'
  6488. elif enabled atomics_win32; then
  6489. add_cppflags '-I\$(SRC_PATH)/compat/atomics/win32'
  6490. elif enabled atomics_suncc; then
  6491. add_cppflags '-I\$(SRC_PATH)/compat/atomics/suncc'
  6492. elif enabled pthreads; then
  6493. add_compat atomics/pthread/stdatomic.o
  6494. add_cppflags '-I\$(SRC_PATH)/compat/atomics/pthread'
  6495. else
  6496. enabled threads && die "Threading is enabled, but no atomics are available"
  6497. add_cppflags '-I\$(SRC_PATH)/compat/atomics/dummy'
  6498. fi
  6499. fi
  6500. # Check if requested libraries were found.
  6501. for lib in $AUTODETECT_LIBS; do
  6502. requested $lib && ! enabled $lib && die "ERROR: $lib requested but not found";
  6503. done
  6504. enabled zlib && add_cppflags -DZLIB_CONST
  6505. # conditional library dependencies, in any order
  6506. enabled afftdn_filter && prepend avfilter_deps "avcodec"
  6507. enabled afftfilt_filter && prepend avfilter_deps "avcodec"
  6508. enabled afir_filter && prepend avfilter_deps "avcodec"
  6509. enabled amovie_filter && prepend avfilter_deps "avformat avcodec"
  6510. enabled aresample_filter && prepend avfilter_deps "swresample"
  6511. enabled atempo_filter && prepend avfilter_deps "avcodec"
  6512. enabled bm3d_filter && prepend avfilter_deps "avcodec"
  6513. enabled cover_rect_filter && prepend avfilter_deps "avformat avcodec"
  6514. enabled convolve_filter && prepend avfilter_deps "avcodec"
  6515. enabled deconvolve_filter && prepend avfilter_deps "avcodec"
  6516. enabled ebur128_filter && enabled swresample && prepend avfilter_deps "swresample"
  6517. enabled elbg_filter && prepend avfilter_deps "avcodec"
  6518. enabled fftfilt_filter && prepend avfilter_deps "avcodec"
  6519. enabled find_rect_filter && prepend avfilter_deps "avformat avcodec"
  6520. enabled firequalizer_filter && prepend avfilter_deps "avcodec"
  6521. enabled mcdeint_filter && prepend avfilter_deps "avcodec"
  6522. enabled movie_filter && prepend avfilter_deps "avformat avcodec"
  6523. enabled pan_filter && prepend avfilter_deps "swresample"
  6524. enabled pp_filter && prepend avfilter_deps "postproc"
  6525. enabled removelogo_filter && prepend avfilter_deps "avformat avcodec swscale"
  6526. enabled resample_filter && prepend avfilter_deps "avresample"
  6527. enabled sab_filter && prepend avfilter_deps "swscale"
  6528. enabled scale_filter && prepend avfilter_deps "swscale"
  6529. enabled scale2ref_filter && prepend avfilter_deps "swscale"
  6530. enabled sofalizer_filter && prepend avfilter_deps "avcodec"
  6531. enabled showcqt_filter && prepend avfilter_deps "avformat avcodec swscale"
  6532. enabled showfreqs_filter && prepend avfilter_deps "avcodec"
  6533. enabled showspectrum_filter && prepend avfilter_deps "avcodec"
  6534. enabled signature_filter && prepend avfilter_deps "avcodec avformat"
  6535. enabled smartblur_filter && prepend avfilter_deps "swscale"
  6536. enabled spectrumsynth_filter && prepend avfilter_deps "avcodec"
  6537. enabled spp_filter && prepend avfilter_deps "avcodec"
  6538. enabled sr_filter && prepend avfilter_deps "avformat swscale"
  6539. enabled subtitles_filter && prepend avfilter_deps "avformat avcodec"
  6540. enabled uspp_filter && prepend avfilter_deps "avcodec"
  6541. enabled zoompan_filter && prepend avfilter_deps "swscale"
  6542. enabled lavfi_indev && prepend avdevice_deps "avfilter"
  6543. #FIXME
  6544. enabled_any sdl2_outdev opengl_outdev && enabled sdl2 &&
  6545. add_cflags $(filter_out '-Dmain=SDL_main' $sdl2_cflags)
  6546. enabled opus_decoder && prepend avcodec_deps "swresample"
  6547. # reorder the items at var $1 to align with the items order at var $2 .
  6548. # die if an item at $1 is not at $2 .
  6549. reorder_by(){
  6550. eval rb_in=\$$1
  6551. eval rb_ordered=\$$2
  6552. for rb in $rb_in; do
  6553. is_in $rb $rb_ordered || die "$rb at \$$1 is not at \$$2"
  6554. done
  6555. rb_out=
  6556. for rb in $rb_ordered; do
  6557. is_in $rb $rb_in && rb_out="$rb_out$rb "
  6558. done
  6559. eval $1=\$rb_out
  6560. }
  6561. # deps-expand fflib $1: N x {append all expanded deps; unique}
  6562. # within a set of N items, N expansions are enough to expose a cycle.
  6563. expand_deps(){
  6564. unique ${1}_deps # required for the early break test.
  6565. for dummy in $LIBRARY_LIST; do # N iteratios
  6566. eval deps=\$${1}_deps
  6567. append ${1}_deps $(map 'eval echo \$${v}_deps' $deps)
  6568. unique ${1}_deps
  6569. eval '[ ${#deps} = ${#'${1}_deps'} ]' && break # doesn't expand anymore
  6570. done
  6571. eval is_in $1 \$${1}_deps && die "Dependency cycle at ${1}_deps"
  6572. reorder_by ${1}_deps LIBRARY_LIST # linking order is expected later
  6573. }
  6574. #we have to remove gpl from the deps here as some code assumes all lib deps are libs
  6575. postproc_deps="$(filter_out 'gpl' $postproc_deps)"
  6576. map 'expand_deps $v' $LIBRARY_LIST
  6577. if test "$quiet" != "yes"; then
  6578. echo "install prefix $prefix"
  6579. echo "source path $source_path"
  6580. echo "C compiler $cc"
  6581. echo "C library $libc_type"
  6582. if test "$host_cc" != "$cc"; then
  6583. echo "host C compiler $host_cc"
  6584. echo "host C library $host_libc_type"
  6585. fi
  6586. echo "ARCH $arch ($cpu)"
  6587. if test "$build_suffix" != ""; then
  6588. echo "build suffix $build_suffix"
  6589. fi
  6590. if test "$progs_suffix" != ""; then
  6591. echo "progs suffix $progs_suffix"
  6592. fi
  6593. if test "$extra_version" != ""; then
  6594. echo "version string suffix $extra_version"
  6595. fi
  6596. echo "big-endian ${bigendian-no}"
  6597. echo "runtime cpu detection ${runtime_cpudetect-no}"
  6598. if enabled x86; then
  6599. echo "standalone assembly ${x86asm-no}"
  6600. echo "x86 assembler ${x86asmexe}"
  6601. echo "MMX enabled ${mmx-no}"
  6602. echo "MMXEXT enabled ${mmxext-no}"
  6603. echo "3DNow! enabled ${amd3dnow-no}"
  6604. echo "3DNow! extended enabled ${amd3dnowext-no}"
  6605. echo "SSE enabled ${sse-no}"
  6606. echo "SSSE3 enabled ${ssse3-no}"
  6607. echo "AESNI enabled ${aesni-no}"
  6608. echo "AVX enabled ${avx-no}"
  6609. echo "AVX2 enabled ${avx2-no}"
  6610. echo "AVX-512 enabled ${avx512-no}"
  6611. echo "XOP enabled ${xop-no}"
  6612. echo "FMA3 enabled ${fma3-no}"
  6613. echo "FMA4 enabled ${fma4-no}"
  6614. echo "i686 features enabled ${i686-no}"
  6615. echo "CMOV is fast ${fast_cmov-no}"
  6616. echo "EBX available ${ebx_available-no}"
  6617. echo "EBP available ${ebp_available-no}"
  6618. fi
  6619. if enabled aarch64; then
  6620. echo "NEON enabled ${neon-no}"
  6621. echo "VFP enabled ${vfp-no}"
  6622. fi
  6623. if enabled arm; then
  6624. echo "ARMv5TE enabled ${armv5te-no}"
  6625. echo "ARMv6 enabled ${armv6-no}"
  6626. echo "ARMv6T2 enabled ${armv6t2-no}"
  6627. echo "VFP enabled ${vfp-no}"
  6628. echo "NEON enabled ${neon-no}"
  6629. echo "THUMB enabled ${thumb-no}"
  6630. fi
  6631. if enabled mips; then
  6632. echo "MIPS FPU enabled ${mipsfpu-no}"
  6633. echo "MIPS DSP R1 enabled ${mipsdsp-no}"
  6634. echo "MIPS DSP R2 enabled ${mipsdspr2-no}"
  6635. echo "MIPS MSA enabled ${msa-no}"
  6636. echo "MIPS MSA2 enabled ${msa2-no}"
  6637. echo "LOONGSON MMI enabled ${mmi-no}"
  6638. fi
  6639. if enabled ppc; then
  6640. echo "AltiVec enabled ${altivec-no}"
  6641. echo "VSX enabled ${vsx-no}"
  6642. echo "POWER8 enabled ${power8-no}"
  6643. echo "PPC 4xx optimizations ${ppc4xx-no}"
  6644. echo "dcbzl available ${dcbzl-no}"
  6645. fi
  6646. echo "debug symbols ${debug-no}"
  6647. echo "strip symbols ${stripping-no}"
  6648. echo "optimize for size ${small-no}"
  6649. echo "optimizations ${optimizations-no}"
  6650. echo "static ${static-no}"
  6651. echo "shared ${shared-no}"
  6652. echo "postprocessing support ${postproc-no}"
  6653. echo "network support ${network-no}"
  6654. echo "threading support ${thread_type-no}"
  6655. echo "safe bitstream reader ${safe_bitstream_reader-no}"
  6656. echo "texi2html enabled ${texi2html-no}"
  6657. echo "perl enabled ${perl-no}"
  6658. echo "pod2man enabled ${pod2man-no}"
  6659. echo "makeinfo enabled ${makeinfo-no}"
  6660. echo "makeinfo supports HTML ${makeinfo_html-no}"
  6661. test -n "$random_seed" &&
  6662. echo "random seed ${random_seed}"
  6663. echo
  6664. echo "External libraries:"
  6665. print_enabled '' $EXTERNAL_LIBRARY_LIST $EXTERNAL_AUTODETECT_LIBRARY_LIST | print_in_columns
  6666. echo
  6667. echo "External libraries providing hardware acceleration:"
  6668. print_enabled '' $HWACCEL_LIBRARY_LIST $HWACCEL_AUTODETECT_LIBRARY_LIST | print_in_columns
  6669. echo
  6670. echo "Libraries:"
  6671. print_enabled '' $LIBRARY_LIST | print_in_columns
  6672. echo
  6673. echo "Programs:"
  6674. print_enabled '' $PROGRAM_LIST | print_in_columns
  6675. echo
  6676. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  6677. echo "Enabled ${type}s:"
  6678. eval list=\$$(toupper $type)_LIST
  6679. print_enabled '_*' $list | print_in_columns
  6680. echo
  6681. done
  6682. if test -n "$ignore_tests"; then
  6683. ignore_tests=$(echo $ignore_tests | tr ',' ' ')
  6684. echo "Ignored FATE tests:"
  6685. echo $ignore_tests | print_in_columns
  6686. echo
  6687. fi
  6688. echo "License: $license"
  6689. fi # test "$quiet" != "yes"
  6690. if test -n "$WARN_IF_GETS_DISABLED_LIST"; then
  6691. for cfg in $WARN_IF_GETS_DISABLED_LIST; do
  6692. if disabled $cfg; then
  6693. varname=${cfg}_disable_reason
  6694. eval "warn \"Disabled $cfg because \$$varname\""
  6695. fi
  6696. done
  6697. fi
  6698. if test -n "$WARNINGS"; then
  6699. printf "\n%s%s$WARNINGS%s" "$warn_color" "$bold_color" "$reset_color"
  6700. enabled fatal_warnings && exit 1
  6701. fi
  6702. test -e Makefile || echo "include $source_path/Makefile" > Makefile
  6703. esc(){
  6704. echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
  6705. }
  6706. echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $FFMPEG_CONFIGURATION)" > ffbuild/config.fate
  6707. enabled stripping || strip="echo skipping strip"
  6708. enabled stripping || striptype=""
  6709. config_files="$TMPH ffbuild/config.mak doc/config.texi"
  6710. cat > ffbuild/config.mak <<EOF
  6711. # Automatically generated by configure - do not modify!
  6712. ifndef FFMPEG_CONFIG_MAK
  6713. FFMPEG_CONFIG_MAK=1
  6714. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  6715. prefix=$prefix
  6716. LIBDIR=\$(DESTDIR)$libdir
  6717. SHLIBDIR=\$(DESTDIR)$shlibdir
  6718. INCDIR=\$(DESTDIR)$incdir
  6719. BINDIR=\$(DESTDIR)$bindir
  6720. DATADIR=\$(DESTDIR)$datadir
  6721. DOCDIR=\$(DESTDIR)$docdir
  6722. MANDIR=\$(DESTDIR)$mandir
  6723. PKGCONFIGDIR=\$(DESTDIR)$pkgconfigdir
  6724. INSTALL_NAME_DIR=$install_name_dir
  6725. SRC_PATH=$source_path
  6726. SRC_LINK=$source_link
  6727. ifndef MAIN_MAKEFILE
  6728. SRC_PATH:=\$(SRC_PATH:.%=..%)
  6729. endif
  6730. CC_IDENT=$cc_ident
  6731. ARCH=$arch
  6732. INTRINSICS=$intrinsics
  6733. EXTERN_PREFIX=$extern_prefix
  6734. CC=$cc
  6735. CXX=$cxx
  6736. AS=$as
  6737. OBJCC=$objcc
  6738. LD=$ld
  6739. DEPCC=$dep_cc
  6740. DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
  6741. DEPAS=$as
  6742. DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
  6743. X86ASM=$x86asmexe
  6744. DEPX86ASM=$x86asmexe
  6745. DEPX86ASMFLAGS=\$(X86ASMFLAGS)
  6746. AR=$ar
  6747. ARFLAGS=$arflags
  6748. AR_O=$ar_o
  6749. AR_CMD=$ar
  6750. NM_CMD=$nm
  6751. RANLIB=$ranlib
  6752. STRIP=$strip
  6753. STRIPTYPE=$striptype
  6754. NVCC=$nvcc
  6755. CP=cp -p
  6756. LN_S=$ln_s
  6757. CPPFLAGS=$CPPFLAGS
  6758. CFLAGS=$CFLAGS
  6759. CXXFLAGS=$CXXFLAGS
  6760. OBJCFLAGS=$OBJCFLAGS
  6761. ASFLAGS=$ASFLAGS
  6762. NVCCFLAGS=$nvccflags
  6763. AS_C=$AS_C
  6764. AS_O=$AS_O
  6765. OBJCC_C=$OBJCC_C
  6766. OBJCC_E=$OBJCC_E
  6767. OBJCC_O=$OBJCC_O
  6768. CC_C=$CC_C
  6769. CC_E=$CC_E
  6770. CC_O=$CC_O
  6771. CXX_C=$CXX_C
  6772. CXX_O=$CXX_O
  6773. NVCC_C=$NVCC_C
  6774. NVCC_O=$NVCC_O
  6775. LD_O=$LD_O
  6776. X86ASM_O=$X86ASM_O
  6777. LD_LIB=$LD_LIB
  6778. LD_PATH=$LD_PATH
  6779. DLLTOOL=$dlltool
  6780. WINDRES=$windres
  6781. DEPWINDRES=$dep_cc
  6782. DOXYGEN=$doxygen
  6783. LDFLAGS=$LDFLAGS
  6784. LDEXEFLAGS=$LDEXEFLAGS
  6785. LDSOFLAGS=$LDSOFLAGS
  6786. SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
  6787. ASMSTRIPFLAGS=$ASMSTRIPFLAGS
  6788. X86ASMFLAGS=$X86ASMFLAGS
  6789. BUILDSUF=$build_suffix
  6790. PROGSSUF=$progs_suffix
  6791. FULLNAME=$FULLNAME
  6792. LIBPREF=$LIBPREF
  6793. LIBSUF=$LIBSUF
  6794. LIBNAME=$LIBNAME
  6795. SLIBPREF=$SLIBPREF
  6796. SLIBSUF=$SLIBSUF
  6797. EXESUF=$EXESUF
  6798. EXTRA_VERSION=$extra_version
  6799. CCDEP=$CCDEP
  6800. CXXDEP=$CXXDEP
  6801. CCDEP_FLAGS=$CCDEP_FLAGS
  6802. ASDEP=$ASDEP
  6803. ASDEP_FLAGS=$ASDEP_FLAGS
  6804. X86ASMDEP=$X86ASMDEP
  6805. X86ASMDEP_FLAGS=$X86ASMDEP_FLAGS
  6806. CC_DEPFLAGS=$CC_DEPFLAGS
  6807. AS_DEPFLAGS=$AS_DEPFLAGS
  6808. X86ASM_DEPFLAGS=$X86ASM_DEPFLAGS
  6809. HOSTCC=$host_cc
  6810. HOSTLD=$host_ld
  6811. HOSTCFLAGS=$host_cflags
  6812. HOSTCPPFLAGS=$host_cppflags
  6813. HOSTEXESUF=$HOSTEXESUF
  6814. HOSTLDFLAGS=$host_ldflags
  6815. HOSTEXTRALIBS=$host_extralibs
  6816. DEPHOSTCC=$host_cc
  6817. DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
  6818. HOSTCCDEP=$HOSTCCDEP
  6819. HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
  6820. HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
  6821. HOSTCC_C=$HOSTCC_C
  6822. HOSTCC_O=$HOSTCC_O
  6823. HOSTLD_O=$HOSTLD_O
  6824. TARGET_EXEC=$target_exec $target_exec_args
  6825. TARGET_PATH=$target_path
  6826. TARGET_SAMPLES=${target_samples:-\$(SAMPLES)}
  6827. CFLAGS-ffplay=${sdl2_cflags}
  6828. CFLAGS_HEADERS=$CFLAGS_HEADERS
  6829. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  6830. EXTRALIBS=$extralibs
  6831. COMPAT_OBJS=$compat_objs
  6832. INSTALL=$install
  6833. LIBTARGET=${LIBTARGET}
  6834. SLIBNAME=${SLIBNAME}
  6835. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  6836. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  6837. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  6838. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  6839. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  6840. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  6841. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  6842. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  6843. VERSION_SCRIPT_POSTPROCESS_CMD=${VERSION_SCRIPT_POSTPROCESS_CMD}
  6844. SAMPLES:=${samples:-\$(FATE_SAMPLES)}
  6845. NOREDZONE_FLAGS=$noredzone_flags
  6846. LIBFUZZER_PATH=$libfuzzer_path
  6847. IGNORE_TESTS=$ignore_tests
  6848. EOF
  6849. map 'eval echo "${v}_FFLIBS=\$${v}_deps" >> ffbuild/config.mak' $LIBRARY_LIST
  6850. for entry in $LIBRARY_LIST $PROGRAM_LIST $EXTRALIBS_LIST; do
  6851. eval echo "EXTRALIBS-${entry}=\$${entry}_extralibs" >> ffbuild/config.mak
  6852. done
  6853. cat > $TMPH <<EOF
  6854. /* Automatically generated by configure - do not modify! */
  6855. #ifndef FFMPEG_CONFIG_H
  6856. #define FFMPEG_CONFIG_H
  6857. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  6858. #define FFMPEG_LICENSE "$(c_escape $license)"
  6859. #define CONFIG_THIS_YEAR 2020
  6860. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  6861. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  6862. #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
  6863. #define av_restrict $restrict_keyword
  6864. #define EXTERN_PREFIX "${extern_prefix}"
  6865. #define EXTERN_ASM ${extern_prefix}
  6866. #define BUILDSUF "$build_suffix"
  6867. #define SLIBSUF "$SLIBSUF"
  6868. #define HAVE_MMX2 HAVE_MMXEXT
  6869. #define SWS_MAX_FILTER_SIZE $sws_max_filter_size
  6870. EOF
  6871. test -n "$assert_level" &&
  6872. echo "#define ASSERT_LEVEL $assert_level" >>$TMPH
  6873. test -n "$malloc_prefix" &&
  6874. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  6875. if enabled x86asm; then
  6876. append config_files $TMPASM
  6877. cat > $TMPASM <<EOF
  6878. ; Automatically generated by configure - do not modify!
  6879. EOF
  6880. fi
  6881. enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
  6882. mkdir -p doc
  6883. mkdir -p tests
  6884. mkdir -p tests/api
  6885. echo "@c auto-generated by configure - do not modify! " > doc/config.texi
  6886. print_config ARCH_ "$config_files" $ARCH_LIST
  6887. print_config HAVE_ "$config_files" $HAVE_LIST
  6888. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  6889. $CONFIG_EXTRA \
  6890. $ALL_COMPONENTS \
  6891. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  6892. echo "endif # FFMPEG_CONFIG_MAK" >> ffbuild/config.mak
  6893. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  6894. cp_if_changed $TMPH config.h
  6895. touch ffbuild/.config
  6896. enabled x86asm && cp_if_changed $TMPASM config.asm
  6897. cat > $TMPH <<EOF
  6898. /* Generated by ffmpeg configure */
  6899. #ifndef AVUTIL_AVCONFIG_H
  6900. #define AVUTIL_AVCONFIG_H
  6901. EOF
  6902. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  6903. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  6904. cp_if_changed $TMPH libavutil/avconfig.h
  6905. # full_filter_name_foo=vf_foo
  6906. # full_filter_name_bar=asrc_bar
  6907. # ...
  6908. eval "$(sed -n "s/^extern AVFilter ff_\([avfsinkrc]\{2,5\}\)_\(.*\);/full_filter_name_\2=\1_\2/p" $source_path/libavfilter/allfilters.c)"
  6909. # generate the lists of enabled components
  6910. print_enabled_components(){
  6911. file=$1
  6912. struct_name=$2
  6913. name=$3
  6914. shift 3
  6915. echo "static const $struct_name * const $name[] = {" > $TMPH
  6916. for c in $*; do
  6917. if enabled $c; then
  6918. case $name in
  6919. filter_list)
  6920. eval c=\$full_filter_name_${c%_filter}
  6921. ;;
  6922. indev_list)
  6923. c=${c%_indev}_demuxer
  6924. ;;
  6925. outdev_list)
  6926. c=${c%_outdev}_muxer
  6927. ;;
  6928. esac
  6929. printf " &ff_%s,\n" $c >> $TMPH
  6930. fi
  6931. done
  6932. if [ "$name" = "filter_list" ]; then
  6933. for c in asrc_abuffer vsrc_buffer asink_abuffer vsink_buffer; do
  6934. printf " &ff_%s,\n" $c >> $TMPH
  6935. done
  6936. fi
  6937. echo " NULL };" >> $TMPH
  6938. cp_if_changed $TMPH $file
  6939. }
  6940. print_enabled_components libavfilter/filter_list.c AVFilter filter_list $FILTER_LIST
  6941. print_enabled_components libavcodec/codec_list.c AVCodec codec_list $CODEC_LIST
  6942. print_enabled_components libavcodec/parser_list.c AVCodecParser parser_list $PARSER_LIST
  6943. print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter bitstream_filters $BSF_LIST
  6944. print_enabled_components libavformat/demuxer_list.c AVInputFormat demuxer_list $DEMUXER_LIST
  6945. print_enabled_components libavformat/muxer_list.c AVOutputFormat muxer_list $MUXER_LIST
  6946. print_enabled_components libavdevice/indev_list.c AVInputFormat indev_list $INDEV_LIST
  6947. print_enabled_components libavdevice/outdev_list.c AVOutputFormat outdev_list $OUTDEV_LIST
  6948. print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $PROTOCOL_LIST
  6949. # Settings for pkg-config files
  6950. cat > $TMPH <<EOF
  6951. # Automatically generated by configure - do not modify!
  6952. shared=$shared
  6953. build_suffix=$build_suffix
  6954. prefix=$prefix
  6955. libdir=$libdir
  6956. incdir=$incdir
  6957. rpath=$(enabled rpath && echo "-Wl,-rpath,\${libdir}")
  6958. source_path=${source_path}
  6959. LIBPREF=${LIBPREF}
  6960. LIBSUF=${LIBSUF}
  6961. extralibs_avutil="$avutil_extralibs"
  6962. extralibs_avcodec="$avcodec_extralibs"
  6963. extralibs_avformat="$avformat_extralibs"
  6964. extralibs_avdevice="$avdevice_extralibs"
  6965. extralibs_avfilter="$avfilter_extralibs"
  6966. extralibs_avresample="$avresample_extralibs"
  6967. extralibs_postproc="$postproc_extralibs"
  6968. extralibs_swscale="$swscale_extralibs"
  6969. extralibs_swresample="$swresample_extralibs"
  6970. EOF
  6971. for lib in $LIBRARY_LIST; do
  6972. lib_deps="$(eval echo \$${lib}_deps)"
  6973. echo ${lib}_deps=\"$lib_deps\" >> $TMPH
  6974. done
  6975. cp_if_changed $TMPH ffbuild/config.sh