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.

7474 lines
244KB

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