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.

7282 lines
237KB

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