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.

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