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.

7515 lines
245KB

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