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.

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