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.

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