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.

7620 lines
250KB

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