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.

7654 lines
251KB

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