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.

7723 lines
254KB

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