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.

7613 lines
250KB

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