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.

7718 lines
254KB

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