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.

7362 lines
241KB

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