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.

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