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.

7653 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. nuv_decoder_select="idctdsp lzo"
  2559. on2avc_decoder_select="mdct"
  2560. opus_decoder_deps="swresample"
  2561. opus_decoder_select="mdct15"
  2562. opus_encoder_select="audio_frame_queue mdct15"
  2563. png_decoder_deps="zlib"
  2564. png_encoder_deps="zlib"
  2565. png_encoder_select="llvidencdsp"
  2566. prores_decoder_select="blockdsp idctdsp"
  2567. prores_encoder_select="fdctdsp"
  2568. qcelp_decoder_select="lsp"
  2569. qdm2_decoder_select="mdct rdft mpegaudiodsp"
  2570. ra_144_decoder_select="audiodsp"
  2571. ra_144_encoder_select="audio_frame_queue lpc audiodsp"
  2572. ralf_decoder_select="golomb"
  2573. rasc_decoder_deps="zlib"
  2574. rawvideo_decoder_select="bswapdsp"
  2575. rscc_decoder_deps="zlib"
  2576. rtjpeg_decoder_select="me_cmp"
  2577. rv10_decoder_select="h263_decoder"
  2578. rv10_encoder_select="h263_encoder"
  2579. rv20_decoder_select="h263_decoder"
  2580. rv20_encoder_select="h263_encoder"
  2581. rv30_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp"
  2582. rv40_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp"
  2583. screenpresso_decoder_deps="zlib"
  2584. shorten_decoder_select="bswapdsp"
  2585. sipr_decoder_select="lsp"
  2586. snow_decoder_select="dwt h264qpel hpeldsp me_cmp rangecoder videodsp"
  2587. snow_encoder_select="dwt h264qpel hpeldsp me_cmp mpegvideoenc rangecoder"
  2588. sonic_decoder_select="golomb rangecoder"
  2589. sonic_encoder_select="golomb rangecoder"
  2590. sonic_ls_encoder_select="golomb rangecoder"
  2591. sp5x_decoder_select="mjpeg_decoder"
  2592. speedhq_decoder_select="mpegvideo"
  2593. srgc_decoder_deps="zlib"
  2594. svq1_decoder_select="hpeldsp"
  2595. svq1_encoder_select="hpeldsp me_cmp mpegvideoenc"
  2596. svq3_decoder_select="golomb h264dsp h264parse h264pred hpeldsp tpeldsp videodsp"
  2597. svq3_decoder_suggest="zlib"
  2598. tak_decoder_select="audiodsp"
  2599. tdsc_decoder_deps="zlib"
  2600. tdsc_decoder_select="mjpeg_decoder"
  2601. theora_decoder_select="vp3_decoder"
  2602. thp_decoder_select="mjpeg_decoder"
  2603. tiff_decoder_select="mjpeg_decoder"
  2604. tiff_decoder_suggest="zlib lzma"
  2605. tiff_encoder_suggest="zlib"
  2606. truehd_decoder_select="mlp_parser"
  2607. truehd_encoder_select="lpc audio_frame_queue"
  2608. truemotion2_decoder_select="bswapdsp"
  2609. truespeech_decoder_select="bswapdsp"
  2610. tscc_decoder_deps="zlib"
  2611. twinvq_decoder_select="mdct lsp sinewin"
  2612. txd_decoder_select="texturedsp"
  2613. utvideo_decoder_select="bswapdsp llviddsp"
  2614. utvideo_encoder_select="bswapdsp huffman llvidencdsp"
  2615. vble_decoder_select="llviddsp"
  2616. vc1_decoder_select="blockdsp h263_decoder h264qpel intrax8 mpegvideo vc1dsp"
  2617. vc1image_decoder_select="vc1_decoder"
  2618. vorbis_decoder_select="mdct"
  2619. vorbis_encoder_select="audio_frame_queue mdct"
  2620. vp3_decoder_select="hpeldsp vp3dsp videodsp"
  2621. vp4_decoder_select="vp3_decoder"
  2622. vp5_decoder_select="h264chroma hpeldsp videodsp vp3dsp vp56dsp"
  2623. vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp vp56dsp"
  2624. vp6a_decoder_select="vp6_decoder"
  2625. vp6f_decoder_select="vp6_decoder"
  2626. vp7_decoder_select="h264pred videodsp vp8dsp"
  2627. vp8_decoder_select="h264pred videodsp vp8dsp"
  2628. vp9_decoder_select="videodsp vp9_parser vp9_superframe_split_bsf"
  2629. wcmv_decoder_deps="zlib"
  2630. webp_decoder_select="vp8_decoder exif"
  2631. wmalossless_decoder_select="llauddsp"
  2632. wmapro_decoder_select="mdct sinewin wma_freqs"
  2633. wmav1_decoder_select="mdct sinewin wma_freqs"
  2634. wmav1_encoder_select="mdct sinewin wma_freqs"
  2635. wmav2_decoder_select="mdct sinewin wma_freqs"
  2636. wmav2_encoder_select="mdct sinewin wma_freqs"
  2637. wmavoice_decoder_select="lsp rdft dct mdct sinewin"
  2638. wmv1_decoder_select="h263_decoder"
  2639. wmv1_encoder_select="h263_encoder"
  2640. wmv2_decoder_select="blockdsp error_resilience h263_decoder idctdsp intrax8 videodsp wmv2dsp"
  2641. wmv2_encoder_select="h263_encoder wmv2dsp"
  2642. wmv3_decoder_select="vc1_decoder"
  2643. wmv3image_decoder_select="wmv3_decoder"
  2644. xma1_decoder_select="wmapro_decoder"
  2645. xma2_decoder_select="wmapro_decoder"
  2646. ylc_decoder_select="bswapdsp"
  2647. zerocodec_decoder_deps="zlib"
  2648. zlib_decoder_deps="zlib"
  2649. zlib_encoder_deps="zlib"
  2650. zmbv_decoder_deps="zlib"
  2651. zmbv_encoder_deps="zlib"
  2652. # hardware accelerators
  2653. crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
  2654. cuda_deps="ffnvcodec"
  2655. cuvid_deps="ffnvcodec"
  2656. d3d11va_deps="dxva_h ID3D11VideoDecoder ID3D11VideoContext"
  2657. dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode ole32 user32"
  2658. ffnvcodec_deps_any="libdl LoadLibrary"
  2659. nvdec_deps="ffnvcodec"
  2660. vaapi_x11_deps="xlib"
  2661. videotoolbox_hwaccel_deps="videotoolbox pthreads"
  2662. videotoolbox_hwaccel_extralibs="-framework QuartzCore"
  2663. xvmc_deps="X11_extensions_XvMClib_h"
  2664. h263_vaapi_hwaccel_deps="vaapi"
  2665. h263_vaapi_hwaccel_select="h263_decoder"
  2666. h263_videotoolbox_hwaccel_deps="videotoolbox"
  2667. h263_videotoolbox_hwaccel_select="h263_decoder"
  2668. h264_d3d11va_hwaccel_deps="d3d11va"
  2669. h264_d3d11va_hwaccel_select="h264_decoder"
  2670. h264_d3d11va2_hwaccel_deps="d3d11va"
  2671. h264_d3d11va2_hwaccel_select="h264_decoder"
  2672. h264_dxva2_hwaccel_deps="dxva2"
  2673. h264_dxva2_hwaccel_select="h264_decoder"
  2674. h264_nvdec_hwaccel_deps="nvdec"
  2675. h264_nvdec_hwaccel_select="h264_decoder"
  2676. h264_vaapi_hwaccel_deps="vaapi"
  2677. h264_vaapi_hwaccel_select="h264_decoder"
  2678. h264_vdpau_hwaccel_deps="vdpau"
  2679. h264_vdpau_hwaccel_select="h264_decoder"
  2680. h264_videotoolbox_hwaccel_deps="videotoolbox"
  2681. h264_videotoolbox_hwaccel_select="h264_decoder"
  2682. hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
  2683. hevc_d3d11va_hwaccel_select="hevc_decoder"
  2684. hevc_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
  2685. hevc_d3d11va2_hwaccel_select="hevc_decoder"
  2686. hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
  2687. hevc_dxva2_hwaccel_select="hevc_decoder"
  2688. hevc_nvdec_hwaccel_deps="nvdec"
  2689. hevc_nvdec_hwaccel_select="hevc_decoder"
  2690. hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC"
  2691. hevc_vaapi_hwaccel_select="hevc_decoder"
  2692. hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC"
  2693. hevc_vdpau_hwaccel_select="hevc_decoder"
  2694. hevc_videotoolbox_hwaccel_deps="videotoolbox"
  2695. hevc_videotoolbox_hwaccel_select="hevc_decoder"
  2696. mjpeg_nvdec_hwaccel_deps="nvdec"
  2697. mjpeg_nvdec_hwaccel_select="mjpeg_decoder"
  2698. mjpeg_vaapi_hwaccel_deps="vaapi"
  2699. mjpeg_vaapi_hwaccel_select="mjpeg_decoder"
  2700. mpeg_xvmc_hwaccel_deps="xvmc"
  2701. mpeg_xvmc_hwaccel_select="mpeg2video_decoder"
  2702. mpeg1_nvdec_hwaccel_deps="nvdec"
  2703. mpeg1_nvdec_hwaccel_select="mpeg1video_decoder"
  2704. mpeg1_vdpau_hwaccel_deps="vdpau"
  2705. mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
  2706. mpeg1_videotoolbox_hwaccel_deps="videotoolbox"
  2707. mpeg1_videotoolbox_hwaccel_select="mpeg1video_decoder"
  2708. mpeg1_xvmc_hwaccel_deps="xvmc"
  2709. mpeg1_xvmc_hwaccel_select="mpeg1video_decoder"
  2710. mpeg2_d3d11va_hwaccel_deps="d3d11va"
  2711. mpeg2_d3d11va_hwaccel_select="mpeg2video_decoder"
  2712. mpeg2_d3d11va2_hwaccel_deps="d3d11va"
  2713. mpeg2_d3d11va2_hwaccel_select="mpeg2video_decoder"
  2714. mpeg2_dxva2_hwaccel_deps="dxva2"
  2715. mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
  2716. mpeg2_nvdec_hwaccel_deps="nvdec"
  2717. mpeg2_nvdec_hwaccel_select="mpeg2video_decoder"
  2718. mpeg2_vaapi_hwaccel_deps="vaapi"
  2719. mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
  2720. mpeg2_vdpau_hwaccel_deps="vdpau"
  2721. mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
  2722. mpeg2_videotoolbox_hwaccel_deps="videotoolbox"
  2723. mpeg2_videotoolbox_hwaccel_select="mpeg2video_decoder"
  2724. mpeg2_xvmc_hwaccel_deps="xvmc"
  2725. mpeg2_xvmc_hwaccel_select="mpeg2video_decoder"
  2726. mpeg4_nvdec_hwaccel_deps="nvdec"
  2727. mpeg4_nvdec_hwaccel_select="mpeg4_decoder"
  2728. mpeg4_vaapi_hwaccel_deps="vaapi"
  2729. mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
  2730. mpeg4_vdpau_hwaccel_deps="vdpau"
  2731. mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
  2732. mpeg4_videotoolbox_hwaccel_deps="videotoolbox"
  2733. mpeg4_videotoolbox_hwaccel_select="mpeg4_decoder"
  2734. vc1_d3d11va_hwaccel_deps="d3d11va"
  2735. vc1_d3d11va_hwaccel_select="vc1_decoder"
  2736. vc1_d3d11va2_hwaccel_deps="d3d11va"
  2737. vc1_d3d11va2_hwaccel_select="vc1_decoder"
  2738. vc1_dxva2_hwaccel_deps="dxva2"
  2739. vc1_dxva2_hwaccel_select="vc1_decoder"
  2740. vc1_nvdec_hwaccel_deps="nvdec"
  2741. vc1_nvdec_hwaccel_select="vc1_decoder"
  2742. vc1_vaapi_hwaccel_deps="vaapi"
  2743. vc1_vaapi_hwaccel_select="vc1_decoder"
  2744. vc1_vdpau_hwaccel_deps="vdpau"
  2745. vc1_vdpau_hwaccel_select="vc1_decoder"
  2746. vp8_nvdec_hwaccel_deps="nvdec"
  2747. vp8_nvdec_hwaccel_select="vp8_decoder"
  2748. vp8_vaapi_hwaccel_deps="vaapi"
  2749. vp8_vaapi_hwaccel_select="vp8_decoder"
  2750. vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
  2751. vp9_d3d11va_hwaccel_select="vp9_decoder"
  2752. vp9_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
  2753. vp9_d3d11va2_hwaccel_select="vp9_decoder"
  2754. vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9"
  2755. vp9_dxva2_hwaccel_select="vp9_decoder"
  2756. vp9_nvdec_hwaccel_deps="nvdec"
  2757. vp9_nvdec_hwaccel_select="vp9_decoder"
  2758. vp9_vaapi_hwaccel_deps="vaapi VADecPictureParameterBufferVP9_bit_depth"
  2759. vp9_vaapi_hwaccel_select="vp9_decoder"
  2760. vp9_vdpau_hwaccel_deps="vdpau VdpPictureInfoVP9"
  2761. vp9_vdpau_hwaccel_select="vp9_decoder"
  2762. wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
  2763. wmv3_d3d11va2_hwaccel_select="vc1_d3d11va2_hwaccel"
  2764. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  2765. wmv3_nvdec_hwaccel_select="vc1_nvdec_hwaccel"
  2766. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  2767. wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
  2768. # hardware-accelerated codecs
  2769. mediafoundation_deps="mftransform_h MFCreateAlignedMemoryBuffer"
  2770. mediafoundation_extralibs="-lmfplat -lmfuuid -lole32 -lstrmiids"
  2771. omx_deps="libdl pthreads"
  2772. omx_rpi_select="omx"
  2773. qsv_deps="libmfx"
  2774. qsvdec_select="qsv"
  2775. qsvenc_select="qsv"
  2776. qsvvpp_select="qsv"
  2777. vaapi_encode_deps="vaapi"
  2778. v4l2_m2m_deps="linux_videodev2_h sem_timedwait"
  2779. hwupload_cuda_filter_deps="ffnvcodec"
  2780. scale_npp_filter_deps="ffnvcodec libnpp"
  2781. scale_cuda_filter_deps="ffnvcodec"
  2782. scale_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
  2783. thumbnail_cuda_filter_deps="ffnvcodec"
  2784. thumbnail_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
  2785. transpose_npp_filter_deps="ffnvcodec libnpp"
  2786. overlay_cuda_filter_deps="ffnvcodec"
  2787. overlay_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
  2788. amf_deps_any="libdl LoadLibrary"
  2789. nvenc_deps="ffnvcodec"
  2790. nvenc_deps_any="libdl LoadLibrary"
  2791. nvenc_encoder_deps="nvenc"
  2792. aac_mf_encoder_deps="mediafoundation"
  2793. ac3_mf_encoder_deps="mediafoundation"
  2794. h263_v4l2m2m_decoder_deps="v4l2_m2m h263_v4l2_m2m"
  2795. h263_v4l2m2m_encoder_deps="v4l2_m2m h263_v4l2_m2m"
  2796. h264_amf_encoder_deps="amf"
  2797. h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
  2798. h264_cuvid_decoder_deps="cuvid"
  2799. h264_cuvid_decoder_select="h264_mp4toannexb_bsf"
  2800. h264_mediacodec_decoder_deps="mediacodec"
  2801. h264_mediacodec_decoder_select="h264_mp4toannexb_bsf h264_parser"
  2802. h264_mf_encoder_deps="mediafoundation"
  2803. h264_mmal_decoder_deps="mmal"
  2804. h264_nvenc_encoder_deps="nvenc"
  2805. h264_omx_encoder_deps="omx"
  2806. h264_qsv_decoder_select="h264_mp4toannexb_bsf qsvdec"
  2807. h264_qsv_encoder_select="qsvenc"
  2808. h264_rkmpp_decoder_deps="rkmpp"
  2809. h264_rkmpp_decoder_select="h264_mp4toannexb_bsf"
  2810. h264_vaapi_encoder_select="cbs_h264 vaapi_encode"
  2811. h264_v4l2m2m_decoder_deps="v4l2_m2m h264_v4l2_m2m"
  2812. h264_v4l2m2m_decoder_select="h264_mp4toannexb_bsf"
  2813. h264_v4l2m2m_encoder_deps="v4l2_m2m h264_v4l2_m2m"
  2814. hevc_amf_encoder_deps="amf"
  2815. hevc_cuvid_decoder_deps="cuvid"
  2816. hevc_cuvid_decoder_select="hevc_mp4toannexb_bsf"
  2817. hevc_mediacodec_decoder_deps="mediacodec"
  2818. hevc_mediacodec_decoder_select="hevc_mp4toannexb_bsf hevc_parser"
  2819. hevc_mf_encoder_deps="mediafoundation"
  2820. hevc_nvenc_encoder_deps="nvenc"
  2821. hevc_qsv_decoder_select="hevc_mp4toannexb_bsf qsvdec"
  2822. hevc_qsv_encoder_select="hevcparse qsvenc"
  2823. hevc_rkmpp_decoder_deps="rkmpp"
  2824. hevc_rkmpp_decoder_select="hevc_mp4toannexb_bsf"
  2825. hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC"
  2826. hevc_vaapi_encoder_select="cbs_h265 vaapi_encode"
  2827. hevc_v4l2m2m_decoder_deps="v4l2_m2m hevc_v4l2_m2m"
  2828. hevc_v4l2m2m_decoder_select="hevc_mp4toannexb_bsf"
  2829. hevc_v4l2m2m_encoder_deps="v4l2_m2m hevc_v4l2_m2m"
  2830. mjpeg_cuvid_decoder_deps="cuvid"
  2831. mjpeg_qsv_decoder_select="qsvdec"
  2832. mjpeg_qsv_encoder_deps="libmfx"
  2833. mjpeg_qsv_encoder_select="qsvenc"
  2834. mjpeg_vaapi_encoder_deps="VAEncPictureParameterBufferJPEG"
  2835. mjpeg_vaapi_encoder_select="cbs_jpeg jpegtables vaapi_encode"
  2836. mp3_mf_encoder_deps="mediafoundation"
  2837. mpeg1_cuvid_decoder_deps="cuvid"
  2838. mpeg1_v4l2m2m_decoder_deps="v4l2_m2m mpeg1_v4l2_m2m"
  2839. mpeg2_crystalhd_decoder_select="crystalhd"
  2840. mpeg2_cuvid_decoder_deps="cuvid"
  2841. mpeg2_mmal_decoder_deps="mmal"
  2842. mpeg2_mediacodec_decoder_deps="mediacodec"
  2843. mpeg2_qsv_decoder_select="qsvdec"
  2844. mpeg2_qsv_encoder_select="qsvenc"
  2845. mpeg2_vaapi_encoder_select="cbs_mpeg2 vaapi_encode"
  2846. mpeg2_v4l2m2m_decoder_deps="v4l2_m2m mpeg2_v4l2_m2m"
  2847. mpeg4_crystalhd_decoder_select="crystalhd"
  2848. mpeg4_cuvid_decoder_deps="cuvid"
  2849. mpeg4_mediacodec_decoder_deps="mediacodec"
  2850. mpeg4_mmal_decoder_deps="mmal"
  2851. mpeg4_omx_encoder_deps="omx"
  2852. mpeg4_v4l2m2m_decoder_deps="v4l2_m2m mpeg4_v4l2_m2m"
  2853. mpeg4_v4l2m2m_encoder_deps="v4l2_m2m mpeg4_v4l2_m2m"
  2854. msmpeg4_crystalhd_decoder_select="crystalhd"
  2855. nvenc_h264_encoder_select="h264_nvenc_encoder"
  2856. nvenc_hevc_encoder_select="hevc_nvenc_encoder"
  2857. vc1_crystalhd_decoder_select="crystalhd"
  2858. vc1_cuvid_decoder_deps="cuvid"
  2859. vc1_mmal_decoder_deps="mmal"
  2860. vc1_qsv_decoder_select="qsvdec"
  2861. vc1_v4l2m2m_decoder_deps="v4l2_m2m vc1_v4l2_m2m"
  2862. vp8_cuvid_decoder_deps="cuvid"
  2863. vp8_mediacodec_decoder_deps="mediacodec"
  2864. vp8_qsv_decoder_select="qsvdec"
  2865. vp8_rkmpp_decoder_deps="rkmpp"
  2866. vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8"
  2867. vp8_vaapi_encoder_select="vaapi_encode"
  2868. vp8_v4l2m2m_decoder_deps="v4l2_m2m vp8_v4l2_m2m"
  2869. vp8_v4l2m2m_encoder_deps="v4l2_m2m vp8_v4l2_m2m"
  2870. vp9_cuvid_decoder_deps="cuvid"
  2871. vp9_mediacodec_decoder_deps="mediacodec"
  2872. vp9_qsv_decoder_select="qsvdec"
  2873. vp9_rkmpp_decoder_deps="rkmpp"
  2874. vp9_vaapi_encoder_deps="VAEncPictureParameterBufferVP9"
  2875. vp9_vaapi_encoder_select="vaapi_encode"
  2876. vp9_qsv_encoder_deps="libmfx MFX_CODEC_VP9"
  2877. vp9_qsv_encoder_select="qsvenc"
  2878. vp9_v4l2m2m_decoder_deps="v4l2_m2m vp9_v4l2_m2m"
  2879. wmv3_crystalhd_decoder_select="crystalhd"
  2880. # parsers
  2881. aac_parser_select="adts_header"
  2882. av1_parser_select="cbs_av1"
  2883. h264_parser_select="golomb h264dsp h264parse"
  2884. hevc_parser_select="hevcparse"
  2885. mpegaudio_parser_select="mpegaudioheader"
  2886. mpegvideo_parser_select="mpegvideo"
  2887. mpeg4video_parser_select="h263dsp mpegvideo qpeldsp"
  2888. vc1_parser_select="vc1dsp"
  2889. # bitstream_filters
  2890. aac_adtstoasc_bsf_select="adts_header"
  2891. av1_frame_merge_bsf_select="cbs_av1"
  2892. av1_frame_split_bsf_select="cbs_av1"
  2893. av1_metadata_bsf_select="cbs_av1"
  2894. eac3_core_bsf_select="ac3_parser"
  2895. filter_units_bsf_select="cbs"
  2896. h264_metadata_bsf_deps="const_nan"
  2897. h264_metadata_bsf_select="cbs_h264"
  2898. h264_redundant_pps_bsf_select="cbs_h264"
  2899. hevc_metadata_bsf_select="cbs_h265"
  2900. mjpeg2jpeg_bsf_select="jpegtables"
  2901. mpeg2_metadata_bsf_select="cbs_mpeg2"
  2902. trace_headers_bsf_select="cbs"
  2903. vp9_metadata_bsf_select="cbs_vp9"
  2904. # external libraries
  2905. aac_at_decoder_deps="audiotoolbox"
  2906. aac_at_decoder_select="aac_adtstoasc_bsf"
  2907. ac3_at_decoder_deps="audiotoolbox"
  2908. ac3_at_decoder_select="ac3_parser"
  2909. adpcm_ima_qt_at_decoder_deps="audiotoolbox"
  2910. alac_at_decoder_deps="audiotoolbox"
  2911. amr_nb_at_decoder_deps="audiotoolbox"
  2912. avisynth_deps_any="libdl LoadLibrary"
  2913. avisynth_demuxer_deps="avisynth"
  2914. avisynth_demuxer_select="riffdec"
  2915. eac3_at_decoder_deps="audiotoolbox"
  2916. eac3_at_decoder_select="ac3_parser"
  2917. gsm_ms_at_decoder_deps="audiotoolbox"
  2918. ilbc_at_decoder_deps="audiotoolbox"
  2919. mp1_at_decoder_deps="audiotoolbox"
  2920. mp2_at_decoder_deps="audiotoolbox"
  2921. mp3_at_decoder_deps="audiotoolbox"
  2922. mp1_at_decoder_select="mpegaudioheader"
  2923. mp2_at_decoder_select="mpegaudioheader"
  2924. mp3_at_decoder_select="mpegaudioheader"
  2925. pcm_alaw_at_decoder_deps="audiotoolbox"
  2926. pcm_mulaw_at_decoder_deps="audiotoolbox"
  2927. qdmc_decoder_select="fft"
  2928. qdmc_at_decoder_deps="audiotoolbox"
  2929. qdm2_at_decoder_deps="audiotoolbox"
  2930. aac_at_encoder_deps="audiotoolbox"
  2931. aac_at_encoder_select="audio_frame_queue"
  2932. alac_at_encoder_deps="audiotoolbox"
  2933. alac_at_encoder_select="audio_frame_queue"
  2934. ilbc_at_encoder_deps="audiotoolbox"
  2935. ilbc_at_encoder_select="audio_frame_queue"
  2936. pcm_alaw_at_encoder_deps="audiotoolbox"
  2937. pcm_alaw_at_encoder_select="audio_frame_queue"
  2938. pcm_mulaw_at_encoder_deps="audiotoolbox"
  2939. pcm_mulaw_at_encoder_select="audio_frame_queue"
  2940. chromaprint_muxer_deps="chromaprint"
  2941. h264_videotoolbox_encoder_deps="pthreads"
  2942. h264_videotoolbox_encoder_select="videotoolbox_encoder"
  2943. hevc_videotoolbox_encoder_deps="pthreads"
  2944. hevc_videotoolbox_encoder_select="videotoolbox_encoder"
  2945. libaom_av1_decoder_deps="libaom"
  2946. libaom_av1_encoder_deps="libaom"
  2947. libaom_av1_encoder_select="extract_extradata_bsf"
  2948. libaribb24_decoder_deps="libaribb24"
  2949. libcelt_decoder_deps="libcelt"
  2950. libcodec2_decoder_deps="libcodec2"
  2951. libcodec2_encoder_deps="libcodec2"
  2952. libdav1d_decoder_deps="libdav1d"
  2953. libdavs2_decoder_deps="libdavs2"
  2954. libfdk_aac_decoder_deps="libfdk_aac"
  2955. libfdk_aac_encoder_deps="libfdk_aac"
  2956. libfdk_aac_encoder_select="audio_frame_queue"
  2957. libgme_demuxer_deps="libgme"
  2958. libgsm_decoder_deps="libgsm"
  2959. libgsm_encoder_deps="libgsm"
  2960. libgsm_ms_decoder_deps="libgsm"
  2961. libgsm_ms_encoder_deps="libgsm"
  2962. libilbc_decoder_deps="libilbc"
  2963. libilbc_encoder_deps="libilbc"
  2964. libkvazaar_encoder_deps="libkvazaar"
  2965. libmodplug_demuxer_deps="libmodplug"
  2966. libmp3lame_encoder_deps="libmp3lame"
  2967. libmp3lame_encoder_select="audio_frame_queue mpegaudioheader"
  2968. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  2969. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  2970. libopencore_amrnb_encoder_select="audio_frame_queue"
  2971. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  2972. libopenh264_decoder_deps="libopenh264"
  2973. libopenh264_decoder_select="h264_mp4toannexb_bsf"
  2974. libopenh264_encoder_deps="libopenh264"
  2975. libopenjpeg_decoder_deps="libopenjpeg"
  2976. libopenjpeg_encoder_deps="libopenjpeg"
  2977. libopenmpt_demuxer_deps="libopenmpt"
  2978. libopus_decoder_deps="libopus"
  2979. libopus_encoder_deps="libopus"
  2980. libopus_encoder_select="audio_frame_queue"
  2981. librav1e_encoder_deps="librav1e"
  2982. librav1e_encoder_select="extract_extradata_bsf"
  2983. librsvg_decoder_deps="librsvg"
  2984. libshine_encoder_deps="libshine"
  2985. libshine_encoder_select="audio_frame_queue"
  2986. libspeex_decoder_deps="libspeex"
  2987. libspeex_encoder_deps="libspeex"
  2988. libspeex_encoder_select="audio_frame_queue"
  2989. libtheora_encoder_deps="libtheora"
  2990. libtwolame_encoder_deps="libtwolame"
  2991. libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
  2992. libvorbis_decoder_deps="libvorbis"
  2993. libvorbis_encoder_deps="libvorbis libvorbisenc"
  2994. libvorbis_encoder_select="audio_frame_queue"
  2995. libvpx_vp8_decoder_deps="libvpx"
  2996. libvpx_vp8_encoder_deps="libvpx"
  2997. libvpx_vp9_decoder_deps="libvpx"
  2998. libvpx_vp9_encoder_deps="libvpx"
  2999. libwavpack_encoder_deps="libwavpack"
  3000. libwavpack_encoder_select="audio_frame_queue"
  3001. libwebp_encoder_deps="libwebp"
  3002. libwebp_anim_encoder_deps="libwebp"
  3003. libx262_encoder_deps="libx262"
  3004. libx264_encoder_deps="libx264"
  3005. libx264rgb_encoder_deps="libx264 x264_csp_bgr"
  3006. libx264rgb_encoder_select="libx264_encoder"
  3007. libx265_encoder_deps="libx265"
  3008. libxavs_encoder_deps="libxavs"
  3009. libxavs2_encoder_deps="libxavs2"
  3010. libxvid_encoder_deps="libxvid"
  3011. libzvbi_teletext_decoder_deps="libzvbi"
  3012. vapoursynth_demuxer_deps="vapoursynth"
  3013. videotoolbox_suggest="coreservices"
  3014. videotoolbox_deps="corefoundation coremedia corevideo"
  3015. videotoolbox_encoder_deps="videotoolbox VTCompressionSessionPrepareToEncodeFrames"
  3016. # demuxers / muxers
  3017. ac3_demuxer_select="ac3_parser"
  3018. act_demuxer_select="riffdec"
  3019. aiff_muxer_select="iso_media"
  3020. asf_demuxer_select="riffdec"
  3021. asf_o_demuxer_select="riffdec"
  3022. asf_muxer_select="riffenc"
  3023. asf_stream_muxer_select="asf_muxer"
  3024. av1_demuxer_select="av1_frame_merge_bsf av1_parser"
  3025. avi_demuxer_select="iso_media riffdec exif"
  3026. avi_muxer_select="riffenc"
  3027. caf_demuxer_select="iso_media riffdec"
  3028. caf_muxer_select="iso_media"
  3029. dash_muxer_select="mp4_muxer"
  3030. dash_demuxer_deps="libxml2"
  3031. dirac_demuxer_select="dirac_parser"
  3032. dts_demuxer_select="dca_parser"
  3033. dtshd_demuxer_select="dca_parser"
  3034. dv_demuxer_select="dvprofile"
  3035. dv_muxer_select="dvprofile"
  3036. dxa_demuxer_select="riffdec"
  3037. eac3_demuxer_select="ac3_parser"
  3038. f4v_muxer_select="mov_muxer"
  3039. fifo_muxer_deps="threads"
  3040. flac_demuxer_select="flac_parser"
  3041. flv_muxer_select="aac_adtstoasc_bsf"
  3042. gxf_muxer_select="pcm_rechunk_bsf"
  3043. hds_muxer_select="flv_muxer"
  3044. hls_muxer_select="mpegts_muxer"
  3045. hls_muxer_suggest="gcrypt openssl"
  3046. image2_alias_pix_demuxer_select="image2_demuxer"
  3047. image2_brender_pix_demuxer_select="image2_demuxer"
  3048. ipod_muxer_select="mov_muxer"
  3049. ismv_muxer_select="mov_muxer"
  3050. ivf_muxer_select="av1_metadata_bsf vp9_superframe_bsf"
  3051. latm_muxer_select="aac_adtstoasc_bsf"
  3052. matroska_audio_muxer_select="matroska_muxer"
  3053. matroska_demuxer_select="iso_media riffdec"
  3054. matroska_demuxer_suggest="bzlib lzo zlib"
  3055. matroska_muxer_select="iso_media riffenc vp9_superframe_bsf aac_adtstoasc_bsf"
  3056. mlp_demuxer_select="mlp_parser"
  3057. mmf_muxer_select="riffenc"
  3058. mov_demuxer_select="iso_media riffdec"
  3059. mov_demuxer_suggest="zlib"
  3060. mov_muxer_select="iso_media riffenc rtpenc_chain vp9_superframe_bsf aac_adtstoasc_bsf"
  3061. mp3_demuxer_select="mpegaudio_parser"
  3062. mp3_muxer_select="mpegaudioheader"
  3063. mp4_muxer_select="mov_muxer"
  3064. mpegts_demuxer_select="iso_media"
  3065. mpegts_muxer_select="adts_muxer latm_muxer h264_mp4toannexb_bsf hevc_mp4toannexb_bsf"
  3066. mpegtsraw_demuxer_select="mpegts_demuxer"
  3067. mxf_muxer_select="golomb pcm_rechunk_bsf"
  3068. mxf_d10_muxer_select="mxf_muxer"
  3069. mxf_opatom_muxer_select="mxf_muxer"
  3070. nut_muxer_select="riffenc"
  3071. nuv_demuxer_select="riffdec"
  3072. oga_muxer_select="ogg_muxer"
  3073. ogg_demuxer_select="dirac_parse"
  3074. ogv_muxer_select="ogg_muxer"
  3075. opus_muxer_select="ogg_muxer"
  3076. psp_muxer_select="mov_muxer"
  3077. rtp_demuxer_select="sdp_demuxer"
  3078. rtp_muxer_select="golomb jpegtables"
  3079. rtpdec_select="asf_demuxer jpegtables mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol srtp"
  3080. rtsp_demuxer_select="http_protocol rtpdec"
  3081. rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
  3082. sap_demuxer_select="sdp_demuxer"
  3083. sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
  3084. sdp_demuxer_select="rtpdec"
  3085. smoothstreaming_muxer_select="ismv_muxer"
  3086. spdif_demuxer_select="adts_header"
  3087. spdif_muxer_select="adts_header"
  3088. spx_muxer_select="ogg_muxer"
  3089. swf_demuxer_suggest="zlib"
  3090. tak_demuxer_select="tak_parser"
  3091. truehd_demuxer_select="mlp_parser"
  3092. tg2_muxer_select="mov_muxer"
  3093. tgp_muxer_select="mov_muxer"
  3094. vobsub_demuxer_select="mpegps_demuxer"
  3095. w64_demuxer_select="wav_demuxer"
  3096. w64_muxer_select="wav_muxer"
  3097. wav_demuxer_select="riffdec"
  3098. wav_muxer_select="riffenc"
  3099. webm_chunk_muxer_select="webm_muxer"
  3100. webm_muxer_select="iso_media riffenc"
  3101. webm_dash_manifest_demuxer_select="matroska_demuxer"
  3102. wtv_demuxer_select="mpegts_demuxer riffdec"
  3103. wtv_muxer_select="mpegts_muxer riffenc"
  3104. xmv_demuxer_select="riffdec"
  3105. xwma_demuxer_select="riffdec"
  3106. # indevs / outdevs
  3107. android_camera_indev_deps="android camera2ndk mediandk pthreads"
  3108. android_camera_indev_extralibs="-landroid -lcamera2ndk -lmediandk"
  3109. alsa_indev_deps="alsa"
  3110. alsa_outdev_deps="alsa"
  3111. avfoundation_indev_deps="avfoundation corevideo coremedia pthreads"
  3112. avfoundation_indev_suggest="coregraphics applicationservices"
  3113. avfoundation_indev_extralibs="-framework Foundation"
  3114. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  3115. caca_outdev_deps="libcaca"
  3116. decklink_deps_any="libdl LoadLibrary"
  3117. decklink_indev_deps="decklink threads"
  3118. decklink_indev_extralibs="-lstdc++"
  3119. decklink_outdev_deps="decklink threads"
  3120. decklink_outdev_suggest="libklvanc"
  3121. decklink_outdev_extralibs="-lstdc++"
  3122. dshow_indev_deps="IBaseFilter"
  3123. dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid -loleaut32 -lshlwapi"
  3124. fbdev_indev_deps="linux_fb_h"
  3125. fbdev_outdev_deps="linux_fb_h"
  3126. gdigrab_indev_deps="CreateDIBSection"
  3127. gdigrab_indev_extralibs="-lgdi32"
  3128. gdigrab_indev_select="bmp_decoder"
  3129. iec61883_indev_deps="libiec61883"
  3130. jack_indev_deps="libjack"
  3131. jack_indev_deps_any="sem_timedwait dispatch_dispatch_h"
  3132. kmsgrab_indev_deps="libdrm"
  3133. lavfi_indev_deps="avfilter"
  3134. libcdio_indev_deps="libcdio"
  3135. libdc1394_indev_deps="libdc1394"
  3136. openal_indev_deps="openal"
  3137. opengl_outdev_deps="opengl"
  3138. opengl_outdev_suggest="sdl2"
  3139. oss_indev_deps_any="sys_soundcard_h"
  3140. oss_outdev_deps_any="sys_soundcard_h"
  3141. pulse_indev_deps="libpulse"
  3142. pulse_outdev_deps="libpulse"
  3143. sdl2_outdev_deps="sdl2"
  3144. sndio_indev_deps="sndio"
  3145. sndio_outdev_deps="sndio"
  3146. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  3147. v4l2_indev_suggest="libv4l2"
  3148. v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h"
  3149. v4l2_outdev_suggest="libv4l2"
  3150. vfwcap_indev_deps="vfw32 vfwcap_defines"
  3151. xcbgrab_indev_deps="libxcb"
  3152. xcbgrab_indev_suggest="libxcb_shm libxcb_shape libxcb_xfixes"
  3153. xv_outdev_deps="xlib"
  3154. # protocols
  3155. async_protocol_deps="threads"
  3156. bluray_protocol_deps="libbluray"
  3157. ffrtmpcrypt_protocol_conflict="librtmp_protocol"
  3158. ffrtmpcrypt_protocol_deps_any="gcrypt gmp openssl mbedtls"
  3159. ffrtmpcrypt_protocol_select="tcp_protocol"
  3160. ffrtmphttp_protocol_conflict="librtmp_protocol"
  3161. ffrtmphttp_protocol_select="http_protocol"
  3162. ftp_protocol_select="tcp_protocol"
  3163. gopher_protocol_select="network"
  3164. http_protocol_select="tcp_protocol"
  3165. http_protocol_suggest="zlib"
  3166. httpproxy_protocol_select="tcp_protocol"
  3167. httpproxy_protocol_suggest="zlib"
  3168. https_protocol_select="tls_protocol"
  3169. https_protocol_suggest="zlib"
  3170. icecast_protocol_select="http_protocol"
  3171. mmsh_protocol_select="http_protocol"
  3172. mmst_protocol_select="network"
  3173. rtmp_protocol_conflict="librtmp_protocol"
  3174. rtmp_protocol_select="tcp_protocol"
  3175. rtmp_protocol_suggest="zlib"
  3176. rtmpe_protocol_select="ffrtmpcrypt_protocol"
  3177. rtmpe_protocol_suggest="zlib"
  3178. rtmps_protocol_conflict="librtmp_protocol"
  3179. rtmps_protocol_select="tls_protocol"
  3180. rtmps_protocol_suggest="zlib"
  3181. rtmpt_protocol_select="ffrtmphttp_protocol"
  3182. rtmpt_protocol_suggest="zlib"
  3183. rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
  3184. rtmpte_protocol_suggest="zlib"
  3185. rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
  3186. rtmpts_protocol_suggest="zlib"
  3187. rtp_protocol_select="udp_protocol"
  3188. schannel_conflict="openssl gnutls libtls mbedtls"
  3189. sctp_protocol_deps="struct_sctp_event_subscribe struct_msghdr_msg_flags"
  3190. sctp_protocol_select="network"
  3191. securetransport_conflict="openssl gnutls libtls mbedtls"
  3192. srtp_protocol_select="rtp_protocol srtp"
  3193. tcp_protocol_select="network"
  3194. tls_protocol_deps_any="gnutls openssl schannel securetransport libtls mbedtls"
  3195. tls_protocol_select="tcp_protocol"
  3196. udp_protocol_select="network"
  3197. udplite_protocol_select="network"
  3198. unix_protocol_deps="sys_un_h"
  3199. unix_protocol_select="network"
  3200. # external library protocols
  3201. libamqp_protocol_deps="librabbitmq"
  3202. libamqp_protocol_select="network"
  3203. librtmp_protocol_deps="librtmp"
  3204. librtmpe_protocol_deps="librtmp"
  3205. librtmps_protocol_deps="librtmp"
  3206. librtmpt_protocol_deps="librtmp"
  3207. librtmpte_protocol_deps="librtmp"
  3208. libsmbclient_protocol_deps="libsmbclient gplv3"
  3209. libsrt_protocol_deps="libsrt"
  3210. libsrt_protocol_select="network"
  3211. libssh_protocol_deps="libssh"
  3212. libtls_conflict="openssl gnutls mbedtls"
  3213. libzmq_protocol_deps="libzmq"
  3214. libzmq_protocol_select="network"
  3215. # filters
  3216. afftdn_filter_deps="avcodec"
  3217. afftdn_filter_select="fft"
  3218. afftfilt_filter_deps="avcodec"
  3219. afftfilt_filter_select="fft"
  3220. afir_filter_deps="avcodec"
  3221. afir_filter_select="rdft"
  3222. amovie_filter_deps="avcodec avformat"
  3223. aresample_filter_deps="swresample"
  3224. asr_filter_deps="pocketsphinx"
  3225. ass_filter_deps="libass"
  3226. atempo_filter_deps="avcodec"
  3227. atempo_filter_select="rdft"
  3228. avgblur_opencl_filter_deps="opencl"
  3229. avgblur_vulkan_filter_deps="vulkan libglslang"
  3230. azmq_filter_deps="libzmq"
  3231. blackframe_filter_deps="gpl"
  3232. bm3d_filter_deps="avcodec"
  3233. bm3d_filter_select="dct"
  3234. boxblur_filter_deps="gpl"
  3235. boxblur_opencl_filter_deps="opencl gpl"
  3236. bs2b_filter_deps="libbs2b"
  3237. chromaber_vulkan_filter_deps="vulkan libglslang"
  3238. colorkey_opencl_filter_deps="opencl"
  3239. colormatrix_filter_deps="gpl"
  3240. convolution_opencl_filter_deps="opencl"
  3241. convolve_filter_deps="avcodec"
  3242. convolve_filter_select="fft"
  3243. coreimage_filter_deps="coreimage appkit"
  3244. coreimage_filter_extralibs="-framework OpenGL"
  3245. coreimagesrc_filter_deps="coreimage appkit"
  3246. coreimagesrc_filter_extralibs="-framework OpenGL"
  3247. cover_rect_filter_deps="avcodec avformat gpl"
  3248. cropdetect_filter_deps="gpl"
  3249. deconvolve_filter_deps="avcodec"
  3250. deconvolve_filter_select="fft"
  3251. deinterlace_qsv_filter_deps="libmfx"
  3252. deinterlace_vaapi_filter_deps="vaapi"
  3253. delogo_filter_deps="gpl"
  3254. denoise_vaapi_filter_deps="vaapi"
  3255. derain_filter_select="dnn"
  3256. deshake_filter_select="pixelutils"
  3257. deshake_opencl_filter_deps="opencl"
  3258. dilation_opencl_filter_deps="opencl"
  3259. dnn_processing_filter_deps="swscale"
  3260. dnn_processing_filter_select="dnn"
  3261. drawtext_filter_deps="libfreetype"
  3262. drawtext_filter_suggest="libfontconfig libfribidi"
  3263. elbg_filter_deps="avcodec"
  3264. eq_filter_deps="gpl"
  3265. erosion_opencl_filter_deps="opencl"
  3266. fftfilt_filter_deps="avcodec"
  3267. fftfilt_filter_select="rdft"
  3268. fftdnoiz_filter_deps="avcodec"
  3269. fftdnoiz_filter_select="fft"
  3270. find_rect_filter_deps="avcodec avformat gpl"
  3271. firequalizer_filter_deps="avcodec"
  3272. firequalizer_filter_select="rdft"
  3273. flite_filter_deps="libflite"
  3274. framerate_filter_select="scene_sad"
  3275. freezedetect_filter_select="scene_sad"
  3276. frei0r_filter_deps="frei0r libdl"
  3277. frei0r_src_filter_deps="frei0r libdl"
  3278. fspp_filter_deps="gpl"
  3279. headphone_filter_select="fft"
  3280. histeq_filter_deps="gpl"
  3281. hqdn3d_filter_deps="gpl"
  3282. interlace_filter_deps="gpl"
  3283. kerndeint_filter_deps="gpl"
  3284. ladspa_filter_deps="ladspa libdl"
  3285. lensfun_filter_deps="liblensfun version3"
  3286. lv2_filter_deps="lv2"
  3287. mcdeint_filter_deps="avcodec gpl"
  3288. movie_filter_deps="avcodec avformat"
  3289. mpdecimate_filter_deps="gpl"
  3290. mpdecimate_filter_select="pixelutils"
  3291. minterpolate_filter_select="scene_sad"
  3292. mptestsrc_filter_deps="gpl"
  3293. negate_filter_deps="lut_filter"
  3294. nlmeans_opencl_filter_deps="opencl"
  3295. nnedi_filter_deps="gpl"
  3296. ocr_filter_deps="libtesseract"
  3297. ocv_filter_deps="libopencv"
  3298. openclsrc_filter_deps="opencl"
  3299. overlay_opencl_filter_deps="opencl"
  3300. overlay_qsv_filter_deps="libmfx"
  3301. overlay_qsv_filter_select="qsvvpp"
  3302. overlay_vulkan_filter_deps="vulkan libglslang"
  3303. owdenoise_filter_deps="gpl"
  3304. pad_opencl_filter_deps="opencl"
  3305. pan_filter_deps="swresample"
  3306. perspective_filter_deps="gpl"
  3307. phase_filter_deps="gpl"
  3308. pp7_filter_deps="gpl"
  3309. pp_filter_deps="gpl postproc"
  3310. prewitt_opencl_filter_deps="opencl"
  3311. procamp_vaapi_filter_deps="vaapi"
  3312. program_opencl_filter_deps="opencl"
  3313. pullup_filter_deps="gpl"
  3314. removelogo_filter_deps="avcodec avformat swscale"
  3315. repeatfields_filter_deps="gpl"
  3316. resample_filter_deps="avresample"
  3317. roberts_opencl_filter_deps="opencl"
  3318. rubberband_filter_deps="librubberband"
  3319. sab_filter_deps="gpl swscale"
  3320. scale2ref_filter_deps="swscale"
  3321. scale_filter_deps="swscale"
  3322. scale_qsv_filter_deps="libmfx"
  3323. scdet_filter_select="scene_sad"
  3324. select_filter_select="scene_sad"
  3325. sharpness_vaapi_filter_deps="vaapi"
  3326. showcqt_filter_deps="avcodec avformat swscale"
  3327. showcqt_filter_suggest="libfontconfig libfreetype"
  3328. showcqt_filter_select="fft"
  3329. showfreqs_filter_deps="avcodec"
  3330. showfreqs_filter_select="fft"
  3331. showspatial_filter_select="fft"
  3332. showspectrum_filter_deps="avcodec"
  3333. showspectrum_filter_select="fft"
  3334. showspectrumpic_filter_deps="avcodec"
  3335. showspectrumpic_filter_select="fft"
  3336. signature_filter_deps="gpl avcodec avformat"
  3337. sinc_filter_select="rdft"
  3338. smartblur_filter_deps="gpl swscale"
  3339. sobel_opencl_filter_deps="opencl"
  3340. sofalizer_filter_deps="libmysofa avcodec"
  3341. sofalizer_filter_select="fft"
  3342. spectrumsynth_filter_deps="avcodec"
  3343. spectrumsynth_filter_select="fft"
  3344. spp_filter_deps="gpl avcodec"
  3345. spp_filter_select="fft idctdsp fdctdsp me_cmp pixblockdsp"
  3346. sr_filter_deps="avformat swscale"
  3347. sr_filter_select="dnn"
  3348. stereo3d_filter_deps="gpl"
  3349. subtitles_filter_deps="avformat avcodec libass"
  3350. super2xsai_filter_deps="gpl"
  3351. pixfmts_super2xsai_test_deps="super2xsai_filter"
  3352. superequalizer_filter_select="rdft"
  3353. surround_filter_select="rdft"
  3354. tinterlace_filter_deps="gpl"
  3355. tinterlace_merge_test_deps="tinterlace_filter"
  3356. tinterlace_pad_test_deps="tinterlace_filter"
  3357. tonemap_filter_deps="const_nan"
  3358. tonemap_vaapi_filter_deps="vaapi VAProcFilterParameterBufferHDRToneMapping"
  3359. tonemap_opencl_filter_deps="opencl const_nan"
  3360. transpose_opencl_filter_deps="opencl"
  3361. transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags"
  3362. unsharp_opencl_filter_deps="opencl"
  3363. uspp_filter_deps="gpl avcodec"
  3364. vaguedenoiser_filter_deps="gpl"
  3365. vidstabdetect_filter_deps="libvidstab"
  3366. vidstabtransform_filter_deps="libvidstab"
  3367. libvmaf_filter_deps="libvmaf pthreads"
  3368. zmq_filter_deps="libzmq"
  3369. zoompan_filter_deps="swscale"
  3370. zscale_filter_deps="libzimg const_nan"
  3371. scale_vaapi_filter_deps="vaapi"
  3372. scale_vulkan_filter_deps="vulkan libglslang"
  3373. vpp_qsv_filter_deps="libmfx"
  3374. vpp_qsv_filter_select="qsvvpp"
  3375. xfade_opencl_filter_deps="opencl"
  3376. yadif_cuda_filter_deps="ffnvcodec"
  3377. yadif_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
  3378. # examples
  3379. avio_list_dir_deps="avformat avutil"
  3380. avio_reading_deps="avformat avcodec avutil"
  3381. decode_audio_example_deps="avcodec avutil"
  3382. decode_video_example_deps="avcodec avutil"
  3383. demuxing_decoding_example_deps="avcodec avformat avutil"
  3384. encode_audio_example_deps="avcodec avutil"
  3385. encode_video_example_deps="avcodec avutil"
  3386. extract_mvs_example_deps="avcodec avformat avutil"
  3387. filter_audio_example_deps="avfilter avutil"
  3388. filtering_audio_example_deps="avfilter avcodec avformat avutil"
  3389. filtering_video_example_deps="avfilter avcodec avformat avutil"
  3390. http_multiclient_example_deps="avformat avutil fork"
  3391. hw_decode_example_deps="avcodec avformat avutil"
  3392. metadata_example_deps="avformat avutil"
  3393. muxing_example_deps="avcodec avformat avutil swscale"
  3394. qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder"
  3395. remuxing_example_deps="avcodec avformat avutil"
  3396. resampling_audio_example_deps="avutil swresample"
  3397. scaling_video_example_deps="avutil swscale"
  3398. transcode_aac_example_deps="avcodec avformat swresample"
  3399. transcoding_example_deps="avfilter avcodec avformat avutil"
  3400. vaapi_encode_example_deps="avcodec avutil h264_vaapi_encoder"
  3401. vaapi_transcode_example_deps="avcodec avformat avutil h264_vaapi_encoder"
  3402. # EXTRALIBS_LIST
  3403. cpu_init_extralibs="pthreads_extralibs"
  3404. cws2fws_extralibs="zlib_extralibs"
  3405. # libraries, in any order
  3406. avcodec_deps="avutil"
  3407. avcodec_suggest="libm"
  3408. avcodec_select="null_bsf"
  3409. avdevice_deps="avformat avcodec avutil"
  3410. avdevice_suggest="libm"
  3411. avfilter_deps="avutil"
  3412. avfilter_suggest="libm"
  3413. avformat_deps="avcodec avutil"
  3414. avformat_suggest="libm network zlib"
  3415. avresample_deps="avutil"
  3416. avresample_suggest="libm"
  3417. avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx opencl user32 vaapi vulkan videotoolbox corefoundation corevideo coremedia bcrypt"
  3418. postproc_deps="avutil gpl"
  3419. postproc_suggest="libm"
  3420. swresample_deps="avutil"
  3421. swresample_suggest="libm libsoxr"
  3422. swscale_deps="avutil"
  3423. swscale_suggest="libm"
  3424. avcodec_extralibs="pthreads_extralibs iconv_extralibs dxva2_extralibs"
  3425. avfilter_extralibs="pthreads_extralibs"
  3426. avutil_extralibs="d3d11va_extralibs nanosleep_extralibs pthreads_extralibs vaapi_drm_extralibs vaapi_x11_extralibs vdpau_x11_extralibs"
  3427. # programs
  3428. ffmpeg_deps="avcodec avfilter avformat"
  3429. ffmpeg_select="aformat_filter anull_filter atrim_filter format_filter
  3430. hflip_filter null_filter
  3431. transpose_filter trim_filter vflip_filter"
  3432. ffmpeg_suggest="ole32 psapi shell32"
  3433. ffplay_deps="avcodec avformat swscale swresample sdl2"
  3434. ffplay_select="rdft crop_filter transpose_filter hflip_filter vflip_filter rotate_filter"
  3435. ffplay_suggest="shell32"
  3436. ffprobe_deps="avcodec avformat"
  3437. ffprobe_suggest="shell32"
  3438. # documentation
  3439. podpages_deps="perl"
  3440. manpages_deps="perl pod2man"
  3441. htmlpages_deps="perl"
  3442. htmlpages_deps_any="makeinfo_html texi2html"
  3443. txtpages_deps="perl makeinfo"
  3444. doc_deps_any="manpages htmlpages podpages txtpages"
  3445. # default parameters
  3446. logfile="ffbuild/config.log"
  3447. # installation paths
  3448. prefix_default="/usr/local"
  3449. bindir_default='${prefix}/bin'
  3450. datadir_default='${prefix}/share/ffmpeg'
  3451. docdir_default='${prefix}/share/doc/ffmpeg'
  3452. incdir_default='${prefix}/include'
  3453. libdir_default='${prefix}/lib'
  3454. mandir_default='${prefix}/share/man'
  3455. # toolchain
  3456. ar_default="ar"
  3457. cc_default="gcc"
  3458. cxx_default="g++"
  3459. host_cc_default="gcc"
  3460. doxygen_default="doxygen"
  3461. install="install"
  3462. ln_s_default="ln -s -f"
  3463. nm_default="nm -g"
  3464. pkg_config_default=pkg-config
  3465. ranlib_default="ranlib"
  3466. strip_default="strip"
  3467. version_script='--version-script'
  3468. objformat="elf32"
  3469. x86asmexe_default="nasm"
  3470. windres_default="windres"
  3471. striptype="direct"
  3472. # OS
  3473. target_os_default=$(tolower $(uname -s))
  3474. host_os=$target_os_default
  3475. # machine
  3476. if test "$target_os_default" = aix; then
  3477. arch_default=$(uname -p)
  3478. strip_default="strip -X32_64"
  3479. nm_default="nm -g -X32_64"
  3480. else
  3481. arch_default=$(uname -m)
  3482. fi
  3483. cpu="generic"
  3484. intrinsics="none"
  3485. # configurable options
  3486. enable $PROGRAM_LIST
  3487. enable $DOCUMENT_LIST
  3488. enable $EXAMPLE_LIST
  3489. enable $(filter_out avresample $LIBRARY_LIST)
  3490. enable stripping
  3491. enable asm
  3492. enable debug
  3493. enable doc
  3494. enable faan faandct faanidct
  3495. enable large_tests
  3496. enable optimizations
  3497. enable runtime_cpudetect
  3498. enable safe_bitstream_reader
  3499. enable static
  3500. enable swscale_alpha
  3501. enable valgrind_backtrace
  3502. sws_max_filter_size_default=256
  3503. set_default sws_max_filter_size
  3504. # internal components are enabled by default
  3505. enable $EXTRALIBS_LIST
  3506. # Avoid external, non-system, libraries getting enabled by dependency resolution
  3507. disable $EXTERNAL_LIBRARY_LIST $HWACCEL_LIBRARY_LIST
  3508. # build settings
  3509. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  3510. LIBPREF="lib"
  3511. LIBSUF=".a"
  3512. FULLNAME='$(NAME)$(BUILDSUF)'
  3513. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  3514. SLIBPREF="lib"
  3515. SLIBSUF=".so"
  3516. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  3517. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  3518. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  3519. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  3520. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
  3521. SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
  3522. VERSION_SCRIPT_POSTPROCESS_CMD="cat"
  3523. asflags_filter=echo
  3524. cflags_filter=echo
  3525. ldflags_filter=echo
  3526. AS_C='-c'
  3527. AS_O='-o $@'
  3528. CC_C='-c'
  3529. CC_E='-E -o $@'
  3530. CC_O='-o $@'
  3531. CXX_C='-c'
  3532. CXX_O='-o $@'
  3533. OBJCC_C='-c'
  3534. OBJCC_E='-E -o $@'
  3535. OBJCC_O='-o $@'
  3536. X86ASM_O='-o $@'
  3537. LD_O='-o $@'
  3538. LD_LIB='-l%'
  3539. LD_PATH='-L'
  3540. HOSTCC_C='-c'
  3541. HOSTCC_E='-E -o $@'
  3542. HOSTCC_O='-o $@'
  3543. HOSTLD_O='-o $@'
  3544. NVCC_C='-c'
  3545. NVCC_O='-o $@'
  3546. host_extralibs='-lm'
  3547. host_cflags_filter=echo
  3548. host_ldflags_filter=echo
  3549. target_path='$(CURDIR)'
  3550. # since the object filename is not given with the -MM flag, the compiler
  3551. # is only able to print the basename, and we must add the path ourselves
  3552. DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>/dev/null | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(@F),$(@D)/$(@F)," > $(@:.o=.d)'
  3553. DEPFLAGS='-MM'
  3554. mkdir -p ffbuild
  3555. # find source path
  3556. if test -f configure; then
  3557. source_path=.
  3558. elif test -f src/configure; then
  3559. source_path=src
  3560. else
  3561. source_path=$(cd $(dirname "$0"); pwd)
  3562. case "$source_path" in
  3563. *[[:blank:]]*) die "Out of tree builds are impossible with whitespace in source path." ;;
  3564. esac
  3565. test -e "$source_path/config.h" &&
  3566. die "Out of tree builds are impossible with config.h in source dir."
  3567. fi
  3568. for v in "$@"; do
  3569. r=${v#*=}
  3570. l=${v%"$r"}
  3571. r=$(sh_quote "$r")
  3572. FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
  3573. done
  3574. find_things_extern(){
  3575. thing=$1
  3576. pattern=$2
  3577. file=$source_path/$3
  3578. out=${4:-$thing}
  3579. sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$out/p" "$file"
  3580. }
  3581. find_filters_extern(){
  3582. file=$source_path/$1
  3583. sed -n 's/^extern AVFilter ff_[avfsinkrc]\{2,5\}_\([[:alnum:]_]\{1,\}\);/\1_filter/p' $file
  3584. }
  3585. FILTER_LIST=$(find_filters_extern libavfilter/allfilters.c)
  3586. OUTDEV_LIST=$(find_things_extern muxer AVOutputFormat libavdevice/alldevices.c outdev)
  3587. INDEV_LIST=$(find_things_extern demuxer AVInputFormat libavdevice/alldevices.c indev)
  3588. MUXER_LIST=$(find_things_extern muxer AVOutputFormat libavformat/allformats.c)
  3589. DEMUXER_LIST=$(find_things_extern demuxer AVInputFormat libavformat/allformats.c)
  3590. ENCODER_LIST=$(find_things_extern encoder AVCodec libavcodec/allcodecs.c)
  3591. DECODER_LIST=$(find_things_extern decoder AVCodec libavcodec/allcodecs.c)
  3592. CODEC_LIST="
  3593. $ENCODER_LIST
  3594. $DECODER_LIST
  3595. "
  3596. PARSER_LIST=$(find_things_extern parser AVCodecParser libavcodec/parsers.c)
  3597. BSF_LIST=$(find_things_extern bsf AVBitStreamFilter libavcodec/bitstream_filters.c)
  3598. HWACCEL_LIST=$(find_things_extern hwaccel AVHWAccel libavcodec/hwaccels.h)
  3599. PROTOCOL_LIST=$(find_things_extern protocol URLProtocol libavformat/protocols.c)
  3600. AVCODEC_COMPONENTS_LIST="
  3601. $BSF_LIST
  3602. $DECODER_LIST
  3603. $ENCODER_LIST
  3604. $HWACCEL_LIST
  3605. $PARSER_LIST
  3606. "
  3607. AVDEVICE_COMPONENTS_LIST="
  3608. $INDEV_LIST
  3609. $OUTDEV_LIST
  3610. "
  3611. AVFILTER_COMPONENTS_LIST="
  3612. $FILTER_LIST
  3613. "
  3614. AVFORMAT_COMPONENTS_LIST="
  3615. $DEMUXER_LIST
  3616. $MUXER_LIST
  3617. $PROTOCOL_LIST
  3618. "
  3619. ALL_COMPONENTS="
  3620. $AVCODEC_COMPONENTS_LIST
  3621. $AVDEVICE_COMPONENTS_LIST
  3622. $AVFILTER_COMPONENTS_LIST
  3623. $AVFORMAT_COMPONENTS_LIST
  3624. "
  3625. for n in $COMPONENT_LIST; do
  3626. v=$(toupper ${n%s})_LIST
  3627. eval enable \$$v
  3628. eval ${n}_if_any="\$$v"
  3629. done
  3630. enable $ARCH_EXT_LIST
  3631. die_unknown(){
  3632. echo "Unknown option \"$1\"."
  3633. echo "See $0 --help for available options."
  3634. exit 1
  3635. }
  3636. print_in_columns() {
  3637. tr ' ' '\n' | sort | tr '\r\n' ' ' | awk -v col_width=24 -v width="$ncols" '
  3638. {
  3639. num_cols = width > col_width ? int(width / col_width) : 1;
  3640. num_rows = int((NF + num_cols-1) / num_cols);
  3641. y = x = 1;
  3642. for (y = 1; y <= num_rows; y++) {
  3643. i = y;
  3644. for (x = 1; x <= num_cols; x++) {
  3645. if (i <= NF) {
  3646. line = sprintf("%s%-" col_width "s", line, $i);
  3647. }
  3648. i = i + num_rows;
  3649. }
  3650. print line; line = "";
  3651. }
  3652. }' | sed 's/ *$//'
  3653. }
  3654. show_list() {
  3655. suffix=_$1
  3656. shift
  3657. echo $* | sed s/$suffix//g | print_in_columns
  3658. exit 0
  3659. }
  3660. rand_list(){
  3661. IFS=', '
  3662. set -- $*
  3663. unset IFS
  3664. for thing; do
  3665. comp=${thing%:*}
  3666. prob=${thing#$comp}
  3667. prob=${prob#:}
  3668. is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
  3669. echo "prob ${prob:-0.5}"
  3670. printf '%s\n' $comp
  3671. done
  3672. }
  3673. do_random(){
  3674. action=$1
  3675. shift
  3676. random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
  3677. $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
  3678. }
  3679. for opt do
  3680. optval="${opt#*=}"
  3681. case "$opt" in
  3682. --extra-ldflags=*)
  3683. add_ldflags $optval
  3684. ;;
  3685. --extra-ldexeflags=*)
  3686. add_ldexeflags $optval
  3687. ;;
  3688. --extra-ldsoflags=*)
  3689. add_ldsoflags $optval
  3690. ;;
  3691. --extra-ldlibflags=*)
  3692. warn "The --extra-ldlibflags option is only provided for compatibility and will be\n"\
  3693. "removed in the future. Use --extra-ldsoflags instead."
  3694. add_ldsoflags $optval
  3695. ;;
  3696. --extra-libs=*)
  3697. add_extralibs $optval
  3698. ;;
  3699. --disable-devices)
  3700. disable $INDEV_LIST $OUTDEV_LIST
  3701. ;;
  3702. --enable-debug=*)
  3703. debuglevel="$optval"
  3704. ;;
  3705. --disable-programs)
  3706. disable $PROGRAM_LIST
  3707. ;;
  3708. --disable-everything)
  3709. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  3710. ;;
  3711. --disable-all)
  3712. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  3713. disable $LIBRARY_LIST $PROGRAM_LIST doc
  3714. enable avutil
  3715. ;;
  3716. --enable-random|--disable-random)
  3717. action=${opt%%-random}
  3718. do_random ${action#--} $COMPONENT_LIST
  3719. ;;
  3720. --enable-random=*|--disable-random=*)
  3721. action=${opt%%-random=*}
  3722. do_random ${action#--} $optval
  3723. ;;
  3724. --enable-sdl)
  3725. enable sdl2
  3726. ;;
  3727. --enable-*=*|--disable-*=*)
  3728. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  3729. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  3730. eval list=\$$(toupper $thing)_LIST
  3731. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  3732. list=$(filter "$name" $list)
  3733. [ "$list" = "" ] && warn "Option $opt did not match anything"
  3734. test $action = enable && warn_if_gets_disabled $list
  3735. $action $list
  3736. ;;
  3737. --enable-yasm|--disable-yasm)
  3738. warn "The ${opt} option is only provided for compatibility and will be\n"\
  3739. "removed in the future. Use --enable-x86asm / --disable-x86asm instead."
  3740. test $opt = --enable-yasm && x86asm=yes || x86asm=no
  3741. ;;
  3742. --yasmexe=*)
  3743. warn "The --yasmexe option is only provided for compatibility and will be\n"\
  3744. "removed in the future. Use --x86asmexe instead."
  3745. x86asmexe="$optval"
  3746. ;;
  3747. --enable-?*|--disable-?*)
  3748. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  3749. if is_in $option $COMPONENT_LIST; then
  3750. test $action = disable && action=unset
  3751. eval $action \$$(toupper ${option%s})_LIST
  3752. elif is_in $option $CMDLINE_SELECT; then
  3753. $action $option
  3754. else
  3755. die_unknown $opt
  3756. fi
  3757. ;;
  3758. --list-*)
  3759. NAME="${opt#--list-}"
  3760. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  3761. NAME=${NAME%s}
  3762. eval show_list $NAME \$$(toupper $NAME)_LIST
  3763. ;;
  3764. --help|-h) show_help
  3765. ;;
  3766. --quiet|-q) quiet=yes
  3767. ;;
  3768. --fatal-warnings) enable fatal_warnings
  3769. ;;
  3770. --libfuzzer=*)
  3771. libfuzzer_path="$optval"
  3772. ;;
  3773. *)
  3774. optname="${opt%%=*}"
  3775. optname="${optname#--}"
  3776. optname=$(echo "$optname" | sed 's/-/_/g')
  3777. if is_in $optname $CMDLINE_SET; then
  3778. eval $optname='$optval'
  3779. elif is_in $optname $CMDLINE_APPEND; then
  3780. append $optname "$optval"
  3781. else
  3782. die_unknown $opt
  3783. fi
  3784. ;;
  3785. esac
  3786. done
  3787. for e in $env; do
  3788. eval "export $e"
  3789. done
  3790. if disabled autodetect; then
  3791. # Unless iconv is explicitely disabled by the user, we still want to probe
  3792. # for the iconv from the libc.
  3793. disabled iconv || enable libc_iconv
  3794. disable_weak $EXTERNAL_AUTODETECT_LIBRARY_LIST
  3795. disable_weak $HWACCEL_AUTODETECT_LIBRARY_LIST
  3796. fi
  3797. # Mark specifically enabled, but normally autodetected libraries as requested.
  3798. for lib in $AUTODETECT_LIBS; do
  3799. enabled $lib && request $lib
  3800. done
  3801. #TODO: switch to $AUTODETECT_LIBS when $THREADS_LIST is supported the same way
  3802. enable_weak $EXTERNAL_AUTODETECT_LIBRARY_LIST
  3803. enable_weak $HWACCEL_AUTODETECT_LIBRARY_LIST
  3804. disabled logging && logfile=/dev/null
  3805. # command line configuration sanity checks
  3806. # we need to build at least one lib type
  3807. if ! enabled_any static shared; then
  3808. cat <<EOF
  3809. At least one library type must be built.
  3810. Specify --enable-static to build the static libraries or --enable-shared to
  3811. build the shared libraries as well. To only build the shared libraries specify
  3812. --disable-static in addition to --enable-shared.
  3813. EOF
  3814. exit 1
  3815. fi
  3816. die_license_disabled() {
  3817. enabled $1 || { enabled $v && die "$v is $1 and --enable-$1 is not specified."; }
  3818. }
  3819. die_license_disabled_gpl() {
  3820. enabled $1 || { enabled $v && die "$v is incompatible with the gpl and --enable-$1 is not specified."; }
  3821. }
  3822. map "die_license_disabled gpl" $EXTERNAL_LIBRARY_GPL_LIST $EXTERNAL_LIBRARY_GPLV3_LIST
  3823. map "die_license_disabled version3" $EXTERNAL_LIBRARY_VERSION3_LIST $EXTERNAL_LIBRARY_GPLV3_LIST
  3824. enabled gpl && map "die_license_disabled_gpl nonfree" $EXTERNAL_LIBRARY_NONFREE_LIST
  3825. map "die_license_disabled nonfree" $HWACCEL_LIBRARY_NONFREE_LIST
  3826. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  3827. if enabled nonfree; then
  3828. license="nonfree and unredistributable"
  3829. elif enabled gplv3; then
  3830. license="GPL version 3 or later"
  3831. elif enabled lgplv3; then
  3832. license="LGPL version 3 or later"
  3833. elif enabled gpl; then
  3834. license="GPL version 2 or later"
  3835. else
  3836. license="LGPL version 2.1 or later"
  3837. fi
  3838. enabled_all gnutls openssl &&
  3839. die "GnuTLS and OpenSSL must not be enabled at the same time."
  3840. enabled_all gnutls mbedtls &&
  3841. die "GnuTLS and mbedTLS must not be enabled at the same time."
  3842. enabled_all openssl mbedtls &&
  3843. die "OpenSSL and mbedTLS must not be enabled at the same time."
  3844. # Disable all the library-specific components if the library itself
  3845. # is disabled, see AVCODEC_LIST and following _LIST variables.
  3846. disable_components(){
  3847. disabled ${1} && disable $(
  3848. eval components="\$$(toupper ${1})_COMPONENTS"
  3849. map 'eval echo \${$(toupper ${v%s})_LIST}' $components
  3850. )
  3851. }
  3852. map 'disable_components $v' $LIBRARY_LIST
  3853. echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
  3854. set >> $logfile
  3855. test -n "$valgrind" && toolchain="valgrind-memcheck"
  3856. enabled ossfuzz && ! echo $CFLAGS | grep -q -- "-fsanitize=" && ! echo $CFLAGS | grep -q -- "-fcoverage-mapping" &&{
  3857. add_cflags -fsanitize=address,undefined -fsanitize-coverage=trace-pc-guard,trace-cmp -fno-omit-frame-pointer
  3858. add_ldflags -fsanitize=address,undefined -fsanitize-coverage=trace-pc-guard,trace-cmp
  3859. }
  3860. case "$toolchain" in
  3861. *-asan)
  3862. cc_default="${toolchain%-asan}"
  3863. add_cflags -fsanitize=address
  3864. add_ldflags -fsanitize=address
  3865. ;;
  3866. *-msan)
  3867. cc_default="${toolchain%-msan}"
  3868. add_cflags -fsanitize=memory -fsanitize-memory-track-origins
  3869. add_ldflags -fsanitize=memory
  3870. ;;
  3871. *-tsan)
  3872. cc_default="${toolchain%-tsan}"
  3873. add_cflags -fsanitize=thread
  3874. add_ldflags -fsanitize=thread
  3875. case "$toolchain" in
  3876. gcc-tsan)
  3877. add_cflags -fPIC
  3878. add_ldflags -fPIC
  3879. ;;
  3880. esac
  3881. ;;
  3882. *-usan)
  3883. cc_default="${toolchain%-usan}"
  3884. add_cflags -fsanitize=undefined
  3885. add_ldflags -fsanitize=undefined
  3886. ;;
  3887. valgrind-*)
  3888. target_exec_default="valgrind"
  3889. case "$toolchain" in
  3890. valgrind-massif)
  3891. 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"
  3892. ;;
  3893. valgrind-memcheck)
  3894. 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"
  3895. ;;
  3896. esac
  3897. ;;
  3898. msvc)
  3899. # Check whether the current MSVC version needs the C99 converter.
  3900. # From MSVC 2013 (compiler major version 18) onwards, it does actually
  3901. # support enough of C99 to build ffmpeg. Default to the new
  3902. # behaviour if the regexp was unable to match anything, since this
  3903. # successfully parses the version number of existing supported
  3904. # versions that require the converter (MSVC 2010 and 2012).
  3905. cl_major_ver=$(cl.exe 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
  3906. if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
  3907. cc_default="cl.exe"
  3908. cxx_default="cl.exe"
  3909. else
  3910. die "Unsupported MSVC version (2013 or newer required)"
  3911. fi
  3912. ld_default="$source_path/compat/windows/mslink"
  3913. nm_default="dumpbin.exe -symbols"
  3914. ar_default="lib.exe"
  3915. case "$arch" in
  3916. aarch64|arm64)
  3917. as_default="armasm64.exe"
  3918. ;;
  3919. arm*)
  3920. as_default="armasm.exe"
  3921. ;;
  3922. esac
  3923. target_os_default="win32"
  3924. # Use a relative path for TMPDIR. This makes sure all the
  3925. # ffconf temp files are written with a relative path, avoiding
  3926. # issues with msys/win32 path conversion for MSVC parameters
  3927. # such as -Fo<file> or -out:<file>.
  3928. TMPDIR=.
  3929. ;;
  3930. icl)
  3931. cc_default="icl"
  3932. ld_default="xilink"
  3933. nm_default="dumpbin -symbols"
  3934. ar_default="xilib"
  3935. target_os_default="win32"
  3936. TMPDIR=.
  3937. ;;
  3938. gcov)
  3939. add_cflags -fprofile-arcs -ftest-coverage
  3940. add_ldflags -fprofile-arcs -ftest-coverage
  3941. ;;
  3942. llvm-cov)
  3943. add_cflags -fprofile-arcs -ftest-coverage
  3944. add_ldflags --coverage
  3945. ;;
  3946. hardened)
  3947. add_cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
  3948. add_cflags -fno-strict-overflow -fstack-protector-all
  3949. add_ldflags -Wl,-z,relro -Wl,-z,now
  3950. add_cflags -fPIE
  3951. add_ldexeflags -fPIE -pie
  3952. ;;
  3953. ?*)
  3954. die "Unknown toolchain $toolchain"
  3955. ;;
  3956. esac
  3957. if test -n "$cross_prefix"; then
  3958. test -n "$arch" && test -n "$target_os" ||
  3959. die "Must specify target arch (--arch) and OS (--target-os) when cross-compiling"
  3960. enable cross_compile
  3961. fi
  3962. set_default target_os
  3963. if test "$target_os" = android; then
  3964. cc_default="clang"
  3965. fi
  3966. ar_default="${cross_prefix}${ar_default}"
  3967. cc_default="${cross_prefix}${cc_default}"
  3968. cxx_default="${cross_prefix}${cxx_default}"
  3969. nm_default="${cross_prefix}${nm_default}"
  3970. pkg_config_default="${cross_prefix}${pkg_config_default}"
  3971. if ${cross_prefix}${ranlib_default} 2>&1 | grep -q "\-D "; then
  3972. ranlib_default="${cross_prefix}${ranlib_default} -D"
  3973. else
  3974. ranlib_default="${cross_prefix}${ranlib_default}"
  3975. fi
  3976. strip_default="${cross_prefix}${strip_default}"
  3977. windres_default="${cross_prefix}${windres_default}"
  3978. sysinclude_default="${sysroot}/usr/include"
  3979. if enabled cuda_sdk; then
  3980. warn "Option --enable-cuda-sdk is deprecated. Use --enable-cuda-nvcc instead."
  3981. enable cuda_nvcc
  3982. fi
  3983. if enabled cuda_nvcc; then
  3984. nvcc_default="nvcc"
  3985. nvccflags_default="-gencode arch=compute_30,code=sm_30 -O2"
  3986. else
  3987. nvcc_default="clang"
  3988. nvccflags_default="--cuda-gpu-arch=sm_30 -O2"
  3989. NVCC_C=""
  3990. fi
  3991. set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \
  3992. target_exec x86asmexe nvcc
  3993. enabled cross_compile || host_cc_default=$cc
  3994. set_default host_cc
  3995. pkg_config_fail_message=""
  3996. if ! $pkg_config --version >/dev/null 2>&1; then
  3997. warn "$pkg_config not found, library detection may fail."
  3998. pkg_config=false
  3999. elif is_in -static $cc $LDFLAGS && ! is_in --static $pkg_config $pkg_config_flags; then
  4000. pkg_config_fail_message="
  4001. Note: When building a static binary, add --pkg-config-flags=\"--static\"."
  4002. fi
  4003. if test $doxygen != $doxygen_default && \
  4004. ! $doxygen --version >/dev/null 2>&1; then
  4005. warn "Specified doxygen \"$doxygen\" not found, API documentation will fail to build."
  4006. fi
  4007. exesuf() {
  4008. case $1 in
  4009. mingw32*|mingw64*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  4010. esac
  4011. }
  4012. EXESUF=$(exesuf $target_os)
  4013. HOSTEXESUF=$(exesuf $host_os)
  4014. # set temporary file name
  4015. : ${TMPDIR:=$TEMPDIR}
  4016. : ${TMPDIR:=$TMP}
  4017. : ${TMPDIR:=/tmp}
  4018. if [ -n "$tempprefix" ] ; then
  4019. mktemp(){
  4020. tmpname="$tempprefix.${HOSTNAME}.${UID}"
  4021. echo "$tmpname"
  4022. mkdir "$tmpname"
  4023. }
  4024. elif ! test_cmd mktemp -u XXXXXX; then
  4025. # simple replacement for missing mktemp
  4026. # NOT SAFE FOR GENERAL USE
  4027. mktemp(){
  4028. tmpname="${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  4029. echo "$tmpname"
  4030. mkdir "$tmpname"
  4031. }
  4032. fi
  4033. FFTMPDIR=$(mktemp -d "${TMPDIR}/ffconf.XXXXXXXX" 2> /dev/null) ||
  4034. die "Unable to create temporary directory in $TMPDIR."
  4035. tmpfile(){
  4036. tmp="${FFTMPDIR}/test"$2
  4037. (set -C; exec > $tmp) 2> /dev/null ||
  4038. die "Unable to create temporary file in $FFTMPDIR."
  4039. eval $1=$tmp
  4040. }
  4041. trap 'rm -rf -- "$FFTMPDIR"' EXIT
  4042. trap 'exit 2' INT
  4043. tmpfile TMPASM .asm
  4044. tmpfile TMPC .c
  4045. tmpfile TMPCPP .cpp
  4046. tmpfile TMPE $EXESUF
  4047. tmpfile TMPH .h
  4048. tmpfile TMPM .m
  4049. tmpfile TMPCU .cu
  4050. tmpfile TMPO .o
  4051. tmpfile TMPS .S
  4052. tmpfile TMPSH .sh
  4053. tmpfile TMPV .ver
  4054. unset -f mktemp
  4055. chmod +x $TMPE
  4056. # make sure we can execute files in $TMPDIR
  4057. cat > $TMPSH 2>> $logfile <<EOF
  4058. #! /bin/sh
  4059. EOF
  4060. chmod +x $TMPSH >> $logfile 2>&1
  4061. if ! $TMPSH >> $logfile 2>&1; then
  4062. cat <<EOF
  4063. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  4064. variable to another directory and make sure that it is not mounted noexec.
  4065. EOF
  4066. die "Sanity test failed."
  4067. fi
  4068. armasm_flags(){
  4069. for flag; do
  4070. case $flag in
  4071. # Filter out MSVC cl.exe options from cflags that shouldn't
  4072. # be passed to gas-preprocessor
  4073. -M[TD]*) ;;
  4074. *) echo $flag ;;
  4075. esac
  4076. done
  4077. }
  4078. cparser_flags(){
  4079. for flag; do
  4080. case $flag in
  4081. -Wno-switch) echo -Wno-switch-enum ;;
  4082. -Wno-format-zero-length) ;;
  4083. -Wdisabled-optimization) ;;
  4084. -Wno-pointer-sign) echo -Wno-other ;;
  4085. *) echo $flag ;;
  4086. esac
  4087. done
  4088. }
  4089. msvc_common_flags(){
  4090. for flag; do
  4091. case $flag in
  4092. # In addition to specifying certain flags under the compiler
  4093. # specific filters, they must be specified here as well or else the
  4094. # generic catch all at the bottom will print the original flag.
  4095. -Wall) ;;
  4096. -Wextra) ;;
  4097. -std=c*) ;;
  4098. # Common flags
  4099. -fomit-frame-pointer) ;;
  4100. -g) echo -Z7 ;;
  4101. -fno-math-errno) ;;
  4102. -fno-common) ;;
  4103. -fno-signed-zeros) ;;
  4104. -fPIC) ;;
  4105. -mthumb) ;;
  4106. -march=*) ;;
  4107. -lz) echo zlib.lib ;;
  4108. -lx264) echo libx264.lib ;;
  4109. -lstdc++) ;;
  4110. -l*) echo ${flag#-l}.lib ;;
  4111. -LARGEADDRESSAWARE) echo $flag ;;
  4112. -L*) echo -libpath:${flag#-L} ;;
  4113. -Wl,*) ;;
  4114. *) echo $flag ;;
  4115. esac
  4116. done
  4117. }
  4118. msvc_flags(){
  4119. msvc_common_flags "$@"
  4120. for flag; do
  4121. case $flag in
  4122. -Wall) echo -W3 -wd4018 -wd4146 -wd4244 -wd4305 \
  4123. -wd4554 ;;
  4124. -Wextra) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
  4125. -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
  4126. -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
  4127. -wd4307 \
  4128. -wd4273 -wd4554 -wd4701 -wd4703 ;;
  4129. esac
  4130. done
  4131. }
  4132. icl_flags(){
  4133. msvc_common_flags "$@"
  4134. for flag; do
  4135. case $flag in
  4136. # Despite what Intel's documentation says -Wall, which is supported
  4137. # on Windows, does enable remarks so disable them here.
  4138. -Wall) echo $flag -Qdiag-disable:remark ;;
  4139. -std=c99) echo -Qstd=c99 ;;
  4140. -flto) echo -ipo ;;
  4141. esac
  4142. done
  4143. }
  4144. icc_flags(){
  4145. for flag; do
  4146. case $flag in
  4147. -flto) echo -ipo ;;
  4148. *) echo $flag ;;
  4149. esac
  4150. done
  4151. }
  4152. suncc_flags(){
  4153. for flag; do
  4154. case $flag in
  4155. -march=*|-mcpu=*)
  4156. case "${flag#*=}" in
  4157. native) echo -xtarget=native ;;
  4158. v9|niagara) echo -xarch=sparc ;;
  4159. ultrasparc) echo -xarch=sparcvis ;;
  4160. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  4161. i586|pentium) echo -xchip=pentium ;;
  4162. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  4163. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  4164. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  4165. pentium4*) echo -xtarget=pentium4 ;;
  4166. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  4167. *-sse3) echo -xarch=sse3 ;;
  4168. core2) echo -xarch=ssse3 -xchip=core2 ;;
  4169. bonnell) echo -xarch=ssse3 ;;
  4170. corei7|nehalem) echo -xtarget=nehalem ;;
  4171. westmere) echo -xtarget=westmere ;;
  4172. silvermont) echo -xarch=sse4_2 ;;
  4173. corei7-avx|sandybridge) echo -xtarget=sandybridge ;;
  4174. core-avx*|ivybridge|haswell|broadwell|skylake*|knl)
  4175. echo -xarch=avx ;;
  4176. amdfam10|barcelona) echo -xtarget=barcelona ;;
  4177. btver1) echo -xarch=amdsse4a ;;
  4178. btver2|bdver*|znver*) echo -xarch=avx ;;
  4179. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  4180. k8|opteron|athlon64|athlon-fx)
  4181. echo -xarch=sse2a ;;
  4182. athlon*) echo -xarch=pentium_proa ;;
  4183. esac
  4184. ;;
  4185. -std=c99) echo -xc99 ;;
  4186. -fomit-frame-pointer) echo -xregs=frameptr ;;
  4187. -fPIC) echo -KPIC -xcode=pic32 ;;
  4188. -W*,*) echo $flag ;;
  4189. -f*-*|-W*|-mimpure-text) ;;
  4190. -shared) echo -G ;;
  4191. *) echo $flag ;;
  4192. esac
  4193. done
  4194. }
  4195. probe_cc(){
  4196. pfx=$1
  4197. _cc=$2
  4198. first=$3
  4199. unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
  4200. unset _ld_o _ldflags _ld_lib _ld_path
  4201. unset _depflags _DEPCMD _DEPFLAGS
  4202. _flags_filter=echo
  4203. if $_cc --version 2>&1 | grep -q '^GNU assembler'; then
  4204. true # no-op to avoid reading stdin in following checks
  4205. elif $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  4206. _type=llvm_gcc
  4207. gcc_extra_ver=$(expr "$($_cc --version 2>/dev/null | head -n1)" : '.*\((.*)\)')
  4208. _ident="llvm-gcc $($_cc -dumpversion 2>/dev/null) $gcc_extra_ver"
  4209. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  4210. _cflags_speed='-O3'
  4211. _cflags_size='-Os'
  4212. elif $_cc -v 2>&1 | grep -qi ^gcc; then
  4213. _type=gcc
  4214. gcc_version=$($_cc --version | head -n1)
  4215. gcc_basever=$($_cc -dumpversion)
  4216. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  4217. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  4218. _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  4219. case $gcc_basever in
  4220. 2) ;;
  4221. 2.*) ;;
  4222. *) _depflags='-MMD -MF $(@:.o=.d) -MT $@' ;;
  4223. esac
  4224. if [ "$first" = true ]; then
  4225. case $gcc_basever in
  4226. 4.2*)
  4227. warn "gcc 4.2 is outdated and may miscompile FFmpeg. Please use a newer compiler." ;;
  4228. esac
  4229. fi
  4230. _cflags_speed='-O3'
  4231. _cflags_size='-Os'
  4232. elif $_cc --version 2>/dev/null | grep -q ^icc; then
  4233. _type=icc
  4234. _ident=$($_cc --version | head -n1)
  4235. _depflags='-MMD'
  4236. _cflags_speed='-O3'
  4237. _cflags_size='-Os'
  4238. _cflags_noopt='-O1'
  4239. _flags_filter=icc_flags
  4240. elif $_cc -v 2>&1 | grep -q xlc; then
  4241. _type=xlc
  4242. _ident=$($_cc -qversion 2>/dev/null | head -n1)
  4243. _cflags_speed='-O5'
  4244. _cflags_size='-O5 -qcompact'
  4245. elif $_cc --vsn 2>/dev/null | grep -Eq "ARM (C/C\+\+ )?Compiler"; then
  4246. test -d "$sysroot" || die "No valid sysroot specified."
  4247. _type=armcc
  4248. _ident=$($_cc --vsn | grep -i build | head -n1 | sed 's/.*: //')
  4249. armcc_conf="$PWD/armcc.conf"
  4250. $_cc --arm_linux_configure \
  4251. --arm_linux_config_file="$armcc_conf" \
  4252. --configure_sysroot="$sysroot" \
  4253. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  4254. die "Error creating armcc configuration file."
  4255. $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  4256. _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
  4257. as_default="${cross_prefix}gcc"
  4258. _depflags='-MMD'
  4259. _cflags_speed='-O3'
  4260. _cflags_size='-Os'
  4261. elif $_cc -v 2>&1 | grep -q clang && ! $_cc -? > /dev/null 2>&1; then
  4262. _type=clang
  4263. _ident=$($_cc --version 2>/dev/null | head -n1)
  4264. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  4265. _cflags_speed='-O3'
  4266. _cflags_size='-Oz'
  4267. elif $_cc -V 2>&1 | grep -q Sun; then
  4268. _type=suncc
  4269. _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  4270. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  4271. _DEPFLAGS='-xM1 -xc99'
  4272. _ldflags='-std=c99'
  4273. _cflags_speed='-O5'
  4274. _cflags_size='-O5 -xspace'
  4275. _flags_filter=suncc_flags
  4276. elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  4277. _type=pathscale
  4278. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  4279. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  4280. _cflags_speed='-O2'
  4281. _cflags_size='-Os'
  4282. _flags_filter='filter_out -Wdisabled-optimization'
  4283. elif $_cc -v 2>&1 | grep -q Open64; then
  4284. _type=open64
  4285. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  4286. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  4287. _cflags_speed='-O2'
  4288. _cflags_size='-Os'
  4289. _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  4290. elif $_cc 2>&1 | grep -q 'Microsoft.*ARM.*Assembler'; then
  4291. _type=armasm
  4292. _ident=$($_cc | head -n1)
  4293. # 4509: "This form of conditional instruction is deprecated"
  4294. _flags="-nologo -ignore 4509"
  4295. _flags_filter=armasm_flags
  4296. elif $_cc 2>&1 | grep -q Intel; then
  4297. _type=icl
  4298. _ident=$($_cc 2>&1 | head -n1)
  4299. _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
  4300. # Not only is O3 broken on 13.x+ but it is slower on all previous
  4301. # versions (tested) as well.
  4302. _cflags_speed="-O2"
  4303. _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
  4304. if $_cc 2>&1 | grep -q Linker; then
  4305. _ld_o='-out:$@'
  4306. else
  4307. _ld_o='-Fe$@'
  4308. fi
  4309. _cc_o='-Fo$@'
  4310. _cc_e='-P'
  4311. _flags_filter=icl_flags
  4312. _ld_lib='lib%.a'
  4313. _ld_path='-libpath:'
  4314. # -Qdiag-error to make icl error when seeing certain unknown arguments
  4315. _flags='-nologo -Qdiag-error:4044,10157'
  4316. # -Qvec- -Qsimd- to prevent miscompilation, -GS, fp:precise for consistency
  4317. # with MSVC which enables it by default.
  4318. _cflags='-Qms0 -Qvec- -Qsimd- -GS -fp:precise'
  4319. disable stripping
  4320. elif $_cc -? 2>/dev/null | grep -q 'LLVM.*Linker'; then
  4321. # lld can emulate multiple different linkers; in ms link.exe mode,
  4322. # the -? parameter gives the help output which contains an identifyable
  4323. # string, while it gives an error in other modes.
  4324. _type=lld-link
  4325. # The link.exe mode doesn't have a switch for getting the version,
  4326. # but we can force it back to gnu mode and get the version from there.
  4327. _ident=$($_cc -flavor gnu --version 2>/dev/null)
  4328. _ld_o='-out:$@'
  4329. _flags_filter=msvc_flags
  4330. _ld_lib='lib%.a'
  4331. _ld_path='-libpath:'
  4332. elif $_cc -nologo- 2>&1 | grep -q Microsoft || { $_cc -v 2>&1 | grep -q clang && $_cc -? > /dev/null 2>&1; }; then
  4333. _type=msvc
  4334. if $_cc -nologo- 2>&1 | grep -q Microsoft; then
  4335. _ident=$($_cc 2>&1 | head -n1 | tr -d '\r')
  4336. else
  4337. _ident=$($_cc --version 2>/dev/null | head -n1 | tr -d '\r')
  4338. fi
  4339. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
  4340. _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
  4341. _cflags_speed="-O2"
  4342. _cflags_size="-O1"
  4343. _cflags_noopt="-O1"
  4344. if $_cc -nologo- 2>&1 | grep -q Linker; then
  4345. _ld_o='-out:$@'
  4346. else
  4347. _ld_o='-Fe$@'
  4348. fi
  4349. _cc_o='-Fo$@'
  4350. _cc_e='-P -Fi$@'
  4351. _flags_filter=msvc_flags
  4352. _ld_lib='lib%.a'
  4353. _ld_path='-libpath:'
  4354. _flags='-nologo'
  4355. disable stripping
  4356. elif $_cc --version 2>/dev/null | grep -q ^cparser; then
  4357. _type=cparser
  4358. _ident=$($_cc --version | head -n1)
  4359. _depflags='-MMD'
  4360. _cflags_speed='-O4'
  4361. _cflags_size='-O2'
  4362. _flags_filter=cparser_flags
  4363. fi
  4364. eval ${pfx}_type=\$_type
  4365. eval ${pfx}_ident=\$_ident
  4366. }
  4367. set_ccvars(){
  4368. eval ${1}_C=\${_cc_c-\${${1}_C}}
  4369. eval ${1}_E=\${_cc_e-\${${1}_E}}
  4370. eval ${1}_O=\${_cc_o-\${${1}_O}}
  4371. if [ -n "$_depflags" ]; then
  4372. eval ${1}_DEPFLAGS=\$_depflags
  4373. else
  4374. eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
  4375. eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
  4376. eval DEP${1}FLAGS=\$_flags
  4377. fi
  4378. }
  4379. probe_cc cc "$cc" "true"
  4380. cflags_filter=$_flags_filter
  4381. cflags_speed=$_cflags_speed
  4382. cflags_size=$_cflags_size
  4383. cflags_noopt=$_cflags_noopt
  4384. add_cflags $_flags $_cflags
  4385. cc_ldflags=$_ldflags
  4386. set_ccvars CC
  4387. set_ccvars CXX
  4388. probe_cc hostcc "$host_cc"
  4389. host_cflags_filter=$_flags_filter
  4390. host_cflags_speed=$_cflags_speed
  4391. add_host_cflags $_flags $_cflags
  4392. set_ccvars HOSTCC
  4393. test -n "$cc_type" && enable $cc_type ||
  4394. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  4395. : ${as_default:=$cc}
  4396. : ${objcc_default:=$cc}
  4397. : ${dep_cc_default:=$cc}
  4398. : ${ld_default:=$cc}
  4399. : ${host_ld_default:=$host_cc}
  4400. set_default ar as objcc dep_cc ld ln_s host_ld windres
  4401. probe_cc as "$as"
  4402. asflags_filter=$_flags_filter
  4403. add_asflags $_flags $_cflags
  4404. set_ccvars AS
  4405. probe_cc objcc "$objcc"
  4406. objcflags_filter=$_flags_filter
  4407. add_objcflags $_flags $_cflags
  4408. set_ccvars OBJC
  4409. probe_cc ld "$ld"
  4410. ldflags_filter=$_flags_filter
  4411. add_ldflags $_flags $_ldflags
  4412. test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
  4413. LD_O=${_ld_o-$LD_O}
  4414. LD_LIB=${_ld_lib-$LD_LIB}
  4415. LD_PATH=${_ld_path-$LD_PATH}
  4416. probe_cc hostld "$host_ld"
  4417. host_ldflags_filter=$_flags_filter
  4418. add_host_ldflags $_flags $_ldflags
  4419. HOSTLD_O=${_ld_o-$HOSTLD_O}
  4420. if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
  4421. probe_cc depcc "$dep_cc"
  4422. CCDEP=${_DEPCMD:-$DEPCMD}
  4423. CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
  4424. DEPCCFLAGS=$_flags
  4425. fi
  4426. if $ar 2>&1 | grep -q Microsoft; then
  4427. arflags="-nologo"
  4428. ar_o='-out:$@'
  4429. elif $ar 2>&1 | grep -q "\[D\] "; then
  4430. arflags="rcD"
  4431. ar_o='$@'
  4432. else
  4433. arflags="rc"
  4434. ar_o='$@'
  4435. fi
  4436. add_cflags $extra_cflags
  4437. add_cxxflags $extra_cxxflags
  4438. add_objcflags $extra_objcflags
  4439. add_asflags $extra_cflags
  4440. if test -n "$sysroot"; then
  4441. case "$cc_type" in
  4442. gcc|llvm_gcc|clang)
  4443. add_cppflags --sysroot="$sysroot"
  4444. add_ldflags --sysroot="$sysroot"
  4445. ;;
  4446. esac
  4447. fi
  4448. if test "$cpu" = host; then
  4449. enabled cross_compile &&
  4450. warn "--cpu=host makes no sense when cross-compiling."
  4451. case "$cc_type" in
  4452. gcc|llvm_gcc)
  4453. check_native(){
  4454. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  4455. sed -n "/cc1.*$1=/{
  4456. s/.*$1=\\([^ ]*\\).*/\\1/
  4457. p
  4458. q
  4459. }" $TMPE
  4460. }
  4461. cpu=$(check_native -march || check_native -mcpu)
  4462. ;;
  4463. clang)
  4464. check_native(){
  4465. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  4466. sed -n "/cc1.*-target-cpu /{
  4467. s/.*-target-cpu \\([^ ]*\\).*/\\1/
  4468. p
  4469. q
  4470. }" $TMPE
  4471. }
  4472. cpu=$(check_native -march)
  4473. ;;
  4474. esac
  4475. test "${cpu:-host}" = host &&
  4476. die "--cpu=host not supported with compiler $cc"
  4477. fi
  4478. # Deal with common $arch aliases
  4479. case "$arch" in
  4480. aarch64|arm64)
  4481. arch="aarch64"
  4482. ;;
  4483. arm*|iPad*|iPhone*)
  4484. arch="arm"
  4485. ;;
  4486. mips*|IP*)
  4487. case "$arch" in
  4488. *el)
  4489. add_cppflags -EL
  4490. add_ldflags -EL
  4491. ;;
  4492. *eb)
  4493. add_cppflags -EB
  4494. add_ldflags -EB
  4495. ;;
  4496. esac
  4497. arch="mips"
  4498. ;;
  4499. parisc*|hppa*)
  4500. arch="parisc"
  4501. ;;
  4502. "Power Macintosh"|ppc*|powerpc*)
  4503. arch="ppc"
  4504. ;;
  4505. s390|s390x)
  4506. arch="s390"
  4507. ;;
  4508. sh4|sh)
  4509. arch="sh4"
  4510. ;;
  4511. sun4*|sparc*)
  4512. arch="sparc"
  4513. ;;
  4514. tilegx|tile-gx)
  4515. arch="tilegx"
  4516. ;;
  4517. i[3-6]86*|i86pc|BePC|x86pc|x86_64|x86_32|amd64)
  4518. arch="x86"
  4519. ;;
  4520. esac
  4521. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  4522. enable $arch
  4523. # Add processor-specific flags
  4524. if enabled aarch64; then
  4525. case $cpu in
  4526. armv*)
  4527. cpuflags="-march=$cpu"
  4528. ;;
  4529. *)
  4530. cpuflags="-mcpu=$cpu"
  4531. ;;
  4532. esac
  4533. elif enabled alpha; then
  4534. cpuflags="-mcpu=$cpu"
  4535. elif enabled arm; then
  4536. check_arm_arch() {
  4537. test_cpp_condition stddef.h \
  4538. "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
  4539. $cpuflags
  4540. }
  4541. probe_arm_arch() {
  4542. if check_arm_arch 4; then echo armv4
  4543. elif check_arm_arch 4T; then echo armv4t
  4544. elif check_arm_arch 5; then echo armv5
  4545. elif check_arm_arch 5E; then echo armv5e
  4546. elif check_arm_arch 5T; then echo armv5t
  4547. elif check_arm_arch 5TE; then echo armv5te
  4548. elif check_arm_arch 5TEJ; then echo armv5te
  4549. elif check_arm_arch 6; then echo armv6
  4550. elif check_arm_arch 6J; then echo armv6j
  4551. elif check_arm_arch 6K; then echo armv6k
  4552. elif check_arm_arch 6Z; then echo armv6z
  4553. elif check_arm_arch 6KZ; then echo armv6zk
  4554. elif check_arm_arch 6ZK; then echo armv6zk
  4555. elif check_arm_arch 6T2; then echo armv6t2
  4556. elif check_arm_arch 7; then echo armv7
  4557. elif check_arm_arch 7A 7_A; then echo armv7-a
  4558. elif check_arm_arch 7S; then echo armv7-a
  4559. elif check_arm_arch 7R 7_R; then echo armv7-r
  4560. elif check_arm_arch 7M 7_M; then echo armv7-m
  4561. elif check_arm_arch 7EM 7E_M; then echo armv7-m
  4562. elif check_arm_arch 8A 8_A; then echo armv8-a
  4563. fi
  4564. }
  4565. [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
  4566. case $cpu in
  4567. armv*)
  4568. cpuflags="-march=$cpu"
  4569. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  4570. ;;
  4571. *)
  4572. cpuflags="-mcpu=$cpu"
  4573. case $cpu in
  4574. cortex-a*) subarch=armv7a ;;
  4575. cortex-r*) subarch=armv7r ;;
  4576. cortex-m*) enable thumb; subarch=armv7m ;;
  4577. arm11*) subarch=armv6 ;;
  4578. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  4579. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  4580. *) subarch=$(probe_arm_arch) ;;
  4581. esac
  4582. ;;
  4583. esac
  4584. case "$subarch" in
  4585. armv5t*) enable fast_clz ;;
  4586. armv[6-8]*)
  4587. enable fast_clz
  4588. disabled fast_unaligned || enable fast_unaligned
  4589. ;;
  4590. esac
  4591. elif enabled avr32; then
  4592. case $cpu in
  4593. ap7[02]0[0-2])
  4594. subarch="avr32_ap"
  4595. cpuflags="-mpart=$cpu"
  4596. ;;
  4597. ap)
  4598. subarch="avr32_ap"
  4599. cpuflags="-march=$cpu"
  4600. ;;
  4601. uc3[ab]*)
  4602. subarch="avr32_uc"
  4603. cpuflags="-mcpu=$cpu"
  4604. ;;
  4605. uc)
  4606. subarch="avr32_uc"
  4607. cpuflags="-march=$cpu"
  4608. ;;
  4609. esac
  4610. elif enabled bfin; then
  4611. cpuflags="-mcpu=$cpu"
  4612. elif enabled mips; then
  4613. cpuflags="-march=$cpu"
  4614. if [ "$cpu" != "generic" ]; then
  4615. disable mips32r2
  4616. disable mips32r5
  4617. disable mips64r2
  4618. disable mips32r6
  4619. disable mips64r6
  4620. disable loongson2
  4621. disable loongson3
  4622. case $cpu in
  4623. 24kc|24kf*|24kec|34kc|1004kc|24kef*|34kf*|1004kf*|74kc|74kf)
  4624. enable mips32r2
  4625. disable msa
  4626. ;;
  4627. p5600|i6400|p6600)
  4628. disable mipsdsp
  4629. disable mipsdspr2
  4630. ;;
  4631. loongson*)
  4632. enable loongson2
  4633. enable loongson3
  4634. enable local_aligned
  4635. enable simd_align_16
  4636. enable fast_64bit
  4637. enable fast_clz
  4638. enable fast_cmov
  4639. enable fast_unaligned
  4640. disable aligned_stack
  4641. disable mipsdsp
  4642. disable mipsdspr2
  4643. # When gcc version less than 5.3.0, add -fno-expensive-optimizations flag.
  4644. if [ $cc == gcc ]; then
  4645. gcc_version=$(gcc -dumpversion)
  4646. if [ "$(echo "$gcc_version 5.3.0" | tr " " "\n" | sort -rV | head -n 1)" == "$gcc_version" ]; then
  4647. expensive_optimization_flag=""
  4648. else
  4649. expensive_optimization_flag="-fno-expensive-optimizations"
  4650. fi
  4651. fi
  4652. case $cpu in
  4653. loongson3*)
  4654. cpuflags="-march=loongson3a -mhard-float $expensive_optimization_flag"
  4655. ;;
  4656. loongson2e)
  4657. cpuflags="-march=loongson2e -mhard-float $expensive_optimization_flag"
  4658. ;;
  4659. loongson2f)
  4660. cpuflags="-march=loongson2f -mhard-float $expensive_optimization_flag"
  4661. ;;
  4662. esac
  4663. ;;
  4664. *)
  4665. # Unknown CPU. Disable everything.
  4666. warn "unknown CPU. Disabling all MIPS optimizations."
  4667. disable mipsfpu
  4668. disable mipsdsp
  4669. disable mipsdspr2
  4670. disable msa
  4671. disable mmi
  4672. ;;
  4673. esac
  4674. case $cpu in
  4675. 24kc)
  4676. disable mipsfpu
  4677. disable mipsdsp
  4678. disable mipsdspr2
  4679. ;;
  4680. 24kf*)
  4681. disable mipsdsp
  4682. disable mipsdspr2
  4683. ;;
  4684. 24kec|34kc|1004kc)
  4685. disable mipsfpu
  4686. disable mipsdspr2
  4687. ;;
  4688. 24kef*|34kf*|1004kf*)
  4689. disable mipsdspr2
  4690. ;;
  4691. 74kc)
  4692. disable mipsfpu
  4693. ;;
  4694. p5600)
  4695. enable mips32r5
  4696. check_cflags "-mtune=p5600" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops"
  4697. ;;
  4698. i6400)
  4699. enable mips64r6
  4700. check_cflags "-mtune=i6400 -mabi=64" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
  4701. ;;
  4702. p6600)
  4703. enable mips64r6
  4704. check_cflags "-mtune=p6600 -mabi=64" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
  4705. ;;
  4706. esac
  4707. else
  4708. # We do not disable anything. Is up to the user to disable the unwanted features.
  4709. warn 'generic cpu selected'
  4710. fi
  4711. elif enabled ppc; then
  4712. disable ldbrx
  4713. case $(tolower $cpu) in
  4714. 601|ppc601|powerpc601)
  4715. cpuflags="-mcpu=601"
  4716. disable altivec
  4717. ;;
  4718. 603*|ppc603*|powerpc603*)
  4719. cpuflags="-mcpu=603"
  4720. disable altivec
  4721. ;;
  4722. 604*|ppc604*|powerpc604*)
  4723. cpuflags="-mcpu=604"
  4724. disable altivec
  4725. ;;
  4726. g3|75*|ppc75*|powerpc75*)
  4727. cpuflags="-mcpu=750"
  4728. disable altivec
  4729. ;;
  4730. g4|745*|ppc745*|powerpc745*)
  4731. cpuflags="-mcpu=7450"
  4732. disable vsx
  4733. ;;
  4734. 74*|ppc74*|powerpc74*)
  4735. cpuflags="-mcpu=7400"
  4736. disable vsx
  4737. ;;
  4738. g5|970|ppc970|powerpc970)
  4739. cpuflags="-mcpu=970"
  4740. disable vsx
  4741. ;;
  4742. power[3-6]*)
  4743. cpuflags="-mcpu=$cpu"
  4744. disable vsx
  4745. ;;
  4746. power[7-8]*)
  4747. cpuflags="-mcpu=$cpu"
  4748. ;;
  4749. cell)
  4750. cpuflags="-mcpu=cell"
  4751. enable ldbrx
  4752. disable vsx
  4753. ;;
  4754. e500mc)
  4755. cpuflags="-mcpu=e500mc"
  4756. disable altivec
  4757. ;;
  4758. e500v2)
  4759. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  4760. disable altivec
  4761. disable dcbzl
  4762. ;;
  4763. e500)
  4764. cpuflags="-mcpu=8540 -mhard-float"
  4765. disable altivec
  4766. disable dcbzl
  4767. ;;
  4768. esac
  4769. elif enabled sparc; then
  4770. case $cpu in
  4771. cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
  4772. cpuflags="-mcpu=$cpu"
  4773. ;;
  4774. ultrasparc*|niagara[234])
  4775. cpuflags="-mcpu=$cpu"
  4776. ;;
  4777. esac
  4778. elif enabled x86; then
  4779. case $cpu in
  4780. i[345]86|pentium)
  4781. cpuflags="-march=$cpu"
  4782. disable i686
  4783. disable mmx
  4784. ;;
  4785. # targets that do NOT support nopl and conditional mov (cmov)
  4786. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  4787. cpuflags="-march=$cpu"
  4788. disable i686
  4789. ;;
  4790. # targets that do support nopl and conditional mov (cmov)
  4791. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx\
  4792. |core*|atom|bonnell|nehalem|westmere|silvermont|sandybridge|ivybridge|haswell|broadwell|skylake*|knl\
  4793. |amdfam10|barcelona|b[dt]ver*|znver*)
  4794. cpuflags="-march=$cpu"
  4795. enable i686
  4796. enable fast_cmov
  4797. ;;
  4798. # targets that do support conditional mov but on which it's slow
  4799. pentium4|pentium4m|prescott|nocona)
  4800. cpuflags="-march=$cpu"
  4801. enable i686
  4802. disable fast_cmov
  4803. ;;
  4804. esac
  4805. fi
  4806. if [ "$cpu" != generic ]; then
  4807. add_cflags $cpuflags
  4808. add_asflags $cpuflags
  4809. test "$cc_type" = "$ld_type" && add_ldflags $cpuflags
  4810. fi
  4811. # compiler sanity check
  4812. test_exec <<EOF
  4813. int main(void){ return 0; }
  4814. EOF
  4815. if test "$?" != 0; then
  4816. echo "$cc is unable to create an executable file."
  4817. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  4818. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  4819. echo "Only do this if you know what cross compiling means."
  4820. fi
  4821. die "C compiler test failed."
  4822. fi
  4823. add_cppflags -D_ISOC99_SOURCE
  4824. add_cxxflags -D__STDC_CONSTANT_MACROS
  4825. check_cxxflags -std=c++11 || check_cxxflags -std=c++0x
  4826. # some compilers silently accept -std=c11, so we also need to check that the
  4827. # version macro is defined properly
  4828. test_cflags_cc -std=c11 ctype.h "__STDC_VERSION__ >= 201112L" &&
  4829. add_cflags -std=c11 ||
  4830. check_cflags -std=c99
  4831. check_cppflags -D_FILE_OFFSET_BITS=64
  4832. check_cppflags -D_LARGEFILE_SOURCE
  4833. add_host_cppflags -D_ISOC99_SOURCE
  4834. check_host_cflags -std=c99
  4835. check_host_cflags -Wall
  4836. check_host_cflags $host_cflags_speed
  4837. check_64bit(){
  4838. arch32=$1
  4839. arch64=$2
  4840. expr=${3:-'sizeof(void *) > 4'}
  4841. test_code cc "" "int test[2*($expr) - 1]" &&
  4842. subarch=$arch64 || subarch=$arch32
  4843. enable $subarch
  4844. }
  4845. case "$arch" in
  4846. aarch64|alpha|ia64)
  4847. enabled shared && enable_weak pic
  4848. ;;
  4849. mips)
  4850. check_64bit mips mips64 '_MIPS_SIM > 1'
  4851. enabled shared && enable_weak pic
  4852. ;;
  4853. parisc)
  4854. check_64bit parisc parisc64
  4855. enabled shared && enable_weak pic
  4856. ;;
  4857. ppc)
  4858. check_64bit ppc ppc64
  4859. enabled shared && enable_weak pic
  4860. ;;
  4861. s390)
  4862. check_64bit s390 s390x
  4863. enabled shared && enable_weak pic
  4864. ;;
  4865. sparc)
  4866. check_64bit sparc sparc64
  4867. enabled shared && enable_weak pic
  4868. ;;
  4869. x86)
  4870. check_64bit x86_32 x86_64
  4871. # Treat x32 as x64 for now. Note it also needs pic if shared
  4872. test "$subarch" = "x86_32" && test_cpp_condition stddef.h 'defined(__x86_64__)' &&
  4873. subarch=x86_64 && enable x86_64 && disable x86_32
  4874. if enabled x86_64; then
  4875. enabled shared && enable_weak pic
  4876. objformat=elf64
  4877. fi
  4878. ;;
  4879. esac
  4880. # OS specific
  4881. case $target_os in
  4882. aix)
  4883. SHFLAGS=-shared
  4884. add_cppflags '-I\$(SRC_PATH)/compat/aix'
  4885. enabled shared && add_ldflags -Wl,-brtl
  4886. arflags='-Xany -r -c'
  4887. striptype=""
  4888. ;;
  4889. android)
  4890. disable symver
  4891. enable section_data_rel_ro
  4892. add_cflags -fPIE
  4893. add_ldexeflags -fPIE -pie
  4894. SLIB_INSTALL_NAME='$(SLIBNAME)'
  4895. SLIB_INSTALL_LINKS=
  4896. SHFLAGS='-shared -Wl,-soname,$(SLIBNAME)'
  4897. ;;
  4898. haiku)
  4899. prefix_default="/boot/common"
  4900. network_extralibs="-lnetwork"
  4901. host_extralibs=
  4902. ;;
  4903. sunos)
  4904. SHFLAGS='-shared -Wl,-h,$$(@F)'
  4905. enabled x86 && append SHFLAGS -mimpure-text
  4906. network_extralibs="-lsocket -lnsl"
  4907. add_cppflags -D__EXTENSIONS__
  4908. # When using suncc to build, the Solaris linker will mark
  4909. # an executable with each instruction set encountered by
  4910. # the Solaris assembler. As our libraries contain their own
  4911. # guards for processor-specific code, instead suppress
  4912. # generation of the HWCAPS ELF section on Solaris x86 only.
  4913. enabled_all suncc x86 &&
  4914. echo "hwcap_1 = OVERRIDE;" > mapfile &&
  4915. add_ldflags -Wl,-M,mapfile
  4916. nm_default='nm -P -g'
  4917. striptype=""
  4918. version_script='-M'
  4919. VERSION_SCRIPT_POSTPROCESS_CMD='perl $(SRC_PATH)/compat/solaris/make_sunver.pl - $(OBJS)'
  4920. ;;
  4921. netbsd)
  4922. disable symver
  4923. oss_indev_extralibs="-lossaudio"
  4924. oss_outdev_extralibs="-lossaudio"
  4925. enabled gcc || check_ldflags -Wl,-zmuldefs
  4926. ;;
  4927. openbsd|bitrig)
  4928. disable symver
  4929. enable section_data_rel_ro
  4930. striptype=""
  4931. SHFLAGS='-shared'
  4932. SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
  4933. SLIB_INSTALL_LINKS=
  4934. oss_indev_extralibs="-lossaudio"
  4935. oss_outdev_extralibs="-lossaudio"
  4936. ;;
  4937. dragonfly)
  4938. disable symver
  4939. ;;
  4940. freebsd)
  4941. ;;
  4942. bsd/os)
  4943. add_extralibs -lpoll -lgnugetopt
  4944. strip="strip -d"
  4945. ;;
  4946. darwin)
  4947. enabled ppc && add_asflags -force_cpusubtype_ALL
  4948. install_name_dir_default='$(SHLIBDIR)'
  4949. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(INSTALL_NAME_DIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  4950. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  4951. strip="${strip} -x"
  4952. add_ldflags -Wl,-dynamic,-search_paths_first
  4953. check_cflags -Werror=partial-availability
  4954. SLIBSUF=".dylib"
  4955. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  4956. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  4957. enabled x86_64 && objformat="macho64" || objformat="macho32"
  4958. enabled_any pic shared x86_64 ||
  4959. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  4960. check_headers dispatch/dispatch.h &&
  4961. add_cppflags '-I\$(SRC_PATH)/compat/dispatch_semaphore'
  4962. if test -n "$sysroot"; then
  4963. is_in -isysroot $cc $CPPFLAGS $CFLAGS || check_cppflags -isysroot $sysroot
  4964. is_in -isysroot $ld $LDFLAGS || check_ldflags -isysroot $sysroot
  4965. fi
  4966. version_script='-exported_symbols_list'
  4967. VERSION_SCRIPT_POSTPROCESS_CMD='tr " " "\n" | sed -n /global:/,/local:/p | grep ";" | tr ";" "\n" | sed -E "s/(.+)/_\1/g" | sed -E "s/(.+[^*])$$$$/\1*/"'
  4968. # Workaround for Xcode 11 -fstack-check bug
  4969. if enabled clang; then
  4970. clang_version=$($cc -dumpversion)
  4971. test ${clang_version%%.*} -eq 11 && add_cflags -fno-stack-check
  4972. fi
  4973. ;;
  4974. msys*)
  4975. die "Native MSYS builds are discouraged, please use the MINGW environment."
  4976. ;;
  4977. mingw32*|mingw64*)
  4978. target_os=mingw32
  4979. LIBTARGET=i386
  4980. if enabled x86_64; then
  4981. LIBTARGET="i386:x86-64"
  4982. elif enabled arm; then
  4983. LIBTARGET="arm"
  4984. elif enabled aarch64; then
  4985. LIBTARGET="arm64"
  4986. fi
  4987. if enabled shared; then
  4988. # Cannot build both shared and static libs when using dllimport.
  4989. disable static
  4990. fi
  4991. enabled shared && ! enabled small && test_cmd $windres --version && enable gnu_windres
  4992. enabled x86_32 && check_ldflags -Wl,--large-address-aware
  4993. shlibdir_default="$bindir_default"
  4994. SLIBPREF=""
  4995. SLIBSUF=".dll"
  4996. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  4997. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  4998. if test_cmd lib.exe -list; then
  4999. SLIB_EXTRA_CMD=-'lib.exe -nologo -machine:$(LIBTARGET) -def:$$(@:$(SLIBSUF)=.def) -out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  5000. if enabled x86_64; then
  5001. LIBTARGET=x64
  5002. fi
  5003. else
  5004. SLIB_EXTRA_CMD=-'$(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
  5005. fi
  5006. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  5007. SLIB_INSTALL_LINKS=
  5008. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  5009. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  5010. 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)'
  5011. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--disable-auto-image-base $$(@:$(SLIBSUF)=.def)'
  5012. enabled x86_64 && objformat="win64" || objformat="win32"
  5013. dlltool="${cross_prefix}dlltool"
  5014. ranlib=:
  5015. enable dos_paths
  5016. check_ldflags -Wl,--nxcompat,--dynamicbase
  5017. # Lets work around some stupidity in binutils.
  5018. # ld will strip relocations from executables even though we need them
  5019. # for dynamicbase (ASLR). Using -pie does retain the reloc section
  5020. # however ld then forgets what the entry point should be (oops) so we
  5021. # have to manually (re)set it.
  5022. if enabled x86_32; then
  5023. disabled debug && add_ldexeflags -Wl,--pic-executable,-e,_mainCRTStartup
  5024. elif enabled x86_64; then
  5025. disabled debug && add_ldexeflags -Wl,--pic-executable,-e,mainCRTStartup
  5026. check_ldflags -Wl,--high-entropy-va # binutils 2.25
  5027. # Set image base >4GB for extra entropy with HEASLR
  5028. add_ldexeflags -Wl,--image-base,0x140000000
  5029. append SHFLAGS -Wl,--image-base,0x180000000
  5030. fi
  5031. ;;
  5032. win32|win64)
  5033. disable symver
  5034. if enabled shared; then
  5035. # Link to the import library instead of the normal static library
  5036. # for shared libs.
  5037. LD_LIB='%.lib'
  5038. # Cannot build both shared and static libs with MSVC or icl.
  5039. disable static
  5040. fi
  5041. enabled x86_32 && check_ldflags -LARGEADDRESSAWARE
  5042. shlibdir_default="$bindir_default"
  5043. SLIBPREF=""
  5044. SLIBSUF=".dll"
  5045. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  5046. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  5047. SLIB_CREATE_DEF_CMD='EXTERN_PREFIX="$(EXTERN_PREFIX)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
  5048. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  5049. SLIB_INSTALL_LINKS=
  5050. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  5051. SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  5052. SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  5053. enabled x86_64 && objformat="win64" || objformat="win32"
  5054. ranlib=:
  5055. enable dos_paths
  5056. ;;
  5057. cygwin*)
  5058. target_os=cygwin
  5059. shlibdir_default="$bindir_default"
  5060. SLIBPREF="cyg"
  5061. SLIBSUF=".dll"
  5062. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  5063. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  5064. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  5065. SLIB_INSTALL_LINKS=
  5066. SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
  5067. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
  5068. enabled x86_64 && objformat="win64" || objformat="win32"
  5069. enable dos_paths
  5070. enabled shared && ! enabled small && test_cmd $windres --version && enable gnu_windres
  5071. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  5072. ;;
  5073. *-dos|freedos|opendos)
  5074. network_extralibs="-lsocket"
  5075. objformat="coff"
  5076. enable dos_paths
  5077. ;;
  5078. linux)
  5079. enable section_data_rel_ro
  5080. enabled_any arm aarch64 && enable_weak linux_perf
  5081. ;;
  5082. irix*)
  5083. target_os=irix
  5084. ranlib="echo ignoring ranlib"
  5085. ;;
  5086. os/2*)
  5087. strip="lxlite -CS"
  5088. striptype=""
  5089. objformat="aout"
  5090. add_cppflags -D_GNU_SOURCE
  5091. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zhigh-mem -Zmap
  5092. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  5093. LIBSUF="_s.a"
  5094. SLIBPREF=""
  5095. SLIBSUF=".dll"
  5096. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  5097. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(FULLNAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  5098. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(FULLNAME).def; \
  5099. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(FULLNAME).def; \
  5100. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(FULLNAME).def; \
  5101. echo EXPORTS >> $(SUBDIR)$(FULLNAME).def; \
  5102. emxexp $(OBJS) >> $(SUBDIR)$(FULLNAME).def'
  5103. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(FULLNAME)_dll.a $(SUBDIR)$(FULLNAME).def; \
  5104. emximp -o $(SUBDIR)$(LIBPREF)$(FULLNAME)_dll.lib $(SUBDIR)$(FULLNAME).def;'
  5105. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  5106. SLIB_INSTALL_LINKS=
  5107. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(FULLNAME)_dll.a $(LIBPREF)$(FULLNAME)_dll.lib'
  5108. enable dos_paths
  5109. enable_weak os2threads
  5110. ;;
  5111. gnu/kfreebsd)
  5112. add_cppflags -D_BSD_SOURCE
  5113. ;;
  5114. gnu)
  5115. ;;
  5116. qnx)
  5117. add_cppflags -D_QNX_SOURCE
  5118. network_extralibs="-lsocket"
  5119. ;;
  5120. symbian)
  5121. SLIBSUF=".dll"
  5122. enable dos_paths
  5123. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  5124. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  5125. add_ldflags -Wl,--target1-abs,--no-undefined \
  5126. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  5127. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  5128. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  5129. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  5130. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  5131. ;;
  5132. minix)
  5133. ;;
  5134. none)
  5135. ;;
  5136. *)
  5137. die "Unknown OS '$target_os'."
  5138. ;;
  5139. esac
  5140. # test if creating links works
  5141. link_dest=$(mktemp -u $TMPDIR/dest_XXXXXXXX)
  5142. link_name=$(mktemp -u $TMPDIR/name_XXXXXXXX)
  5143. mkdir "$link_dest"
  5144. $ln_s "$link_dest" "$link_name"
  5145. touch "$link_dest/test_file"
  5146. if [ "$source_path" != "." ] && [ "$source_path" != "src" ] && ([ ! -d src ] || [ -L src ]) && [ -e "$link_name/test_file" ]; then
  5147. # create link to source path
  5148. [ -e src ] && rm src
  5149. $ln_s "$source_path" src
  5150. source_link=src
  5151. else
  5152. # creating directory links doesn't work
  5153. # fall back to using the full source path
  5154. source_link="$source_path"
  5155. fi
  5156. # cleanup
  5157. rm -r "$link_dest"
  5158. rm -r "$link_name"
  5159. # determine libc flavour
  5160. probe_libc(){
  5161. pfx=$1
  5162. pfx_no_=${pfx%_}
  5163. # uclibc defines __GLIBC__, so it needs to be checked before glibc.
  5164. if test_${pfx}cpp_condition features.h "defined __UCLIBC__"; then
  5165. eval ${pfx}libc_type=uclibc
  5166. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  5167. elif test_${pfx}cpp_condition features.h "defined __GLIBC__"; then
  5168. eval ${pfx}libc_type=glibc
  5169. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  5170. # MinGW headers can be installed on Cygwin, so check for newlib first.
  5171. elif test_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
  5172. eval ${pfx}libc_type=newlib
  5173. add_${pfx}cppflags -U__STRICT_ANSI__ -D_XOPEN_SOURCE=600
  5174. # MinGW64 is backwards compatible with MinGW32, so check for it first.
  5175. elif test_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then
  5176. eval ${pfx}libc_type=mingw64
  5177. if test_${pfx}cpp_condition _mingw.h "__MINGW64_VERSION_MAJOR < 3"; then
  5178. add_compat msvcrt/snprintf.o
  5179. add_cflags "-include $source_path/compat/msvcrt/snprintf.h"
  5180. fi
  5181. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  5182. eval test \$${pfx_no_}cc_type = "gcc" &&
  5183. add_${pfx}cppflags -D__printf__=__gnu_printf__
  5184. test_${pfx}cpp_condition windows.h "!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600" &&
  5185. add_${pfx}cppflags -D_WIN32_WINNT=0x0600
  5186. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  5187. elif test_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION" ||
  5188. test_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then
  5189. eval ${pfx}libc_type=mingw32
  5190. test_${pfx}cpp_condition _mingw.h "__MINGW32_MAJOR_VERSION > 3 || \
  5191. (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  5192. die "ERROR: MinGW32 runtime version must be >= 3.15."
  5193. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  5194. test_${pfx}cpp_condition _mingw.h "__MSVCRT_VERSION__ < 0x0700" &&
  5195. add_${pfx}cppflags -D__MSVCRT_VERSION__=0x0700
  5196. test_${pfx}cpp_condition windows.h "!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600" &&
  5197. add_${pfx}cppflags -D_WIN32_WINNT=0x0600
  5198. eval test \$${pfx_no_}cc_type = "gcc" &&
  5199. add_${pfx}cppflags -D__printf__=__gnu_printf__
  5200. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  5201. elif test_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then
  5202. eval ${pfx}libc_type=msvcrt
  5203. if test_${pfx}cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION < 14"; then
  5204. if [ "$pfx" = host_ ]; then
  5205. add_host_cppflags -Dsnprintf=_snprintf
  5206. else
  5207. add_compat strtod.o strtod=avpriv_strtod
  5208. add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
  5209. _snprintf=avpriv_snprintf \
  5210. vsnprintf=avpriv_vsnprintf
  5211. fi
  5212. fi
  5213. add_${pfx}cppflags -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS
  5214. # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
  5215. # 0x601 by default unless something else is set by the user.
  5216. # This can easily lead to us detecting functions only present
  5217. # in such new versions and producing binaries requiring windows 7.0.
  5218. # Therefore explicitly set the default to Vista unless the user has
  5219. # set something else on the command line.
  5220. # Don't do this if WINAPI_FAMILY is set and is set to a non-desktop
  5221. # family. For these cases, configure is free to use any functions
  5222. # found in the SDK headers by default. (Alternatively, we could force
  5223. # _WIN32_WINNT to 0x0602 in that case.)
  5224. test_${pfx}cpp_condition stdlib.h "defined(_WIN32_WINNT)" ||
  5225. { test_${pfx}cpp <<EOF && add_${pfx}cppflags -D_WIN32_WINNT=0x0600; }
  5226. #ifdef WINAPI_FAMILY
  5227. #include <winapifamily.h>
  5228. #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  5229. #error not desktop
  5230. #endif
  5231. #endif
  5232. EOF
  5233. if [ "$pfx" = "" ]; then
  5234. check_func strtoll || add_cflags -Dstrtoll=_strtoi64
  5235. check_func strtoull || add_cflags -Dstrtoull=_strtoui64
  5236. fi
  5237. elif test_${pfx}cpp_condition stddef.h "defined __KLIBC__"; then
  5238. eval ${pfx}libc_type=klibc
  5239. elif test_${pfx}cpp_condition sys/cdefs.h "defined __BIONIC__"; then
  5240. eval ${pfx}libc_type=bionic
  5241. elif test_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then
  5242. eval ${pfx}libc_type=solaris
  5243. add_${pfx}cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
  5244. elif test_${pfx}cpp_condition sys/version.h "defined __DJGPP__"; then
  5245. eval ${pfx}libc_type=djgpp
  5246. add_cppflags -U__STRICT_ANSI__
  5247. add_cflags "-include $source_path/compat/djgpp/math.h"
  5248. add_compat djgpp/math.o
  5249. fi
  5250. test_${pfx}cc <<EOF
  5251. #include <time.h>
  5252. void *v = localtime_r;
  5253. EOF
  5254. 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
  5255. #include <time.h>
  5256. void *v = localtime_r;
  5257. EOF
  5258. eval test -n "\${${pfx}libc_type}" && enable ${pfx}libc_${libc_type}
  5259. }
  5260. probe_libc
  5261. probe_libc host_
  5262. # hacks for compiler/libc/os combinations
  5263. case $libc_type in
  5264. bionic)
  5265. add_compat strtod.o strtod=avpriv_strtod
  5266. ;;
  5267. esac
  5268. check_compile_assert flt_lim "float.h limits.h" "DBL_MAX == (double)DBL_MAX" ||
  5269. add_cppflags '-I\$(SRC_PATH)/compat/float'
  5270. test_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic
  5271. set_default libdir
  5272. : ${shlibdir_default:="$libdir"}
  5273. : ${pkgconfigdir_default:="$libdir/pkgconfig"}
  5274. set_default $PATHS_LIST
  5275. set_default nm
  5276. disabled optimizations || enabled ossfuzz || check_cflags -fomit-frame-pointer
  5277. enable_weak_pic() {
  5278. disabled pic && return
  5279. enable pic
  5280. add_cppflags -DPIC
  5281. case "$target_os" in
  5282. mingw*|cygwin*|win*)
  5283. ;;
  5284. *)
  5285. add_cflags -fPIC
  5286. add_asflags -fPIC
  5287. ;;
  5288. esac
  5289. }
  5290. enabled pic && enable_weak_pic
  5291. test_cc <<EOF || die "Symbol mangling check failed."
  5292. int ff_extern;
  5293. EOF
  5294. sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  5295. extern_prefix=${sym%%ff_extern*}
  5296. ! disabled inline_asm && check_inline_asm inline_asm '"" ::'
  5297. for restrict_keyword in restrict __restrict__ __restrict ""; do
  5298. test_code cc "" "char * $restrict_keyword p" && break
  5299. done
  5300. check_cc pragma_deprecated "" '_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")'
  5301. # The global variable ensures the bits appear unchanged in the object file.
  5302. test_cc <<EOF || die "endian test failed"
  5303. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  5304. EOF
  5305. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  5306. check_cc const_nan math.h "struct { double d; } static const bar[] = { { NAN } }"
  5307. if ! enabled ppc64 || enabled bigendian; then
  5308. disable vsx
  5309. fi
  5310. check_gas() {
  5311. log "check_gas using '$as' as AS"
  5312. # :vararg is used on aarch64, arm and ppc altivec
  5313. check_as vararg "
  5314. .macro m n, y:vararg=0
  5315. \n: .int \y
  5316. .endm
  5317. m x" || return 1
  5318. # .altmacro is only used in arm asm
  5319. ! enabled arm || check_as gnu_as ".altmacro"
  5320. }
  5321. if enabled_any arm aarch64 || enabled_all ppc altivec && enabled asm; then
  5322. nogas=:
  5323. enabled_any arm aarch64 && nogas=die
  5324. enabled_all ppc altivec && [ $target_os_default != aix ] && nogas=warn
  5325. as_noop=-v
  5326. case $as_type in
  5327. arm*) gaspp_as_type=armasm; as_noop=-h ;;
  5328. gcc) gaspp_as_type=gas ;;
  5329. *) gaspp_as_type=$as_type ;;
  5330. esac
  5331. [ $target_os = "darwin" ] && gaspp_as_type="apple-$gaspp_as_type"
  5332. test "${as#*gas-preprocessor.pl}" != "$as" ||
  5333. test_cmd gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- ${as:=$cc} $as_noop &&
  5334. gas="${gas:=gas-preprocessor.pl} -arch $arch -as-type $gaspp_as_type -- ${as:=$cc}"
  5335. if ! check_gas ; then
  5336. as=${gas:=$as}
  5337. check_gas || \
  5338. $nogas "GNU assembler not found, install/update gas-preprocessor"
  5339. fi
  5340. check_as as_func ".func test
  5341. .endfunc"
  5342. fi
  5343. check_inline_asm inline_asm_labels '"1:\n"'
  5344. check_inline_asm inline_asm_nonlocal_labels '"Label:\n"'
  5345. if enabled aarch64; then
  5346. enabled armv8 && check_insn armv8 'prfm pldl1strm, [x0]'
  5347. # internal assembler in clang 3.3 does not support this instruction
  5348. enabled neon && check_insn neon 'ext v0.8B, v0.8B, v1.8B, #1'
  5349. enabled vfp && check_insn vfp 'fmadd d0, d0, d1, d2'
  5350. map 'enabled_any ${v}_external ${v}_inline || disable $v' $ARCH_EXT_LIST_ARM
  5351. elif enabled alpha; then
  5352. check_cflags -mieee
  5353. elif enabled arm; then
  5354. enabled msvc && check_cpp_condition thumb stddef.h "defined _M_ARMT"
  5355. test_cpp_condition stddef.h "defined __thumb__" && test_cc <<EOF && enable_weak thumb
  5356. float func(float a, float b){ return a+b; }
  5357. EOF
  5358. enabled thumb && check_cflags -mthumb || check_cflags -marm
  5359. if check_cpp_condition vfp_args stddef.h "defined __ARM_PCS_VFP"; then
  5360. :
  5361. elif check_cpp_condition vfp_args stddef.h "defined _M_ARM_FP && _M_ARM_FP >= 30"; then
  5362. :
  5363. elif ! test_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__" && [ $target_os != darwin ]; then
  5364. case "${cross_prefix:-$cc}" in
  5365. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  5366. *) check_ld "cc" vfp_args <<EOF && fpabi=vfp || fpabi=soft ;;
  5367. __asm__ (".eabi_attribute 28, 1");
  5368. int main(void) { return 0; }
  5369. EOF
  5370. esac
  5371. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  5372. fi
  5373. enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
  5374. enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
  5375. enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
  5376. enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
  5377. enabled vfp && check_insn vfp 'fadds s0, s0, s0'
  5378. enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
  5379. enabled setend && check_insn setend 'setend be'
  5380. [ $target_os = linux ] || [ $target_os = android ] ||
  5381. map 'enabled_any ${v}_external ${v}_inline || disable $v' \
  5382. $ARCH_EXT_LIST_ARM
  5383. check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
  5384. check_as as_arch_directive ".arch armv7-a"
  5385. check_as as_dn_directive "ra .dn d0.i16"
  5386. check_as as_fpu_directive ".fpu neon"
  5387. # llvm's integrated assembler supports .object_arch from llvm 3.5
  5388. [ "$objformat" = elf32 ] || [ "$objformat" = elf64 ] &&
  5389. check_as as_object_arch ".object_arch armv4"
  5390. # MS armasm fails to assemble our PIC constructs
  5391. [ $target_os != win32 ] && enabled_all armv6t2 shared !pic && enable_weak_pic
  5392. elif enabled mips; then
  5393. enabled loongson2 && check_inline_asm loongson2 '"dmult.g $8, $9, $10"'
  5394. enabled loongson3 && check_inline_asm loongson3 '"gsldxc1 $f0, 0($2, $3)"'
  5395. enabled mmi && check_inline_asm mmi '"punpcklhw $f0, $f0, $f0"'
  5396. # Enable minimum ISA based on selected options
  5397. if enabled mips64; then
  5398. enabled mips64r6 && check_inline_asm_flags mips64r6 '"dlsa $0, $0, $0, 1"' '-mips64r6'
  5399. enabled mips64r2 && check_inline_asm_flags mips64r2 '"dext $0, $0, 0, 1"' '-mips64r2'
  5400. disabled mips64r6 && disabled mips64r2 && check_inline_asm_flags mips64r1 '"daddi $0, $0, 0"' '-mips64'
  5401. else
  5402. enabled mips32r6 && check_inline_asm_flags mips32r6 '"aui $0, $0, 0"' '-mips32r6'
  5403. enabled mips32r5 && check_inline_asm_flags mips32r5 '"eretnc"' '-mips32r5'
  5404. enabled mips32r2 && check_inline_asm_flags mips32r2 '"ext $0, $0, 0, 1"' '-mips32r2'
  5405. disabled mips32r6 && disabled mips32r5 && disabled mips32r2 && check_inline_asm_flags mips32r1 '"addi $0, $0, 0"' '-mips32'
  5406. fi
  5407. enabled mipsfpu && check_inline_asm_flags mipsfpu '"cvt.d.l $f0, $f2"' '-mhard-float'
  5408. enabled mipsfpu && (enabled mips32r5 || enabled mips32r6 || enabled mips64r6) && check_inline_asm_flags mipsfpu '"cvt.d.l $f0, $f1"' '-mfp64'
  5409. enabled mipsfpu && enabled msa && check_inline_asm_flags msa '"addvi.b $w0, $w1, 1"' '-mmsa' && check_headers msa.h || disable msa
  5410. enabled mipsdsp && check_inline_asm_flags mipsdsp '"addu.qb $t0, $t1, $t2"' '-mdsp'
  5411. enabled mipsdspr2 && check_inline_asm_flags mipsdspr2 '"absq_s.qb $t0, $t1"' '-mdspr2'
  5412. enabled msa && enabled msa2 && check_inline_asm_flags msa2 '"nxbits.any.b $w0, $w0"' '-mmsa2' && check_headers msa2.h || disable msa2
  5413. if enabled bigendian && enabled msa; then
  5414. disable msa
  5415. fi
  5416. elif enabled parisc; then
  5417. if enabled gcc; then
  5418. case $($cc -dumpversion) in
  5419. 4.[3-9].*) check_cflags -fno-optimize-sibling-calls ;;
  5420. esac
  5421. fi
  5422. elif enabled ppc; then
  5423. enable local_aligned
  5424. check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  5425. check_inline_asm ibm_asm '"add 0, 0, 0"'
  5426. check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
  5427. check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  5428. if enabled altivec; then
  5429. check_cflags -maltivec -mabi=altivec
  5430. # check if our compiler supports Motorola AltiVec C API
  5431. check_cc altivec altivec.h "vector signed int v1 = (vector signed int) { 0 };
  5432. vector signed int v2 = (vector signed int) { 1 };
  5433. v1 = vec_add(v1, v2);"
  5434. enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
  5435. fi
  5436. if enabled vsx; then
  5437. check_cflags -mvsx &&
  5438. check_cc vsx altivec.h "int v[4] = { 0 };
  5439. vector signed int v1 = vec_vsx_ld(0, v);"
  5440. fi
  5441. if enabled power8; then
  5442. check_cpp_condition power8 "altivec.h" "defined(_ARCH_PWR8)"
  5443. fi
  5444. elif enabled x86; then
  5445. check_builtin rdtsc intrin.h "__rdtsc()"
  5446. check_builtin mm_empty mmintrin.h "_mm_empty()"
  5447. enable local_aligned
  5448. # check whether EBP is available on x86
  5449. # As 'i' is stored on the stack, this program will crash
  5450. # if the base pointer is used to access it because the
  5451. # base pointer is cleared in the inline assembly code.
  5452. check_exec_crash <<EOF && enable ebp_available
  5453. volatile int i=0;
  5454. __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
  5455. return i;
  5456. EOF
  5457. # check whether EBX is available on x86
  5458. check_inline_asm ebx_available '""::"b"(0)' &&
  5459. check_inline_asm ebx_available '"":::"%ebx"'
  5460. # check whether xmm clobbers are supported
  5461. check_inline_asm xmm_clobbers '"":::"%xmm0"'
  5462. check_inline_asm inline_asm_direct_symbol_refs '"movl '$extern_prefix'test, %eax"' ||
  5463. check_inline_asm inline_asm_direct_symbol_refs '"movl '$extern_prefix'test(%rip), %eax"'
  5464. # check whether binutils is new enough to compile SSSE3/MMXEXT
  5465. enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
  5466. enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
  5467. probe_x86asm(){
  5468. x86asmexe_probe=$1
  5469. if test_cmd $x86asmexe_probe -v; then
  5470. x86asmexe=$x86asmexe_probe
  5471. x86asm_type=nasm
  5472. x86asm_debug="-g -F dwarf"
  5473. X86ASMDEP=
  5474. X86ASM_DEPFLAGS='-MD $(@:.o=.d)'
  5475. elif test_cmd $x86asmexe_probe --version; then
  5476. x86asmexe=$x86asmexe_probe
  5477. x86asm_type=yasm
  5478. x86asm_debug="-g dwarf2"
  5479. X86ASMDEP='$(DEPX86ASM) $(X86ASMFLAGS) -M $(X86ASM_O) $< > $(@:.o=.d)'
  5480. X86ASM_DEPFLAGS=
  5481. fi
  5482. check_x86asm x86asm "movbe ecx, [5]"
  5483. }
  5484. if ! disabled_any asm mmx x86asm; then
  5485. disable x86asm
  5486. for program in $x86asmexe nasm yasm; do
  5487. probe_x86asm $program && break
  5488. done
  5489. disabled x86asm && die "nasm/yasm not found or too old. Use --disable-x86asm for a crippled build."
  5490. X86ASMFLAGS="-f $objformat"
  5491. enabled pic && append X86ASMFLAGS "-DPIC"
  5492. test -n "$extern_prefix" && append X86ASMFLAGS "-DPREFIX"
  5493. case "$objformat" in
  5494. elf*) enabled debug && append X86ASMFLAGS $x86asm_debug ;;
  5495. esac
  5496. enabled avx512 && check_x86asm avx512_external "vmovdqa32 [eax]{k1}{z}, zmm0"
  5497. enabled avx2 && check_x86asm avx2_external "vextracti128 xmm0, ymm0, 0"
  5498. enabled xop && check_x86asm xop_external "vpmacsdd xmm0, xmm1, xmm2, xmm3"
  5499. enabled fma4 && check_x86asm fma4_external "vfmaddps ymm0, ymm1, ymm2, ymm3"
  5500. check_x86asm cpunop "CPU amdnop"
  5501. fi
  5502. case "$cpu" in
  5503. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  5504. disable fast_clz
  5505. ;;
  5506. esac
  5507. fi
  5508. check_cc intrinsics_neon arm_neon.h "int16x8_t test = vdupq_n_s16(0)"
  5509. check_ldflags -Wl,--as-needed
  5510. check_ldflags -Wl,-z,noexecstack
  5511. if ! disabled network; then
  5512. check_func getaddrinfo $network_extralibs
  5513. check_func inet_aton $network_extralibs
  5514. check_type netdb.h "struct addrinfo"
  5515. check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
  5516. check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
  5517. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  5518. check_type poll.h "struct pollfd"
  5519. check_type netinet/sctp.h "struct sctp_event_subscribe"
  5520. check_struct "sys/socket.h" "struct msghdr" msg_flags
  5521. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  5522. check_type netinet/in.h "struct sockaddr_in6"
  5523. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  5524. check_type "sys/types.h sys/socket.h" socklen_t
  5525. # Prefer arpa/inet.h over winsock2
  5526. if check_headers arpa/inet.h ; then
  5527. check_func closesocket
  5528. elif check_headers winsock2.h ; then
  5529. check_func_headers winsock2.h closesocket -lws2 &&
  5530. network_extralibs="-lws2" ||
  5531. { check_func_headers winsock2.h closesocket -lws2_32 &&
  5532. network_extralibs="-lws2_32"; } || disable winsock2_h network
  5533. check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
  5534. check_type ws2tcpip.h socklen_t
  5535. check_type ws2tcpip.h "struct addrinfo"
  5536. check_type ws2tcpip.h "struct group_source_req"
  5537. check_type ws2tcpip.h "struct ip_mreq_source"
  5538. check_type ws2tcpip.h "struct ipv6_mreq"
  5539. check_type winsock2.h "struct pollfd"
  5540. check_struct winsock2.h "struct sockaddr" sa_len
  5541. check_type ws2tcpip.h "struct sockaddr_in6"
  5542. check_type ws2tcpip.h "struct sockaddr_storage"
  5543. else
  5544. disable network
  5545. fi
  5546. fi
  5547. check_builtin atomic_cas_ptr atomic.h "void **ptr; void *oldval, *newval; atomic_cas_ptr(ptr, oldval, newval)"
  5548. check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
  5549. check_builtin MemoryBarrier windows.h "MemoryBarrier()"
  5550. check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
  5551. check_builtin gmtime_r time.h "time_t *time; struct tm *tm; gmtime_r(time, tm)"
  5552. check_builtin localtime_r time.h "time_t *time; struct tm *tm; localtime_r(time, tm)"
  5553. check_builtin x264_csp_bgr "stdint.h x264.h" "X264_CSP_BGR"
  5554. case "$custom_allocator" in
  5555. jemalloc)
  5556. # jemalloc by default does not use a prefix
  5557. require libjemalloc jemalloc/jemalloc.h malloc -ljemalloc
  5558. ;;
  5559. tcmalloc)
  5560. require_pkg_config libtcmalloc libtcmalloc gperftools/tcmalloc.h tc_malloc
  5561. malloc_prefix=tc_
  5562. ;;
  5563. esac
  5564. check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
  5565. check_func ${malloc_prefix}memalign && enable memalign
  5566. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  5567. check_func access
  5568. check_func_headers stdlib.h arc4random
  5569. check_lib clock_gettime time.h clock_gettime || check_lib clock_gettime time.h clock_gettime -lrt
  5570. check_func fcntl
  5571. check_func fork
  5572. check_func gethrtime
  5573. check_func getopt
  5574. check_func getrusage
  5575. check_func gettimeofday
  5576. check_func isatty
  5577. check_func mkstemp
  5578. check_func mmap
  5579. check_func mprotect
  5580. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  5581. check_func_headers time.h nanosleep || check_lib nanosleep time.h nanosleep -lrt
  5582. check_func sched_getaffinity
  5583. check_func setrlimit
  5584. check_struct "sys/stat.h" "struct stat" st_mtim.tv_nsec -D_BSD_SOURCE
  5585. check_func strerror_r
  5586. check_func sysconf
  5587. check_func sysctl
  5588. check_func usleep
  5589. check_func_headers conio.h kbhit
  5590. check_func_headers io.h setmode
  5591. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  5592. check_func_headers mach/mach_time.h mach_absolute_time
  5593. check_func_headers stdlib.h getenv
  5594. check_func_headers sys/stat.h lstat
  5595. check_func_headers windows.h GetModuleHandle
  5596. check_func_headers windows.h GetProcessAffinityMask
  5597. check_func_headers windows.h GetProcessTimes
  5598. check_func_headers windows.h GetStdHandle
  5599. check_func_headers windows.h GetSystemTimeAsFileTime
  5600. check_func_headers windows.h LoadLibrary
  5601. check_func_headers windows.h MapViewOfFile
  5602. check_func_headers windows.h PeekNamedPipe
  5603. check_func_headers windows.h SetConsoleTextAttribute
  5604. check_func_headers windows.h SetConsoleCtrlHandler
  5605. check_func_headers windows.h SetDllDirectory
  5606. check_func_headers windows.h Sleep
  5607. check_func_headers windows.h VirtualAlloc
  5608. check_func_headers glob.h glob
  5609. enabled xlib &&
  5610. check_lib xlib "X11/Xlib.h X11/extensions/Xvlib.h" XvGetPortAttribute -lXv -lX11 -lXext
  5611. check_headers direct.h
  5612. check_headers dirent.h
  5613. check_headers dxgidebug.h
  5614. check_headers dxva.h
  5615. check_headers dxva2api.h -D_WIN32_WINNT=0x0600
  5616. check_headers io.h
  5617. check_headers linux/perf_event.h
  5618. check_headers libcrystalhd/libcrystalhd_if.h
  5619. check_headers malloc.h
  5620. check_headers mftransform.h
  5621. check_headers net/udplite.h
  5622. check_headers poll.h
  5623. check_headers sys/param.h
  5624. check_headers sys/resource.h
  5625. check_headers sys/select.h
  5626. check_headers sys/time.h
  5627. check_headers sys/un.h
  5628. check_headers termios.h
  5629. check_headers unistd.h
  5630. check_headers valgrind/valgrind.h
  5631. check_func_headers VideoToolbox/VTCompressionSession.h VTCompressionSessionPrepareToEncodeFrames -framework VideoToolbox
  5632. check_headers windows.h
  5633. check_headers X11/extensions/XvMClib.h
  5634. check_headers asm/types.h
  5635. # it seems there are versions of clang in some distros that try to use the
  5636. # gcc headers, which explodes for stdatomic
  5637. # so we also check that atomics actually work here
  5638. check_builtin stdatomic stdatomic.h "atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0); foo += bar"
  5639. check_lib advapi32 "windows.h" RegCloseKey -ladvapi32
  5640. check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom -lbcrypt &&
  5641. check_cpp_condition bcrypt bcrypt.h "defined BCRYPT_RNG_ALGORITHM"
  5642. check_lib ole32 "windows.h" CoTaskMemFree -lole32
  5643. check_lib shell32 "windows.h shellapi.h" CommandLineToArgvW -lshell32
  5644. check_lib psapi "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  5645. check_lib android android/native_window.h ANativeWindow_acquire -landroid
  5646. check_lib mediandk "stdint.h media/NdkImage.h" AImage_delete -lmediandk
  5647. check_lib camera2ndk "stdbool.h stdint.h camera/NdkCameraManager.h" ACameraManager_create -lcamera2ndk
  5648. enabled appkit && check_apple_framework AppKit
  5649. enabled audiotoolbox && check_apple_framework AudioToolbox
  5650. enabled avfoundation && check_apple_framework AVFoundation
  5651. enabled coreimage && check_apple_framework CoreImage
  5652. enabled videotoolbox && check_apple_framework VideoToolbox
  5653. check_apple_framework CoreFoundation
  5654. check_apple_framework CoreMedia
  5655. check_apple_framework CoreVideo
  5656. enabled avfoundation && {
  5657. disable coregraphics applicationservices
  5658. check_lib coregraphics CoreGraphics/CoreGraphics.h CGGetActiveDisplayList "-framework CoreGraphics" ||
  5659. check_lib applicationservices ApplicationServices/ApplicationServices.h CGGetActiveDisplayList "-framework ApplicationServices"; }
  5660. enabled videotoolbox && {
  5661. check_lib coreservices CoreServices/CoreServices.h UTGetOSTypeFromString "-framework CoreServices"
  5662. check_func_headers CoreMedia/CMFormatDescription.h kCMVideoCodecType_HEVC "-framework CoreMedia"
  5663. check_func_headers CoreVideo/CVPixelBuffer.h kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange "-framework CoreVideo"
  5664. check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ "-framework CoreVideo"
  5665. check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_ITU_R_2100_HLG "-framework CoreVideo"
  5666. check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_Linear "-framework CoreVideo"
  5667. }
  5668. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  5669. check_type "windows.h dxva.h" "DXVA_PicParams_HEVC" -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_CRT_BUILD_DESKTOP_APP=0
  5670. check_type "windows.h dxva.h" "DXVA_PicParams_VP9" -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_CRT_BUILD_DESKTOP_APP=0
  5671. check_type "windows.h d3d11.h" "ID3D11VideoDecoder"
  5672. check_type "windows.h d3d11.h" "ID3D11VideoContext"
  5673. check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602
  5674. check_func_headers mfapi.h MFCreateAlignedMemoryBuffer -lmfplat
  5675. check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC"
  5676. check_type "vdpau/vdpau.h" "VdpPictureInfoVP9"
  5677. if [ -z "$nvccflags" ]; then
  5678. nvccflags=$nvccflags_default
  5679. fi
  5680. if enabled x86_64 || enabled ppc64 || enabled aarch64; then
  5681. nvccflags="$nvccflags -m64"
  5682. else
  5683. nvccflags="$nvccflags -m32"
  5684. fi
  5685. if enabled cuda_nvcc; then
  5686. nvccflags="$nvccflags -ptx"
  5687. else
  5688. nvccflags="$nvccflags -S -nocudalib -nocudainc --cuda-device-only -include ${source_link}/compat/cuda/cuda_runtime.h"
  5689. check_nvcc cuda_llvm
  5690. fi
  5691. if ! disabled ffnvcodec; then
  5692. ffnv_hdr_list="ffnvcodec/nvEncodeAPI.h ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h ffnvcodec/dynlink_nvcuvid.h"
  5693. check_pkg_config ffnvcodec "ffnvcodec >= 9.1.23.1" "$ffnv_hdr_list" "" || \
  5694. check_pkg_config ffnvcodec "ffnvcodec >= 9.0.18.3 ffnvcodec < 9.1" "$ffnv_hdr_list" "" || \
  5695. check_pkg_config ffnvcodec "ffnvcodec >= 8.2.15.10 ffnvcodec < 8.3" "$ffnv_hdr_list" "" || \
  5696. check_pkg_config ffnvcodec "ffnvcodec >= 8.1.24.11 ffnvcodec < 8.2" "$ffnv_hdr_list" ""
  5697. fi
  5698. check_cpp_condition winrt windows.h "!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)"
  5699. if ! disabled w32threads && ! enabled pthreads; then
  5700. check_func_headers "windows.h process.h" _beginthreadex &&
  5701. check_type "windows.h" CONDITION_VARIABLE &&
  5702. check_type "windows.h" INIT_ONCE &&
  5703. enable w32threads || disable w32threads
  5704. if ! enabled w32threads && enabled winrt; then
  5705. check_func_headers "windows.h" CreateThread &&
  5706. enable w32threads || disable w32threads
  5707. fi
  5708. fi
  5709. # check for some common methods of building with pthread support
  5710. # do this before the optional library checks as some of them require pthreads
  5711. if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then
  5712. if check_lib pthreads pthread.h pthread_join -pthread &&
  5713. check_lib pthreads pthread.h pthread_create -pthread; then
  5714. add_cflags -pthread
  5715. elif check_lib pthreads pthread.h pthread_join -pthreads &&
  5716. check_lib pthreads pthread.h pthread_create -pthreads; then
  5717. add_cflags -pthreads
  5718. elif check_lib pthreads pthread.h pthread_join -ldl -pthread &&
  5719. check_lib pthreads pthread.h pthread_create -ldl -pthread; then
  5720. add_cflags -ldl -pthread
  5721. elif check_lib pthreads pthread.h pthread_join -lpthreadGC2 &&
  5722. check_lib pthreads pthread.h pthread_create -lpthreadGC2; then
  5723. :
  5724. elif check_lib pthreads pthread.h pthread_join -lpthread &&
  5725. check_lib pthreads pthread.h pthread_create -lpthread; then
  5726. :
  5727. elif check_func pthread_join && check_func pthread_create; then
  5728. enable pthreads
  5729. fi
  5730. check_cc pthreads "pthread.h" "static pthread_mutex_t atomic_lock = PTHREAD_MUTEX_INITIALIZER"
  5731. if enabled pthreads; then
  5732. check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); sem_timedwait(s,0); sem_destroy(s)" $pthreads_extralibs
  5733. check_func pthread_cancel $pthreads_extralibs
  5734. fi
  5735. fi
  5736. enabled zlib && { check_pkg_config zlib zlib "zlib.h" zlibVersion ||
  5737. check_lib zlib zlib.h zlibVersion -lz; }
  5738. enabled bzlib && check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2
  5739. enabled lzma && check_lib lzma lzma.h lzma_version_number -llzma
  5740. # On some systems dynamic loading requires no extra linker flags
  5741. check_lib libdl dlfcn.h "dlopen dlsym" || check_lib libdl dlfcn.h "dlopen dlsym" -ldl
  5742. check_lib libm math.h sin -lm
  5743. atan2f_args=2
  5744. copysign_args=2
  5745. hypot_args=2
  5746. ldexpf_args=2
  5747. powf_args=2
  5748. for func in $MATH_FUNCS; do
  5749. eval check_mathfunc $func \${${func}_args:-1} $libm_extralibs
  5750. done
  5751. for func in $COMPLEX_FUNCS; do
  5752. eval check_complexfunc $func \${${func}_args:-1}
  5753. done
  5754. # these are off by default, so fail if requested and not available
  5755. enabled avisynth && require_headers "avisynth/avisynth_c.h"
  5756. enabled cuda_nvcc && { check_nvcc cuda_nvcc || die "ERROR: failed checking for nvcc."; }
  5757. enabled chromaprint && require chromaprint chromaprint.h chromaprint_get_version -lchromaprint
  5758. enabled decklink && { require_headers DeckLinkAPI.h &&
  5759. { test_cpp_condition DeckLinkAPIVersion.h "BLACKMAGIC_DECKLINK_API_VERSION >= 0x0a090500" || die "ERROR: Decklink API version must be >= 10.9.5."; } }
  5760. enabled frei0r && require_headers "frei0r.h dlfcn.h"
  5761. enabled gmp && require gmp gmp.h mpz_export -lgmp
  5762. enabled gnutls && require_pkg_config gnutls gnutls gnutls/gnutls.h gnutls_global_init
  5763. enabled jni && { [ $target_os = "android" ] && check_headers jni.h && enabled pthreads || die "ERROR: jni not found"; }
  5764. enabled ladspa && require_headers "ladspa.h dlfcn.h"
  5765. enabled libaom && require_pkg_config libaom "aom >= 1.0.0" aom/aom_codec.h aom_codec_version
  5766. enabled libaribb24 && { check_pkg_config libaribb24 "aribb24 > 1.0.3" "aribb24/aribb24.h" arib_instance_new ||
  5767. { enabled gpl && require_pkg_config libaribb24 aribb24 "aribb24/aribb24.h" arib_instance_new; } ||
  5768. die "ERROR: libaribb24 requires version higher than 1.0.3 or --enable-gpl."; }
  5769. enabled lv2 && require_pkg_config lv2 lilv-0 "lilv/lilv.h" lilv_world_new
  5770. enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
  5771. enabled libass && require_pkg_config libass libass ass/ass.h ass_library_init
  5772. enabled libbluray && require_pkg_config libbluray libbluray libbluray/bluray.h bd_open
  5773. enabled libbs2b && require_pkg_config libbs2b libbs2b bs2b.h bs2b_open
  5774. enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 &&
  5775. { check_lib libcelt celt/celt.h celt_decoder_create_custom -lcelt0 ||
  5776. die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
  5777. enabled libcaca && require_pkg_config libcaca caca caca.h caca_create_canvas
  5778. enabled libcodec2 && require libcodec2 codec2/codec2.h codec2_create -lcodec2
  5779. enabled libdav1d && require_pkg_config libdav1d "dav1d >= 0.4.0" "dav1d/dav1d.h" dav1d_version
  5780. enabled libdavs2 && require_pkg_config libdavs2 "davs2 >= 1.6.0" davs2.h davs2_decoder_open
  5781. enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new
  5782. enabled libdrm && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion
  5783. enabled libfdk_aac && { check_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen ||
  5784. { require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac &&
  5785. warn "using libfdk without pkg-config"; } }
  5786. 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"
  5787. enabled libflite && require libflite "flite/flite.h" flite_init $flite_extralibs
  5788. enabled fontconfig && enable libfontconfig
  5789. enabled libfontconfig && require_pkg_config libfontconfig fontconfig "fontconfig/fontconfig.h" FcInit
  5790. enabled libfreetype && require_pkg_config libfreetype freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
  5791. enabled libfribidi && require_pkg_config libfribidi fribidi fribidi.h fribidi_version_info
  5792. enabled libglslang && require_cpp libglslang glslang/SPIRV/GlslangToSpv.h "glslang::TIntermediate*" -lglslang -lOSDependent -lHLSL -lOGLCompiler -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++
  5793. enabled libgme && { check_pkg_config libgme libgme gme/gme.h gme_new_emu ||
  5794. require libgme gme/gme.h gme_new_emu -lgme -lstdc++; }
  5795. enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
  5796. check_lib libgsm "${gsm_hdr}" gsm_create -lgsm && break;
  5797. done || die "ERROR: libgsm not found"; }
  5798. enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc $pthreads_extralibs
  5799. enabled libklvanc && require libklvanc libklvanc/vanc.h klvanc_context_create -lklvanc
  5800. enabled libkvazaar && require_pkg_config libkvazaar "kvazaar >= 0.8.1" kvazaar.h kvz_api_get
  5801. enabled liblensfun && require_pkg_config liblensfun lensfun lensfun.h lf_db_new
  5802. # While it may appear that require is being used as a pkg-config
  5803. # fallback for libmfx, it is actually being used to detect a different
  5804. # installation route altogether. If libmfx is installed via the Intel
  5805. # Media SDK or Intel Media Server Studio, these don't come with
  5806. # pkg-config support. Instead, users should make sure that the build
  5807. # can find the libraries and headers through other means.
  5808. enabled libmfx && { check_pkg_config libmfx libmfx "mfx/mfxvideo.h" MFXInit ||
  5809. { require libmfx "mfx/mfxvideo.h" MFXInit "-llibmfx $advapi32_extralibs" && warn "using libmfx without pkg-config"; } }
  5810. if enabled libmfx; then
  5811. check_cc MFX_CODEC_VP9 "mfx/mfxvp9.h mfx/mfxstructures.h" "MFX_CODEC_VP9"
  5812. fi
  5813. enabled libmodplug && require_pkg_config libmodplug libmodplug libmodplug/modplug.h ModPlug_Load
  5814. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame $libm_extralibs
  5815. enabled libmysofa && { check_pkg_config libmysofa libmysofa mysofa.h mysofa_neighborhood_init_withstepdefine ||
  5816. require libmysofa mysofa.h mysofa_neighborhood_init_withstepdefine -lmysofa $zlib_extralibs; }
  5817. enabled libnpp && { check_lib libnpp npp.h nppGetLibVersion -lnppig -lnppicc -lnppc -lnppidei ||
  5818. check_lib libnpp npp.h nppGetLibVersion -lnppi -lnppc -lnppidei ||
  5819. die "ERROR: libnpp not found"; }
  5820. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  5821. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  5822. enabled libopencv && { check_headers opencv2/core/core_c.h &&
  5823. { check_pkg_config libopencv opencv opencv2/core/core_c.h cvCreateImageHeader ||
  5824. require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
  5825. require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; }
  5826. enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion
  5827. enabled libopenjpeg && { check_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version ||
  5828. { require_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } }
  5829. enabled libopenmpt && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++"
  5830. enabled libopus && {
  5831. enabled libopus_decoder && {
  5832. require_pkg_config libopus opus opus_multistream.h opus_multistream_decoder_create
  5833. }
  5834. enabled libopus_encoder && {
  5835. require_pkg_config libopus opus opus_multistream.h opus_multistream_surround_encoder_create
  5836. }
  5837. }
  5838. enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new
  5839. enabled librabbitmq && require_pkg_config librabbitmq "librabbitmq >= 0.7.1" amqp.h amqp_new_connection
  5840. enabled librav1e && require_pkg_config librav1e "rav1e >= 0.1.0" rav1e.h rav1e_context_new
  5841. enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo
  5842. enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket
  5843. enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++"
  5844. enabled libshine && require_pkg_config libshine shine shine/layer3.h shine_encode_buffer
  5845. enabled libsmbclient && { check_pkg_config libsmbclient smbclient libsmbclient.h smbc_init ||
  5846. require libsmbclient libsmbclient.h smbc_init -lsmbclient; }
  5847. enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++
  5848. enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
  5849. enabled libssh && require_pkg_config libssh libssh libssh/sftp.h sftp_init
  5850. enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
  5851. enabled libsrt && require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket
  5852. enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow
  5853. enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate
  5854. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  5855. enabled libtls && require_pkg_config libtls libtls tls.h tls_configure
  5856. enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame &&
  5857. { check_lib libtwolame twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
  5858. die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; }
  5859. enabled libv4l2 && require_pkg_config libv4l2 libv4l2 libv4l2.h v4l2_ioctl
  5860. enabled libvidstab && require_pkg_config libvidstab "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit
  5861. enabled libvmaf && require_pkg_config libvmaf "libvmaf >= 1.3.9" libvmaf.h compute_vmaf
  5862. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  5863. enabled libvorbis && require_pkg_config libvorbis vorbis vorbis/codec.h vorbis_info_init &&
  5864. require_pkg_config libvorbisenc vorbisenc vorbis/vorbisenc.h vorbis_encode_init
  5865. enabled libvpx && {
  5866. enabled libvpx_vp8_decoder && {
  5867. check_pkg_config libvpx_vp8_decoder "vpx >= 1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx ||
  5868. 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"
  5869. }
  5870. enabled libvpx_vp8_encoder && {
  5871. check_pkg_config libvpx_vp8_encoder "vpx >= 1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx ||
  5872. 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"
  5873. }
  5874. enabled libvpx_vp9_decoder && {
  5875. check_pkg_config libvpx_vp9_decoder "vpx >= 1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx ||
  5876. 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"
  5877. }
  5878. enabled libvpx_vp9_encoder && {
  5879. check_pkg_config libvpx_vp9_encoder "vpx >= 1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx ||
  5880. 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"
  5881. }
  5882. if disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder; then
  5883. die "libvpx enabled but no supported decoders found"
  5884. fi
  5885. }
  5886. enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack
  5887. enabled libwebp && {
  5888. enabled libwebp_encoder && require_pkg_config libwebp "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion
  5889. enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
  5890. enabled libx264 && { check_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode ||
  5891. { require libx264 "stdint.h x264.h" x264_encoder_encode "-lx264 $pthreads_extralibs $libm_extralibs" &&
  5892. warn "using libx264 without pkg-config"; } } &&
  5893. require_cpp_condition libx264 x264.h "X264_BUILD >= 118" &&
  5894. check_cpp_condition libx262 x264.h "X264_MPEG2"
  5895. enabled libx265 && require_pkg_config libx265 x265 x265.h x265_api_get &&
  5896. require_cpp_condition libx265 x265.h "X265_BUILD >= 70"
  5897. enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"
  5898. enabled libxavs2 && require_pkg_config libxavs2 "xavs2 >= 1.3.0" "stdint.h xavs2.h" xavs2_api_get
  5899. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  5900. enabled libzimg && require_pkg_config libzimg "zimg >= 2.7.0" zimg.h zimg_get_api_version
  5901. enabled libzmq && require_pkg_config libzmq "libzmq >= 4.2.1" zmq.h zmq_ctx_new
  5902. enabled libzvbi && require_pkg_config libzvbi zvbi-0.2 libzvbi.h vbi_decoder_new &&
  5903. { test_cpp_condition libzvbi.h "VBI_VERSION_MAJOR > 0 || VBI_VERSION_MINOR > 2 || VBI_VERSION_MINOR == 2 && VBI_VERSION_MICRO >= 28" ||
  5904. enabled gpl || die "ERROR: libzvbi requires version 0.2.28 or --enable-gpl."; }
  5905. enabled libxml2 && require_pkg_config libxml2 libxml-2.0 libxml2/libxml/xmlversion.h xmlCheckVersion
  5906. enabled mbedtls && { check_pkg_config mbedtls mbedtls mbedtls/x509_crt.h mbedtls_x509_crt_init ||
  5907. check_pkg_config mbedtls mbedtls mbedtls/ssl.h mbedtls_ssl_init ||
  5908. check_lib mbedtls mbedtls/ssl.h mbedtls_ssl_init -lmbedtls -lmbedx509 -lmbedcrypto ||
  5909. die "ERROR: mbedTLS not found"; }
  5910. enabled mediacodec && { enabled jni || die "ERROR: mediacodec requires --enable-jni"; }
  5911. enabled mmal && { check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ||
  5912. { ! enabled cross_compile &&
  5913. add_cflags -isystem/opt/vc/include/ -isystem/opt/vc/include/interface/vmcs_host/linux -isystem/opt/vc/include/interface/vcos/pthreads -fgnu89-inline &&
  5914. add_ldflags -L/opt/vc/lib/ &&
  5915. check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host; } ||
  5916. die "ERROR: mmal not found" &&
  5917. check_func_headers interface/mmal/mmal.h "MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"; }
  5918. enabled openal && { { for al_extralibs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
  5919. check_lib openal 'AL/al.h' alGetError "${al_extralibs}" && break; done } ||
  5920. die "ERROR: openal not found"; } &&
  5921. { test_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
  5922. die "ERROR: openal must be installed and version must be 1.1 or compatible"; }
  5923. enabled opencl && { check_pkg_config opencl OpenCL CL/cl.h clEnqueueNDRangeKernel ||
  5924. check_lib opencl OpenCL/cl.h clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
  5925. check_lib opencl CL/cl.h clEnqueueNDRangeKernel -lOpenCL ||
  5926. die "ERROR: opencl not found"; } &&
  5927. { test_cpp_condition "OpenCL/cl.h" "defined(CL_VERSION_1_2)" ||
  5928. test_cpp_condition "CL/cl.h" "defined(CL_VERSION_1_2)" ||
  5929. die "ERROR: opencl must be installed and version must be 1.2 or compatible"; }
  5930. enabled opengl && { check_lib opengl GL/glx.h glXGetProcAddress "-lGL" ||
  5931. check_lib opengl windows.h wglGetProcAddress "-lopengl32 -lgdi32" ||
  5932. check_lib opengl OpenGL/gl3.h glGetError "-Wl,-framework,OpenGL" ||
  5933. check_lib opengl ES2/gl.h glGetError "-isysroot=${sysroot} -Wl,-framework,OpenGLES" ||
  5934. die "ERROR: opengl not found."
  5935. }
  5936. enabled omx_rpi && { test_code cc OMX_Core.h OMX_IndexConfigBrcmVideoRequestIFrame ||
  5937. { ! enabled cross_compile &&
  5938. add_cflags -isystem/opt/vc/include/IL &&
  5939. test_code cc OMX_Core.h OMX_IndexConfigBrcmVideoRequestIFrame; } ||
  5940. die "ERROR: OpenMAX IL headers from raspberrypi/firmware not found"; } &&
  5941. enable omx
  5942. enabled omx && require_headers OMX_Core.h
  5943. enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OPENSSL_init_ssl ||
  5944. check_pkg_config openssl openssl openssl/ssl.h SSL_library_init ||
  5945. check_lib openssl openssl/ssl.h OPENSSL_init_ssl -lssl -lcrypto ||
  5946. check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  5947. check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  5948. check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  5949. die "ERROR: openssl not found"; }
  5950. enabled pocketsphinx && require_pkg_config pocketsphinx pocketsphinx pocketsphinx/pocketsphinx.h ps_init
  5951. enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/rk_mpi.h mpp_create &&
  5952. require_pkg_config rockchip_mpp "rockchip_mpp >= 1.3.7" rockchip/rk_mpi.h mpp_create &&
  5953. { enabled libdrm ||
  5954. die "ERROR: rkmpp requires --enable-libdrm"; }
  5955. }
  5956. enabled vapoursynth && require_pkg_config vapoursynth "vapoursynth-script >= 42" VSScript.h vsscript_init
  5957. if enabled gcrypt; then
  5958. GCRYPT_CONFIG="${cross_prefix}libgcrypt-config"
  5959. if "${GCRYPT_CONFIG}" --version > /dev/null 2>&1; then
  5960. gcrypt_cflags=$("${GCRYPT_CONFIG}" --cflags)
  5961. gcrypt_extralibs=$("${GCRYPT_CONFIG}" --libs)
  5962. check_func_headers gcrypt.h gcry_mpi_new $gcrypt_cflags $gcrypt_extralibs ||
  5963. die "ERROR: gcrypt not found"
  5964. add_cflags $gcrypt_cflags
  5965. else
  5966. require gcrypt gcrypt.h gcry_mpi_new -lgcrypt
  5967. fi
  5968. fi
  5969. if enabled sdl2; then
  5970. SDL2_CONFIG="${cross_prefix}sdl2-config"
  5971. test_pkg_config sdl2 "sdl2 >= 2.0.1 sdl2 < 2.1.0" SDL_events.h SDL_PollEvent
  5972. if disabled sdl2 && "${SDL2_CONFIG}" --version > /dev/null 2>&1; then
  5973. sdl2_cflags=$("${SDL2_CONFIG}" --cflags)
  5974. sdl2_extralibs=$("${SDL2_CONFIG}" --libs)
  5975. test_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags &&
  5976. test_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags &&
  5977. check_func_headers SDL_events.h SDL_PollEvent $sdl2_extralibs $sdl2_cflags &&
  5978. enable sdl2
  5979. fi
  5980. if test $target_os = "mingw32"; then
  5981. sdl2_extralibs=$(filter_out '-mwindows' $sdl2_extralibs)
  5982. fi
  5983. fi
  5984. if enabled decklink; then
  5985. case $target_os in
  5986. mingw32*|mingw64*|win32|win64)
  5987. decklink_outdev_extralibs="$decklink_outdev_extralibs -lole32 -loleaut32"
  5988. decklink_indev_extralibs="$decklink_indev_extralibs -lole32 -loleaut32"
  5989. ;;
  5990. esac
  5991. fi
  5992. enabled securetransport &&
  5993. check_func SecIdentityCreate "-Wl,-framework,CoreFoundation -Wl,-framework,Security" &&
  5994. check_lib securetransport "Security/SecureTransport.h Security/Security.h" "SSLCreateContext" "-Wl,-framework,CoreFoundation -Wl,-framework,Security" ||
  5995. disable securetransport
  5996. enabled securetransport &&
  5997. check_func SecItemImport "-Wl,-framework,CoreFoundation -Wl,-framework,Security"
  5998. enabled schannel &&
  5999. check_func_headers "windows.h security.h" InitializeSecurityContext -DSECURITY_WIN32 -lsecur32 &&
  6000. test_cpp_condition winerror.h "defined(SEC_I_CONTEXT_EXPIRED)" &&
  6001. schannel_extralibs="-lsecur32" ||
  6002. disable schannel
  6003. makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo
  6004. enabled makeinfo \
  6005. && [ 0$(makeinfo --version | grep "texinfo" | sed 's/.*texinfo[^0-9]*\([0-9]*\)\..*/\1/') -ge 5 ] \
  6006. && enable makeinfo_html || disable makeinfo_html
  6007. disabled makeinfo_html && texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html
  6008. perl -v > /dev/null 2>&1 && enable perl || disable perl
  6009. pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
  6010. rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
  6011. # check V4L2 codecs available in the API
  6012. if enabled v4l2_m2m; then
  6013. check_headers linux/fb.h
  6014. check_headers linux/videodev2.h
  6015. test_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete
  6016. check_cc v4l2_m2m linux/videodev2.h "int i = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_M2M | V4L2_BUF_FLAG_LAST;"
  6017. check_cc vc1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VC1_ANNEX_G;"
  6018. check_cc mpeg1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG1;"
  6019. check_cc mpeg2_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG2;"
  6020. check_cc mpeg4_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG4;"
  6021. check_cc hevc_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_HEVC;"
  6022. check_cc h263_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_H263;"
  6023. check_cc h264_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_H264;"
  6024. check_cc vp8_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP8;"
  6025. check_cc vp9_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP9;"
  6026. fi
  6027. check_headers sys/videoio.h
  6028. test_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete
  6029. check_lib user32 "windows.h winuser.h" GetShellWindow -luser32
  6030. check_lib vfw32 "windows.h vfw.h" capCreateCaptureWindow -lvfw32
  6031. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  6032. # w32api 3.12 had it defined wrong
  6033. check_cpp_condition vfwcap_defines vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER"
  6034. check_type "dshow.h" IBaseFilter
  6035. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  6036. check_headers "dev/bktr/ioctl_meteor.h dev/bktr/ioctl_bt848.h" ||
  6037. check_headers "machine/ioctl_meteor.h machine/ioctl_bt848.h" ||
  6038. check_headers "dev/video/meteor/ioctl_meteor.h dev/video/bktr/ioctl_bt848.h" ||
  6039. check_headers "dev/ic/bt8xx.h"
  6040. if check_struct sys/soundcard.h audio_buf_info bytes; then
  6041. enable_sanitized sys/soundcard.h
  6042. else
  6043. test_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_sanitized sys/soundcard.h
  6044. #include <sys/soundcard.h>
  6045. audio_buf_info abc;
  6046. EOF
  6047. fi
  6048. enabled alsa && { check_pkg_config alsa alsa "alsa/asoundlib.h" snd_pcm_htimestamp ||
  6049. check_lib alsa alsa/asoundlib.h snd_pcm_htimestamp -lasound; }
  6050. enabled libjack &&
  6051. require_pkg_config libjack jack jack/jack.h jack_port_get_latency_range
  6052. enabled sndio && check_lib sndio sndio.h sio_open -lsndio
  6053. if enabled libcdio; then
  6054. check_pkg_config libcdio libcdio_paranoia "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open ||
  6055. check_pkg_config libcdio libcdio_paranoia "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open ||
  6056. check_lib libcdio "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  6057. check_lib libcdio "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  6058. die "ERROR: No usable libcdio/cdparanoia found"
  6059. fi
  6060. enabled libxcb && check_pkg_config libxcb "xcb >= 1.4" xcb/xcb.h xcb_connect ||
  6061. disable libxcb_shm libxcb_shape libxcb_xfixes
  6062. if enabled libxcb; then
  6063. enabled libxcb_shm && check_pkg_config libxcb_shm xcb-shm xcb/shm.h xcb_shm_attach
  6064. enabled libxcb_shape && check_pkg_config libxcb_shape xcb-shape xcb/shape.h xcb_shape_get_rectangles
  6065. enabled libxcb_xfixes && check_pkg_config libxcb_xfixes xcb-xfixes xcb/xfixes.h xcb_xfixes_get_cursor_image
  6066. fi
  6067. check_func_headers "windows.h" CreateDIBSection "$gdigrab_indev_extralibs"
  6068. # d3d11va requires linking directly to dxgi and d3d11 if not building for
  6069. # the desktop api partition
  6070. test_cpp <<EOF && enable uwp && d3d11va_extralibs="-ldxgi -ld3d11"
  6071. #ifdef WINAPI_FAMILY
  6072. #include <winapifamily.h>
  6073. #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  6074. #error desktop, not uwp
  6075. #else
  6076. // WINAPI_FAMILY_APP, WINAPI_FAMILY_PHONE_APP => UWP
  6077. #endif
  6078. #else
  6079. #error no family set
  6080. #endif
  6081. EOF
  6082. enabled vaapi &&
  6083. check_pkg_config vaapi "libva >= 0.35.0" "va/va.h" vaInitialize
  6084. if enabled vaapi; then
  6085. check_pkg_config vaapi_drm "libva-drm" "va/va_drm.h" vaGetDisplayDRM
  6086. if enabled xlib; then
  6087. check_pkg_config vaapi_x11 "libva-x11" "va/va_x11.h" vaGetDisplay
  6088. fi
  6089. check_cpp_condition vaapi_1 "va/va.h" "VA_CHECK_VERSION(1, 0, 0)"
  6090. check_type "va/va.h va/va_dec_hevc.h" "VAPictureParameterBufferHEVC"
  6091. check_struct "va/va.h" "VADecPictureParameterBufferVP9" bit_depth
  6092. check_type "va/va.h va/va_vpp.h" "VAProcFilterParameterBufferHDRToneMapping"
  6093. check_struct "va/va.h va/va_vpp.h" "VAProcPipelineCaps" rotation_flags
  6094. check_type "va/va.h va/va_enc_hevc.h" "VAEncPictureParameterBufferHEVC"
  6095. check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG"
  6096. check_type "va/va.h va/va_enc_vp8.h" "VAEncPictureParameterBufferVP8"
  6097. check_type "va/va.h va/va_enc_vp9.h" "VAEncPictureParameterBufferVP9"
  6098. fi
  6099. if enabled_all opencl libdrm ; then
  6100. check_type "CL/cl_intel.h" "clCreateImageFromFdINTEL_fn" &&
  6101. enable opencl_drm_beignet
  6102. check_func_headers "CL/cl_ext.h" clImportMemoryARM &&
  6103. enable opencl_drm_arm
  6104. fi
  6105. if enabled_all opencl vaapi ; then
  6106. if enabled opencl_drm_beignet ; then
  6107. enable opencl_vaapi_beignet
  6108. else
  6109. check_type "CL/cl.h CL/cl_va_api_media_sharing_intel.h" "clCreateFromVA_APIMediaSurfaceINTEL_fn" &&
  6110. enable opencl_vaapi_intel_media
  6111. fi
  6112. fi
  6113. if enabled_all opencl dxva2 ; then
  6114. check_type "CL/cl_dx9_media_sharing.h" cl_dx9_surface_info_khr &&
  6115. enable opencl_dxva2
  6116. fi
  6117. if enabled_all opencl d3d11va ; then
  6118. check_type "CL/cl_d3d11.h" clGetDeviceIDsFromD3D11KHR_fn &&
  6119. enable opencl_d3d11
  6120. fi
  6121. enabled vdpau &&
  6122. check_cpp_condition vdpau vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP"
  6123. enabled vdpau &&
  6124. check_lib vdpau_x11 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau -lX11
  6125. enabled crystalhd && check_lib crystalhd "stdint.h libcrystalhd/libcrystalhd_if.h" DtsCrystalHDVersion -lcrystalhd
  6126. enabled vulkan &&
  6127. require_pkg_config vulkan "vulkan >= 1.1.97" "vulkan/vulkan.h" vkCreateInstance
  6128. if enabled x86; then
  6129. case $target_os in
  6130. mingw32*|mingw64*|win32|win64|linux|cygwin*)
  6131. ;;
  6132. *)
  6133. disable ffnvcodec cuvid nvdec nvenc
  6134. ;;
  6135. esac
  6136. elif enabled_any aarch64 ppc64 && ! enabled bigendian; then
  6137. case $target_os in
  6138. linux)
  6139. ;;
  6140. *)
  6141. disable ffnvcodec cuvid nvdec nvenc
  6142. ;;
  6143. esac
  6144. else
  6145. disable ffnvcodec cuvid nvdec nvenc
  6146. fi
  6147. enabled ffnvcodec && enable cuda
  6148. enabled nvenc &&
  6149. test_cc -I$source_path <<EOF || disable nvenc
  6150. #include <ffnvcodec/nvEncodeAPI.h>
  6151. NV_ENCODE_API_FUNCTION_LIST flist;
  6152. void f(void) { struct { const GUID guid; } s[] = { { NV_ENC_PRESET_HQ_GUID } }; }
  6153. int main(void) { return 0; }
  6154. EOF
  6155. enabled amf &&
  6156. check_cpp_condition amf "AMF/core/Version.h" \
  6157. "(AMF_VERSION_MAJOR << 48 | AMF_VERSION_MINOR << 32 | AMF_VERSION_RELEASE << 16 | AMF_VERSION_BUILD_NUM) >= 0x0001000400090000"
  6158. # Funny iconv installations are not unusual, so check it after all flags have been set
  6159. if enabled libc_iconv; then
  6160. check_func_headers iconv.h iconv
  6161. elif enabled iconv; then
  6162. check_func_headers iconv.h iconv || check_lib iconv iconv.h iconv -liconv
  6163. fi
  6164. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  6165. # add some useful compiler flags if supported
  6166. check_cflags -Wdeclaration-after-statement
  6167. check_cflags -Wall
  6168. check_cflags -Wdisabled-optimization
  6169. check_cflags -Wpointer-arith
  6170. check_cflags -Wredundant-decls
  6171. check_cflags -Wwrite-strings
  6172. check_cflags -Wtype-limits
  6173. check_cflags -Wundef
  6174. check_cflags -Wmissing-prototypes
  6175. check_cflags -Wno-pointer-to-int-cast
  6176. check_cflags -Wstrict-prototypes
  6177. check_cflags -Wempty-body
  6178. if enabled extra_warnings; then
  6179. check_cflags -Wcast-qual
  6180. check_cflags -Wextra
  6181. check_cflags -Wpedantic
  6182. fi
  6183. check_disable_warning(){
  6184. warning_flag=-W${1#-Wno-}
  6185. test_cflags $unknown_warning_flags $warning_flag && add_cflags $1
  6186. }
  6187. test_cflags -Werror=unused-command-line-argument &&
  6188. append unknown_warning_flags "-Werror=unused-command-line-argument"
  6189. test_cflags -Werror=unknown-warning-option &&
  6190. append unknown_warning_flags "-Werror=unknown-warning-option"
  6191. check_disable_warning -Wno-parentheses
  6192. check_disable_warning -Wno-switch
  6193. check_disable_warning -Wno-format-zero-length
  6194. check_disable_warning -Wno-pointer-sign
  6195. check_disable_warning -Wno-unused-const-variable
  6196. check_disable_warning -Wno-bool-operation
  6197. check_disable_warning -Wno-char-subscripts
  6198. check_disable_warning_headers(){
  6199. warning_flag=-W${1#-Wno-}
  6200. test_cflags $warning_flag && add_cflags_headers $1
  6201. }
  6202. check_disable_warning_headers -Wno-deprecated-declarations
  6203. check_disable_warning_headers -Wno-unused-variable
  6204. test_cc <<EOF && enable blocks_extension
  6205. void (^block)(void);
  6206. EOF
  6207. # add some linker flags
  6208. check_ldflags -Wl,--warn-common
  6209. check_ldflags -Wl,-rpath-link=:libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
  6210. enabled rpath && add_ldexeflags -Wl,-rpath,$libdir && add_ldsoflags -Wl,-rpath,$libdir
  6211. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  6212. # add some strip flags
  6213. check_stripflags -x
  6214. enabled neon_clobber_test &&
  6215. check_ldflags -Wl,--wrap,avcodec_open2 \
  6216. -Wl,--wrap,avcodec_decode_audio4 \
  6217. -Wl,--wrap,avcodec_decode_video2 \
  6218. -Wl,--wrap,avcodec_decode_subtitle2 \
  6219. -Wl,--wrap,avcodec_encode_audio2 \
  6220. -Wl,--wrap,avcodec_encode_video2 \
  6221. -Wl,--wrap,avcodec_encode_subtitle \
  6222. -Wl,--wrap,avcodec_send_packet \
  6223. -Wl,--wrap,avcodec_receive_packet \
  6224. -Wl,--wrap,avcodec_send_frame \
  6225. -Wl,--wrap,avcodec_receive_frame \
  6226. -Wl,--wrap,swr_convert \
  6227. -Wl,--wrap,avresample_convert ||
  6228. disable neon_clobber_test
  6229. enabled xmm_clobber_test &&
  6230. check_ldflags -Wl,--wrap,avcodec_open2 \
  6231. -Wl,--wrap,avcodec_decode_audio4 \
  6232. -Wl,--wrap,avcodec_decode_video2 \
  6233. -Wl,--wrap,avcodec_decode_subtitle2 \
  6234. -Wl,--wrap,avcodec_encode_audio2 \
  6235. -Wl,--wrap,avcodec_encode_video2 \
  6236. -Wl,--wrap,avcodec_encode_subtitle \
  6237. -Wl,--wrap,avcodec_send_packet \
  6238. -Wl,--wrap,avcodec_receive_packet \
  6239. -Wl,--wrap,avcodec_send_frame \
  6240. -Wl,--wrap,avcodec_receive_frame \
  6241. -Wl,--wrap,swr_convert \
  6242. -Wl,--wrap,avresample_convert \
  6243. -Wl,--wrap,sws_scale ||
  6244. disable xmm_clobber_test
  6245. check_ld "cc" proper_dce <<EOF
  6246. extern const int array[512];
  6247. static inline int func(void) { return array[0]; }
  6248. int main(void) { return 0; }
  6249. EOF
  6250. if enabled proper_dce; then
  6251. echo "X { local: *; };" > $TMPV
  6252. if test_ldflags -Wl,${version_script},$TMPV; then
  6253. append SHFLAGS '-Wl,${version_script},\$(SUBDIR)lib\$(NAME).ver'
  6254. quotes='""'
  6255. test_cc <<EOF && enable symver_asm_label
  6256. void ff_foo(void) __asm__ ("av_foo@VERSION");
  6257. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  6258. EOF
  6259. test_cc <<EOF && enable symver_gnu_asm
  6260. __asm__(".symver ff_foo,av_foo@VERSION");
  6261. void ff_foo(void) {}
  6262. EOF
  6263. fi
  6264. fi
  6265. if [ -z "$optflags" ]; then
  6266. if enabled small; then
  6267. optflags=$cflags_size
  6268. elif enabled optimizations; then
  6269. optflags=$cflags_speed
  6270. else
  6271. optflags=$cflags_noopt
  6272. fi
  6273. fi
  6274. check_optflags(){
  6275. check_cflags "$@"
  6276. enabled lto && check_ldflags "$@"
  6277. }
  6278. check_optflags $optflags
  6279. check_optflags -fno-math-errno
  6280. check_optflags -fno-signed-zeros
  6281. if enabled lto; then
  6282. test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
  6283. check_cflags -flto
  6284. check_ldflags -flto $cpuflags
  6285. disable inline_asm_direct_symbol_refs
  6286. fi
  6287. enabled ftrapv && check_cflags -ftrapv
  6288. test_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
  6289. int x;
  6290. EOF
  6291. if enabled icc; then
  6292. # Just warnings, no remarks
  6293. check_cflags -w1
  6294. # -wd: Disable following warnings
  6295. # 144, 167, 556: -Wno-pointer-sign
  6296. # 188: enumerated type mixed with another type
  6297. # 1292: attribute "foo" ignored
  6298. # 1419: external declaration in primary source file
  6299. # 10006: ignoring unknown option -fno-signed-zeros
  6300. # 10148: ignoring unknown option -Wno-parentheses
  6301. # 10156: ignoring option '-W'; no argument required
  6302. # 13200: No EMMS instruction before call to function
  6303. # 13203: No EMMS instruction before return from function
  6304. check_cflags -wd144,167,188,556,1292,1419,10006,10148,10156,13200,13203
  6305. # 11030: Warning unknown option --as-needed
  6306. # 10156: ignoring option '-export'; no argument required
  6307. check_ldflags -wd10156,11030
  6308. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  6309. enable ebp_available
  6310. # The test above does not test linking
  6311. enabled lto && disable symver_asm_label
  6312. if enabled x86_32; then
  6313. icc_version=$($cc -dumpversion)
  6314. test ${icc_version%%.*} -ge 11 &&
  6315. check_cflags -falign-stack=maintain-16-byte ||
  6316. disable aligned_stack
  6317. fi
  6318. elif enabled gcc; then
  6319. check_optflags -fno-tree-vectorize
  6320. check_cflags -Werror=format-security
  6321. check_cflags -Werror=implicit-function-declaration
  6322. check_cflags -Werror=missing-prototypes
  6323. check_cflags -Werror=return-type
  6324. check_cflags -Werror=vla
  6325. check_cflags -Wformat
  6326. check_cflags -fdiagnostics-color=auto
  6327. enabled extra_warnings || check_disable_warning -Wno-maybe-uninitialized
  6328. if enabled x86_32; then
  6329. case $target_os in
  6330. *bsd*)
  6331. # BSDs don't guarantee a 16 byte aligned stack, but we can
  6332. # request GCC to try to maintain 16 byte alignment throughout
  6333. # function calls. Library entry points that might call assembly
  6334. # functions align the stack. (The parameter means 2^4 bytes.)
  6335. check_cflags -mpreferred-stack-boundary=4
  6336. ;;
  6337. esac
  6338. fi
  6339. elif enabled llvm_gcc; then
  6340. check_cflags -mllvm -stack-alignment=16
  6341. elif enabled clang; then
  6342. if enabled x86_32; then
  6343. # Clang doesn't support maintaining alignment without assuming the
  6344. # same alignment in every function. If 16 byte alignment would be
  6345. # enabled, one would also have to either add attribute_align_arg on
  6346. # every single entry point into the libraries or enable -mstackrealign
  6347. # (doing stack realignment in every single function).
  6348. case $target_os in
  6349. mingw32|win32|*bsd*)
  6350. disable aligned_stack
  6351. ;;
  6352. *)
  6353. check_cflags -mllvm -stack-alignment=16
  6354. check_cflags -mstack-alignment=16
  6355. ;;
  6356. esac
  6357. else
  6358. check_cflags -mllvm -stack-alignment=16
  6359. check_cflags -mstack-alignment=16
  6360. fi
  6361. check_cflags -Qunused-arguments
  6362. check_cflags -Werror=implicit-function-declaration
  6363. check_cflags -Werror=missing-prototypes
  6364. check_cflags -Werror=return-type
  6365. elif enabled cparser; then
  6366. add_cflags -Wno-missing-variable-declarations
  6367. add_cflags -Wno-empty-statement
  6368. elif enabled armcc; then
  6369. add_cflags -W${armcc_opt},--diag_suppress=4343 # hardfp compat
  6370. add_cflags -W${armcc_opt},--diag_suppress=3036 # using . as system include dir
  6371. # 2523: use of inline assembly is deprecated
  6372. add_cflags -W${armcc_opt},--diag_suppress=2523
  6373. add_cflags -W${armcc_opt},--diag_suppress=1207
  6374. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  6375. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  6376. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  6377. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  6378. elif enabled pathscale; then
  6379. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  6380. disable inline_asm
  6381. elif enabled_any msvc icl; then
  6382. enabled x86_32 && disable aligned_stack
  6383. enabled_all x86_32 debug && add_cflags -Oy-
  6384. enabled debug && add_ldflags -debug
  6385. enable pragma_deprecated
  6386. if enabled icl; then
  6387. # -Qansi-alias is basically -fstrict-aliasing, but does not work
  6388. # (correctly) on icl 13.x.
  6389. test_cpp_condition "windows.h" "__ICL < 1300 || __ICL >= 1400" &&
  6390. add_cflags -Qansi-alias
  6391. # Some inline asm is not compilable in debug
  6392. if enabled debug; then
  6393. disable ebp_available
  6394. disable ebx_available
  6395. fi
  6396. fi
  6397. # msvcrt10 x64 incorrectly enables log2, only msvcrt12 (MSVC 2013) onwards actually has log2.
  6398. check_cpp_condition log2 crtversion.h "_VC_CRT_MAJOR_VERSION >= 12"
  6399. # The CRT headers contain __declspec(restrict) in a few places, but if redefining
  6400. # restrict, this might break. MSVC 2010 and 2012 fail with __declspec(__restrict)
  6401. # (as it ends up if the restrict redefine is done before including stdlib.h), while
  6402. # MSVC 2013 and newer can handle it fine.
  6403. # If this declspec fails, force including stdlib.h before the restrict redefinition
  6404. # happens in config.h.
  6405. if [ $restrict_keyword != restrict ]; then
  6406. test_cc <<EOF || add_cflags -FIstdlib.h
  6407. __declspec($restrict_keyword) void *foo(int);
  6408. EOF
  6409. fi
  6410. # the new SSA optimzer in VS2015 U3 is mis-optimizing some parts of the code
  6411. # Issue has been fixed in MSVC v19.00.24218.
  6412. test_cpp_condition windows.h "_MSC_FULL_VER >= 190024218" ||
  6413. check_cflags -d2SSAOptimizer-
  6414. # enable utf-8 source processing on VS2015 U2 and newer
  6415. test_cpp_condition windows.h "_MSC_FULL_VER >= 190023918" &&
  6416. add_cflags -utf-8
  6417. fi
  6418. for pfx in "" host_; do
  6419. varname=${pfx%_}cc_type
  6420. eval "type=\$$varname"
  6421. if [ "$type" = "msvc" ]; then
  6422. test_${pfx}cc <<EOF || add_${pfx}cflags -Dinline=__inline
  6423. static inline int foo(int a) { return a; }
  6424. EOF
  6425. fi
  6426. done
  6427. case $as_type in
  6428. clang)
  6429. add_asflags -Qunused-arguments
  6430. ;;
  6431. esac
  6432. case $ld_type in
  6433. clang)
  6434. check_ldflags -Qunused-arguments
  6435. ;;
  6436. esac
  6437. enable frame_thread_encoder
  6438. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  6439. check_deps $CONFIG_LIST \
  6440. $CONFIG_EXTRA \
  6441. $HAVE_LIST \
  6442. $ALL_COMPONENTS \
  6443. 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"
  6444. enabled avresample && warn "Building with deprecated library libavresample"
  6445. case $target_os in
  6446. haiku)
  6447. disable memalign
  6448. disable posix_memalign
  6449. ;;
  6450. *-dos|freedos|opendos)
  6451. if test_cpp_condition sys/version.h "defined(__DJGPP__) && __DJGPP__ == 2 && __DJGPP_MINOR__ == 5"; then
  6452. disable memalign
  6453. fi
  6454. ;;
  6455. esac
  6456. flatten_extralibs(){
  6457. nested_entries=
  6458. list_name=$1
  6459. eval list=\$${1}
  6460. for entry in $list; do
  6461. entry_copy=$entry
  6462. resolve entry_copy
  6463. flat_entries=
  6464. for e in $entry_copy; do
  6465. case $e in
  6466. *_extralibs) nested_entries="$nested_entries$e ";;
  6467. *) flat_entries="$flat_entries$e ";;
  6468. esac
  6469. done
  6470. eval $entry="\$flat_entries"
  6471. done
  6472. append $list_name "$nested_entries"
  6473. resolve nested_entries
  6474. if test -n "$(filter '*_extralibs' $nested_entries)"; then
  6475. flatten_extralibs $list_name
  6476. fi
  6477. }
  6478. flatten_extralibs_wrapper(){
  6479. list_name=$1
  6480. flatten_extralibs $list_name
  6481. unique $list_name
  6482. resolve $list_name
  6483. eval $list_name=\$\(\$ldflags_filter \$$list_name\)
  6484. eval printf \''%s'\' \""\$$list_name"\"
  6485. }
  6486. for linkunit in $LIBRARY_LIST; do
  6487. unset current_extralibs
  6488. eval components=\$$(toupper ${linkunit})_COMPONENTS_LIST
  6489. for comp in ${components}; do
  6490. enabled $comp || continue
  6491. comp_extralibs="${comp}_extralibs"
  6492. append current_extralibs $comp_extralibs
  6493. done
  6494. eval prepend ${linkunit}_extralibs $current_extralibs
  6495. done
  6496. for linkunit in $LIBRARY_LIST $PROGRAM_LIST $EXTRALIBS_LIST; do
  6497. eval ${linkunit}_extralibs=\$\(flatten_extralibs_wrapper ${linkunit}_extralibs\)
  6498. done
  6499. map 'enabled $v && intrinsics=${v#intrinsics_}' $INTRINSICS_LIST
  6500. for thread in $THREADS_LIST; do
  6501. if enabled $thread; then
  6502. test -n "$thread_type" &&
  6503. die "ERROR: Only one thread type must be selected." ||
  6504. thread_type="$thread"
  6505. fi
  6506. done
  6507. if disabled stdatomic; then
  6508. if enabled atomics_gcc; then
  6509. add_cppflags '-I\$(SRC_PATH)/compat/atomics/gcc'
  6510. elif enabled atomics_win32; then
  6511. add_cppflags '-I\$(SRC_PATH)/compat/atomics/win32'
  6512. elif enabled atomics_suncc; then
  6513. add_cppflags '-I\$(SRC_PATH)/compat/atomics/suncc'
  6514. elif enabled pthreads; then
  6515. add_compat atomics/pthread/stdatomic.o
  6516. add_cppflags '-I\$(SRC_PATH)/compat/atomics/pthread'
  6517. else
  6518. enabled threads && die "Threading is enabled, but no atomics are available"
  6519. add_cppflags '-I\$(SRC_PATH)/compat/atomics/dummy'
  6520. fi
  6521. fi
  6522. # Check if requested libraries were found.
  6523. for lib in $AUTODETECT_LIBS; do
  6524. requested $lib && ! enabled $lib && die "ERROR: $lib requested but not found";
  6525. done
  6526. enabled zlib && add_cppflags -DZLIB_CONST
  6527. # conditional library dependencies, in any order
  6528. enabled afftdn_filter && prepend avfilter_deps "avcodec"
  6529. enabled afftfilt_filter && prepend avfilter_deps "avcodec"
  6530. enabled afir_filter && prepend avfilter_deps "avcodec"
  6531. enabled amovie_filter && prepend avfilter_deps "avformat avcodec"
  6532. enabled aresample_filter && prepend avfilter_deps "swresample"
  6533. enabled atempo_filter && prepend avfilter_deps "avcodec"
  6534. enabled bm3d_filter && prepend avfilter_deps "avcodec"
  6535. enabled cover_rect_filter && prepend avfilter_deps "avformat avcodec"
  6536. enabled convolve_filter && prepend avfilter_deps "avcodec"
  6537. enabled deconvolve_filter && prepend avfilter_deps "avcodec"
  6538. enabled ebur128_filter && enabled swresample && prepend avfilter_deps "swresample"
  6539. enabled elbg_filter && prepend avfilter_deps "avcodec"
  6540. enabled fftfilt_filter && prepend avfilter_deps "avcodec"
  6541. enabled find_rect_filter && prepend avfilter_deps "avformat avcodec"
  6542. enabled firequalizer_filter && prepend avfilter_deps "avcodec"
  6543. enabled mcdeint_filter && prepend avfilter_deps "avcodec"
  6544. enabled movie_filter && prepend avfilter_deps "avformat avcodec"
  6545. enabled pan_filter && prepend avfilter_deps "swresample"
  6546. enabled pp_filter && prepend avfilter_deps "postproc"
  6547. enabled removelogo_filter && prepend avfilter_deps "avformat avcodec swscale"
  6548. enabled resample_filter && prepend avfilter_deps "avresample"
  6549. enabled sab_filter && prepend avfilter_deps "swscale"
  6550. enabled scale_filter && prepend avfilter_deps "swscale"
  6551. enabled scale2ref_filter && prepend avfilter_deps "swscale"
  6552. enabled sofalizer_filter && prepend avfilter_deps "avcodec"
  6553. enabled showcqt_filter && prepend avfilter_deps "avformat avcodec swscale"
  6554. enabled showfreqs_filter && prepend avfilter_deps "avcodec"
  6555. enabled showspectrum_filter && prepend avfilter_deps "avcodec"
  6556. enabled signature_filter && prepend avfilter_deps "avcodec avformat"
  6557. enabled smartblur_filter && prepend avfilter_deps "swscale"
  6558. enabled spectrumsynth_filter && prepend avfilter_deps "avcodec"
  6559. enabled spp_filter && prepend avfilter_deps "avcodec"
  6560. enabled sr_filter && prepend avfilter_deps "avformat swscale"
  6561. enabled subtitles_filter && prepend avfilter_deps "avformat avcodec"
  6562. enabled uspp_filter && prepend avfilter_deps "avcodec"
  6563. enabled zoompan_filter && prepend avfilter_deps "swscale"
  6564. enabled lavfi_indev && prepend avdevice_deps "avfilter"
  6565. #FIXME
  6566. enabled_any sdl2_outdev opengl_outdev && enabled sdl2 &&
  6567. add_cflags $(filter_out '-Dmain=SDL_main' $sdl2_cflags)
  6568. enabled opus_decoder && prepend avcodec_deps "swresample"
  6569. # reorder the items at var $1 to align with the items order at var $2 .
  6570. # die if an item at $1 is not at $2 .
  6571. reorder_by(){
  6572. eval rb_in=\$$1
  6573. eval rb_ordered=\$$2
  6574. for rb in $rb_in; do
  6575. is_in $rb $rb_ordered || die "$rb at \$$1 is not at \$$2"
  6576. done
  6577. rb_out=
  6578. for rb in $rb_ordered; do
  6579. is_in $rb $rb_in && rb_out="$rb_out$rb "
  6580. done
  6581. eval $1=\$rb_out
  6582. }
  6583. # deps-expand fflib $1: N x {append all expanded deps; unique}
  6584. # within a set of N items, N expansions are enough to expose a cycle.
  6585. expand_deps(){
  6586. unique ${1}_deps # required for the early break test.
  6587. for dummy in $LIBRARY_LIST; do # N iteratios
  6588. eval deps=\$${1}_deps
  6589. append ${1}_deps $(map 'eval echo \$${v}_deps' $deps)
  6590. unique ${1}_deps
  6591. eval '[ ${#deps} = ${#'${1}_deps'} ]' && break # doesn't expand anymore
  6592. done
  6593. eval is_in $1 \$${1}_deps && die "Dependency cycle at ${1}_deps"
  6594. reorder_by ${1}_deps LIBRARY_LIST # linking order is expected later
  6595. }
  6596. #we have to remove gpl from the deps here as some code assumes all lib deps are libs
  6597. postproc_deps="$(filter_out 'gpl' $postproc_deps)"
  6598. map 'expand_deps $v' $LIBRARY_LIST
  6599. if test "$quiet" != "yes"; then
  6600. echo "install prefix $prefix"
  6601. echo "source path $source_path"
  6602. echo "C compiler $cc"
  6603. echo "C library $libc_type"
  6604. if test "$host_cc" != "$cc"; then
  6605. echo "host C compiler $host_cc"
  6606. echo "host C library $host_libc_type"
  6607. fi
  6608. echo "ARCH $arch ($cpu)"
  6609. if test "$build_suffix" != ""; then
  6610. echo "build suffix $build_suffix"
  6611. fi
  6612. if test "$progs_suffix" != ""; then
  6613. echo "progs suffix $progs_suffix"
  6614. fi
  6615. if test "$extra_version" != ""; then
  6616. echo "version string suffix $extra_version"
  6617. fi
  6618. echo "big-endian ${bigendian-no}"
  6619. echo "runtime cpu detection ${runtime_cpudetect-no}"
  6620. if enabled x86; then
  6621. echo "standalone assembly ${x86asm-no}"
  6622. echo "x86 assembler ${x86asmexe}"
  6623. echo "MMX enabled ${mmx-no}"
  6624. echo "MMXEXT enabled ${mmxext-no}"
  6625. echo "3DNow! enabled ${amd3dnow-no}"
  6626. echo "3DNow! extended enabled ${amd3dnowext-no}"
  6627. echo "SSE enabled ${sse-no}"
  6628. echo "SSSE3 enabled ${ssse3-no}"
  6629. echo "AESNI enabled ${aesni-no}"
  6630. echo "AVX enabled ${avx-no}"
  6631. echo "AVX2 enabled ${avx2-no}"
  6632. echo "AVX-512 enabled ${avx512-no}"
  6633. echo "XOP enabled ${xop-no}"
  6634. echo "FMA3 enabled ${fma3-no}"
  6635. echo "FMA4 enabled ${fma4-no}"
  6636. echo "i686 features enabled ${i686-no}"
  6637. echo "CMOV is fast ${fast_cmov-no}"
  6638. echo "EBX available ${ebx_available-no}"
  6639. echo "EBP available ${ebp_available-no}"
  6640. fi
  6641. if enabled aarch64; then
  6642. echo "NEON enabled ${neon-no}"
  6643. echo "VFP enabled ${vfp-no}"
  6644. fi
  6645. if enabled arm; then
  6646. echo "ARMv5TE enabled ${armv5te-no}"
  6647. echo "ARMv6 enabled ${armv6-no}"
  6648. echo "ARMv6T2 enabled ${armv6t2-no}"
  6649. echo "VFP enabled ${vfp-no}"
  6650. echo "NEON enabled ${neon-no}"
  6651. echo "THUMB enabled ${thumb-no}"
  6652. fi
  6653. if enabled mips; then
  6654. echo "MIPS FPU enabled ${mipsfpu-no}"
  6655. echo "MIPS DSP R1 enabled ${mipsdsp-no}"
  6656. echo "MIPS DSP R2 enabled ${mipsdspr2-no}"
  6657. echo "MIPS MSA enabled ${msa-no}"
  6658. echo "MIPS MSA2 enabled ${msa2-no}"
  6659. echo "LOONGSON MMI enabled ${mmi-no}"
  6660. fi
  6661. if enabled ppc; then
  6662. echo "AltiVec enabled ${altivec-no}"
  6663. echo "VSX enabled ${vsx-no}"
  6664. echo "POWER8 enabled ${power8-no}"
  6665. echo "PPC 4xx optimizations ${ppc4xx-no}"
  6666. echo "dcbzl available ${dcbzl-no}"
  6667. fi
  6668. echo "debug symbols ${debug-no}"
  6669. echo "strip symbols ${stripping-no}"
  6670. echo "optimize for size ${small-no}"
  6671. echo "optimizations ${optimizations-no}"
  6672. echo "static ${static-no}"
  6673. echo "shared ${shared-no}"
  6674. echo "postprocessing support ${postproc-no}"
  6675. echo "network support ${network-no}"
  6676. echo "threading support ${thread_type-no}"
  6677. echo "safe bitstream reader ${safe_bitstream_reader-no}"
  6678. echo "texi2html enabled ${texi2html-no}"
  6679. echo "perl enabled ${perl-no}"
  6680. echo "pod2man enabled ${pod2man-no}"
  6681. echo "makeinfo enabled ${makeinfo-no}"
  6682. echo "makeinfo supports HTML ${makeinfo_html-no}"
  6683. test -n "$random_seed" &&
  6684. echo "random seed ${random_seed}"
  6685. echo
  6686. echo "External libraries:"
  6687. print_enabled '' $EXTERNAL_LIBRARY_LIST $EXTERNAL_AUTODETECT_LIBRARY_LIST | print_in_columns
  6688. echo
  6689. echo "External libraries providing hardware acceleration:"
  6690. print_enabled '' $HWACCEL_LIBRARY_LIST $HWACCEL_AUTODETECT_LIBRARY_LIST | print_in_columns
  6691. echo
  6692. echo "Libraries:"
  6693. print_enabled '' $LIBRARY_LIST | print_in_columns
  6694. echo
  6695. echo "Programs:"
  6696. print_enabled '' $PROGRAM_LIST | print_in_columns
  6697. echo
  6698. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  6699. echo "Enabled ${type}s:"
  6700. eval list=\$$(toupper $type)_LIST
  6701. print_enabled '_*' $list | print_in_columns
  6702. echo
  6703. done
  6704. if test -n "$ignore_tests"; then
  6705. ignore_tests=$(echo $ignore_tests | tr ',' ' ')
  6706. echo "Ignored FATE tests:"
  6707. echo $ignore_tests | print_in_columns
  6708. echo
  6709. fi
  6710. echo "License: $license"
  6711. fi # test "$quiet" != "yes"
  6712. if test -n "$WARN_IF_GETS_DISABLED_LIST"; then
  6713. for cfg in $WARN_IF_GETS_DISABLED_LIST; do
  6714. if disabled $cfg; then
  6715. varname=${cfg}_disable_reason
  6716. eval "warn \"Disabled $cfg because \$$varname\""
  6717. fi
  6718. done
  6719. fi
  6720. if test -n "$WARNINGS"; then
  6721. printf "\n%s%s$WARNINGS%s" "$warn_color" "$bold_color" "$reset_color"
  6722. enabled fatal_warnings && exit 1
  6723. fi
  6724. test -e Makefile || echo "include $source_path/Makefile" > Makefile
  6725. esc(){
  6726. echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
  6727. }
  6728. echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $FFMPEG_CONFIGURATION)" > ffbuild/config.fate
  6729. enabled stripping || strip="echo skipping strip"
  6730. enabled stripping || striptype=""
  6731. config_files="$TMPH ffbuild/config.mak doc/config.texi"
  6732. cat > ffbuild/config.mak <<EOF
  6733. # Automatically generated by configure - do not modify!
  6734. ifndef FFMPEG_CONFIG_MAK
  6735. FFMPEG_CONFIG_MAK=1
  6736. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  6737. prefix=$prefix
  6738. LIBDIR=\$(DESTDIR)$libdir
  6739. SHLIBDIR=\$(DESTDIR)$shlibdir
  6740. INCDIR=\$(DESTDIR)$incdir
  6741. BINDIR=\$(DESTDIR)$bindir
  6742. DATADIR=\$(DESTDIR)$datadir
  6743. DOCDIR=\$(DESTDIR)$docdir
  6744. MANDIR=\$(DESTDIR)$mandir
  6745. PKGCONFIGDIR=\$(DESTDIR)$pkgconfigdir
  6746. INSTALL_NAME_DIR=$install_name_dir
  6747. SRC_PATH=$source_path
  6748. SRC_LINK=$source_link
  6749. ifndef MAIN_MAKEFILE
  6750. SRC_PATH:=\$(SRC_PATH:.%=..%)
  6751. endif
  6752. CC_IDENT=$cc_ident
  6753. ARCH=$arch
  6754. INTRINSICS=$intrinsics
  6755. EXTERN_PREFIX=$extern_prefix
  6756. CC=$cc
  6757. CXX=$cxx
  6758. AS=$as
  6759. OBJCC=$objcc
  6760. LD=$ld
  6761. DEPCC=$dep_cc
  6762. DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
  6763. DEPAS=$as
  6764. DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
  6765. X86ASM=$x86asmexe
  6766. DEPX86ASM=$x86asmexe
  6767. DEPX86ASMFLAGS=\$(X86ASMFLAGS)
  6768. AR=$ar
  6769. ARFLAGS=$arflags
  6770. AR_O=$ar_o
  6771. AR_CMD=$ar
  6772. NM_CMD=$nm
  6773. RANLIB=$ranlib
  6774. STRIP=$strip
  6775. STRIPTYPE=$striptype
  6776. NVCC=$nvcc
  6777. CP=cp -p
  6778. LN_S=$ln_s
  6779. CPPFLAGS=$CPPFLAGS
  6780. CFLAGS=$CFLAGS
  6781. CXXFLAGS=$CXXFLAGS
  6782. OBJCFLAGS=$OBJCFLAGS
  6783. ASFLAGS=$ASFLAGS
  6784. NVCCFLAGS=$nvccflags
  6785. AS_C=$AS_C
  6786. AS_O=$AS_O
  6787. OBJCC_C=$OBJCC_C
  6788. OBJCC_E=$OBJCC_E
  6789. OBJCC_O=$OBJCC_O
  6790. CC_C=$CC_C
  6791. CC_E=$CC_E
  6792. CC_O=$CC_O
  6793. CXX_C=$CXX_C
  6794. CXX_O=$CXX_O
  6795. NVCC_C=$NVCC_C
  6796. NVCC_O=$NVCC_O
  6797. LD_O=$LD_O
  6798. X86ASM_O=$X86ASM_O
  6799. LD_LIB=$LD_LIB
  6800. LD_PATH=$LD_PATH
  6801. DLLTOOL=$dlltool
  6802. WINDRES=$windres
  6803. DEPWINDRES=$dep_cc
  6804. DOXYGEN=$doxygen
  6805. LDFLAGS=$LDFLAGS
  6806. LDEXEFLAGS=$LDEXEFLAGS
  6807. LDSOFLAGS=$LDSOFLAGS
  6808. SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
  6809. ASMSTRIPFLAGS=$ASMSTRIPFLAGS
  6810. X86ASMFLAGS=$X86ASMFLAGS
  6811. BUILDSUF=$build_suffix
  6812. PROGSSUF=$progs_suffix
  6813. FULLNAME=$FULLNAME
  6814. LIBPREF=$LIBPREF
  6815. LIBSUF=$LIBSUF
  6816. LIBNAME=$LIBNAME
  6817. SLIBPREF=$SLIBPREF
  6818. SLIBSUF=$SLIBSUF
  6819. EXESUF=$EXESUF
  6820. EXTRA_VERSION=$extra_version
  6821. CCDEP=$CCDEP
  6822. CXXDEP=$CXXDEP
  6823. CCDEP_FLAGS=$CCDEP_FLAGS
  6824. ASDEP=$ASDEP
  6825. ASDEP_FLAGS=$ASDEP_FLAGS
  6826. X86ASMDEP=$X86ASMDEP
  6827. X86ASMDEP_FLAGS=$X86ASMDEP_FLAGS
  6828. CC_DEPFLAGS=$CC_DEPFLAGS
  6829. AS_DEPFLAGS=$AS_DEPFLAGS
  6830. X86ASM_DEPFLAGS=$X86ASM_DEPFLAGS
  6831. HOSTCC=$host_cc
  6832. HOSTLD=$host_ld
  6833. HOSTCFLAGS=$host_cflags
  6834. HOSTCPPFLAGS=$host_cppflags
  6835. HOSTEXESUF=$HOSTEXESUF
  6836. HOSTLDFLAGS=$host_ldflags
  6837. HOSTEXTRALIBS=$host_extralibs
  6838. DEPHOSTCC=$host_cc
  6839. DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
  6840. HOSTCCDEP=$HOSTCCDEP
  6841. HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
  6842. HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
  6843. HOSTCC_C=$HOSTCC_C
  6844. HOSTCC_O=$HOSTCC_O
  6845. HOSTLD_O=$HOSTLD_O
  6846. TARGET_EXEC=$target_exec $target_exec_args
  6847. TARGET_PATH=$target_path
  6848. TARGET_SAMPLES=${target_samples:-\$(SAMPLES)}
  6849. CFLAGS-ffplay=${sdl2_cflags}
  6850. CFLAGS_HEADERS=$CFLAGS_HEADERS
  6851. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  6852. EXTRALIBS=$extralibs
  6853. COMPAT_OBJS=$compat_objs
  6854. INSTALL=$install
  6855. LIBTARGET=${LIBTARGET}
  6856. SLIBNAME=${SLIBNAME}
  6857. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  6858. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  6859. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  6860. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  6861. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  6862. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  6863. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  6864. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  6865. VERSION_SCRIPT_POSTPROCESS_CMD=${VERSION_SCRIPT_POSTPROCESS_CMD}
  6866. SAMPLES:=${samples:-\$(FATE_SAMPLES)}
  6867. NOREDZONE_FLAGS=$noredzone_flags
  6868. LIBFUZZER_PATH=$libfuzzer_path
  6869. IGNORE_TESTS=$ignore_tests
  6870. EOF
  6871. map 'eval echo "${v}_FFLIBS=\$${v}_deps" >> ffbuild/config.mak' $LIBRARY_LIST
  6872. for entry in $LIBRARY_LIST $PROGRAM_LIST $EXTRALIBS_LIST; do
  6873. eval echo "EXTRALIBS-${entry}=\$${entry}_extralibs" >> ffbuild/config.mak
  6874. done
  6875. cat > $TMPH <<EOF
  6876. /* Automatically generated by configure - do not modify! */
  6877. #ifndef FFMPEG_CONFIG_H
  6878. #define FFMPEG_CONFIG_H
  6879. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  6880. #define FFMPEG_LICENSE "$(c_escape $license)"
  6881. #define CONFIG_THIS_YEAR 2020
  6882. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  6883. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  6884. #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
  6885. #define av_restrict $restrict_keyword
  6886. #define EXTERN_PREFIX "${extern_prefix}"
  6887. #define EXTERN_ASM ${extern_prefix}
  6888. #define BUILDSUF "$build_suffix"
  6889. #define SLIBSUF "$SLIBSUF"
  6890. #define HAVE_MMX2 HAVE_MMXEXT
  6891. #define SWS_MAX_FILTER_SIZE $sws_max_filter_size
  6892. EOF
  6893. test -n "$assert_level" &&
  6894. echo "#define ASSERT_LEVEL $assert_level" >>$TMPH
  6895. test -n "$malloc_prefix" &&
  6896. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  6897. if enabled x86asm; then
  6898. append config_files $TMPASM
  6899. cat > $TMPASM <<EOF
  6900. ; Automatically generated by configure - do not modify!
  6901. EOF
  6902. fi
  6903. enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
  6904. mkdir -p doc
  6905. mkdir -p tests
  6906. mkdir -p tests/api
  6907. echo "@c auto-generated by configure - do not modify! " > doc/config.texi
  6908. print_config ARCH_ "$config_files" $ARCH_LIST
  6909. print_config HAVE_ "$config_files" $HAVE_LIST
  6910. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  6911. $CONFIG_EXTRA \
  6912. $ALL_COMPONENTS \
  6913. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  6914. echo "endif # FFMPEG_CONFIG_MAK" >> ffbuild/config.mak
  6915. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  6916. cp_if_changed $TMPH config.h
  6917. touch ffbuild/.config
  6918. enabled x86asm && cp_if_changed $TMPASM config.asm
  6919. cat > $TMPH <<EOF
  6920. /* Generated by ffmpeg configure */
  6921. #ifndef AVUTIL_AVCONFIG_H
  6922. #define AVUTIL_AVCONFIG_H
  6923. EOF
  6924. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  6925. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  6926. cp_if_changed $TMPH libavutil/avconfig.h
  6927. # full_filter_name_foo=vf_foo
  6928. # full_filter_name_bar=asrc_bar
  6929. # ...
  6930. eval "$(sed -n "s/^extern AVFilter ff_\([avfsinkrc]\{2,5\}\)_\(.*\);/full_filter_name_\2=\1_\2/p" $source_path/libavfilter/allfilters.c)"
  6931. # generate the lists of enabled components
  6932. print_enabled_components(){
  6933. file=$1
  6934. struct_name=$2
  6935. name=$3
  6936. shift 3
  6937. echo "static const $struct_name * const $name[] = {" > $TMPH
  6938. for c in $*; do
  6939. if enabled $c; then
  6940. case $name in
  6941. filter_list)
  6942. eval c=\$full_filter_name_${c%_filter}
  6943. ;;
  6944. indev_list)
  6945. c=${c%_indev}_demuxer
  6946. ;;
  6947. outdev_list)
  6948. c=${c%_outdev}_muxer
  6949. ;;
  6950. esac
  6951. printf " &ff_%s,\n" $c >> $TMPH
  6952. fi
  6953. done
  6954. if [ "$name" = "filter_list" ]; then
  6955. for c in asrc_abuffer vsrc_buffer asink_abuffer vsink_buffer; do
  6956. printf " &ff_%s,\n" $c >> $TMPH
  6957. done
  6958. fi
  6959. echo " NULL };" >> $TMPH
  6960. cp_if_changed $TMPH $file
  6961. }
  6962. print_enabled_components libavfilter/filter_list.c AVFilter filter_list $FILTER_LIST
  6963. print_enabled_components libavcodec/codec_list.c AVCodec codec_list $CODEC_LIST
  6964. print_enabled_components libavcodec/parser_list.c AVCodecParser parser_list $PARSER_LIST
  6965. print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter bitstream_filters $BSF_LIST
  6966. print_enabled_components libavformat/demuxer_list.c AVInputFormat demuxer_list $DEMUXER_LIST
  6967. print_enabled_components libavformat/muxer_list.c AVOutputFormat muxer_list $MUXER_LIST
  6968. print_enabled_components libavdevice/indev_list.c AVInputFormat indev_list $INDEV_LIST
  6969. print_enabled_components libavdevice/outdev_list.c AVOutputFormat outdev_list $OUTDEV_LIST
  6970. print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $PROTOCOL_LIST
  6971. # Settings for pkg-config files
  6972. cat > $TMPH <<EOF
  6973. # Automatically generated by configure - do not modify!
  6974. shared=$shared
  6975. build_suffix=$build_suffix
  6976. prefix=$prefix
  6977. libdir=$libdir
  6978. incdir=$incdir
  6979. rpath=$(enabled rpath && echo "-Wl,-rpath,\${libdir}")
  6980. source_path=${source_path}
  6981. LIBPREF=${LIBPREF}
  6982. LIBSUF=${LIBSUF}
  6983. extralibs_avutil="$avutil_extralibs"
  6984. extralibs_avcodec="$avcodec_extralibs"
  6985. extralibs_avformat="$avformat_extralibs"
  6986. extralibs_avdevice="$avdevice_extralibs"
  6987. extralibs_avfilter="$avfilter_extralibs"
  6988. extralibs_avresample="$avresample_extralibs"
  6989. extralibs_postproc="$postproc_extralibs"
  6990. extralibs_swscale="$swscale_extralibs"
  6991. extralibs_swresample="$swresample_extralibs"
  6992. EOF
  6993. for lib in $LIBRARY_LIST; do
  6994. lib_deps="$(eval echo \$${lib}_deps)"
  6995. echo ${lib}_deps=\"$lib_deps\" >> $TMPH
  6996. done
  6997. cp_if_changed $TMPH ffbuild/config.sh