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.

7593 lines
248KB

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