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.

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