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.

7360 lines
240KB

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