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.

7279 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 srcnn [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. procamp_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer"
  3126. program_opencl_filter_deps="opencl"
  3127. pullup_filter_deps="gpl"
  3128. removelogo_filter_deps="avcodec avformat swscale"
  3129. repeatfields_filter_deps="gpl"
  3130. resample_filter_deps="avresample"
  3131. rubberband_filter_deps="librubberband"
  3132. sab_filter_deps="gpl swscale"
  3133. scale2ref_filter_deps="swscale"
  3134. scale_filter_deps="swscale"
  3135. scale_qsv_filter_deps="libmfx"
  3136. select_filter_select="pixelutils"
  3137. sharpness_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer"
  3138. showcqt_filter_deps="avcodec avformat swscale"
  3139. showcqt_filter_suggest="libfontconfig libfreetype"
  3140. showcqt_filter_select="fft"
  3141. showfreqs_filter_deps="avcodec"
  3142. showfreqs_filter_select="fft"
  3143. showspectrum_filter_deps="avcodec"
  3144. showspectrum_filter_select="fft"
  3145. showspectrumpic_filter_deps="avcodec"
  3146. showspectrumpic_filter_select="fft"
  3147. signature_filter_deps="gpl avcodec avformat"
  3148. smartblur_filter_deps="gpl swscale"
  3149. sofalizer_filter_deps="libmysofa avcodec"
  3150. sofalizer_filter_select="fft"
  3151. spectrumsynth_filter_deps="avcodec"
  3152. spectrumsynth_filter_select="fft"
  3153. spp_filter_deps="gpl avcodec"
  3154. spp_filter_select="fft idctdsp fdctdsp me_cmp pixblockdsp"
  3155. srcnn_filter_deps="avformat"
  3156. srcnn_filter_select="dnn"
  3157. stereo3d_filter_deps="gpl"
  3158. subtitles_filter_deps="avformat avcodec libass"
  3159. super2xsai_filter_deps="gpl"
  3160. pixfmts_super2xsai_test_deps="super2xsai_filter"
  3161. tinterlace_filter_deps="gpl"
  3162. tinterlace_merge_test_deps="tinterlace_filter"
  3163. tinterlace_pad_test_deps="tinterlace_filter"
  3164. tonemap_filter_deps="const_nan"
  3165. tonemap_opencl_filter_deps="opencl const_nan"
  3166. unsharp_opencl_filter_deps="opencl"
  3167. uspp_filter_deps="gpl avcodec"
  3168. vaguedenoiser_filter_deps="gpl"
  3169. vidstabdetect_filter_deps="libvidstab"
  3170. vidstabtransform_filter_deps="libvidstab"
  3171. libvmaf_filter_deps="libvmaf pthreads"
  3172. zmq_filter_deps="libzmq"
  3173. zoompan_filter_deps="swscale"
  3174. zscale_filter_deps="libzimg const_nan"
  3175. scale_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer"
  3176. vpp_qsv_filter_deps="libmfx"
  3177. vpp_qsv_filter_select="qsvvpp"
  3178. # examples
  3179. avio_dir_cmd_deps="avformat avutil"
  3180. avio_reading_deps="avformat avcodec avutil"
  3181. decode_audio_example_deps="avcodec avutil"
  3182. decode_video_example_deps="avcodec avutil"
  3183. demuxing_decoding_example_deps="avcodec avformat avutil"
  3184. encode_audio_example_deps="avcodec avutil"
  3185. encode_video_example_deps="avcodec avutil"
  3186. extract_mvs_example_deps="avcodec avformat avutil"
  3187. filter_audio_example_deps="avfilter avutil"
  3188. filtering_audio_example_deps="avfilter avcodec avformat avutil"
  3189. filtering_video_example_deps="avfilter avcodec avformat avutil"
  3190. http_multiclient_example_deps="avformat avutil fork"
  3191. hw_decode_example_deps="avcodec avformat avutil"
  3192. metadata_example_deps="avformat avutil"
  3193. muxing_example_deps="avcodec avformat avutil swscale"
  3194. qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder"
  3195. remuxing_example_deps="avcodec avformat avutil"
  3196. resampling_audio_example_deps="avutil swresample"
  3197. scaling_video_example_deps="avutil swscale"
  3198. transcode_aac_example_deps="avcodec avformat swresample"
  3199. transcoding_example_deps="avfilter avcodec avformat avutil"
  3200. vaapi_encode_example_deps="avcodec avutil h264_vaapi_encoder"
  3201. vaapi_transcode_example_deps="avcodec avformat avutil h264_vaapi_encoder"
  3202. # EXTRALIBS_LIST
  3203. cpu_init_extralibs="pthreads_extralibs"
  3204. cws2fws_extralibs="zlib_extralibs"
  3205. # libraries, in linking order
  3206. avcodec_deps="avutil"
  3207. avcodec_suggest="libm"
  3208. avcodec_select="null_bsf"
  3209. avdevice_deps="avformat avcodec avutil"
  3210. avdevice_suggest="libm"
  3211. avfilter_deps="avutil"
  3212. avfilter_suggest="libm"
  3213. avformat_deps="avcodec avutil"
  3214. avformat_suggest="libm network zlib"
  3215. avresample_deps="avutil"
  3216. avresample_suggest="libm"
  3217. avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx opencl user32 vaapi videotoolbox corefoundation corevideo coremedia bcrypt"
  3218. postproc_deps="avutil gpl"
  3219. postproc_suggest="libm"
  3220. swresample_deps="avutil"
  3221. swresample_suggest="libm libsoxr"
  3222. swscale_deps="avutil"
  3223. swscale_suggest="libm"
  3224. avcodec_extralibs="pthreads_extralibs iconv_extralibs"
  3225. avfilter_extralibs="pthreads_extralibs"
  3226. avutil_extralibs="d3d11va_extralibs nanosleep_extralibs pthreads_extralibs vaapi_drm_extralibs vaapi_x11_extralibs vdpau_x11_extralibs"
  3227. # programs
  3228. ffmpeg_deps="avcodec avfilter avformat"
  3229. ffmpeg_select="aformat_filter anull_filter atrim_filter format_filter
  3230. null_filter
  3231. trim_filter"
  3232. ffmpeg_suggest="ole32 psapi shell32"
  3233. ffplay_deps="avcodec avformat swscale swresample sdl2"
  3234. ffplay_select="rdft crop_filter transpose_filter hflip_filter vflip_filter rotate_filter"
  3235. ffplay_suggest="shell32"
  3236. ffprobe_deps="avcodec avformat"
  3237. ffprobe_suggest="shell32"
  3238. # documentation
  3239. podpages_deps="perl"
  3240. manpages_deps="perl pod2man"
  3241. htmlpages_deps="perl"
  3242. htmlpages_deps_any="makeinfo_html texi2html"
  3243. txtpages_deps="perl makeinfo"
  3244. doc_deps_any="manpages htmlpages podpages txtpages"
  3245. # default parameters
  3246. logfile="ffbuild/config.log"
  3247. # installation paths
  3248. prefix_default="/usr/local"
  3249. bindir_default='${prefix}/bin'
  3250. datadir_default='${prefix}/share/ffmpeg'
  3251. docdir_default='${prefix}/share/doc/ffmpeg'
  3252. incdir_default='${prefix}/include'
  3253. libdir_default='${prefix}/lib'
  3254. mandir_default='${prefix}/share/man'
  3255. # toolchain
  3256. ar_default="ar"
  3257. cc_default="gcc"
  3258. cxx_default="g++"
  3259. host_cc_default="gcc"
  3260. doxygen_default="doxygen"
  3261. install="install"
  3262. ln_s_default="ln -s -f"
  3263. nm_default="nm -g"
  3264. pkg_config_default=pkg-config
  3265. ranlib_default="ranlib"
  3266. strip_default="strip"
  3267. version_script='--version-script'
  3268. objformat="elf32"
  3269. x86asmexe_default="nasm"
  3270. windres_default="windres"
  3271. nvcc_default="nvcc"
  3272. nvccflags_default="-gencode arch=compute_30,code=sm_30 -O2"
  3273. striptype="direct"
  3274. # OS
  3275. target_os_default=$(tolower $(uname -s))
  3276. host_os=$target_os_default
  3277. # machine
  3278. if test "$target_os_default" = aix; then
  3279. arch_default=$(uname -p)
  3280. strip_default="strip -X32_64"
  3281. else
  3282. arch_default=$(uname -m)
  3283. fi
  3284. cpu="generic"
  3285. intrinsics="none"
  3286. # configurable options
  3287. enable $PROGRAM_LIST
  3288. enable $DOCUMENT_LIST
  3289. enable $EXAMPLE_LIST
  3290. enable $(filter_out avresample $LIBRARY_LIST)
  3291. enable stripping
  3292. enable asm
  3293. enable debug
  3294. enable doc
  3295. enable faan faandct faanidct
  3296. enable optimizations
  3297. enable runtime_cpudetect
  3298. enable safe_bitstream_reader
  3299. enable static
  3300. enable swscale_alpha
  3301. enable valgrind_backtrace
  3302. sws_max_filter_size_default=256
  3303. set_default sws_max_filter_size
  3304. # internal components are enabled by default
  3305. enable $EXTRALIBS_LIST
  3306. # Avoid external, non-system, libraries getting enabled by dependency resolution
  3307. disable $EXTERNAL_LIBRARY_LIST $HWACCEL_LIBRARY_LIST
  3308. # build settings
  3309. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  3310. LIBPREF="lib"
  3311. LIBSUF=".a"
  3312. FULLNAME='$(NAME)$(BUILDSUF)'
  3313. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  3314. SLIBPREF="lib"
  3315. SLIBSUF=".so"
  3316. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  3317. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  3318. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  3319. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  3320. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
  3321. SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
  3322. VERSION_SCRIPT_POSTPROCESS_CMD="cat"
  3323. asflags_filter=echo
  3324. cflags_filter=echo
  3325. ldflags_filter=echo
  3326. AS_C='-c'
  3327. AS_O='-o $@'
  3328. CC_C='-c'
  3329. CC_E='-E -o $@'
  3330. CC_O='-o $@'
  3331. CXX_C='-c'
  3332. CXX_O='-o $@'
  3333. OBJCC_C='-c'
  3334. OBJCC_E='-E -o $@'
  3335. OBJCC_O='-o $@'
  3336. X86ASM_O='-o $@'
  3337. LD_O='-o $@'
  3338. LD_LIB='-l%'
  3339. LD_PATH='-L'
  3340. HOSTCC_C='-c'
  3341. HOSTCC_E='-E -o $@'
  3342. HOSTCC_O='-o $@'
  3343. HOSTLD_O='-o $@'
  3344. NVCC_C='-c'
  3345. NVCC_O='-o $@'
  3346. host_extralibs='-lm'
  3347. host_cflags_filter=echo
  3348. host_ldflags_filter=echo
  3349. target_path='$(CURDIR)'
  3350. # since the object filename is not given with the -MM flag, the compiler
  3351. # is only able to print the basename, and we must add the path ourselves
  3352. DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>/dev/null | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(@F),$(@D)/$(@F)," > $(@:.o=.d)'
  3353. DEPFLAGS='-MM'
  3354. mkdir -p ffbuild
  3355. # find source path
  3356. if test -f configure; then
  3357. source_path=.
  3358. else
  3359. source_path=$(cd $(dirname "$0"); pwd)
  3360. case "$source_path" in
  3361. *[[:blank:]]*) die "Out of tree builds are impossible with whitespace in source path." ;;
  3362. esac
  3363. test -e "$source_path/config.h" &&
  3364. die "Out of tree builds are impossible with config.h in source dir."
  3365. fi
  3366. for v in "$@"; do
  3367. r=${v#*=}
  3368. l=${v%"$r"}
  3369. r=$(sh_quote "$r")
  3370. FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
  3371. done
  3372. find_things_extern(){
  3373. thing=$1
  3374. pattern=$2
  3375. file=$source_path/$3
  3376. out=${4:-$thing}
  3377. sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$out/p" "$file"
  3378. }
  3379. find_filters_extern(){
  3380. file=$source_path/$1
  3381. #sed -n "s/^extern AVFilter ff_\([avfsinkrc]\{2,5\}\)_\(\w\+\);/\2_filter/p" $file
  3382. sed -E -n "s/^extern AVFilter ff_([avfsinkrc]{2,5})_([a-zA-Z0-9_]+);/\2_filter/p" $file
  3383. }
  3384. FILTER_LIST=$(find_filters_extern libavfilter/allfilters.c)
  3385. OUTDEV_LIST=$(find_things_extern muxer AVOutputFormat libavdevice/alldevices.c outdev)
  3386. INDEV_LIST=$(find_things_extern demuxer AVInputFormat libavdevice/alldevices.c indev)
  3387. MUXER_LIST=$(find_things_extern muxer AVOutputFormat libavformat/allformats.c)
  3388. DEMUXER_LIST=$(find_things_extern demuxer AVInputFormat libavformat/allformats.c)
  3389. ENCODER_LIST=$(find_things_extern encoder AVCodec libavcodec/allcodecs.c)
  3390. DECODER_LIST=$(find_things_extern decoder AVCodec libavcodec/allcodecs.c)
  3391. CODEC_LIST="
  3392. $ENCODER_LIST
  3393. $DECODER_LIST
  3394. "
  3395. PARSER_LIST=$(find_things_extern parser AVCodecParser libavcodec/parser.c)
  3396. BSF_LIST=$(find_things_extern bsf AVBitStreamFilter libavcodec/bitstream_filters.c)
  3397. HWACCEL_LIST=$(find_things_extern hwaccel AVHWAccel libavcodec/hwaccels.h)
  3398. PROTOCOL_LIST=$(find_things_extern protocol URLProtocol libavformat/protocols.c)
  3399. AVCODEC_COMPONENTS_LIST="
  3400. $BSF_LIST
  3401. $DECODER_LIST
  3402. $ENCODER_LIST
  3403. $HWACCEL_LIST
  3404. $PARSER_LIST
  3405. "
  3406. AVDEVICE_COMPONENTS_LIST="
  3407. $INDEV_LIST
  3408. $OUTDEV_LIST
  3409. "
  3410. AVFILTER_COMPONENTS_LIST="
  3411. $FILTER_LIST
  3412. "
  3413. AVFORMAT_COMPONENTS_LIST="
  3414. $DEMUXER_LIST
  3415. $MUXER_LIST
  3416. $PROTOCOL_LIST
  3417. "
  3418. ALL_COMPONENTS="
  3419. $AVCODEC_COMPONENTS_LIST
  3420. $AVDEVICE_COMPONENTS_LIST
  3421. $AVFILTER_COMPONENTS_LIST
  3422. $AVFORMAT_COMPONENTS_LIST
  3423. "
  3424. for n in $COMPONENT_LIST; do
  3425. v=$(toupper ${n%s})_LIST
  3426. eval enable \$$v
  3427. eval ${n}_if_any="\$$v"
  3428. done
  3429. enable $ARCH_EXT_LIST
  3430. die_unknown(){
  3431. echo "Unknown option \"$1\"."
  3432. echo "See $0 --help for available options."
  3433. exit 1
  3434. }
  3435. print_in_columns() {
  3436. cols=$(expr $ncols / 24)
  3437. cat | tr ' ' '\n' | sort | pr -r "-$cols" -w $ncols -t
  3438. }
  3439. show_list() {
  3440. suffix=_$1
  3441. shift
  3442. echo $* | sed s/$suffix//g | print_in_columns
  3443. exit 0
  3444. }
  3445. rand_list(){
  3446. IFS=', '
  3447. set -- $*
  3448. unset IFS
  3449. for thing; do
  3450. comp=${thing%:*}
  3451. prob=${thing#$comp}
  3452. prob=${prob#:}
  3453. is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
  3454. echo "prob ${prob:-0.5}"
  3455. printf '%s\n' $comp
  3456. done
  3457. }
  3458. do_random(){
  3459. action=$1
  3460. shift
  3461. random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
  3462. $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
  3463. }
  3464. for opt do
  3465. optval="${opt#*=}"
  3466. case "$opt" in
  3467. --extra-ldflags=*)
  3468. add_ldflags $optval
  3469. ;;
  3470. --extra-ldexeflags=*)
  3471. add_ldexeflags $optval
  3472. ;;
  3473. --extra-ldsoflags=*)
  3474. add_ldsoflags $optval
  3475. ;;
  3476. --extra-ldlibflags=*)
  3477. warn "The --extra-ldlibflags option is only provided for compatibility and will be\n"\
  3478. "removed in the future. Use --extra-ldsoflags instead."
  3479. add_ldsoflags $optval
  3480. ;;
  3481. --extra-libs=*)
  3482. add_extralibs $optval
  3483. ;;
  3484. --disable-devices)
  3485. disable $INDEV_LIST $OUTDEV_LIST
  3486. ;;
  3487. --enable-debug=*)
  3488. debuglevel="$optval"
  3489. ;;
  3490. --disable-programs)
  3491. disable $PROGRAM_LIST
  3492. ;;
  3493. --disable-everything)
  3494. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  3495. ;;
  3496. --disable-all)
  3497. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  3498. disable $LIBRARY_LIST $PROGRAM_LIST doc
  3499. enable avutil
  3500. ;;
  3501. --enable-random|--disable-random)
  3502. action=${opt%%-random}
  3503. do_random ${action#--} $COMPONENT_LIST
  3504. ;;
  3505. --enable-random=*|--disable-random=*)
  3506. action=${opt%%-random=*}
  3507. do_random ${action#--} $optval
  3508. ;;
  3509. --enable-sdl)
  3510. enable sdl2
  3511. ;;
  3512. --enable-*=*|--disable-*=*)
  3513. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  3514. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  3515. eval list=\$$(toupper $thing)_LIST
  3516. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  3517. list=$(filter "$name" $list)
  3518. [ "$list" = "" ] && warn "Option $opt did not match anything"
  3519. $action $list
  3520. ;;
  3521. --enable-yasm|--disable-yasm)
  3522. warn "The ${opt} option is only provided for compatibility and will be\n"\
  3523. "removed in the future. Use --enable-x86asm / --disable-x86asm instead."
  3524. test $opt = --enable-yasm && x86asm=yes || x86asm=no
  3525. ;;
  3526. --yasmexe=*)
  3527. warn "The --yasmexe option is only provided for compatibility and will be\n"\
  3528. "removed in the future. Use --x86asmexe instead."
  3529. x86asmexe="$optval"
  3530. ;;
  3531. --enable-?*|--disable-?*)
  3532. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  3533. if is_in $option $COMPONENT_LIST; then
  3534. test $action = disable && action=unset
  3535. eval $action \$$(toupper ${option%s})_LIST
  3536. elif is_in $option $CMDLINE_SELECT; then
  3537. $action $option
  3538. else
  3539. die_unknown $opt
  3540. fi
  3541. ;;
  3542. --list-*)
  3543. NAME="${opt#--list-}"
  3544. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  3545. NAME=${NAME%s}
  3546. eval show_list $NAME \$$(toupper $NAME)_LIST
  3547. ;;
  3548. --help|-h) show_help
  3549. ;;
  3550. --quiet|-q) quiet=yes
  3551. ;;
  3552. --fatal-warnings) enable fatal_warnings
  3553. ;;
  3554. --libfuzzer=*)
  3555. libfuzzer_path="$optval"
  3556. ;;
  3557. *)
  3558. optname="${opt%%=*}"
  3559. optname="${optname#--}"
  3560. optname=$(echo "$optname" | sed 's/-/_/g')
  3561. if is_in $optname $CMDLINE_SET; then
  3562. eval $optname='$optval'
  3563. elif is_in $optname $CMDLINE_APPEND; then
  3564. append $optname "$optval"
  3565. else
  3566. die_unknown $opt
  3567. fi
  3568. ;;
  3569. esac
  3570. done
  3571. for e in $env; do
  3572. eval "export $e"
  3573. done
  3574. if disabled autodetect; then
  3575. # Unless iconv is explicitely disabled by the user, we still want to probe
  3576. # for the iconv from the libc.
  3577. disabled iconv || enable libc_iconv
  3578. disable_weak $EXTERNAL_AUTODETECT_LIBRARY_LIST
  3579. disable_weak $HWACCEL_AUTODETECT_LIBRARY_LIST
  3580. fi
  3581. # Mark specifically enabled, but normally autodetected libraries as requested.
  3582. for lib in $AUTODETECT_LIBS; do
  3583. enabled $lib && request $lib
  3584. done
  3585. #TODO: switch to $AUTODETECT_LIBS when $THREADS_LIST is supported the same way
  3586. enable_weak $EXTERNAL_AUTODETECT_LIBRARY_LIST
  3587. enable_weak $HWACCEL_AUTODETECT_LIBRARY_LIST
  3588. disabled logging && logfile=/dev/null
  3589. # command line configuration sanity checks
  3590. # we need to build at least one lib type
  3591. if ! enabled_any static shared; then
  3592. cat <<EOF
  3593. At least one library type must be built.
  3594. Specify --enable-static to build the static libraries or --enable-shared to
  3595. build the shared libraries as well. To only build the shared libraries specify
  3596. --disable-static in addition to --enable-shared.
  3597. EOF
  3598. exit 1
  3599. fi
  3600. die_license_disabled() {
  3601. enabled $1 || { enabled $v && die "$v is $1 and --enable-$1 is not specified."; }
  3602. }
  3603. die_license_disabled_gpl() {
  3604. enabled $1 || { enabled $v && die "$v is incompatible with the gpl and --enable-$1 is not specified."; }
  3605. }
  3606. map "die_license_disabled gpl" $EXTERNAL_LIBRARY_GPL_LIST $EXTERNAL_LIBRARY_GPLV3_LIST
  3607. map "die_license_disabled version3" $EXTERNAL_LIBRARY_VERSION3_LIST $EXTERNAL_LIBRARY_GPLV3_LIST
  3608. enabled gpl && map "die_license_disabled_gpl nonfree" $EXTERNAL_LIBRARY_NONFREE_LIST
  3609. map "die_license_disabled nonfree" $HWACCEL_LIBRARY_NONFREE_LIST
  3610. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  3611. if enabled nonfree; then
  3612. license="nonfree and unredistributable"
  3613. elif enabled gplv3; then
  3614. license="GPL version 3 or later"
  3615. elif enabled lgplv3; then
  3616. license="LGPL version 3 or later"
  3617. elif enabled gpl; then
  3618. license="GPL version 2 or later"
  3619. else
  3620. license="LGPL version 2.1 or later"
  3621. fi
  3622. enabled_all gnutls openssl &&
  3623. die "GnuTLS and OpenSSL must not be enabled at the same time."
  3624. enabled_all gnutls mbedtls &&
  3625. die "GnuTLS and mbedTLS must not be enabled at the same time."
  3626. enabled_all openssl mbedtls &&
  3627. die "OpenSSL and mbedTLS must not be enabled at the same time."
  3628. # Disable all the library-specific components if the library itself
  3629. # is disabled, see AVCODEC_LIST and following _LIST variables.
  3630. disable_components(){
  3631. disabled ${1} && disable $(
  3632. eval components="\$$(toupper ${1})_COMPONENTS"
  3633. map 'eval echo \${$(toupper ${v%s})_LIST}' $components
  3634. )
  3635. }
  3636. map 'disable_components $v' $LIBRARY_LIST
  3637. echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
  3638. set >> $logfile
  3639. test -n "$valgrind" && toolchain="valgrind-memcheck"
  3640. enabled ossfuzz && ! echo $CFLAGS | grep -q -- "-fsanitize=" &&{
  3641. add_cflags -fsanitize=address,undefined -fsanitize-coverage=trace-pc-guard,trace-cmp -fno-omit-frame-pointer
  3642. add_ldflags -fsanitize=address,undefined -fsanitize-coverage=trace-pc-guard,trace-cmp
  3643. }
  3644. case "$toolchain" in
  3645. *-asan)
  3646. cc_default="${toolchain%-asan}"
  3647. add_cflags -fsanitize=address
  3648. add_ldflags -fsanitize=address
  3649. ;;
  3650. *-msan)
  3651. cc_default="${toolchain%-msan}"
  3652. add_cflags -fsanitize=memory -fsanitize-memory-track-origins
  3653. add_ldflags -fsanitize=memory
  3654. ;;
  3655. *-tsan)
  3656. cc_default="${toolchain%-tsan}"
  3657. add_cflags -fsanitize=thread -fPIE
  3658. add_ldflags -fsanitize=thread -pie
  3659. case "$toolchain" in
  3660. gcc-tsan)
  3661. add_cflags -fPIC
  3662. add_ldflags -fPIC
  3663. ;;
  3664. esac
  3665. ;;
  3666. *-usan)
  3667. cc_default="${toolchain%-usan}"
  3668. add_cflags -fsanitize=undefined
  3669. add_ldflags -fsanitize=undefined
  3670. ;;
  3671. valgrind-*)
  3672. target_exec_default="valgrind"
  3673. case "$toolchain" in
  3674. valgrind-massif)
  3675. 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"
  3676. ;;
  3677. valgrind-memcheck)
  3678. 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"
  3679. ;;
  3680. esac
  3681. ;;
  3682. msvc)
  3683. # Check whether the current MSVC version needs the C99 converter.
  3684. # From MSVC 2013 (compiler major version 18) onwards, it does actually
  3685. # support enough of C99 to build ffmpeg. Default to the new
  3686. # behaviour if the regexp was unable to match anything, since this
  3687. # successfully parses the version number of existing supported
  3688. # versions that require the converter (MSVC 2010 and 2012).
  3689. cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
  3690. if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
  3691. cc_default="cl"
  3692. cxx_default="cl"
  3693. else
  3694. die "Unsupported MSVC version (2013 or newer required)"
  3695. fi
  3696. ld_default="$source_path/compat/windows/mslink"
  3697. nm_default="dumpbin -symbols"
  3698. ar_default="lib"
  3699. case "$arch" in
  3700. aarch64|arm64)
  3701. as_default="armasm64"
  3702. ;;
  3703. arm*)
  3704. as_default="armasm"
  3705. ;;
  3706. esac
  3707. target_os_default="win32"
  3708. # Use a relative path for TMPDIR. This makes sure all the
  3709. # ffconf temp files are written with a relative path, avoiding
  3710. # issues with msys/win32 path conversion for MSVC parameters
  3711. # such as -Fo<file> or -out:<file>.
  3712. TMPDIR=.
  3713. ;;
  3714. icl)
  3715. cc_default="icl"
  3716. ld_default="xilink"
  3717. nm_default="dumpbin -symbols"
  3718. ar_default="xilib"
  3719. target_os_default="win32"
  3720. TMPDIR=.
  3721. ;;
  3722. gcov)
  3723. add_cflags -fprofile-arcs -ftest-coverage
  3724. add_ldflags -fprofile-arcs -ftest-coverage
  3725. ;;
  3726. llvm-cov)
  3727. add_cflags -fprofile-arcs -ftest-coverage
  3728. add_ldflags --coverage
  3729. ;;
  3730. hardened)
  3731. add_cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
  3732. add_cflags -fno-strict-overflow -fstack-protector-all
  3733. add_ldflags -Wl,-z,relro -Wl,-z,now
  3734. add_cflags -fPIE
  3735. add_ldexeflags -fPIE -pie
  3736. ;;
  3737. ?*)
  3738. die "Unknown toolchain $toolchain"
  3739. ;;
  3740. esac
  3741. if test -n "$cross_prefix"; then
  3742. test -n "$arch" && test -n "$target_os" ||
  3743. die "Must specify target arch (--arch) and OS (--target-os) when cross-compiling"
  3744. enable cross_compile
  3745. fi
  3746. ar_default="${cross_prefix}${ar_default}"
  3747. cc_default="${cross_prefix}${cc_default}"
  3748. cxx_default="${cross_prefix}${cxx_default}"
  3749. nm_default="${cross_prefix}${nm_default}"
  3750. pkg_config_default="${cross_prefix}${pkg_config_default}"
  3751. if ${cross_prefix}${ranlib_default} 2>&1 | grep -q "\-D "; then
  3752. ranlib_default="${cross_prefix}${ranlib_default} -D"
  3753. else
  3754. ranlib_default="${cross_prefix}${ranlib_default}"
  3755. fi
  3756. strip_default="${cross_prefix}${strip_default}"
  3757. windres_default="${cross_prefix}${windres_default}"
  3758. sysinclude_default="${sysroot}/usr/include"
  3759. set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \
  3760. target_exec target_os x86asmexe nvcc
  3761. enabled cross_compile || host_cc_default=$cc
  3762. set_default host_cc
  3763. pkg_config_fail_message=""
  3764. if ! $pkg_config --version >/dev/null 2>&1; then
  3765. warn "$pkg_config not found, library detection may fail."
  3766. pkg_config=false
  3767. elif is_in -static $cc $LDFLAGS && ! is_in --static $pkg_config $pkg_config_flags; then
  3768. pkg_config_fail_message="
  3769. Note: When building a static binary, add --pkg-config-flags=\"--static\"."
  3770. fi
  3771. if test $doxygen != $doxygen_default && \
  3772. ! $doxygen --version >/dev/null 2>&1; then
  3773. warn "Specified doxygen \"$doxygen\" not found, API documentation will fail to build."
  3774. fi
  3775. exesuf() {
  3776. case $1 in
  3777. mingw32*|mingw64*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  3778. esac
  3779. }
  3780. EXESUF=$(exesuf $target_os)
  3781. HOSTEXESUF=$(exesuf $host_os)
  3782. # set temporary file name
  3783. : ${TMPDIR:=$TEMPDIR}
  3784. : ${TMPDIR:=$TMP}
  3785. : ${TMPDIR:=/tmp}
  3786. if [ -n "$tempprefix" ] ; then
  3787. mktemp(){
  3788. tmpname="$tempprefix.${HOSTNAME}.${UID}"
  3789. echo "$tmpname"
  3790. mkdir "$tmpname"
  3791. }
  3792. elif ! test_cmd mktemp -u XXXXXX; then
  3793. # simple replacement for missing mktemp
  3794. # NOT SAFE FOR GENERAL USE
  3795. mktemp(){
  3796. tmpname="${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  3797. echo "$tmpname"
  3798. mkdir "$tmpname"
  3799. }
  3800. fi
  3801. FFTMPDIR=$(mktemp -d "${TMPDIR}/ffconf.XXXXXXXX" 2> /dev/null) ||
  3802. die "Unable to create temporary directory in $TMPDIR."
  3803. tmpfile(){
  3804. tmp="${FFTMPDIR}/test"$2
  3805. (set -C; exec > $tmp) 2> /dev/null ||
  3806. die "Unable to create temporary file in $FFTMPDIR."
  3807. eval $1=$tmp
  3808. }
  3809. trap 'rm -rf -- "$FFTMPDIR"' EXIT
  3810. trap 'exit 2' INT
  3811. tmpfile TMPASM .asm
  3812. tmpfile TMPC .c
  3813. tmpfile TMPCPP .cpp
  3814. tmpfile TMPE $EXESUF
  3815. tmpfile TMPH .h
  3816. tmpfile TMPM .m
  3817. tmpfile TMPO .o
  3818. tmpfile TMPS .S
  3819. tmpfile TMPSH .sh
  3820. tmpfile TMPV .ver
  3821. unset -f mktemp
  3822. chmod +x $TMPE
  3823. # make sure we can execute files in $TMPDIR
  3824. cat > $TMPSH 2>> $logfile <<EOF
  3825. #! /bin/sh
  3826. EOF
  3827. chmod +x $TMPSH >> $logfile 2>&1
  3828. if ! $TMPSH >> $logfile 2>&1; then
  3829. cat <<EOF
  3830. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  3831. variable to another directory and make sure that it is not mounted noexec.
  3832. EOF
  3833. die "Sanity test failed."
  3834. fi
  3835. armasm_flags(){
  3836. for flag; do
  3837. case $flag in
  3838. # Filter out MSVC cl.exe options from cflags that shouldn't
  3839. # be passed to gas-preprocessor
  3840. -M[TD]*) ;;
  3841. *) echo $flag ;;
  3842. esac
  3843. done
  3844. }
  3845. cparser_flags(){
  3846. for flag; do
  3847. case $flag in
  3848. -Wno-switch) echo -Wno-switch-enum ;;
  3849. -Wno-format-zero-length) ;;
  3850. -Wdisabled-optimization) ;;
  3851. -Wno-pointer-sign) echo -Wno-other ;;
  3852. *) echo $flag ;;
  3853. esac
  3854. done
  3855. }
  3856. msvc_common_flags(){
  3857. for flag; do
  3858. case $flag in
  3859. # In addition to specifying certain flags under the compiler
  3860. # specific filters, they must be specified here as well or else the
  3861. # generic catch all at the bottom will print the original flag.
  3862. -Wall) ;;
  3863. -Wextra) ;;
  3864. -std=c99) ;;
  3865. # Common flags
  3866. -fomit-frame-pointer) ;;
  3867. -g) echo -Z7 ;;
  3868. -fno-math-errno) ;;
  3869. -fno-common) ;;
  3870. -fno-signed-zeros) ;;
  3871. -fPIC) ;;
  3872. -mthumb) ;;
  3873. -march=*) ;;
  3874. -lz) echo zlib.lib ;;
  3875. -lx264) echo libx264.lib ;;
  3876. -lstdc++) ;;
  3877. -l*) echo ${flag#-l}.lib ;;
  3878. -LARGEADDRESSAWARE) echo $flag ;;
  3879. -L*) echo -libpath:${flag#-L} ;;
  3880. *) echo $flag ;;
  3881. esac
  3882. done
  3883. }
  3884. msvc_flags(){
  3885. msvc_common_flags "$@"
  3886. for flag; do
  3887. case $flag in
  3888. -Wall) echo -W3 -wd4018 -wd4146 -wd4244 -wd4305 \
  3889. -wd4554 ;;
  3890. -Wextra) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
  3891. -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
  3892. -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
  3893. -wd4307 \
  3894. -wd4273 -wd4554 -wd4701 -wd4703 ;;
  3895. esac
  3896. done
  3897. }
  3898. icl_flags(){
  3899. msvc_common_flags "$@"
  3900. for flag; do
  3901. case $flag in
  3902. # Despite what Intel's documentation says -Wall, which is supported
  3903. # on Windows, does enable remarks so disable them here.
  3904. -Wall) echo $flag -Qdiag-disable:remark ;;
  3905. -std=c99) echo -Qstd=c99 ;;
  3906. -flto) echo -ipo ;;
  3907. esac
  3908. done
  3909. }
  3910. icc_flags(){
  3911. for flag; do
  3912. case $flag in
  3913. -flto) echo -ipo ;;
  3914. *) echo $flag ;;
  3915. esac
  3916. done
  3917. }
  3918. suncc_flags(){
  3919. for flag; do
  3920. case $flag in
  3921. -march=*|-mcpu=*)
  3922. case "${flag#*=}" in
  3923. native) echo -xtarget=native ;;
  3924. v9|niagara) echo -xarch=sparc ;;
  3925. ultrasparc) echo -xarch=sparcvis ;;
  3926. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  3927. i586|pentium) echo -xchip=pentium ;;
  3928. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  3929. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  3930. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  3931. pentium4*) echo -xtarget=pentium4 ;;
  3932. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  3933. *-sse3) echo -xarch=sse3 ;;
  3934. core2) echo -xarch=ssse3 -xchip=core2 ;;
  3935. bonnell) echo -xarch=ssse3 ;;
  3936. corei7|nehalem) echo -xtarget=nehalem ;;
  3937. westmere) echo -xtarget=westmere ;;
  3938. silvermont) echo -xarch=sse4_2 ;;
  3939. corei7-avx|sandybridge) echo -xtarget=sandybridge ;;
  3940. core-avx*|ivybridge|haswell|broadwell|skylake*|knl)
  3941. echo -xarch=avx ;;
  3942. amdfam10|barcelona) echo -xtarget=barcelona ;;
  3943. btver1) echo -xarch=amdsse4a ;;
  3944. btver2|bdver*|znver*) echo -xarch=avx ;;
  3945. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  3946. k8|opteron|athlon64|athlon-fx)
  3947. echo -xarch=sse2a ;;
  3948. athlon*) echo -xarch=pentium_proa ;;
  3949. esac
  3950. ;;
  3951. -std=c99) echo -xc99 ;;
  3952. -fomit-frame-pointer) echo -xregs=frameptr ;;
  3953. -fPIC) echo -KPIC -xcode=pic32 ;;
  3954. -W*,*) echo $flag ;;
  3955. -f*-*|-W*|-mimpure-text) ;;
  3956. -shared) echo -G ;;
  3957. *) echo $flag ;;
  3958. esac
  3959. done
  3960. }
  3961. probe_cc(){
  3962. pfx=$1
  3963. _cc=$2
  3964. first=$3
  3965. unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
  3966. unset _ld_o _ldflags _ld_lib _ld_path
  3967. unset _depflags _DEPCMD _DEPFLAGS
  3968. _flags_filter=echo
  3969. if $_cc --version 2>&1 | grep -q '^GNU assembler'; then
  3970. true # no-op to avoid reading stdin in following checks
  3971. elif $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  3972. _type=llvm_gcc
  3973. gcc_extra_ver=$(expr "$($_cc --version 2>/dev/null | head -n1)" : '.*\((.*)\)')
  3974. _ident="llvm-gcc $($_cc -dumpversion 2>/dev/null) $gcc_extra_ver"
  3975. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  3976. _cflags_speed='-O3'
  3977. _cflags_size='-Os'
  3978. elif $_cc -v 2>&1 | grep -qi ^gcc; then
  3979. _type=gcc
  3980. gcc_version=$($_cc --version | head -n1)
  3981. gcc_basever=$($_cc -dumpversion)
  3982. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  3983. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  3984. _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  3985. case $gcc_basever in
  3986. 2) ;;
  3987. 2.*) ;;
  3988. *) _depflags='-MMD -MF $(@:.o=.d) -MT $@' ;;
  3989. esac
  3990. if [ "$first" = true ]; then
  3991. case $gcc_basever in
  3992. 4.2*)
  3993. warn "gcc 4.2 is outdated and may miscompile FFmpeg. Please use a newer compiler." ;;
  3994. esac
  3995. fi
  3996. _cflags_speed='-O3'
  3997. _cflags_size='-Os'
  3998. elif $_cc --version 2>/dev/null | grep -q ^icc; then
  3999. _type=icc
  4000. _ident=$($_cc --version | head -n1)
  4001. _depflags='-MMD'
  4002. _cflags_speed='-O3'
  4003. _cflags_size='-Os'
  4004. _cflags_noopt='-O1'
  4005. _flags_filter=icc_flags
  4006. elif $_cc -v 2>&1 | grep -q xlc; then
  4007. _type=xlc
  4008. _ident=$($_cc -qversion 2>/dev/null | head -n1)
  4009. _cflags_speed='-O5'
  4010. _cflags_size='-O5 -qcompact'
  4011. elif $_cc --vsn 2>/dev/null | grep -Eq "ARM (C/C\+\+ )?Compiler"; then
  4012. test -d "$sysroot" || die "No valid sysroot specified."
  4013. _type=armcc
  4014. _ident=$($_cc --vsn | grep -i build | head -n1 | sed 's/.*: //')
  4015. armcc_conf="$PWD/armcc.conf"
  4016. $_cc --arm_linux_configure \
  4017. --arm_linux_config_file="$armcc_conf" \
  4018. --configure_sysroot="$sysroot" \
  4019. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  4020. die "Error creating armcc configuration file."
  4021. $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  4022. _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
  4023. as_default="${cross_prefix}gcc"
  4024. _depflags='-MMD'
  4025. _cflags_speed='-O3'
  4026. _cflags_size='-Os'
  4027. elif $_cc -v 2>&1 | grep -q clang && ! $_cc -? > /dev/null 2>&1; then
  4028. _type=clang
  4029. _ident=$($_cc --version 2>/dev/null | head -n1)
  4030. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  4031. _cflags_speed='-O3'
  4032. _cflags_size='-Oz'
  4033. elif $_cc -V 2>&1 | grep -q Sun; then
  4034. _type=suncc
  4035. _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  4036. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  4037. _DEPFLAGS='-xM1 -xc99'
  4038. _ldflags='-std=c99'
  4039. _cflags_speed='-O5'
  4040. _cflags_size='-O5 -xspace'
  4041. _flags_filter=suncc_flags
  4042. elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  4043. _type=pathscale
  4044. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  4045. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  4046. _cflags_speed='-O2'
  4047. _cflags_size='-Os'
  4048. _flags_filter='filter_out -Wdisabled-optimization'
  4049. elif $_cc -v 2>&1 | grep -q Open64; then
  4050. _type=open64
  4051. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  4052. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  4053. _cflags_speed='-O2'
  4054. _cflags_size='-Os'
  4055. _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  4056. elif $_cc 2>&1 | grep -q 'Microsoft.*ARM.*Assembler'; then
  4057. _type=armasm
  4058. _ident=$($_cc | head -n1)
  4059. # 4509: "This form of conditional instruction is deprecated"
  4060. _flags="-nologo -ignore 4509"
  4061. _flags_filter=armasm_flags
  4062. elif $_cc 2>&1 | grep -q Intel; then
  4063. _type=icl
  4064. _ident=$($_cc 2>&1 | head -n1)
  4065. _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
  4066. # Not only is O3 broken on 13.x+ but it is slower on all previous
  4067. # versions (tested) as well.
  4068. _cflags_speed="-O2"
  4069. _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
  4070. if $_cc 2>&1 | grep -q Linker; then
  4071. _ld_o='-out:$@'
  4072. else
  4073. _ld_o='-Fe$@'
  4074. fi
  4075. _cc_o='-Fo$@'
  4076. _cc_e='-P'
  4077. _flags_filter=icl_flags
  4078. _ld_lib='lib%.a'
  4079. _ld_path='-libpath:'
  4080. # -Qdiag-error to make icl error when seeing certain unknown arguments
  4081. _flags='-nologo -Qdiag-error:4044,10157'
  4082. # -Qvec- -Qsimd- to prevent miscompilation, -GS, fp:precise for consistency
  4083. # with MSVC which enables it by default.
  4084. _cflags='-Qms0 -Qvec- -Qsimd- -GS -fp:precise'
  4085. disable stripping
  4086. elif $_cc -? 2>/dev/null | grep -q 'LLVM.*Linker'; then
  4087. # lld can emulate multiple different linkers; in ms link.exe mode,
  4088. # the -? parameter gives the help output which contains an identifyable
  4089. # string, while it gives an error in other modes.
  4090. _type=lld-link
  4091. # The link.exe mode doesn't have a switch for getting the version,
  4092. # but we can force it back to gnu mode and get the version from there.
  4093. _ident=$($_cc -flavor gnu --version 2>/dev/null)
  4094. _ld_o='-out:$@'
  4095. _flags_filter=msvc_flags
  4096. _ld_lib='lib%.a'
  4097. _ld_path='-libpath:'
  4098. elif $_cc -nologo- 2>&1 | grep -q Microsoft || { $_cc -v 2>&1 | grep -q clang && $_cc -? > /dev/null 2>&1; }; then
  4099. _type=msvc
  4100. _ident=$($_cc 2>&1 | head -n1 | tr -d '\r')
  4101. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
  4102. _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
  4103. _cflags_speed="-O2"
  4104. _cflags_size="-O1"
  4105. _cflags_noopt="-O1"
  4106. if $_cc -nologo- 2>&1 | grep -q Linker; then
  4107. _ld_o='-out:$@'
  4108. else
  4109. _ld_o='-Fe$@'
  4110. fi
  4111. _cc_o='-Fo$@'
  4112. _cc_e='-P -Fi$@'
  4113. _flags_filter=msvc_flags
  4114. _ld_lib='lib%.a'
  4115. _ld_path='-libpath:'
  4116. _flags='-nologo'
  4117. disable stripping
  4118. elif $_cc --version 2>/dev/null | grep -q ^cparser; then
  4119. _type=cparser
  4120. _ident=$($_cc --version | head -n1)
  4121. _depflags='-MMD'
  4122. _cflags_speed='-O4'
  4123. _cflags_size='-O2'
  4124. _flags_filter=cparser_flags
  4125. fi
  4126. eval ${pfx}_type=\$_type
  4127. eval ${pfx}_ident=\$_ident
  4128. }
  4129. set_ccvars(){
  4130. eval ${1}_C=\${_cc_c-\${${1}_C}}
  4131. eval ${1}_E=\${_cc_e-\${${1}_E}}
  4132. eval ${1}_O=\${_cc_o-\${${1}_O}}
  4133. if [ -n "$_depflags" ]; then
  4134. eval ${1}_DEPFLAGS=\$_depflags
  4135. else
  4136. eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
  4137. eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
  4138. eval DEP${1}FLAGS=\$_flags
  4139. fi
  4140. }
  4141. probe_cc cc "$cc" "true"
  4142. cflags_filter=$_flags_filter
  4143. cflags_speed=$_cflags_speed
  4144. cflags_size=$_cflags_size
  4145. cflags_noopt=$_cflags_noopt
  4146. add_cflags $_flags $_cflags
  4147. cc_ldflags=$_ldflags
  4148. set_ccvars CC
  4149. set_ccvars CXX
  4150. probe_cc hostcc "$host_cc"
  4151. host_cflags_filter=$_flags_filter
  4152. host_cflags_speed=$_cflags_speed
  4153. add_host_cflags $_flags $_cflags
  4154. set_ccvars HOSTCC
  4155. test -n "$cc_type" && enable $cc_type ||
  4156. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  4157. : ${as_default:=$cc}
  4158. : ${objcc_default:=$cc}
  4159. : ${dep_cc_default:=$cc}
  4160. : ${ld_default:=$cc}
  4161. : ${host_ld_default:=$host_cc}
  4162. set_default ar as objcc dep_cc ld ln_s host_ld windres
  4163. probe_cc as "$as"
  4164. asflags_filter=$_flags_filter
  4165. add_asflags $_flags $_cflags
  4166. set_ccvars AS
  4167. probe_cc objcc "$objcc"
  4168. objcflags_filter=$_flags_filter
  4169. add_objcflags $_flags $_cflags
  4170. set_ccvars OBJC
  4171. probe_cc ld "$ld"
  4172. ldflags_filter=$_flags_filter
  4173. add_ldflags $_flags $_ldflags
  4174. test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
  4175. LD_O=${_ld_o-$LD_O}
  4176. LD_LIB=${_ld_lib-$LD_LIB}
  4177. LD_PATH=${_ld_path-$LD_PATH}
  4178. probe_cc hostld "$host_ld"
  4179. host_ldflags_filter=$_flags_filter
  4180. add_host_ldflags $_flags $_ldflags
  4181. HOSTLD_O=${_ld_o-$HOSTLD_O}
  4182. if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
  4183. probe_cc depcc "$dep_cc"
  4184. CCDEP=${_DEPCMD:-$DEPCMD}
  4185. CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
  4186. DEPCCFLAGS=$_flags
  4187. fi
  4188. if $ar 2>&1 | grep -q Microsoft; then
  4189. arflags="-nologo"
  4190. ar_o='-out:$@'
  4191. elif $ar 2>&1 | grep -q "\[D\] "; then
  4192. arflags="rcD"
  4193. ar_o='$@'
  4194. else
  4195. arflags="rc"
  4196. ar_o='$@'
  4197. fi
  4198. add_cflags $extra_cflags
  4199. add_cxxflags $extra_cxxflags
  4200. add_objcflags $extra_objcflags
  4201. add_asflags $extra_cflags
  4202. if test -n "$sysroot"; then
  4203. case "$cc_type" in
  4204. gcc|llvm_gcc|clang)
  4205. add_cppflags --sysroot="$sysroot"
  4206. add_ldflags --sysroot="$sysroot"
  4207. ;;
  4208. esac
  4209. fi
  4210. if test "$cpu" = host; then
  4211. enabled cross_compile &&
  4212. die "--cpu=host makes no sense when cross-compiling."
  4213. case "$cc_type" in
  4214. gcc|llvm_gcc)
  4215. check_native(){
  4216. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  4217. sed -n "/cc1.*$1=/{
  4218. s/.*$1=\\([^ ]*\\).*/\\1/
  4219. p
  4220. q
  4221. }" $TMPE
  4222. }
  4223. cpu=$(check_native -march || check_native -mcpu)
  4224. ;;
  4225. clang)
  4226. check_native(){
  4227. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  4228. sed -n "/cc1.*-target-cpu /{
  4229. s/.*-target-cpu \\([^ ]*\\).*/\\1/
  4230. p
  4231. q
  4232. }" $TMPE
  4233. }
  4234. cpu=$(check_native -march)
  4235. ;;
  4236. esac
  4237. test "${cpu:-host}" = host &&
  4238. die "--cpu=host not supported with compiler $cc"
  4239. fi
  4240. # Deal with common $arch aliases
  4241. case "$arch" in
  4242. aarch64|arm64)
  4243. arch="aarch64"
  4244. ;;
  4245. arm*|iPad*|iPhone*)
  4246. arch="arm"
  4247. ;;
  4248. mips*|IP*)
  4249. case "$arch" in
  4250. *el)
  4251. add_cppflags -EL
  4252. add_ldflags -EL
  4253. ;;
  4254. *eb)
  4255. add_cppflags -EB
  4256. add_ldflags -EB
  4257. ;;
  4258. esac
  4259. arch="mips"
  4260. ;;
  4261. parisc*|hppa*)
  4262. arch="parisc"
  4263. ;;
  4264. "Power Macintosh"|ppc*|powerpc*)
  4265. arch="ppc"
  4266. ;;
  4267. s390|s390x)
  4268. arch="s390"
  4269. ;;
  4270. sh4|sh)
  4271. arch="sh4"
  4272. ;;
  4273. sun4*|sparc*)
  4274. arch="sparc"
  4275. ;;
  4276. tilegx|tile-gx)
  4277. arch="tilegx"
  4278. ;;
  4279. i[3-6]86*|i86pc|BePC|x86pc|x86_64|x86_32|amd64)
  4280. arch="x86"
  4281. ;;
  4282. esac
  4283. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  4284. enable $arch
  4285. # Add processor-specific flags
  4286. if enabled aarch64; then
  4287. case $cpu in
  4288. armv*)
  4289. cpuflags="-march=$cpu"
  4290. ;;
  4291. *)
  4292. cpuflags="-mcpu=$cpu"
  4293. ;;
  4294. esac
  4295. elif enabled alpha; then
  4296. cpuflags="-mcpu=$cpu"
  4297. elif enabled arm; then
  4298. check_arm_arch() {
  4299. test_cpp_condition stddef.h \
  4300. "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
  4301. $cpuflags
  4302. }
  4303. probe_arm_arch() {
  4304. if check_arm_arch 4; then echo armv4
  4305. elif check_arm_arch 4T; then echo armv4t
  4306. elif check_arm_arch 5; then echo armv5
  4307. elif check_arm_arch 5E; then echo armv5e
  4308. elif check_arm_arch 5T; then echo armv5t
  4309. elif check_arm_arch 5TE; then echo armv5te
  4310. elif check_arm_arch 5TEJ; then echo armv5te
  4311. elif check_arm_arch 6; then echo armv6
  4312. elif check_arm_arch 6J; then echo armv6j
  4313. elif check_arm_arch 6K; then echo armv6k
  4314. elif check_arm_arch 6Z; then echo armv6z
  4315. elif check_arm_arch 6KZ; then echo armv6zk
  4316. elif check_arm_arch 6ZK; then echo armv6zk
  4317. elif check_arm_arch 6T2; then echo armv6t2
  4318. elif check_arm_arch 7; then echo armv7
  4319. elif check_arm_arch 7A 7_A; then echo armv7-a
  4320. elif check_arm_arch 7S; then echo armv7-a
  4321. elif check_arm_arch 7R 7_R; then echo armv7-r
  4322. elif check_arm_arch 7M 7_M; then echo armv7-m
  4323. elif check_arm_arch 7EM 7E_M; then echo armv7-m
  4324. elif check_arm_arch 8A 8_A; then echo armv8-a
  4325. fi
  4326. }
  4327. [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
  4328. case $cpu in
  4329. armv*)
  4330. cpuflags="-march=$cpu"
  4331. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  4332. ;;
  4333. *)
  4334. cpuflags="-mcpu=$cpu"
  4335. case $cpu in
  4336. cortex-a*) subarch=armv7a ;;
  4337. cortex-r*) subarch=armv7r ;;
  4338. cortex-m*) enable thumb; subarch=armv7m ;;
  4339. arm11*) subarch=armv6 ;;
  4340. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  4341. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  4342. *) subarch=$(probe_arm_arch) ;;
  4343. esac
  4344. ;;
  4345. esac
  4346. case "$subarch" in
  4347. armv5t*) enable fast_clz ;;
  4348. armv[6-8]*)
  4349. enable fast_clz
  4350. disabled fast_unaligned || enable fast_unaligned
  4351. ;;
  4352. esac
  4353. elif enabled avr32; then
  4354. case $cpu in
  4355. ap7[02]0[0-2])
  4356. subarch="avr32_ap"
  4357. cpuflags="-mpart=$cpu"
  4358. ;;
  4359. ap)
  4360. subarch="avr32_ap"
  4361. cpuflags="-march=$cpu"
  4362. ;;
  4363. uc3[ab]*)
  4364. subarch="avr32_uc"
  4365. cpuflags="-mcpu=$cpu"
  4366. ;;
  4367. uc)
  4368. subarch="avr32_uc"
  4369. cpuflags="-march=$cpu"
  4370. ;;
  4371. esac
  4372. elif enabled bfin; then
  4373. cpuflags="-mcpu=$cpu"
  4374. elif enabled mips; then
  4375. cpuflags="-march=$cpu"
  4376. if [ "$cpu" != "generic" ]; then
  4377. disable mips32r2
  4378. disable mips32r5
  4379. disable mips64r2
  4380. disable mips32r6
  4381. disable mips64r6
  4382. disable loongson2
  4383. disable loongson3
  4384. case $cpu in
  4385. 24kc|24kf*|24kec|34kc|1004kc|24kef*|34kf*|1004kf*|74kc|74kf)
  4386. enable mips32r2
  4387. disable msa
  4388. ;;
  4389. p5600|i6400|p6600)
  4390. disable mipsdsp
  4391. disable mipsdspr2
  4392. ;;
  4393. loongson*)
  4394. enable loongson2
  4395. enable loongson3
  4396. enable local_aligned
  4397. enable simd_align_16
  4398. enable fast_64bit
  4399. enable fast_clz
  4400. enable fast_cmov
  4401. enable fast_unaligned
  4402. disable aligned_stack
  4403. disable mipsfpu
  4404. disable mipsdsp
  4405. disable mipsdspr2
  4406. case $cpu in
  4407. loongson3*)
  4408. cpuflags="-march=loongson3a -mhard-float -fno-expensive-optimizations"
  4409. ;;
  4410. loongson2e)
  4411. cpuflags="-march=loongson2e -mhard-float -fno-expensive-optimizations"
  4412. ;;
  4413. loongson2f)
  4414. cpuflags="-march=loongson2f -mhard-float -fno-expensive-optimizations"
  4415. ;;
  4416. esac
  4417. ;;
  4418. *)
  4419. # Unknown CPU. Disable everything.
  4420. warn "unknown CPU. Disabling all MIPS optimizations."
  4421. disable mipsfpu
  4422. disable mipsdsp
  4423. disable mipsdspr2
  4424. disable msa
  4425. disable mmi
  4426. ;;
  4427. esac
  4428. case $cpu in
  4429. 24kc)
  4430. disable mipsfpu
  4431. disable mipsdsp
  4432. disable mipsdspr2
  4433. ;;
  4434. 24kf*)
  4435. disable mipsdsp
  4436. disable mipsdspr2
  4437. ;;
  4438. 24kec|34kc|1004kc)
  4439. disable mipsfpu
  4440. disable mipsdspr2
  4441. ;;
  4442. 24kef*|34kf*|1004kf*)
  4443. disable mipsdspr2
  4444. ;;
  4445. 74kc)
  4446. disable mipsfpu
  4447. ;;
  4448. p5600)
  4449. enable mips32r5
  4450. check_cflags "-mtune=p5600" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops"
  4451. ;;
  4452. i6400)
  4453. enable mips64r6
  4454. check_cflags "-mtune=i6400 -mabi=64" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
  4455. ;;
  4456. p6600)
  4457. enable mips64r6
  4458. check_cflags "-mtune=p6600 -mabi=64" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
  4459. ;;
  4460. esac
  4461. else
  4462. # We do not disable anything. Is up to the user to disable the unwanted features.
  4463. warn 'generic cpu selected'
  4464. fi
  4465. elif enabled ppc; then
  4466. disable ldbrx
  4467. case $(tolower $cpu) in
  4468. 601|ppc601|powerpc601)
  4469. cpuflags="-mcpu=601"
  4470. disable altivec
  4471. ;;
  4472. 603*|ppc603*|powerpc603*)
  4473. cpuflags="-mcpu=603"
  4474. disable altivec
  4475. ;;
  4476. 604*|ppc604*|powerpc604*)
  4477. cpuflags="-mcpu=604"
  4478. disable altivec
  4479. ;;
  4480. g3|75*|ppc75*|powerpc75*)
  4481. cpuflags="-mcpu=750"
  4482. disable altivec
  4483. ;;
  4484. g4|745*|ppc745*|powerpc745*)
  4485. cpuflags="-mcpu=7450"
  4486. disable vsx
  4487. ;;
  4488. 74*|ppc74*|powerpc74*)
  4489. cpuflags="-mcpu=7400"
  4490. disable vsx
  4491. ;;
  4492. g5|970|ppc970|powerpc970)
  4493. cpuflags="-mcpu=970"
  4494. disable vsx
  4495. ;;
  4496. power[3-6]*)
  4497. cpuflags="-mcpu=$cpu"
  4498. disable vsx
  4499. ;;
  4500. power[7-8]*)
  4501. cpuflags="-mcpu=$cpu"
  4502. ;;
  4503. cell)
  4504. cpuflags="-mcpu=cell"
  4505. enable ldbrx
  4506. disable vsx
  4507. ;;
  4508. e500mc)
  4509. cpuflags="-mcpu=e500mc"
  4510. disable altivec
  4511. ;;
  4512. e500v2)
  4513. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  4514. disable altivec
  4515. disable dcbzl
  4516. ;;
  4517. e500)
  4518. cpuflags="-mcpu=8540 -mhard-float"
  4519. disable altivec
  4520. disable dcbzl
  4521. ;;
  4522. esac
  4523. elif enabled sparc; then
  4524. case $cpu in
  4525. cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
  4526. cpuflags="-mcpu=$cpu"
  4527. ;;
  4528. ultrasparc*|niagara[234])
  4529. cpuflags="-mcpu=$cpu"
  4530. ;;
  4531. esac
  4532. elif enabled x86; then
  4533. case $cpu in
  4534. i[345]86|pentium)
  4535. cpuflags="-march=$cpu"
  4536. disable i686
  4537. disable mmx
  4538. ;;
  4539. # targets that do NOT support nopl and conditional mov (cmov)
  4540. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  4541. cpuflags="-march=$cpu"
  4542. disable i686
  4543. ;;
  4544. # targets that do support nopl and conditional mov (cmov)
  4545. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx\
  4546. |core*|atom|bonnell|nehalem|westmere|silvermont|sandybridge|ivybridge|haswell|broadwell|skylake*|knl\
  4547. |amdfam10|barcelona|b[dt]ver*|znver*)
  4548. cpuflags="-march=$cpu"
  4549. enable i686
  4550. enable fast_cmov
  4551. ;;
  4552. # targets that do support conditional mov but on which it's slow
  4553. pentium4|pentium4m|prescott|nocona)
  4554. cpuflags="-march=$cpu"
  4555. enable i686
  4556. disable fast_cmov
  4557. ;;
  4558. esac
  4559. fi
  4560. if [ "$cpu" != generic ]; then
  4561. add_cflags $cpuflags
  4562. add_asflags $cpuflags
  4563. test "$cc_type" = "$ld_type" && add_ldflags $cpuflags
  4564. fi
  4565. # compiler sanity check
  4566. test_exec <<EOF
  4567. int main(void){ return 0; }
  4568. EOF
  4569. if test "$?" != 0; then
  4570. echo "$cc is unable to create an executable file."
  4571. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  4572. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  4573. echo "Only do this if you know what cross compiling means."
  4574. fi
  4575. die "C compiler test failed."
  4576. fi
  4577. add_cppflags -D_ISOC99_SOURCE
  4578. add_cxxflags -D__STDC_CONSTANT_MACROS
  4579. check_cxxflags -std=c++11 || check_cxxflags -std=c++0x
  4580. # some compilers silently accept -std=c11, so we also need to check that the
  4581. # version macro is defined properly
  4582. test_cflags_cc -std=c11 ctype.h "__STDC_VERSION__ >= 201112L" &&
  4583. add_cflags -std=c11 ||
  4584. check_cflags -std=c99
  4585. check_cppflags -D_FILE_OFFSET_BITS=64
  4586. check_cppflags -D_LARGEFILE_SOURCE
  4587. add_host_cppflags -D_ISOC99_SOURCE
  4588. check_host_cflags -std=c99
  4589. check_host_cflags -Wall
  4590. check_host_cflags $host_cflags_speed
  4591. check_64bit(){
  4592. arch32=$1
  4593. arch64=$2
  4594. expr=${3:-'sizeof(void *) > 4'}
  4595. test_code cc "" "int test[2*($expr) - 1]" &&
  4596. subarch=$arch64 || subarch=$arch32
  4597. enable $subarch
  4598. }
  4599. case "$arch" in
  4600. aarch64|alpha|ia64)
  4601. enabled shared && enable_weak pic
  4602. ;;
  4603. mips)
  4604. check_64bit mips mips64 '_MIPS_SIM > 1'
  4605. enabled shared && enable_weak pic
  4606. ;;
  4607. parisc)
  4608. check_64bit parisc parisc64
  4609. enabled shared && enable_weak pic
  4610. ;;
  4611. ppc)
  4612. check_64bit ppc ppc64
  4613. enabled shared && enable_weak pic
  4614. ;;
  4615. s390)
  4616. check_64bit s390 s390x
  4617. enabled shared && enable_weak pic
  4618. ;;
  4619. sparc)
  4620. check_64bit sparc sparc64
  4621. enabled shared && enable_weak pic
  4622. ;;
  4623. x86)
  4624. check_64bit x86_32 x86_64
  4625. # Treat x32 as x64 for now. Note it also needs pic if shared
  4626. test "$subarch" = "x86_32" && test_cpp_condition stddef.h 'defined(__x86_64__)' &&
  4627. subarch=x86_64 && enable x86_64 && disable x86_32
  4628. if enabled x86_64; then
  4629. enabled shared && enable_weak pic
  4630. objformat=elf64
  4631. fi
  4632. ;;
  4633. esac
  4634. # OS specific
  4635. case $target_os in
  4636. aix)
  4637. SHFLAGS=-shared
  4638. add_cppflags '-I\$(SRC_PATH)/compat/aix'
  4639. enabled shared && add_ldflags -Wl,-brtl
  4640. arflags='-Xany -r -c'
  4641. striptype=""
  4642. ;;
  4643. android)
  4644. disable symver
  4645. enable section_data_rel_ro
  4646. SLIB_INSTALL_NAME='$(SLIBNAME)'
  4647. SLIB_INSTALL_LINKS=
  4648. SHFLAGS='-shared -Wl,-soname,$(SLIBNAME)'
  4649. ;;
  4650. haiku)
  4651. prefix_default="/boot/common"
  4652. network_extralibs="-lnetwork"
  4653. host_extralibs=
  4654. ;;
  4655. sunos)
  4656. SHFLAGS='-shared -Wl,-h,$$(@F)'
  4657. enabled x86 && append SHFLAGS -mimpure-text
  4658. network_extralibs="-lsocket -lnsl"
  4659. add_cppflags -D__EXTENSIONS__
  4660. # When using suncc to build, the Solaris linker will mark
  4661. # an executable with each instruction set encountered by
  4662. # the Solaris assembler. As our libraries contain their own
  4663. # guards for processor-specific code, instead suppress
  4664. # generation of the HWCAPS ELF section on Solaris x86 only.
  4665. enabled_all suncc x86 &&
  4666. echo "hwcap_1 = OVERRIDE;" > mapfile &&
  4667. add_ldflags -Wl,-M,mapfile
  4668. nm_default='nm -P -g'
  4669. version_script='-M'
  4670. VERSION_SCRIPT_POSTPROCESS_CMD='perl $(SRC_PATH)/compat/solaris/make_sunver.pl - $(OBJS)'
  4671. ;;
  4672. netbsd)
  4673. disable symver
  4674. oss_indev_extralibs="-lossaudio"
  4675. oss_outdev_extralibs="-lossaudio"
  4676. enabled gcc || check_ldflags -Wl,-zmuldefs
  4677. ;;
  4678. openbsd|bitrig)
  4679. disable symver
  4680. striptype=""
  4681. SHFLAGS='-shared'
  4682. SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
  4683. SLIB_INSTALL_LINKS=
  4684. oss_indev_extralibs="-lossaudio"
  4685. oss_outdev_extralibs="-lossaudio"
  4686. ;;
  4687. dragonfly)
  4688. disable symver
  4689. ;;
  4690. freebsd)
  4691. ;;
  4692. bsd/os)
  4693. add_extralibs -lpoll -lgnugetopt
  4694. strip="strip -d"
  4695. ;;
  4696. darwin)
  4697. enabled ppc && add_asflags -force_cpusubtype_ALL
  4698. install_name_dir_default='$(SHLIBDIR)'
  4699. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(INSTALL_NAME_DIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  4700. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  4701. strip="${strip} -x"
  4702. add_ldflags -Wl,-dynamic,-search_paths_first
  4703. check_cflags -Werror=partial-availability
  4704. SLIBSUF=".dylib"
  4705. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  4706. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  4707. enabled x86_64 && objformat="macho64" || objformat="macho32"
  4708. enabled_any pic shared x86_64 ||
  4709. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  4710. check_header dispatch/dispatch.h &&
  4711. add_cppflags '-I\$(SRC_PATH)/compat/dispatch_semaphore'
  4712. if test -n "$sysroot"; then
  4713. is_in -isysroot $cc $CPPFLAGS $CFLAGS || check_cppflags -isysroot $sysroot
  4714. is_in -isysroot $ld $LDFLAGS || check_ldflags -isysroot $sysroot
  4715. fi
  4716. version_script='-exported_symbols_list'
  4717. VERSION_SCRIPT_POSTPROCESS_CMD='tr " " "\n" | sed -n /global:/,/local:/p | grep ";" | tr ";" "\n" | sed -E "s/(.+)/_\1/g" | sed -E "s/(.+[^*])$$$$/\1*/"'
  4718. ;;
  4719. msys*)
  4720. die "Native MSYS builds are discouraged, please use the MINGW environment."
  4721. ;;
  4722. mingw32*|mingw64*)
  4723. target_os=mingw32
  4724. LIBTARGET=i386
  4725. if enabled x86_64; then
  4726. LIBTARGET="i386:x86-64"
  4727. elif enabled arm; then
  4728. LIBTARGET="arm"
  4729. elif enabled aarch64; then
  4730. LIBTARGET="arm64"
  4731. fi
  4732. if enabled shared; then
  4733. # Cannot build both shared and static libs when using dllimport.
  4734. disable static
  4735. fi
  4736. enabled shared && ! enabled small && test_cmd $windres --version && enable gnu_windres
  4737. enabled x86_32 && check_ldflags -Wl,--large-address-aware
  4738. shlibdir_default="$bindir_default"
  4739. SLIBPREF=""
  4740. SLIBSUF=".dll"
  4741. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  4742. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  4743. if test_cmd lib.exe -list; then
  4744. SLIB_EXTRA_CMD=-'lib.exe -nologo -machine:$(LIBTARGET) -def:$$(@:$(SLIBSUF)=.def) -out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  4745. if enabled x86_64; then
  4746. LIBTARGET=x64
  4747. fi
  4748. else
  4749. SLIB_EXTRA_CMD=-'$(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
  4750. fi
  4751. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  4752. SLIB_INSTALL_LINKS=
  4753. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  4754. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  4755. 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)'
  4756. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--disable-auto-image-base $$(@:$(SLIBSUF)=.def)'
  4757. enabled x86_64 && objformat="win64" || objformat="win32"
  4758. dlltool="${cross_prefix}dlltool"
  4759. ranlib=:
  4760. enable dos_paths
  4761. check_ldflags -Wl,--nxcompat,--dynamicbase
  4762. # Lets work around some stupidity in binutils.
  4763. # ld will strip relocations from executables even though we need them
  4764. # for dynamicbase (ASLR). Using -pie does retain the reloc section
  4765. # however ld then forgets what the entry point should be (oops) so we
  4766. # have to manually (re)set it.
  4767. if enabled x86_32; then
  4768. disabled debug && add_ldexeflags -Wl,--pic-executable,-e,_mainCRTStartup
  4769. elif enabled x86_64; then
  4770. disabled debug && add_ldexeflags -Wl,--pic-executable,-e,mainCRTStartup
  4771. check_ldflags -Wl,--high-entropy-va # binutils 2.25
  4772. # Set image base >4GB for extra entropy with HEASLR
  4773. add_ldexeflags -Wl,--image-base,0x140000000
  4774. append SHFLAGS -Wl,--image-base,0x180000000
  4775. fi
  4776. ;;
  4777. win32|win64)
  4778. disable symver
  4779. if enabled shared; then
  4780. # Link to the import library instead of the normal static library
  4781. # for shared libs.
  4782. LD_LIB='%.lib'
  4783. # Cannot build both shared and static libs with MSVC or icl.
  4784. disable static
  4785. fi
  4786. enabled x86_32 && check_ldflags -LARGEADDRESSAWARE
  4787. shlibdir_default="$bindir_default"
  4788. SLIBPREF=""
  4789. SLIBSUF=".dll"
  4790. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  4791. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  4792. SLIB_CREATE_DEF_CMD='EXTERN_PREFIX="$(EXTERN_PREFIX)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
  4793. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  4794. SLIB_INSTALL_LINKS=
  4795. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  4796. SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  4797. SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  4798. enabled x86_64 && objformat="win64" || objformat="win32"
  4799. ranlib=:
  4800. enable dos_paths
  4801. ;;
  4802. cygwin*)
  4803. target_os=cygwin
  4804. shlibdir_default="$bindir_default"
  4805. SLIBPREF="cyg"
  4806. SLIBSUF=".dll"
  4807. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  4808. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  4809. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  4810. SLIB_INSTALL_LINKS=
  4811. SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
  4812. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
  4813. enabled x86_64 && objformat="win64" || objformat="win32"
  4814. enable dos_paths
  4815. enabled shared && ! enabled small && test_cmd $windres --version && enable gnu_windres
  4816. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  4817. ;;
  4818. *-dos|freedos|opendos)
  4819. network_extralibs="-lsocket"
  4820. objformat="coff"
  4821. enable dos_paths
  4822. add_cppflags -U__STRICT_ANSI__
  4823. ;;
  4824. linux)
  4825. enable section_data_rel_ro
  4826. enabled_any arm aarch64 && enable_weak linux_perf
  4827. ;;
  4828. irix*)
  4829. target_os=irix
  4830. ranlib="echo ignoring ranlib"
  4831. ;;
  4832. os/2*)
  4833. strip="lxlite -CS"
  4834. striptype=""
  4835. objformat="aout"
  4836. add_cppflags -D_GNU_SOURCE
  4837. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zhigh-mem -Zmap
  4838. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  4839. LIBSUF="_s.a"
  4840. SLIBPREF=""
  4841. SLIBSUF=".dll"
  4842. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  4843. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(FULLNAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  4844. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(FULLNAME).def; \
  4845. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(FULLNAME).def; \
  4846. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(FULLNAME).def; \
  4847. echo EXPORTS >> $(SUBDIR)$(FULLNAME).def; \
  4848. emxexp $(OBJS) >> $(SUBDIR)$(FULLNAME).def'
  4849. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(FULLNAME)_dll.a $(SUBDIR)$(FULLNAME).def; \
  4850. emximp -o $(SUBDIR)$(LIBPREF)$(FULLNAME)_dll.lib $(SUBDIR)$(FULLNAME).def;'
  4851. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  4852. SLIB_INSTALL_LINKS=
  4853. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(FULLNAME)_dll.a $(LIBPREF)$(FULLNAME)_dll.lib'
  4854. enable dos_paths
  4855. enable_weak os2threads
  4856. ;;
  4857. gnu/kfreebsd)
  4858. add_cppflags -D_BSD_SOURCE
  4859. ;;
  4860. gnu)
  4861. ;;
  4862. qnx)
  4863. add_cppflags -D_QNX_SOURCE
  4864. network_extralibs="-lsocket"
  4865. ;;
  4866. symbian)
  4867. SLIBSUF=".dll"
  4868. enable dos_paths
  4869. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  4870. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  4871. add_ldflags -Wl,--target1-abs,--no-undefined \
  4872. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  4873. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  4874. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  4875. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  4876. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  4877. ;;
  4878. minix)
  4879. ;;
  4880. none)
  4881. ;;
  4882. *)
  4883. die "Unknown OS '$target_os'."
  4884. ;;
  4885. esac
  4886. # test if creating links works
  4887. link_dest=$(mktemp -u $TMPDIR/dest_XXXXXXXX)
  4888. link_name=$(mktemp -u $TMPDIR/name_XXXXXXXX)
  4889. mkdir "$link_dest"
  4890. $ln_s "$link_dest" "$link_name"
  4891. touch "$link_dest/test_file"
  4892. if [ "$source_path" != "." ] && ([ ! -d src ] || [ -L src ]) && [ -e "$link_name/test_file" ]; then
  4893. # create link to source path
  4894. [ -e src ] && rm src
  4895. $ln_s "$source_path" src
  4896. source_link=src
  4897. else
  4898. # creating directory links doesn't work
  4899. # fall back to using the full source path
  4900. source_link="$source_path"
  4901. fi
  4902. # cleanup
  4903. rm -r "$link_dest"
  4904. rm -r "$link_name"
  4905. # determine libc flavour
  4906. probe_libc(){
  4907. pfx=$1
  4908. pfx_no_=${pfx%_}
  4909. # uclibc defines __GLIBC__, so it needs to be checked before glibc.
  4910. if test_${pfx}cpp_condition features.h "defined __UCLIBC__"; then
  4911. eval ${pfx}libc_type=uclibc
  4912. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  4913. elif test_${pfx}cpp_condition features.h "defined __GLIBC__"; then
  4914. eval ${pfx}libc_type=glibc
  4915. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  4916. # MinGW headers can be installed on Cygwin, so check for newlib first.
  4917. elif test_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
  4918. eval ${pfx}libc_type=newlib
  4919. add_${pfx}cppflags -U__STRICT_ANSI__ -D_XOPEN_SOURCE=600
  4920. # MinGW64 is backwards compatible with MinGW32, so check for it first.
  4921. elif test_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then
  4922. eval ${pfx}libc_type=mingw64
  4923. if test_${pfx}cpp_condition _mingw.h "__MINGW64_VERSION_MAJOR < 3"; then
  4924. add_compat msvcrt/snprintf.o
  4925. add_cflags "-include $source_path/compat/msvcrt/snprintf.h"
  4926. fi
  4927. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  4928. eval test \$${pfx_no_}cc_type = "gcc" &&
  4929. add_${pfx}cppflags -D__printf__=__gnu_printf__
  4930. test_${pfx}cpp_condition windows.h "!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600" &&
  4931. add_${pfx}cppflags -D_WIN32_WINNT=0x0600
  4932. elif test_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION" ||
  4933. test_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then
  4934. eval ${pfx}libc_type=mingw32
  4935. test_${pfx}cpp_condition _mingw.h "__MINGW32_MAJOR_VERSION > 3 || \
  4936. (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  4937. die "ERROR: MinGW32 runtime version must be >= 3.15."
  4938. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  4939. test_${pfx}cpp_condition _mingw.h "__MSVCRT_VERSION__ < 0x0700" &&
  4940. add_${pfx}cppflags -D__MSVCRT_VERSION__=0x0700
  4941. test_${pfx}cpp_condition windows.h "!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600" &&
  4942. add_${pfx}cppflags -D_WIN32_WINNT=0x0600
  4943. eval test \$${pfx_no_}cc_type = "gcc" &&
  4944. add_${pfx}cppflags -D__printf__=__gnu_printf__
  4945. elif test_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then
  4946. eval ${pfx}libc_type=msvcrt
  4947. if test_${pfx}cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION < 14"; then
  4948. if [ "$pfx" = host_ ]; then
  4949. add_host_cppflags -Dsnprintf=_snprintf
  4950. else
  4951. add_compat strtod.o strtod=avpriv_strtod
  4952. add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
  4953. _snprintf=avpriv_snprintf \
  4954. vsnprintf=avpriv_vsnprintf
  4955. fi
  4956. fi
  4957. add_${pfx}cppflags -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS
  4958. # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
  4959. # 0x601 by default unless something else is set by the user.
  4960. # This can easily lead to us detecting functions only present
  4961. # in such new versions and producing binaries requiring windows 7.0.
  4962. # Therefore explicitly set the default to Vista unless the user has
  4963. # set something else on the command line.
  4964. # Don't do this if WINAPI_FAMILY is set and is set to a non-desktop
  4965. # family. For these cases, configure is free to use any functions
  4966. # found in the SDK headers by default. (Alternatively, we could force
  4967. # _WIN32_WINNT to 0x0602 in that case.)
  4968. test_${pfx}cpp_condition stdlib.h "defined(_WIN32_WINNT)" ||
  4969. { test_${pfx}cpp <<EOF && add_${pfx}cppflags -D_WIN32_WINNT=0x0600; }
  4970. #ifdef WINAPI_FAMILY
  4971. #include <winapifamily.h>
  4972. #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  4973. #error not desktop
  4974. #endif
  4975. #endif
  4976. EOF
  4977. if [ "$pfx" = "" ]; then
  4978. check_func strtoll || add_cflags -Dstrtoll=_strtoi64
  4979. check_func strtoull || add_cflags -Dstrtoull=_strtoui64
  4980. fi
  4981. elif test_${pfx}cpp_condition stddef.h "defined __KLIBC__"; then
  4982. eval ${pfx}libc_type=klibc
  4983. elif test_${pfx}cpp_condition sys/cdefs.h "defined __BIONIC__"; then
  4984. eval ${pfx}libc_type=bionic
  4985. elif test_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then
  4986. eval ${pfx}libc_type=solaris
  4987. add_${pfx}cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
  4988. fi
  4989. test_${pfx}cc <<EOF
  4990. #include <time.h>
  4991. void *v = localtime_r;
  4992. EOF
  4993. 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
  4994. #include <time.h>
  4995. void *v = localtime_r;
  4996. EOF
  4997. eval test -n "\${${pfx}libc_type}" && enable ${pfx}libc_${libc_type}
  4998. }
  4999. probe_libc
  5000. probe_libc host_
  5001. # hacks for compiler/libc/os combinations
  5002. case $libc_type in
  5003. bionic)
  5004. add_compat strtod.o strtod=avpriv_strtod
  5005. ;;
  5006. esac
  5007. check_compile_assert flt_lim "float.h limits.h" "DBL_MAX == (double)DBL_MAX" ||
  5008. add_cppflags '-I\$(SRC_PATH)/compat/float'
  5009. test_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic
  5010. set_default libdir
  5011. : ${shlibdir_default:="$libdir"}
  5012. : ${pkgconfigdir_default:="$libdir/pkgconfig"}
  5013. set_default $PATHS_LIST
  5014. set_default nm
  5015. disabled optimizations || enabled ossfuzz || check_cflags -fomit-frame-pointer
  5016. enable_weak_pic() {
  5017. disabled pic && return
  5018. enable pic
  5019. add_cppflags -DPIC
  5020. case "$target_os" in
  5021. mingw*|cygwin*|win*)
  5022. ;;
  5023. *)
  5024. add_cflags -fPIC
  5025. add_asflags -fPIC
  5026. ;;
  5027. esac
  5028. }
  5029. enabled pic && enable_weak_pic
  5030. test_cc <<EOF || die "Symbol mangling check failed."
  5031. int ff_extern;
  5032. EOF
  5033. sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  5034. extern_prefix=${sym%%ff_extern*}
  5035. ! disabled inline_asm && check_inline_asm inline_asm '"" ::'
  5036. for restrict_keyword in restrict __restrict__ __restrict ""; do
  5037. test_code cc "" "char * $restrict_keyword p" && break
  5038. done
  5039. check_cc pragma_deprecated "" '_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")'
  5040. # The global variable ensures the bits appear unchanged in the object file.
  5041. test_cc <<EOF || die "endian test failed"
  5042. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  5043. EOF
  5044. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  5045. check_cc const_nan math.h "struct { double d; } static const bar[] = { { NAN } }"
  5046. if ! enabled ppc64 || enabled bigendian; then
  5047. disable vsx
  5048. fi
  5049. check_gas() {
  5050. log "check_gas using '$as' as AS"
  5051. # :vararg is used on aarch64, arm and ppc altivec
  5052. check_as vararg "
  5053. .macro m n, y:vararg=0
  5054. \n: .int \y
  5055. .endm
  5056. m x" || return 1
  5057. # .altmacro is only used in arm asm
  5058. ! enabled arm || check_as gnu_as ".altmacro"
  5059. }
  5060. if enabled_any arm aarch64 || enabled_all ppc altivec && enabled asm; then
  5061. nogas=:
  5062. enabled_any arm aarch64 && nogas=die
  5063. enabled_all ppc altivec && [ $target_os_default != aix ] && nogas=warn
  5064. as_noop=-v
  5065. case $as_type in
  5066. arm*) gaspp_as_type=armasm; as_noop=-h ;;
  5067. gcc) gaspp_as_type=gas ;;
  5068. *) gaspp_as_type=$as_type ;;
  5069. esac
  5070. [ $target_os = "darwin" ] && gaspp_as_type="apple-$gaspp_as_type"
  5071. test "${as#*gas-preprocessor.pl}" != "$as" ||
  5072. test_cmd gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- ${as:=$cc} $as_noop &&
  5073. gas="${gas:=gas-preprocessor.pl} -arch $arch -as-type $gaspp_as_type -- ${as:=$cc}"
  5074. if ! check_gas ; then
  5075. as=${gas:=$as}
  5076. check_gas || \
  5077. $nogas "GNU assembler not found, install/update gas-preprocessor"
  5078. fi
  5079. check_as as_func ".func test
  5080. .endfunc"
  5081. fi
  5082. check_inline_asm inline_asm_labels '"1:\n"'
  5083. check_inline_asm inline_asm_nonlocal_labels '"Label:\n"'
  5084. if enabled aarch64; then
  5085. enabled armv8 && check_insn armv8 'prfm pldl1strm, [x0]'
  5086. # internal assembler in clang 3.3 does not support this instruction
  5087. enabled neon && check_insn neon 'ext v0.8B, v0.8B, v1.8B, #1'
  5088. enabled vfp && check_insn vfp 'fmadd d0, d0, d1, d2'
  5089. map 'enabled_any ${v}_external ${v}_inline || disable $v' $ARCH_EXT_LIST_ARM
  5090. elif enabled alpha; then
  5091. check_cflags -mieee
  5092. elif enabled arm; then
  5093. enabled msvc && check_cpp_condition thumb stddef.h "defined _M_ARMT"
  5094. test_cpp_condition stddef.h "defined __thumb__" && test_cc <<EOF && enable_weak thumb
  5095. float func(float a, float b){ return a+b; }
  5096. EOF
  5097. enabled thumb && check_cflags -mthumb || check_cflags -marm
  5098. if check_cpp_condition vfp_args stddef.h "defined __ARM_PCS_VFP"; then
  5099. :
  5100. elif check_cpp_condition vfp_args stddef.h "defined _M_ARM_FP && _M_ARM_FP >= 30"; then
  5101. :
  5102. elif ! test_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__" && [ $target_os != darwin ]; then
  5103. case "${cross_prefix:-$cc}" in
  5104. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  5105. *) check_ld "cc" vfp_args <<EOF && fpabi=vfp || fpabi=soft ;;
  5106. __asm__ (".eabi_attribute 28, 1");
  5107. int main(void) { return 0; }
  5108. EOF
  5109. esac
  5110. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  5111. fi
  5112. enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
  5113. enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
  5114. enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
  5115. enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
  5116. enabled vfp && check_insn vfp 'fadds s0, s0, s0'
  5117. enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
  5118. enabled setend && check_insn setend 'setend be'
  5119. [ $target_os = linux ] || [ $target_os = android ] ||
  5120. map 'enabled_any ${v}_external ${v}_inline || disable $v' \
  5121. $ARCH_EXT_LIST_ARM
  5122. check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
  5123. check_as as_arch_directive ".arch armv7-a"
  5124. check_as as_dn_directive "ra .dn d0.i16"
  5125. check_as as_fpu_directive ".fpu neon"
  5126. # llvm's integrated assembler supports .object_arch from llvm 3.5
  5127. [ "$objformat" = elf32 ] || [ "$objformat" = elf64 ] &&
  5128. check_as as_object_arch ".object_arch armv4"
  5129. # MS armasm fails to assemble our PIC constructs
  5130. [ $target_os != win32 ] && enabled_all armv6t2 shared !pic && enable_weak_pic
  5131. elif enabled mips; then
  5132. enabled loongson2 && check_inline_asm loongson2 '"dmult.g $8, $9, $10"'
  5133. enabled loongson3 && check_inline_asm loongson3 '"gsldxc1 $f0, 0($2, $3)"'
  5134. enabled mmi && check_inline_asm mmi '"punpcklhw $f0, $f0, $f0"'
  5135. # Enable minimum ISA based on selected options
  5136. if enabled mips64; then
  5137. enabled mips64r6 && check_inline_asm_flags mips64r6 '"dlsa $0, $0, $0, 1"' '-mips64r6'
  5138. enabled mips64r2 && check_inline_asm_flags mips64r2 '"dext $0, $0, 0, 1"' '-mips64r2'
  5139. disabled mips64r6 && disabled mips64r2 && check_inline_asm_flags mips64r1 '"daddi $0, $0, 0"' '-mips64'
  5140. else
  5141. enabled mips32r6 && check_inline_asm_flags mips32r6 '"aui $0, $0, 0"' '-mips32r6'
  5142. enabled mips32r5 && check_inline_asm_flags mips32r5 '"eretnc"' '-mips32r5'
  5143. enabled mips32r2 && check_inline_asm_flags mips32r2 '"ext $0, $0, 0, 1"' '-mips32r2'
  5144. disabled mips32r6 && disabled mips32r5 && disabled mips32r2 && check_inline_asm_flags mips32r1 '"addi $0, $0, 0"' '-mips32'
  5145. fi
  5146. enabled mipsfpu && check_inline_asm_flags mipsfpu '"cvt.d.l $f0, $f2"' '-mhard-float'
  5147. enabled mipsfpu && (enabled mips32r5 || enabled mips32r6 || enabled mips64r6) && check_inline_asm_flags mipsfpu '"cvt.d.l $f0, $f1"' '-mfp64'
  5148. enabled mipsfpu && enabled msa && check_inline_asm_flags msa '"addvi.b $w0, $w1, 1"' '-mmsa' && check_header msa.h || disable msa
  5149. enabled mipsdsp && check_inline_asm_flags mipsdsp '"addu.qb $t0, $t1, $t2"' '-mdsp'
  5150. enabled mipsdspr2 && check_inline_asm_flags mipsdspr2 '"absq_s.qb $t0, $t1"' '-mdspr2'
  5151. if enabled bigendian && enabled msa; then
  5152. disable msa
  5153. fi
  5154. elif enabled parisc; then
  5155. if enabled gcc; then
  5156. case $($cc -dumpversion) in
  5157. 4.[3-9].*) check_cflags -fno-optimize-sibling-calls ;;
  5158. esac
  5159. fi
  5160. elif enabled ppc; then
  5161. enable local_aligned
  5162. check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  5163. check_inline_asm ibm_asm '"add 0, 0, 0"'
  5164. check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
  5165. check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  5166. if enabled altivec; then
  5167. check_cflags -maltivec -mabi=altivec
  5168. # check if our compiler supports Motorola AltiVec C API
  5169. check_cc altivec altivec.h "vector signed int v1 = (vector signed int) { 0 };
  5170. vector signed int v2 = (vector signed int) { 1 };
  5171. v1 = vec_add(v1, v2);"
  5172. enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
  5173. fi
  5174. if enabled vsx; then
  5175. check_cflags -mvsx &&
  5176. check_cc vsx altivec.h "int v[4] = { 0 };
  5177. vector signed int v1 = vec_vsx_ld(0, v);"
  5178. fi
  5179. if enabled power8; then
  5180. check_cpp_condition power8 "altivec.h" "defined(_ARCH_PWR8)"
  5181. fi
  5182. elif enabled x86; then
  5183. check_builtin rdtsc intrin.h "__rdtsc()"
  5184. check_builtin mm_empty mmintrin.h "_mm_empty()"
  5185. enable local_aligned
  5186. # check whether EBP is available on x86
  5187. # As 'i' is stored on the stack, this program will crash
  5188. # if the base pointer is used to access it because the
  5189. # base pointer is cleared in the inline assembly code.
  5190. check_exec_crash <<EOF && enable ebp_available
  5191. volatile int i=0;
  5192. __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
  5193. return i;
  5194. EOF
  5195. # check whether EBX is available on x86
  5196. check_inline_asm ebx_available '""::"b"(0)' &&
  5197. check_inline_asm ebx_available '"":::"%ebx"'
  5198. # check whether xmm clobbers are supported
  5199. check_inline_asm xmm_clobbers '"":::"%xmm0"'
  5200. check_inline_asm inline_asm_direct_symbol_refs '"movl '$extern_prefix'test, %eax"' ||
  5201. check_inline_asm inline_asm_direct_symbol_refs '"movl '$extern_prefix'test(%rip), %eax"'
  5202. # check whether binutils is new enough to compile SSSE3/MMXEXT
  5203. enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
  5204. enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
  5205. probe_x86asm(){
  5206. x86asmexe_probe=$1
  5207. if test_cmd $x86asmexe_probe -v; then
  5208. x86asmexe=$x86asmexe_probe
  5209. x86asm_type=nasm
  5210. x86asm_debug="-g -F dwarf"
  5211. X86ASMDEP=
  5212. X86ASM_DEPFLAGS='-MD $(@:.o=.d)'
  5213. elif test_cmd $x86asmexe_probe --version; then
  5214. x86asmexe=$x86asmexe_probe
  5215. x86asm_type=yasm
  5216. x86asm_debug="-g dwarf2"
  5217. X86ASMDEP='$(DEPX86ASM) $(X86ASMFLAGS) -M $(X86ASM_O) $< > $(@:.o=.d)'
  5218. X86ASM_DEPFLAGS=
  5219. fi
  5220. check_x86asm x86asm "movbe ecx, [5]"
  5221. }
  5222. if ! disabled_any asm mmx x86asm; then
  5223. disable x86asm
  5224. for program in $x86asmexe nasm yasm; do
  5225. probe_x86asm $program && break
  5226. done
  5227. disabled x86asm && die "nasm/yasm not found or too old. Use --disable-x86asm for a crippled build."
  5228. X86ASMFLAGS="-f $objformat"
  5229. enabled pic && append X86ASMFLAGS "-DPIC"
  5230. test -n "$extern_prefix" && append X86ASMFLAGS "-DPREFIX"
  5231. case "$objformat" in
  5232. elf*) enabled debug && append X86ASMFLAGS $x86asm_debug ;;
  5233. esac
  5234. check_x86asm avx512_external "vmovdqa32 [eax]{k1}{z}, zmm0"
  5235. check_x86asm avx2_external "vextracti128 xmm0, ymm0, 0"
  5236. check_x86asm xop_external "vpmacsdd xmm0, xmm1, xmm2, xmm3"
  5237. check_x86asm fma4_external "vfmaddps ymm0, ymm1, ymm2, ymm3"
  5238. check_x86asm cpunop "CPU amdnop"
  5239. fi
  5240. case "$cpu" in
  5241. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  5242. disable fast_clz
  5243. ;;
  5244. esac
  5245. fi
  5246. check_cc intrinsics_neon arm_neon.h "int16x8_t test = vdupq_n_s16(0)"
  5247. check_ldflags -Wl,--as-needed
  5248. check_ldflags -Wl,-z,noexecstack
  5249. if ! disabled network; then
  5250. check_func getaddrinfo $network_extralibs
  5251. check_func inet_aton $network_extralibs
  5252. check_type netdb.h "struct addrinfo"
  5253. check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
  5254. check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
  5255. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  5256. check_type poll.h "struct pollfd"
  5257. check_type netinet/sctp.h "struct sctp_event_subscribe"
  5258. check_struct "sys/socket.h" "struct msghdr" msg_flags
  5259. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  5260. check_type netinet/in.h "struct sockaddr_in6"
  5261. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  5262. check_type "sys/types.h sys/socket.h" socklen_t
  5263. # Prefer arpa/inet.h over winsock2
  5264. if check_header arpa/inet.h ; then
  5265. check_func closesocket
  5266. elif check_header winsock2.h ; then
  5267. check_func_headers winsock2.h closesocket -lws2 &&
  5268. network_extralibs="-lws2" ||
  5269. { check_func_headers winsock2.h closesocket -lws2_32 &&
  5270. network_extralibs="-lws2_32"; } || disable winsock2_h network
  5271. check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
  5272. check_type ws2tcpip.h socklen_t
  5273. check_type ws2tcpip.h "struct addrinfo"
  5274. check_type ws2tcpip.h "struct group_source_req"
  5275. check_type ws2tcpip.h "struct ip_mreq_source"
  5276. check_type ws2tcpip.h "struct ipv6_mreq"
  5277. check_type winsock2.h "struct pollfd"
  5278. check_struct winsock2.h "struct sockaddr" sa_len
  5279. check_type ws2tcpip.h "struct sockaddr_in6"
  5280. check_type ws2tcpip.h "struct sockaddr_storage"
  5281. else
  5282. disable network
  5283. fi
  5284. fi
  5285. check_builtin atomic_cas_ptr atomic.h "void **ptr; void *oldval, *newval; atomic_cas_ptr(ptr, oldval, newval)"
  5286. check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
  5287. check_builtin MemoryBarrier windows.h "MemoryBarrier()"
  5288. check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
  5289. check_builtin gmtime_r time.h "time_t *time; struct tm *tm; gmtime_r(time, tm)"
  5290. check_builtin localtime_r time.h "time_t *time; struct tm *tm; localtime_r(time, tm)"
  5291. check_builtin x264_csp_bgr "stdint.h x264.h" "X264_CSP_BGR"
  5292. case "$custom_allocator" in
  5293. jemalloc)
  5294. # jemalloc by default does not use a prefix
  5295. require libjemalloc jemalloc/jemalloc.h malloc -ljemalloc
  5296. ;;
  5297. tcmalloc)
  5298. require_pkg_config libtcmalloc libtcmalloc gperftools/tcmalloc.h tc_malloc
  5299. malloc_prefix=tc_
  5300. ;;
  5301. esac
  5302. check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
  5303. check_func ${malloc_prefix}memalign && enable memalign
  5304. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  5305. check_func access
  5306. check_func_headers stdlib.h arc4random
  5307. check_lib clock_gettime time.h clock_gettime || check_lib clock_gettime time.h clock_gettime -lrt
  5308. check_func fcntl
  5309. check_func fork
  5310. check_func gethrtime
  5311. check_func getopt
  5312. check_func getrusage
  5313. check_func gettimeofday
  5314. check_func isatty
  5315. check_func mkstemp
  5316. check_func mmap
  5317. check_func mprotect
  5318. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  5319. check_func_headers time.h nanosleep || check_lib nanosleep time.h nanosleep -lrt
  5320. check_func sched_getaffinity
  5321. check_func setrlimit
  5322. check_struct "sys/stat.h" "struct stat" st_mtim.tv_nsec -D_BSD_SOURCE
  5323. check_func strerror_r
  5324. check_func sysconf
  5325. check_func sysctl
  5326. check_func usleep
  5327. check_func_headers conio.h kbhit
  5328. check_func_headers io.h setmode
  5329. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  5330. check_func_headers mach/mach_time.h mach_absolute_time
  5331. check_func_headers stdlib.h getenv
  5332. check_func_headers sys/stat.h lstat
  5333. check_func_headers windows.h GetProcessAffinityMask
  5334. check_func_headers windows.h GetProcessTimes
  5335. check_func_headers windows.h GetSystemTimeAsFileTime
  5336. check_func_headers windows.h LoadLibrary
  5337. check_func_headers windows.h MapViewOfFile
  5338. check_func_headers windows.h PeekNamedPipe
  5339. check_func_headers windows.h SetConsoleTextAttribute
  5340. check_func_headers windows.h SetConsoleCtrlHandler
  5341. check_func_headers windows.h Sleep
  5342. check_func_headers windows.h VirtualAlloc
  5343. check_func_headers glob.h glob
  5344. enabled xlib &&
  5345. check_lib xlib "X11/Xlib.h X11/extensions/Xvlib.h" XvGetPortAttribute -lXv -lX11 -lXext
  5346. check_header direct.h
  5347. check_header dirent.h
  5348. check_header dxgidebug.h
  5349. check_header dxva.h
  5350. check_header dxva2api.h -D_WIN32_WINNT=0x0600
  5351. check_header io.h
  5352. check_header linux/perf_event.h
  5353. check_header libcrystalhd/libcrystalhd_if.h
  5354. check_header malloc.h
  5355. check_header net/udplite.h
  5356. check_header poll.h
  5357. check_header sys/param.h
  5358. check_header sys/resource.h
  5359. check_header sys/select.h
  5360. check_header sys/time.h
  5361. check_header sys/un.h
  5362. check_header termios.h
  5363. check_header unistd.h
  5364. check_header valgrind/valgrind.h
  5365. check_func_headers VideoToolbox/VTCompressionSession.h VTCompressionSessionPrepareToEncodeFrames -framework VideoToolbox
  5366. check_header windows.h
  5367. check_header X11/extensions/XvMClib.h
  5368. check_header asm/types.h
  5369. # it seems there are versions of clang in some distros that try to use the
  5370. # gcc headers, which explodes for stdatomic
  5371. # so we also check that atomics actually work here
  5372. check_builtin stdatomic stdatomic.h "atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0); foo += bar"
  5373. check_lib advapi32 "windows.h" RegCloseKey -ladvapi32
  5374. check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom -lbcrypt &&
  5375. check_cpp_condition bcrypt bcrypt.h "defined BCRYPT_RNG_ALGORITHM"
  5376. check_lib ole32 "windows.h" CoTaskMemFree -lole32
  5377. check_lib shell32 "windows.h shellapi.h" CommandLineToArgvW -lshell32
  5378. check_lib psapi "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  5379. check_lib android android/native_window.h ANativeWindow_acquire -landroid
  5380. check_lib mediandk "stdint.h media/NdkImage.h" AImage_delete -lmediandk
  5381. check_lib camera2ndk "stdbool.h stdint.h camera/NdkCameraManager.h" ACameraManager_create -lcamera2ndk
  5382. enabled appkit && check_apple_framework AppKit
  5383. enabled audiotoolbox && check_apple_framework AudioToolbox
  5384. enabled avfoundation && check_apple_framework AVFoundation
  5385. enabled coreimage && check_apple_framework CoreImage
  5386. enabled videotoolbox && check_apple_framework VideoToolbox
  5387. check_apple_framework CoreFoundation
  5388. check_apple_framework CoreMedia
  5389. check_apple_framework CoreVideo
  5390. enabled avfoundation && {
  5391. disable coregraphics applicationservices
  5392. check_lib coregraphics CoreGraphics/CoreGraphics.h CGGetActiveDisplayList "-framework CoreGraphics" ||
  5393. check_lib applicationservices ApplicationServices/ApplicationServices.h CGGetActiveDisplayList "-framework ApplicationServices"; }
  5394. enabled videotoolbox && {
  5395. check_lib coreservices CoreServices/CoreServices.h UTGetOSTypeFromString "-framework CoreServices"
  5396. check_func_headers CoreMedia/CMFormatDescription.h kCMVideoCodecType_HEVC "-framework CoreMedia"
  5397. }
  5398. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  5399. check_type "windows.h dxva.h" "DXVA_PicParams_HEVC" -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_CRT_BUILD_DESKTOP_APP=0
  5400. check_type "windows.h dxva.h" "DXVA_PicParams_VP9" -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_CRT_BUILD_DESKTOP_APP=0
  5401. check_type "windows.h d3d11.h" "ID3D11VideoDecoder"
  5402. check_type "windows.h d3d11.h" "ID3D11VideoContext"
  5403. check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602
  5404. check_type "va/va.h va/va_dec_hevc.h" "VAPictureParameterBufferHEVC"
  5405. check_type "va/va.h va/va_dec_vp8.h" "VAPictureParameterBufferVP8"
  5406. check_struct "va/va.h" "VADecPictureParameterBufferVP9" bit_depth
  5407. check_type "va/va.h va/va_vpp.h" "VAProcPipelineParameterBuffer"
  5408. check_type "va/va.h va/va_enc_h264.h" "VAEncPictureParameterBufferH264"
  5409. check_type "va/va.h va/va_enc_hevc.h" "VAEncPictureParameterBufferHEVC"
  5410. check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG"
  5411. check_type "va/va.h va/va_enc_mpeg2.h" "VAEncPictureParameterBufferMPEG2"
  5412. check_type "va/va.h va/va_enc_vp8.h" "VAEncPictureParameterBufferVP8"
  5413. check_type "va/va.h va/va_enc_vp9.h" "VAEncPictureParameterBufferVP9"
  5414. check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC"
  5415. if ! disabled ffnvcodec; then
  5416. check_pkg_config ffnvcodec "ffnvcodec >= 8.1.24.2" \
  5417. "ffnvcodec/nvEncodeAPI.h ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h ffnvcodec/dynlink_nvcuvid.h" "" || \
  5418. check_pkg_config ffnvcodec "ffnvcodec >= 8.0.14.2 ffnvcodec < 8.1" \
  5419. "ffnvcodec/nvEncodeAPI.h ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h ffnvcodec/dynlink_nvcuvid.h" ""
  5420. fi
  5421. check_cpp_condition winrt windows.h "!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)"
  5422. if ! disabled w32threads && ! enabled pthreads; then
  5423. check_func_headers "windows.h process.h" _beginthreadex &&
  5424. check_type "windows.h" CONDITION_VARIABLE &&
  5425. check_type "windows.h" INIT_ONCE &&
  5426. enable w32threads || disable w32threads
  5427. if ! enabled w32threads && enabled winrt; then
  5428. check_func_headers "windows.h" CreateThread &&
  5429. enable w32threads || disable w32threads
  5430. fi
  5431. fi
  5432. # check for some common methods of building with pthread support
  5433. # do this before the optional library checks as some of them require pthreads
  5434. if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then
  5435. if check_lib pthreads pthread.h pthread_join -pthread &&
  5436. check_lib pthreads pthread.h pthread_create -pthread; then
  5437. add_cflags -pthread
  5438. elif check_lib pthreads pthread.h pthread_join -pthreads &&
  5439. check_lib pthreads pthread.h pthread_create -pthreads; then
  5440. add_cflags -pthreads
  5441. elif check_lib pthreads pthread.h pthread_join -ldl -pthread &&
  5442. check_lib pthreads pthread.h pthread_create -ldl -pthread; then
  5443. add_cflags -ldl -pthread
  5444. elif check_lib pthreads pthread.h pthread_join -lpthreadGC2 &&
  5445. check_lib pthreads pthread.h pthread_create -lpthreadGC2; then
  5446. :
  5447. elif check_lib pthreads pthread.h pthread_join -lpthread &&
  5448. check_lib pthreads pthread.h pthread_create -lpthread; then
  5449. :
  5450. elif check_func pthread_join && check_func pthread_create; then
  5451. enable pthreads
  5452. fi
  5453. check_cc pthreads "pthread.h" "static pthread_mutex_t atomic_lock = PTHREAD_MUTEX_INITIALIZER"
  5454. if enabled pthreads; then
  5455. check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); sem_timedwait(s,0); sem_destroy(s)" $pthreads_extralibs
  5456. check_func pthread_cancel $pthreads_extralibs
  5457. fi
  5458. fi
  5459. enabled zlib && { check_pkg_config zlib zlib "zlib.h" zlibVersion ||
  5460. check_lib zlib zlib.h zlibVersion -lz; }
  5461. enabled bzlib && check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2
  5462. enabled lzma && check_lib lzma lzma.h lzma_version_number -llzma
  5463. # On some systems dynamic loading requires no extra linker flags
  5464. check_lib libdl dlfcn.h "dlopen dlsym" || check_lib libdl dlfcn.h "dlopen dlsym" -ldl
  5465. check_lib libm math.h sin -lm
  5466. atan2f_args=2
  5467. copysign_args=2
  5468. hypot_args=2
  5469. ldexpf_args=2
  5470. powf_args=2
  5471. for func in $MATH_FUNCS; do
  5472. eval check_mathfunc $func \${${func}_args:-1} $libm_extralibs
  5473. done
  5474. for func in $COMPLEX_FUNCS; do
  5475. eval check_complexfunc $func \${${func}_args:-1}
  5476. done
  5477. # these are off by default, so fail if requested and not available
  5478. enabled cuda_sdk && require cuda_sdk cuda.h cuCtxCreate -lcuda
  5479. enabled chromaprint && require chromaprint chromaprint.h chromaprint_get_version -lchromaprint
  5480. enabled decklink && { require_header DeckLinkAPI.h &&
  5481. { test_cpp_condition DeckLinkAPIVersion.h "BLACKMAGIC_DECKLINK_API_VERSION >= 0x0a060100" || die "ERROR: Decklink API version must be >= 10.6.1."; } }
  5482. enabled libndi_newtek && require_header Processing.NDI.Lib.h
  5483. enabled frei0r && require_header frei0r.h
  5484. enabled gmp && require gmp gmp.h mpz_export -lgmp
  5485. enabled gnutls && require_pkg_config gnutls gnutls gnutls/gnutls.h gnutls_global_init
  5486. enabled jni && { [ $target_os = "android" ] && check_header jni.h && enabled pthreads || die "ERROR: jni not found"; }
  5487. enabled ladspa && require_header ladspa.h
  5488. enabled libaom && require_pkg_config libaom "aom >= 1.0.0" aom/aom_codec.h aom_codec_version
  5489. enabled lv2 && require_pkg_config lv2 lilv-0 "lilv/lilv.h" lilv_world_new
  5490. enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
  5491. enabled libass && require_pkg_config libass libass ass/ass.h ass_library_init
  5492. enabled libbluray && require_pkg_config libbluray libbluray libbluray/bluray.h bd_open
  5493. enabled libbs2b && require_pkg_config libbs2b libbs2b bs2b.h bs2b_open
  5494. enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 &&
  5495. { check_lib libcelt celt/celt.h celt_decoder_create_custom -lcelt0 ||
  5496. die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
  5497. enabled libcaca && require_pkg_config libcaca caca caca.h caca_create_canvas
  5498. enabled libcodec2 && require libcodec2 codec2/codec2.h codec2_create -lcodec2
  5499. enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new
  5500. enabled libdrm && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion
  5501. enabled libfdk_aac && { check_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen ||
  5502. { require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac &&
  5503. warn "using libfdk without pkg-config"; } }
  5504. 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"
  5505. enabled libflite && require libflite "flite/flite.h" flite_init $flite_extralibs
  5506. enabled fontconfig && enable libfontconfig
  5507. enabled libfontconfig && require_pkg_config libfontconfig fontconfig "fontconfig/fontconfig.h" FcInit
  5508. enabled libfreetype && require_pkg_config libfreetype freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
  5509. enabled libfribidi && require_pkg_config libfribidi fribidi fribidi.h fribidi_version_info
  5510. enabled libgme && { check_pkg_config libgme libgme gme/gme.h gme_new_emu ||
  5511. require libgme gme/gme.h gme_new_emu -lgme -lstdc++; }
  5512. enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
  5513. check_lib libgsm "${gsm_hdr}" gsm_create -lgsm && break;
  5514. done || die "ERROR: libgsm not found"; }
  5515. enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc $pthreads_extralibs
  5516. enabled libkvazaar && require_pkg_config libkvazaar "kvazaar >= 0.8.1" kvazaar.h kvz_api_get
  5517. # While it may appear that require is being used as a pkg-config
  5518. # fallback for libmfx, it is actually being used to detect a different
  5519. # installation route altogether. If libmfx is installed via the Intel
  5520. # Media SDK or Intel Media Server Studio, these don't come with
  5521. # pkg-config support. Instead, users should make sure that the build
  5522. # can find the libraries and headers through other means.
  5523. enabled libmfx && { check_pkg_config libmfx libmfx "mfx/mfxvideo.h" MFXInit ||
  5524. { require libmfx "mfx/mfxvideo.h" MFXInit "-llibmfx $advapi32_extralibs" && warn "using libmfx without pkg-config"; } }
  5525. enabled libmodplug && require_pkg_config libmodplug libmodplug libmodplug/modplug.h ModPlug_Load
  5526. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame $libm_extralibs
  5527. enabled libmysofa && { check_pkg_config libmysofa libmysofa mysofa.h mysofa_load ||
  5528. require libmysofa mysofa.h mysofa_load -lmysofa $zlib_extralibs; }
  5529. enabled libnpp && { check_lib libnpp npp.h nppGetLibVersion -lnppig -lnppicc -lnppc ||
  5530. check_lib libnpp npp.h nppGetLibVersion -lnppi -lnppc ||
  5531. die "ERROR: libnpp not found"; }
  5532. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  5533. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  5534. enabled libopencv && { check_header opencv2/core/core_c.h &&
  5535. { check_pkg_config libopencv opencv opencv2/core/core_c.h cvCreateImageHeader ||
  5536. require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
  5537. require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; }
  5538. enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion
  5539. enabled libopenjpeg && { check_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version ||
  5540. { require_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } }
  5541. enabled libopenmpt && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++"
  5542. enabled libopus && {
  5543. enabled libopus_decoder && {
  5544. require_pkg_config libopus opus opus_multistream.h opus_multistream_decoder_create
  5545. }
  5546. enabled libopus_encoder && {
  5547. require_pkg_config libopus opus opus_multistream.h opus_multistream_surround_encoder_create
  5548. }
  5549. }
  5550. enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new
  5551. enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo
  5552. enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket
  5553. enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++"
  5554. enabled libshine && require_pkg_config libshine shine shine/layer3.h shine_encode_buffer
  5555. enabled libsmbclient && { check_pkg_config libsmbclient smbclient libsmbclient.h smbc_init ||
  5556. require libsmbclient libsmbclient.h smbc_init -lsmbclient; }
  5557. enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++
  5558. enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
  5559. enabled libssh && require_pkg_config libssh libssh libssh/sftp.h sftp_init
  5560. enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
  5561. enabled libsrt && require_pkg_config libsrt "srt >= 1.2.0" srt/srt.h srt_socket
  5562. enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow
  5563. enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate
  5564. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  5565. enabled libtls && require_pkg_config libtls libtls tls.h tls_configure
  5566. enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame &&
  5567. { check_lib libtwolame twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
  5568. die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; }
  5569. enabled libv4l2 && require_pkg_config libv4l2 libv4l2 libv4l2.h v4l2_ioctl
  5570. enabled libvidstab && require_pkg_config libvidstab "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit
  5571. enabled libvmaf && require_pkg_config libvmaf "libvmaf >= 0.6.2" libvmaf.h compute_vmaf
  5572. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  5573. enabled libvorbis && require_pkg_config libvorbis vorbis vorbis/codec.h vorbis_info_init &&
  5574. require_pkg_config libvorbisenc vorbisenc vorbis/vorbisenc.h vorbis_encode_init
  5575. enabled libvpx && {
  5576. enabled libvpx_vp8_decoder && {
  5577. check_pkg_config libvpx_vp8_decoder "vpx >= 1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx ||
  5578. check_lib libvpx_vp8_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_dec_init_ver VPX_IMG_FMT_HIGHBITDEPTH" -lvpx ||
  5579. die "ERROR: libvpx decoder version must be >=1.4.0";
  5580. }
  5581. enabled libvpx_vp8_encoder && {
  5582. check_pkg_config libvpx_vp8_encoder "vpx >= 1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx ||
  5583. check_lib libvpx_vp8_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_IMG_FMT_HIGHBITDEPTH" -lvpx ||
  5584. die "ERROR: libvpx encoder version must be >=1.4.0";
  5585. }
  5586. enabled libvpx_vp9_decoder && {
  5587. check_pkg_config libvpx_vp9_decoder "vpx >= 1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx ||
  5588. check_lib libvpx_vp9_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs"
  5589. }
  5590. enabled libvpx_vp9_encoder && {
  5591. check_pkg_config libvpx_vp9_encoder "vpx >= 1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx ||
  5592. check_lib libvpx_vp9_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs"
  5593. }
  5594. if disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder; then
  5595. die "libvpx enabled but no supported decoders found"
  5596. fi
  5597. }
  5598. enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack
  5599. enabled libwebp && {
  5600. enabled libwebp_encoder && require_pkg_config libwebp "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion
  5601. enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
  5602. enabled libx264 && { check_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode ||
  5603. { require libx264 "stdint.h x264.h" x264_encoder_encode "-lx264 $pthreads_extralibs $libm_extralibs" &&
  5604. warn "using libx264 without pkg-config"; } } &&
  5605. require_cpp_condition x264.h "X264_BUILD >= 118" &&
  5606. check_cpp_condition libx262 x264.h "X264_MPEG2"
  5607. enabled libx265 && require_pkg_config libx265 x265 x265.h x265_api_get &&
  5608. require_cpp_condition x265.h "X265_BUILD >= 68"
  5609. enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"
  5610. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  5611. enabled libzimg && require_pkg_config libzimg "zimg >= 2.7.0" zimg.h zimg_get_api_version
  5612. enabled libzmq && require_pkg_config libzmq libzmq zmq.h zmq_ctx_new
  5613. enabled libzvbi && require_pkg_config libzvbi zvbi-0.2 libzvbi.h vbi_decoder_new &&
  5614. { test_cpp_condition libzvbi.h "VBI_VERSION_MAJOR > 0 || VBI_VERSION_MINOR > 2 || VBI_VERSION_MINOR == 2 && VBI_VERSION_MICRO >= 28" ||
  5615. enabled gpl || die "ERROR: libzvbi requires version 0.2.28 or --enable-gpl."; }
  5616. enabled libxml2 && require_pkg_config libxml2 libxml-2.0 libxml2/libxml/xmlversion.h xmlCheckVersion
  5617. enabled mbedtls && { check_pkg_config mbedtls mbedtls mbedtls/x509_crt.h mbedtls_x509_crt_init ||
  5618. check_pkg_config mbedtls mbedtls mbedtls/ssl.h mbedtls_ssl_init ||
  5619. check_lib mbedtls mbedtls/ssl.h mbedtls_ssl_init -lmbedtls -lmbedx509 -lmbedcrypto ||
  5620. die "ERROR: mbedTLS not found"; }
  5621. enabled mediacodec && { enabled jni || die "ERROR: mediacodec requires --enable-jni"; }
  5622. enabled mmal && { check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ||
  5623. { ! enabled cross_compile &&
  5624. add_cflags -isystem/opt/vc/include/ -isystem/opt/vc/include/interface/vmcs_host/linux -isystem/opt/vc/include/interface/vcos/pthreads -fgnu89-inline &&
  5625. add_ldflags -L/opt/vc/lib/ &&
  5626. check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host; } ||
  5627. die "ERROR: mmal not found" &&
  5628. check_func_headers interface/mmal/mmal.h "MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"; }
  5629. enabled openal && { { for al_extralibs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
  5630. check_lib openal 'AL/al.h' alGetError "${al_extralibs}" && break; done } ||
  5631. die "ERROR: openal not found"; } &&
  5632. { test_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
  5633. die "ERROR: openal must be installed and version must be 1.1 or compatible"; }
  5634. enabled opencl && { check_pkg_config opencl OpenCL CL/cl.h clEnqueueNDRangeKernel ||
  5635. check_lib opencl OpenCL/cl.h clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
  5636. check_lib opencl CL/cl.h clEnqueueNDRangeKernel -lOpenCL ||
  5637. die "ERROR: opencl not found"; } &&
  5638. { test_cpp_condition "OpenCL/cl.h" "defined(CL_VERSION_1_2)" ||
  5639. test_cpp_condition "CL/cl.h" "defined(CL_VERSION_1_2)" ||
  5640. die "ERROR: opencl must be installed and version must be 1.2 or compatible"; }
  5641. enabled opengl && { check_lib opengl GL/glx.h glXGetProcAddress "-lGL" ||
  5642. check_lib opengl windows.h wglGetProcAddress "-lopengl32 -lgdi32" ||
  5643. check_lib opengl OpenGL/gl3.h glGetError "-Wl,-framework,OpenGL" ||
  5644. check_lib opengl ES2/gl.h glGetError "-isysroot=${sysroot} -Wl,-framework,OpenGLES" ||
  5645. die "ERROR: opengl not found."
  5646. }
  5647. enabled omx && require_header OMX_Core.h
  5648. enabled omx_rpi && { check_header OMX_Core.h ||
  5649. { ! enabled cross_compile && add_cflags -isystem/opt/vc/include/IL && check_header OMX_Core.h ; } ||
  5650. die "ERROR: OpenMAX IL headers not found"; } && enable omx
  5651. enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OPENSSL_init_ssl ||
  5652. check_pkg_config openssl openssl openssl/ssl.h SSL_library_init ||
  5653. check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  5654. check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  5655. check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  5656. die "ERROR: openssl not found"; }
  5657. enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/rk_mpi.h mpp_create &&
  5658. require_pkg_config rockchip_mpp "rockchip_mpp >= 1.3.7" rockchip/rk_mpi.h mpp_create &&
  5659. { enabled libdrm ||
  5660. die "ERROR: rkmpp requires --enable-libdrm"; }
  5661. }
  5662. enabled vapoursynth && require_pkg_config vapoursynth "vapoursynth-script >= 42" VSScript.h vsscript_init
  5663. if enabled gcrypt; then
  5664. GCRYPT_CONFIG="${cross_prefix}libgcrypt-config"
  5665. if "${GCRYPT_CONFIG}" --version > /dev/null 2>&1; then
  5666. gcrypt_cflags=$("${GCRYPT_CONFIG}" --cflags)
  5667. gcrypt_extralibs=$("${GCRYPT_CONFIG}" --libs)
  5668. check_func_headers gcrypt.h gcry_mpi_new $gcrypt_cflags $gcrypt_extralibs ||
  5669. die "ERROR: gcrypt not found"
  5670. add_cflags $gcrypt_cflags
  5671. else
  5672. require gcrypt gcrypt.h gcry_mpi_new -lgcrypt
  5673. fi
  5674. fi
  5675. if enabled sdl2; then
  5676. SDL2_CONFIG="${cross_prefix}sdl2-config"
  5677. test_pkg_config sdl2 "sdl2 >= 2.0.1 sdl2 < 2.1.0" SDL_events.h SDL_PollEvent
  5678. if disabled sdl2 && "${SDL2_CONFIG}" --version > /dev/null 2>&1; then
  5679. sdl2_cflags=$("${SDL2_CONFIG}" --cflags)
  5680. sdl2_extralibs=$("${SDL2_CONFIG}" --libs)
  5681. test_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags &&
  5682. test_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags &&
  5683. check_func_headers SDL_events.h SDL_PollEvent $sdl2_extralibs $sdl2_cflags &&
  5684. enable sdl2
  5685. fi
  5686. if test $target_os = "mingw32"; then
  5687. sdl2_extralibs=$(filter_out '-mwindows' $sdl2_extralibs)
  5688. fi
  5689. fi
  5690. if enabled decklink; then
  5691. case $target_os in
  5692. mingw32*|mingw64*|win32|win64)
  5693. decklink_outdev_extralibs="$decklink_outdev_extralibs -lole32 -loleaut32"
  5694. decklink_indev_extralibs="$decklink_indev_extralibs -lole32 -loleaut32"
  5695. ;;
  5696. esac
  5697. fi
  5698. enabled securetransport &&
  5699. check_func SecIdentityCreate "-Wl,-framework,CoreFoundation -Wl,-framework,Security" &&
  5700. check_lib securetransport "Security/SecureTransport.h Security/Security.h" "SSLCreateContext" "-Wl,-framework,CoreFoundation -Wl,-framework,Security" ||
  5701. disable securetransport
  5702. enabled securetransport &&
  5703. check_func SecItemImport "-Wl,-framework,CoreFoundation -Wl,-framework,Security"
  5704. enabled schannel &&
  5705. check_func_headers "windows.h security.h" InitializeSecurityContext -DSECURITY_WIN32 -lsecur32 &&
  5706. test_cpp_condition winerror.h "defined(SEC_I_CONTEXT_EXPIRED)" &&
  5707. schannel_extralibs="-lsecur32" ||
  5708. disable schannel
  5709. makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo
  5710. enabled makeinfo \
  5711. && [ 0$(makeinfo --version | grep "texinfo" | sed 's/.*texinfo[^0-9]*\([0-9]*\)\..*/\1/') -ge 5 ] \
  5712. && enable makeinfo_html || disable makeinfo_html
  5713. disabled makeinfo_html && texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html
  5714. perl -v > /dev/null 2>&1 && enable perl || disable perl
  5715. pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
  5716. rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
  5717. # check V4L2 codecs available in the API
  5718. check_header linux/fb.h
  5719. check_header linux/videodev2.h
  5720. test_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete
  5721. check_cc v4l2_m2m linux/videodev2.h "int i = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_M2M | V4L2_BUF_FLAG_LAST;"
  5722. check_cc vc1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VC1_ANNEX_G;"
  5723. check_cc mpeg1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG1;"
  5724. check_cc mpeg2_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG2;"
  5725. check_cc mpeg4_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG4;"
  5726. check_cc hevc_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_HEVC;"
  5727. check_cc h263_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_H263;"
  5728. check_cc h264_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_H264;"
  5729. check_cc vp8_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP8;"
  5730. check_cc vp9_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP9;"
  5731. check_header sys/videoio.h
  5732. test_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete
  5733. check_lib user32 "windows.h winuser.h" GetShellWindow -luser32
  5734. check_lib vfw32 "windows.h vfw.h" capCreateCaptureWindow -lvfw32
  5735. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  5736. # w32api 3.12 had it defined wrong
  5737. check_cpp_condition vfwcap_defines vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER"
  5738. check_type "dshow.h" IBaseFilter
  5739. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  5740. check_header "dev/bktr/ioctl_meteor.h dev/bktr/ioctl_bt848.h" ||
  5741. check_header "machine/ioctl_meteor.h machine/ioctl_bt848.h" ||
  5742. check_header "dev/video/meteor/ioctl_meteor.h dev/video/bktr/ioctl_bt848.h" ||
  5743. check_header "dev/ic/bt8xx.h"
  5744. if check_struct sys/soundcard.h audio_buf_info bytes; then
  5745. enable_sanitized sys/soundcard.h
  5746. else
  5747. test_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_sanitized sys/soundcard.h
  5748. #include <sys/soundcard.h>
  5749. audio_buf_info abc;
  5750. EOF
  5751. fi
  5752. enabled alsa && check_pkg_config alsa alsa "alsa/asoundlib.h" snd_pcm_htimestamp ||
  5753. check_lib alsa alsa/asoundlib.h snd_pcm_htimestamp -lasound
  5754. enabled libjack &&
  5755. require_pkg_config libjack jack jack/jack.h jack_port_get_latency_range
  5756. enabled sndio && check_lib sndio sndio.h sio_open -lsndio
  5757. if enabled libcdio; then
  5758. check_pkg_config libcdio libcdio_paranoia "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open ||
  5759. check_pkg_config libcdio libcdio_paranoia "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open ||
  5760. check_lib libcdio "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  5761. check_lib libcdio "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  5762. die "ERROR: No usable libcdio/cdparanoia found"
  5763. fi
  5764. enabled libxcb && check_pkg_config libxcb "xcb >= 1.4" xcb/xcb.h xcb_connect ||
  5765. disable libxcb_shm libxcb_shape libxcb_xfixes
  5766. if enabled libxcb; then
  5767. enabled libxcb_shm && check_pkg_config libxcb_shm xcb-shm xcb/shm.h xcb_shm_attach
  5768. enabled libxcb_shape && check_pkg_config libxcb_shape xcb-shape xcb/shape.h xcb_shape_get_rectangles
  5769. enabled libxcb_xfixes && check_pkg_config libxcb_xfixes xcb-xfixes xcb/xfixes.h xcb_xfixes_get_cursor_image
  5770. fi
  5771. check_func_headers "windows.h" CreateDIBSection "$gdigrab_indev_extralibs"
  5772. # d3d11va requires linking directly to dxgi and d3d11 if not building for
  5773. # the desktop api partition
  5774. test_cpp <<EOF && enable uwp && d3d11va_extralibs="-ldxgi -ld3d11"
  5775. #ifdef WINAPI_FAMILY
  5776. #include <winapifamily.h>
  5777. #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  5778. #error desktop, not uwp
  5779. #else
  5780. // WINAPI_FAMILY_APP, WINAPI_FAMILY_PHONE_APP => UWP
  5781. #endif
  5782. #else
  5783. #error no family set
  5784. #endif
  5785. EOF
  5786. enabled vaapi &&
  5787. check_lib vaapi va/va.h vaInitialize -lva
  5788. enabled vaapi &&
  5789. check_cc vaapi "va/va.h" "vaCreateSurfaces(0, 0, 0, 0, 0, 0, 0, 0)"
  5790. if enabled vaapi; then
  5791. check_lib vaapi_drm "va/va.h va/va_drm.h" vaGetDisplayDRM -lva -lva-drm
  5792. check_lib vaapi_x11 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 -lX11
  5793. fi
  5794. enabled vaapi &&
  5795. check_cpp_condition vaapi_1 "va/va.h" "VA_CHECK_VERSION(1, 0, 0)"
  5796. if enabled_all opencl libdrm ; then
  5797. check_type "CL/cl_intel.h" "clCreateImageFromFdINTEL_fn" &&
  5798. enable opencl_drm_beignet
  5799. check_func_headers "CL/cl_ext.h" clImportMemoryARM &&
  5800. enable opencl_drm_arm
  5801. fi
  5802. if enabled_all opencl vaapi ; then
  5803. enabled opencl_drm_beignet && enable opencl_vaapi_beignet
  5804. check_type "CL/cl.h CL/va_ext.h" "clCreateFromVA_APIMediaSurfaceINTEL_fn" &&
  5805. enable opencl_vaapi_intel_media
  5806. fi
  5807. if enabled_all opencl dxva2 ; then
  5808. check_type "CL/cl_dx9_media_sharing.h" cl_dx9_surface_info_khr &&
  5809. enable opencl_dxva2
  5810. fi
  5811. if enabled_all opencl d3d11va ; then
  5812. check_type "CL/cl_d3d11.h" clGetDeviceIDsFromD3D11KHR_fn &&
  5813. enable opencl_d3d11
  5814. fi
  5815. enabled vdpau &&
  5816. check_cpp_condition vdpau vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP"
  5817. enabled vdpau &&
  5818. check_lib vdpau_x11 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau -lX11
  5819. enabled crystalhd && check_lib crystalhd "stdint.h libcrystalhd/libcrystalhd_if.h" DtsCrystalHDVersion -lcrystalhd
  5820. if enabled x86; then
  5821. case $target_os in
  5822. mingw32*|mingw64*|win32|win64|linux|cygwin*)
  5823. ;;
  5824. *)
  5825. disable ffnvcodec cuvid nvdec nvenc
  5826. ;;
  5827. esac
  5828. else
  5829. disable ffnvcodec cuvid nvdec nvenc
  5830. fi
  5831. enabled ffnvcodec && enable cuda
  5832. enabled nvenc &&
  5833. test_cc -I$source_path <<EOF || disable nvenc
  5834. #include <ffnvcodec/nvEncodeAPI.h>
  5835. NV_ENCODE_API_FUNCTION_LIST flist;
  5836. void f(void) { struct { const GUID guid; } s[] = { { NV_ENC_PRESET_HQ_GUID } }; }
  5837. int main(void) { return 0; }
  5838. EOF
  5839. enabled amf &&
  5840. check_cpp_condition amf "AMF/core/Version.h" \
  5841. "(AMF_VERSION_MAJOR << 48 | AMF_VERSION_MINOR << 32 | AMF_VERSION_RELEASE << 16 | AMF_VERSION_BUILD_NUM) >= 0x0001000400040001"
  5842. # Funny iconv installations are not unusual, so check it after all flags have been set
  5843. if enabled libc_iconv; then
  5844. check_func_headers iconv.h iconv
  5845. elif enabled iconv; then
  5846. check_func_headers iconv.h iconv || check_lib iconv iconv.h iconv -liconv
  5847. fi
  5848. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  5849. # add some useful compiler flags if supported
  5850. check_cflags -Wdeclaration-after-statement
  5851. check_cflags -Wall
  5852. check_cflags -Wdisabled-optimization
  5853. check_cflags -Wpointer-arith
  5854. check_cflags -Wredundant-decls
  5855. check_cflags -Wwrite-strings
  5856. check_cflags -Wtype-limits
  5857. check_cflags -Wundef
  5858. check_cflags -Wmissing-prototypes
  5859. check_cflags -Wno-pointer-to-int-cast
  5860. check_cflags -Wstrict-prototypes
  5861. check_cflags -Wempty-body
  5862. if enabled extra_warnings; then
  5863. check_cflags -Wcast-qual
  5864. check_cflags -Wextra
  5865. check_cflags -Wpedantic
  5866. fi
  5867. check_disable_warning(){
  5868. warning_flag=-W${1#-Wno-}
  5869. test_cflags $unknown_warning_flags $warning_flag && add_cflags $1
  5870. }
  5871. test_cflags -Werror=unused-command-line-argument &&
  5872. append unknown_warning_flags "-Werror=unused-command-line-argument"
  5873. test_cflags -Werror=unknown-warning-option &&
  5874. append unknown_warning_flags "-Werror=unknown-warning-option"
  5875. check_disable_warning -Wno-parentheses
  5876. check_disable_warning -Wno-switch
  5877. check_disable_warning -Wno-format-zero-length
  5878. check_disable_warning -Wno-pointer-sign
  5879. check_disable_warning -Wno-unused-const-variable
  5880. check_disable_warning -Wno-bool-operation
  5881. check_disable_warning_headers(){
  5882. warning_flag=-W${1#-Wno-}
  5883. test_cflags $warning_flag && add_cflags_headers $1
  5884. }
  5885. check_disable_warning_headers -Wno-deprecated-declarations
  5886. check_disable_warning_headers -Wno-unused-variable
  5887. test_cc <<EOF && enable blocks_extension
  5888. void (^block)(void);
  5889. EOF
  5890. # add some linker flags
  5891. check_ldflags -Wl,--warn-common
  5892. check_ldflags -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
  5893. enabled rpath && add_ldexeflags -Wl,-rpath,$libdir && add_ldsoflags -Wl,-rpath,$libdir
  5894. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  5895. # add some strip flags
  5896. check_stripflags -x
  5897. enabled neon_clobber_test &&
  5898. check_ldflags -Wl,--wrap,avcodec_open2 \
  5899. -Wl,--wrap,avcodec_decode_audio4 \
  5900. -Wl,--wrap,avcodec_decode_video2 \
  5901. -Wl,--wrap,avcodec_decode_subtitle2 \
  5902. -Wl,--wrap,avcodec_encode_audio2 \
  5903. -Wl,--wrap,avcodec_encode_video2 \
  5904. -Wl,--wrap,avcodec_encode_subtitle \
  5905. -Wl,--wrap,avcodec_send_packet \
  5906. -Wl,--wrap,avcodec_receive_packet \
  5907. -Wl,--wrap,avcodec_send_frame \
  5908. -Wl,--wrap,avcodec_receive_frame \
  5909. -Wl,--wrap,swr_convert \
  5910. -Wl,--wrap,avresample_convert ||
  5911. disable neon_clobber_test
  5912. enabled xmm_clobber_test &&
  5913. check_ldflags -Wl,--wrap,avcodec_open2 \
  5914. -Wl,--wrap,avcodec_decode_audio4 \
  5915. -Wl,--wrap,avcodec_decode_video2 \
  5916. -Wl,--wrap,avcodec_decode_subtitle2 \
  5917. -Wl,--wrap,avcodec_encode_audio2 \
  5918. -Wl,--wrap,avcodec_encode_video2 \
  5919. -Wl,--wrap,avcodec_encode_subtitle \
  5920. -Wl,--wrap,avcodec_send_packet \
  5921. -Wl,--wrap,avcodec_receive_packet \
  5922. -Wl,--wrap,avcodec_send_frame \
  5923. -Wl,--wrap,avcodec_receive_frame \
  5924. -Wl,--wrap,swr_convert \
  5925. -Wl,--wrap,avresample_convert \
  5926. -Wl,--wrap,sws_scale ||
  5927. disable xmm_clobber_test
  5928. check_ld "cc" proper_dce <<EOF
  5929. extern const int array[512];
  5930. static inline int func(void) { return array[0]; }
  5931. int main(void) { return 0; }
  5932. EOF
  5933. if enabled proper_dce; then
  5934. echo "X { local: *; };" > $TMPV
  5935. if test_ldflags -Wl,${version_script},$TMPV; then
  5936. append SHFLAGS '-Wl,${version_script},\$(SUBDIR)lib\$(NAME).ver'
  5937. quotes='""'
  5938. test_cc <<EOF && enable symver_asm_label
  5939. void ff_foo(void) __asm__ ("av_foo@VERSION");
  5940. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  5941. EOF
  5942. test_cc <<EOF && enable symver_gnu_asm
  5943. __asm__(".symver ff_foo,av_foo@VERSION");
  5944. void ff_foo(void) {}
  5945. EOF
  5946. fi
  5947. fi
  5948. if [ -z "$optflags" ]; then
  5949. if enabled small; then
  5950. optflags=$cflags_size
  5951. elif enabled optimizations; then
  5952. optflags=$cflags_speed
  5953. else
  5954. optflags=$cflags_noopt
  5955. fi
  5956. fi
  5957. if [ -z "$nvccflags" ]; then
  5958. nvccflags=$nvccflags_default
  5959. fi
  5960. if enabled x86_64 || enabled ppc64 || enabled aarch64; then
  5961. nvccflags="$nvccflags -m64"
  5962. else
  5963. nvccflags="$nvccflags -m32"
  5964. fi
  5965. check_optflags(){
  5966. check_cflags "$@"
  5967. enabled lto && check_ldflags "$@"
  5968. }
  5969. check_optflags $optflags
  5970. check_optflags -fno-math-errno
  5971. check_optflags -fno-signed-zeros
  5972. if enabled lto; then
  5973. test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
  5974. check_cflags -flto
  5975. check_ldflags -flto $cpuflags
  5976. disable inline_asm_direct_symbol_refs
  5977. fi
  5978. enabled ftrapv && check_cflags -ftrapv
  5979. test_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
  5980. int x;
  5981. EOF
  5982. if enabled icc; then
  5983. # Just warnings, no remarks
  5984. check_cflags -w1
  5985. # -wd: Disable following warnings
  5986. # 144, 167, 556: -Wno-pointer-sign
  5987. # 188: enumerated type mixed with another type
  5988. # 1292: attribute "foo" ignored
  5989. # 1419: external declaration in primary source file
  5990. # 10006: ignoring unknown option -fno-signed-zeros
  5991. # 10148: ignoring unknown option -Wno-parentheses
  5992. # 10156: ignoring option '-W'; no argument required
  5993. # 13200: No EMMS instruction before call to function
  5994. # 13203: No EMMS instruction before return from function
  5995. check_cflags -wd144,167,188,556,1292,1419,10006,10148,10156,13200,13203
  5996. # 11030: Warning unknown option --as-needed
  5997. # 10156: ignoring option '-export'; no argument required
  5998. check_ldflags -wd10156,11030
  5999. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  6000. enable ebp_available
  6001. # The test above does not test linking
  6002. enabled lto && disable symver_asm_label
  6003. if enabled x86_32; then
  6004. icc_version=$($cc -dumpversion)
  6005. test ${icc_version%%.*} -ge 11 &&
  6006. check_cflags -falign-stack=maintain-16-byte ||
  6007. disable aligned_stack
  6008. fi
  6009. elif enabled gcc; then
  6010. check_optflags -fno-tree-vectorize
  6011. check_cflags -Werror=format-security
  6012. check_cflags -Werror=implicit-function-declaration
  6013. check_cflags -Werror=missing-prototypes
  6014. check_cflags -Werror=return-type
  6015. check_cflags -Werror=vla
  6016. check_cflags -Wformat
  6017. check_cflags -fdiagnostics-color=auto
  6018. enabled extra_warnings || check_disable_warning -Wno-maybe-uninitialized
  6019. if enabled x86_32; then
  6020. case $target_os in
  6021. *bsd*)
  6022. # BSDs don't guarantee a 16 byte aligned stack, but we can
  6023. # request GCC to try to maintain 16 byte alignment throughout
  6024. # function calls. Library entry points that might call assembly
  6025. # functions align the stack. (The parameter means 2^4 bytes.)
  6026. check_cflags -mpreferred-stack-boundary=4
  6027. ;;
  6028. esac
  6029. fi
  6030. elif enabled llvm_gcc; then
  6031. check_cflags -mllvm -stack-alignment=16
  6032. elif enabled clang; then
  6033. if enabled x86_32; then
  6034. # Clang doesn't support maintaining alignment without assuming the
  6035. # same alignment in every function. If 16 byte alignment would be
  6036. # enabled, one would also have to either add attribute_align_arg on
  6037. # every single entry point into the libraries or enable -mstackrealign
  6038. # (doing stack realignment in every single function).
  6039. case $target_os in
  6040. mingw32|win32|*bsd*)
  6041. disable aligned_stack
  6042. ;;
  6043. *)
  6044. check_cflags -mllvm -stack-alignment=16
  6045. check_cflags -mstack-alignment=16
  6046. ;;
  6047. esac
  6048. else
  6049. check_cflags -mllvm -stack-alignment=16
  6050. check_cflags -mstack-alignment=16
  6051. fi
  6052. check_cflags -Qunused-arguments
  6053. check_cflags -Werror=implicit-function-declaration
  6054. check_cflags -Werror=missing-prototypes
  6055. check_cflags -Werror=return-type
  6056. elif enabled cparser; then
  6057. add_cflags -Wno-missing-variable-declarations
  6058. add_cflags -Wno-empty-statement
  6059. elif enabled armcc; then
  6060. add_cflags -W${armcc_opt},--diag_suppress=4343 # hardfp compat
  6061. add_cflags -W${armcc_opt},--diag_suppress=3036 # using . as system include dir
  6062. # 2523: use of inline assembly is deprecated
  6063. add_cflags -W${armcc_opt},--diag_suppress=2523
  6064. add_cflags -W${armcc_opt},--diag_suppress=1207
  6065. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  6066. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  6067. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  6068. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  6069. elif enabled pathscale; then
  6070. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  6071. disable inline_asm
  6072. elif enabled_any msvc icl; then
  6073. enabled x86_32 && disable aligned_stack
  6074. enabled_all x86_32 debug && add_cflags -Oy-
  6075. enabled debug && add_ldflags -debug
  6076. enable pragma_deprecated
  6077. if enabled icl; then
  6078. # -Qansi-alias is basically -fstrict-aliasing, but does not work
  6079. # (correctly) on icl 13.x.
  6080. test_cpp_condition "windows.h" "__ICL < 1300 || __ICL >= 1400" &&
  6081. add_cflags -Qansi-alias
  6082. # Some inline asm is not compilable in debug
  6083. if enabled debug; then
  6084. disable ebp_available
  6085. disable ebx_available
  6086. fi
  6087. fi
  6088. # msvcrt10 x64 incorrectly enables log2, only msvcrt12 (MSVC 2013) onwards actually has log2.
  6089. check_cpp_condition log2 crtversion.h "_VC_CRT_MAJOR_VERSION >= 12"
  6090. # The CRT headers contain __declspec(restrict) in a few places, but if redefining
  6091. # restrict, this might break. MSVC 2010 and 2012 fail with __declspec(__restrict)
  6092. # (as it ends up if the restrict redefine is done before including stdlib.h), while
  6093. # MSVC 2013 and newer can handle it fine.
  6094. # If this declspec fails, force including stdlib.h before the restrict redefinition
  6095. # happens in config.h.
  6096. if [ $restrict_keyword != restrict ]; then
  6097. test_cc <<EOF || add_cflags -FIstdlib.h
  6098. __declspec($restrict_keyword) void *foo(int);
  6099. EOF
  6100. fi
  6101. # the new SSA optimzer in VS2015 U3 is mis-optimizing some parts of the code
  6102. # Issue has been fixed in MSVC v19.00.24218.
  6103. test_cpp_condition windows.h "_MSC_FULL_VER >= 190024218" ||
  6104. check_cflags -d2SSAOptimizer-
  6105. # enable utf-8 source processing on VS2015 U2 and newer
  6106. test_cpp_condition windows.h "_MSC_FULL_VER >= 190023918" &&
  6107. add_cflags -utf-8
  6108. fi
  6109. for pfx in "" host_; do
  6110. varname=${pfx%_}cc_type
  6111. eval "type=\$$varname"
  6112. if [ "$type" = "msvc" ]; then
  6113. test_${pfx}cc <<EOF || add_${pfx}cflags -Dinline=__inline
  6114. static inline int foo(int a) { return a; }
  6115. EOF
  6116. fi
  6117. done
  6118. case $as_type in
  6119. clang)
  6120. add_asflags -Qunused-arguments
  6121. ;;
  6122. esac
  6123. case $ld_type in
  6124. clang)
  6125. check_ldflags -Qunused-arguments
  6126. ;;
  6127. esac
  6128. enable frame_thread_encoder
  6129. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  6130. check_deps $CONFIG_LIST \
  6131. $CONFIG_EXTRA \
  6132. $HAVE_LIST \
  6133. $ALL_COMPONENTS \
  6134. 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"
  6135. enabled avresample && warn "Building with deprecated library libavresample"
  6136. if test $target_os = "haiku"; then
  6137. disable memalign
  6138. disable posix_memalign
  6139. fi
  6140. flatten_extralibs(){
  6141. unset nested_entries
  6142. list_name=$1
  6143. eval list=\$${1}
  6144. for entry in $list; do
  6145. entry_copy=$entry
  6146. resolve entry_copy
  6147. append nested_entries $(filter '*_extralibs' $entry_copy)
  6148. flat_entries=$(filter_out '*_extralibs' $entry_copy)
  6149. eval $entry="\$flat_entries"
  6150. done
  6151. append $list_name "$nested_entries"
  6152. resolve nested_entries
  6153. if test -n "$(filter '*_extralibs' $nested_entries)"; then
  6154. flatten_extralibs $list_name
  6155. fi
  6156. }
  6157. flatten_extralibs_wrapper(){
  6158. list_name=$1
  6159. flatten_extralibs $list_name
  6160. unique $list_name
  6161. resolve $list_name
  6162. eval $list_name=\$\(\$ldflags_filter \$$list_name\)
  6163. eval printf \''%s'\' \""\$$list_name"\"
  6164. }
  6165. for linkunit in $LIBRARY_LIST; do
  6166. unset current_extralibs
  6167. eval components=\$$(toupper ${linkunit})_COMPONENTS_LIST
  6168. for comp in ${components}; do
  6169. enabled $comp || continue
  6170. comp_extralibs="${comp}_extralibs"
  6171. append current_extralibs $comp_extralibs
  6172. done
  6173. eval prepend ${linkunit}_extralibs $current_extralibs
  6174. done
  6175. for linkunit in $LIBRARY_LIST $PROGRAM_LIST $EXTRALIBS_LIST; do
  6176. eval ${linkunit}_extralibs=\$\(flatten_extralibs_wrapper ${linkunit}_extralibs\)
  6177. done
  6178. map 'enabled $v && intrinsics=${v#intrinsics_}' $INTRINSICS_LIST
  6179. for thread in $THREADS_LIST; do
  6180. if enabled $thread; then
  6181. test -n "$thread_type" &&
  6182. die "ERROR: Only one thread type must be selected." ||
  6183. thread_type="$thread"
  6184. fi
  6185. done
  6186. if disabled stdatomic; then
  6187. if enabled atomics_gcc; then
  6188. add_cppflags '-I\$(SRC_PATH)/compat/atomics/gcc'
  6189. elif enabled atomics_win32; then
  6190. add_cppflags '-I\$(SRC_PATH)/compat/atomics/win32'
  6191. elif enabled atomics_suncc; then
  6192. add_cppflags '-I\$(SRC_PATH)/compat/atomics/suncc'
  6193. elif enabled pthreads; then
  6194. add_compat atomics/pthread/stdatomic.o
  6195. add_cppflags '-I\$(SRC_PATH)/compat/atomics/pthread'
  6196. else
  6197. enabled threads && die "Threading is enabled, but no atomics are available"
  6198. add_cppflags '-I\$(SRC_PATH)/compat/atomics/dummy'
  6199. fi
  6200. fi
  6201. # Check if requested libraries were found.
  6202. for lib in $AUTODETECT_LIBS; do
  6203. requested $lib && ! enabled $lib && die "ERROR: $lib requested but not found";
  6204. done
  6205. enabled zlib && add_cppflags -DZLIB_CONST
  6206. # conditional library dependencies, in linking order
  6207. enabled afftfilt_filter && prepend avfilter_deps "avcodec"
  6208. enabled afir_filter && prepend avfilter_deps "avcodec"
  6209. enabled amovie_filter && prepend avfilter_deps "avformat avcodec"
  6210. enabled aresample_filter && prepend avfilter_deps "swresample"
  6211. enabled atempo_filter && prepend avfilter_deps "avcodec"
  6212. enabled cover_rect_filter && prepend avfilter_deps "avformat avcodec"
  6213. enabled convolve_filter && prepend avfilter_deps "avcodec"
  6214. enabled deconvolve_filter && prepend avfilter_deps "avcodec"
  6215. enabled ebur128_filter && enabled swresample && prepend avfilter_deps "swresample"
  6216. enabled elbg_filter && prepend avfilter_deps "avcodec"
  6217. enabled fftfilt_filter && prepend avfilter_deps "avcodec"
  6218. enabled find_rect_filter && prepend avfilter_deps "avformat avcodec"
  6219. enabled firequalizer_filter && prepend avfilter_deps "avcodec"
  6220. enabled mcdeint_filter && prepend avfilter_deps "avcodec"
  6221. enabled movie_filter && prepend avfilter_deps "avformat avcodec"
  6222. enabled pan_filter && prepend avfilter_deps "swresample"
  6223. enabled pp_filter && prepend avfilter_deps "postproc"
  6224. enabled removelogo_filter && prepend avfilter_deps "avformat avcodec swscale"
  6225. enabled resample_filter && prepend avfilter_deps "avresample"
  6226. enabled sab_filter && prepend avfilter_deps "swscale"
  6227. enabled scale_filter && prepend avfilter_deps "swscale"
  6228. enabled scale2ref_filter && prepend avfilter_deps "swscale"
  6229. enabled sofalizer_filter && prepend avfilter_deps "avcodec"
  6230. enabled showcqt_filter && prepend avfilter_deps "avformat avcodec swscale"
  6231. enabled showfreqs_filter && prepend avfilter_deps "avcodec"
  6232. enabled showspectrum_filter && prepend avfilter_deps "avcodec"
  6233. enabled signature_filter && prepend avfilter_deps "avcodec avformat"
  6234. enabled smartblur_filter && prepend avfilter_deps "swscale"
  6235. enabled spectrumsynth_filter && prepend avfilter_deps "avcodec"
  6236. enabled spp_filter && prepend avfilter_deps "avcodec"
  6237. enabled srcnn_filter && prepend avfilter_deps "avformat"
  6238. enabled subtitles_filter && prepend avfilter_deps "avformat avcodec"
  6239. enabled uspp_filter && prepend avfilter_deps "avcodec"
  6240. enabled zoompan_filter && prepend avfilter_deps "swscale"
  6241. enabled lavfi_indev && prepend avdevice_deps "avfilter"
  6242. #FIXME
  6243. enabled sdl2_outdev && add_cflags $(filter_out '-Dmain=SDL_main' $sdl2_cflags)
  6244. enabled opus_decoder && prepend avcodec_deps "swresample"
  6245. expand_deps(){
  6246. lib_deps=${1}_deps
  6247. eval "deps=\$$lib_deps"
  6248. append $lib_deps $(map 'eval echo \$${v}_deps' $deps)
  6249. unique $lib_deps
  6250. }
  6251. #we have to remove gpl from the deps here as some code assumes all lib deps are libs
  6252. postproc_deps="$(filter_out 'gpl' $postproc_deps)"
  6253. map 'expand_deps $v' $LIBRARY_LIST
  6254. if test "$quiet" != "yes"; then
  6255. echo "install prefix $prefix"
  6256. echo "source path $source_path"
  6257. echo "C compiler $cc"
  6258. echo "C library $libc_type"
  6259. if test "$host_cc" != "$cc"; then
  6260. echo "host C compiler $host_cc"
  6261. echo "host C library $host_libc_type"
  6262. fi
  6263. echo "ARCH $arch ($cpu)"
  6264. if test "$build_suffix" != ""; then
  6265. echo "build suffix $build_suffix"
  6266. fi
  6267. if test "$progs_suffix" != ""; then
  6268. echo "progs suffix $progs_suffix"
  6269. fi
  6270. if test "$extra_version" != ""; then
  6271. echo "version string suffix $extra_version"
  6272. fi
  6273. echo "big-endian ${bigendian-no}"
  6274. echo "runtime cpu detection ${runtime_cpudetect-no}"
  6275. if enabled x86; then
  6276. echo "standalone assembly ${x86asm-no}"
  6277. echo "x86 assembler ${x86asmexe}"
  6278. echo "MMX enabled ${mmx-no}"
  6279. echo "MMXEXT enabled ${mmxext-no}"
  6280. echo "3DNow! enabled ${amd3dnow-no}"
  6281. echo "3DNow! extended enabled ${amd3dnowext-no}"
  6282. echo "SSE enabled ${sse-no}"
  6283. echo "SSSE3 enabled ${ssse3-no}"
  6284. echo "AESNI enabled ${aesni-no}"
  6285. echo "AVX enabled ${avx-no}"
  6286. echo "AVX2 enabled ${avx2-no}"
  6287. echo "AVX-512 enabled ${avx512-no}"
  6288. echo "XOP enabled ${xop-no}"
  6289. echo "FMA3 enabled ${fma3-no}"
  6290. echo "FMA4 enabled ${fma4-no}"
  6291. echo "i686 features enabled ${i686-no}"
  6292. echo "CMOV is fast ${fast_cmov-no}"
  6293. echo "EBX available ${ebx_available-no}"
  6294. echo "EBP available ${ebp_available-no}"
  6295. fi
  6296. if enabled aarch64; then
  6297. echo "NEON enabled ${neon-no}"
  6298. echo "VFP enabled ${vfp-no}"
  6299. fi
  6300. if enabled arm; then
  6301. echo "ARMv5TE enabled ${armv5te-no}"
  6302. echo "ARMv6 enabled ${armv6-no}"
  6303. echo "ARMv6T2 enabled ${armv6t2-no}"
  6304. echo "VFP enabled ${vfp-no}"
  6305. echo "NEON enabled ${neon-no}"
  6306. echo "THUMB enabled ${thumb-no}"
  6307. fi
  6308. if enabled mips; then
  6309. echo "MIPS FPU enabled ${mipsfpu-no}"
  6310. echo "MIPS DSP R1 enabled ${mipsdsp-no}"
  6311. echo "MIPS DSP R2 enabled ${mipsdspr2-no}"
  6312. echo "MIPS MSA enabled ${msa-no}"
  6313. echo "LOONGSON MMI enabled ${mmi-no}"
  6314. fi
  6315. if enabled ppc; then
  6316. echo "AltiVec enabled ${altivec-no}"
  6317. echo "VSX enabled ${vsx-no}"
  6318. echo "POWER8 enabled ${power8-no}"
  6319. echo "PPC 4xx optimizations ${ppc4xx-no}"
  6320. echo "dcbzl available ${dcbzl-no}"
  6321. fi
  6322. echo "debug symbols ${debug-no}"
  6323. echo "strip symbols ${stripping-no}"
  6324. echo "optimize for size ${small-no}"
  6325. echo "optimizations ${optimizations-no}"
  6326. echo "static ${static-no}"
  6327. echo "shared ${shared-no}"
  6328. echo "postprocessing support ${postproc-no}"
  6329. echo "network support ${network-no}"
  6330. echo "threading support ${thread_type-no}"
  6331. echo "safe bitstream reader ${safe_bitstream_reader-no}"
  6332. echo "texi2html enabled ${texi2html-no}"
  6333. echo "perl enabled ${perl-no}"
  6334. echo "pod2man enabled ${pod2man-no}"
  6335. echo "makeinfo enabled ${makeinfo-no}"
  6336. echo "makeinfo supports HTML ${makeinfo_html-no}"
  6337. test -n "$random_seed" &&
  6338. echo "random seed ${random_seed}"
  6339. echo
  6340. echo "External libraries:"
  6341. print_enabled '' $EXTERNAL_LIBRARY_LIST $EXTERNAL_AUTODETECT_LIBRARY_LIST | print_in_columns
  6342. echo
  6343. echo "External libraries providing hardware acceleration:"
  6344. print_enabled '' $HWACCEL_LIBRARY_LIST $HWACCEL_AUTODETECT_LIBRARY_LIST | print_in_columns
  6345. echo
  6346. echo "Libraries:"
  6347. print_enabled '' $LIBRARY_LIST | print_in_columns
  6348. echo
  6349. echo "Programs:"
  6350. print_enabled '' $PROGRAM_LIST | print_in_columns
  6351. echo
  6352. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  6353. echo "Enabled ${type}s:"
  6354. eval list=\$$(toupper $type)_LIST
  6355. print_enabled '_*' $list | print_in_columns
  6356. echo
  6357. done
  6358. if test -n "$ignore_tests"; then
  6359. ignore_tests=$(echo $ignore_tests | tr ',' ' ')
  6360. echo "Ignored FATE tests:"
  6361. echo $ignore_tests | print_in_columns
  6362. echo
  6363. fi
  6364. echo "License: $license"
  6365. fi # test "$quiet" != "yes"
  6366. if test -n "$WARNINGS"; then
  6367. printf "\n%s%s$WARNINGS%s" "$warn_color" "$bold_color" "$reset_color"
  6368. enabled fatal_warnings && exit 1
  6369. fi
  6370. test -e Makefile || echo "include $source_path/Makefile" > Makefile
  6371. esc(){
  6372. echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
  6373. }
  6374. echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $FFMPEG_CONFIGURATION)" > ffbuild/config.fate
  6375. enabled stripping || strip="echo skipping strip"
  6376. enabled stripping || striptype=""
  6377. config_files="$TMPH ffbuild/config.mak doc/config.texi"
  6378. cat > ffbuild/config.mak <<EOF
  6379. # Automatically generated by configure - do not modify!
  6380. ifndef FFMPEG_CONFIG_MAK
  6381. FFMPEG_CONFIG_MAK=1
  6382. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  6383. prefix=$prefix
  6384. LIBDIR=\$(DESTDIR)$libdir
  6385. SHLIBDIR=\$(DESTDIR)$shlibdir
  6386. INCDIR=\$(DESTDIR)$incdir
  6387. BINDIR=\$(DESTDIR)$bindir
  6388. DATADIR=\$(DESTDIR)$datadir
  6389. DOCDIR=\$(DESTDIR)$docdir
  6390. MANDIR=\$(DESTDIR)$mandir
  6391. PKGCONFIGDIR=\$(DESTDIR)$pkgconfigdir
  6392. INSTALL_NAME_DIR=$install_name_dir
  6393. SRC_PATH=$source_path
  6394. SRC_LINK=$source_link
  6395. ifndef MAIN_MAKEFILE
  6396. SRC_PATH:=\$(SRC_PATH:.%=..%)
  6397. endif
  6398. CC_IDENT=$cc_ident
  6399. ARCH=$arch
  6400. INTRINSICS=$intrinsics
  6401. EXTERN_PREFIX=$extern_prefix
  6402. CC=$cc
  6403. CXX=$cxx
  6404. AS=$as
  6405. OBJCC=$objcc
  6406. LD=$ld
  6407. DEPCC=$dep_cc
  6408. DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
  6409. DEPAS=$as
  6410. DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
  6411. X86ASM=$x86asmexe
  6412. DEPX86ASM=$x86asmexe
  6413. DEPX86ASMFLAGS=\$(X86ASMFLAGS)
  6414. AR=$ar
  6415. ARFLAGS=$arflags
  6416. AR_O=$ar_o
  6417. AR_CMD=$ar
  6418. NM_CMD=$nm
  6419. RANLIB=$ranlib
  6420. STRIP=$strip
  6421. STRIPTYPE=$striptype
  6422. NVCC=$nvcc
  6423. CP=cp -p
  6424. LN_S=$ln_s
  6425. CPPFLAGS=$CPPFLAGS
  6426. CFLAGS=$CFLAGS
  6427. CXXFLAGS=$CXXFLAGS
  6428. OBJCFLAGS=$OBJCFLAGS
  6429. ASFLAGS=$ASFLAGS
  6430. NVCCFLAGS=$nvccflags
  6431. AS_C=$AS_C
  6432. AS_O=$AS_O
  6433. OBJCC_C=$OBJCC_C
  6434. OBJCC_E=$OBJCC_E
  6435. OBJCC_O=$OBJCC_O
  6436. CC_C=$CC_C
  6437. CC_E=$CC_E
  6438. CC_O=$CC_O
  6439. CXX_C=$CXX_C
  6440. CXX_O=$CXX_O
  6441. NVCC_C=$NVCC_C
  6442. NVCC_O=$NVCC_O
  6443. LD_O=$LD_O
  6444. X86ASM_O=$X86ASM_O
  6445. LD_LIB=$LD_LIB
  6446. LD_PATH=$LD_PATH
  6447. DLLTOOL=$dlltool
  6448. WINDRES=$windres
  6449. DEPWINDRES=$dep_cc
  6450. DOXYGEN=$doxygen
  6451. LDFLAGS=$LDFLAGS
  6452. LDEXEFLAGS=$LDEXEFLAGS
  6453. LDSOFLAGS=$LDSOFLAGS
  6454. SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
  6455. ASMSTRIPFLAGS=$ASMSTRIPFLAGS
  6456. X86ASMFLAGS=$X86ASMFLAGS
  6457. BUILDSUF=$build_suffix
  6458. PROGSSUF=$progs_suffix
  6459. FULLNAME=$FULLNAME
  6460. LIBPREF=$LIBPREF
  6461. LIBSUF=$LIBSUF
  6462. LIBNAME=$LIBNAME
  6463. SLIBPREF=$SLIBPREF
  6464. SLIBSUF=$SLIBSUF
  6465. EXESUF=$EXESUF
  6466. EXTRA_VERSION=$extra_version
  6467. CCDEP=$CCDEP
  6468. CXXDEP=$CXXDEP
  6469. CCDEP_FLAGS=$CCDEP_FLAGS
  6470. ASDEP=$ASDEP
  6471. ASDEP_FLAGS=$ASDEP_FLAGS
  6472. X86ASMDEP=$X86ASMDEP
  6473. X86ASMDEP_FLAGS=$X86ASMDEP_FLAGS
  6474. CC_DEPFLAGS=$CC_DEPFLAGS
  6475. AS_DEPFLAGS=$AS_DEPFLAGS
  6476. X86ASM_DEPFLAGS=$X86ASM_DEPFLAGS
  6477. HOSTCC=$host_cc
  6478. HOSTLD=$host_ld
  6479. HOSTCFLAGS=$host_cflags
  6480. HOSTCPPFLAGS=$host_cppflags
  6481. HOSTEXESUF=$HOSTEXESUF
  6482. HOSTLDFLAGS=$host_ldflags
  6483. HOSTEXTRALIBS=$host_extralibs
  6484. DEPHOSTCC=$host_cc
  6485. DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
  6486. HOSTCCDEP=$HOSTCCDEP
  6487. HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
  6488. HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
  6489. HOSTCC_C=$HOSTCC_C
  6490. HOSTCC_O=$HOSTCC_O
  6491. HOSTLD_O=$HOSTLD_O
  6492. TARGET_EXEC=$target_exec $target_exec_args
  6493. TARGET_PATH=$target_path
  6494. TARGET_SAMPLES=${target_samples:-\$(SAMPLES)}
  6495. CFLAGS-ffplay=${sdl2_cflags}
  6496. CFLAGS_HEADERS=$CFLAGS_HEADERS
  6497. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  6498. EXTRALIBS=$extralibs
  6499. COMPAT_OBJS=$compat_objs
  6500. INSTALL=$install
  6501. LIBTARGET=${LIBTARGET}
  6502. SLIBNAME=${SLIBNAME}
  6503. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  6504. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  6505. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  6506. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  6507. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  6508. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  6509. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  6510. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  6511. VERSION_SCRIPT_POSTPROCESS_CMD=${VERSION_SCRIPT_POSTPROCESS_CMD}
  6512. SAMPLES:=${samples:-\$(FATE_SAMPLES)}
  6513. NOREDZONE_FLAGS=$noredzone_flags
  6514. LIBFUZZER_PATH=$libfuzzer_path
  6515. IGNORE_TESTS=$ignore_tests
  6516. EOF
  6517. map 'eval echo "${v}_FFLIBS=\$${v}_deps" >> ffbuild/config.mak' $LIBRARY_LIST
  6518. for entry in $LIBRARY_LIST $PROGRAM_LIST $EXTRALIBS_LIST; do
  6519. eval echo "EXTRALIBS-${entry}=\$${entry}_extralibs" >> ffbuild/config.mak
  6520. done
  6521. cat > $TMPH <<EOF
  6522. /* Automatically generated by configure - do not modify! */
  6523. #ifndef FFMPEG_CONFIG_H
  6524. #define FFMPEG_CONFIG_H
  6525. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  6526. #define FFMPEG_LICENSE "$(c_escape $license)"
  6527. #define CONFIG_THIS_YEAR 2018
  6528. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  6529. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  6530. #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
  6531. #define av_restrict $restrict_keyword
  6532. #define EXTERN_PREFIX "${extern_prefix}"
  6533. #define EXTERN_ASM ${extern_prefix}
  6534. #define BUILDSUF "$build_suffix"
  6535. #define SLIBSUF "$SLIBSUF"
  6536. #define HAVE_MMX2 HAVE_MMXEXT
  6537. #define SWS_MAX_FILTER_SIZE $sws_max_filter_size
  6538. EOF
  6539. test -n "$assert_level" &&
  6540. echo "#define ASSERT_LEVEL $assert_level" >>$TMPH
  6541. test -n "$malloc_prefix" &&
  6542. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  6543. if enabled x86asm; then
  6544. append config_files $TMPASM
  6545. cat > $TMPASM <<EOF
  6546. ; Automatically generated by configure - do not modify!
  6547. EOF
  6548. fi
  6549. enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
  6550. mkdir -p doc
  6551. mkdir -p tests
  6552. mkdir -p tests/api
  6553. echo "@c auto-generated by configure - do not modify! " > doc/config.texi
  6554. print_config ARCH_ "$config_files" $ARCH_LIST
  6555. print_config HAVE_ "$config_files" $HAVE_LIST
  6556. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  6557. $CONFIG_EXTRA \
  6558. $ALL_COMPONENTS \
  6559. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  6560. echo "endif # FFMPEG_CONFIG_MAK" >> ffbuild/config.mak
  6561. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  6562. cp_if_changed $TMPH config.h
  6563. touch ffbuild/.config
  6564. enabled x86asm && cp_if_changed $TMPASM config.asm
  6565. cat > $TMPH <<EOF
  6566. /* Generated by ffmpeg configure */
  6567. #ifndef AVUTIL_AVCONFIG_H
  6568. #define AVUTIL_AVCONFIG_H
  6569. EOF
  6570. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  6571. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  6572. cp_if_changed $TMPH libavutil/avconfig.h
  6573. full_filter_name(){
  6574. sed -n "s/^extern AVFilter ff_\([avfsinkrc]\{2,5\}\)_$1;/\1_$1/p" $source_path/libavfilter/allfilters.c
  6575. }
  6576. # generate the lists of enabled components
  6577. print_enabled_components(){
  6578. file=$1
  6579. struct_name=$2
  6580. name=$3
  6581. shift 3
  6582. echo "static const $struct_name * const $name[] = {" > $TMPH
  6583. for c in $*; do
  6584. if enabled $c; then
  6585. case $name in
  6586. filter_list)
  6587. c=$(full_filter_name $(remove_suffix _filter $c))
  6588. ;;
  6589. indev_list)
  6590. c=$(add_suffix _demuxer $(remove_suffix _indev $c))
  6591. ;;
  6592. outdev_list)
  6593. c=$(add_suffix _muxer $(remove_suffix _outdev $c))
  6594. ;;
  6595. esac
  6596. printf " &ff_%s,\n" $c >> $TMPH
  6597. fi
  6598. done
  6599. if [ "$name" = "filter_list" ]; then
  6600. for c in asrc_abuffer vsrc_buffer asink_abuffer vsink_buffer; do
  6601. printf " &ff_%s,\n" $c >> $TMPH
  6602. done
  6603. fi
  6604. echo " NULL };" >> $TMPH
  6605. cp_if_changed $TMPH $file
  6606. }
  6607. print_enabled_components libavfilter/filter_list.c AVFilter filter_list $FILTER_LIST
  6608. print_enabled_components libavcodec/codec_list.c AVCodec codec_list $CODEC_LIST
  6609. print_enabled_components libavcodec/parser_list.c AVCodecParser parser_list $PARSER_LIST
  6610. print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter bitstream_filters $BSF_LIST
  6611. print_enabled_components libavformat/demuxer_list.c AVInputFormat demuxer_list $DEMUXER_LIST
  6612. print_enabled_components libavformat/muxer_list.c AVOutputFormat muxer_list $MUXER_LIST
  6613. print_enabled_components libavdevice/indev_list.c AVInputFormat indev_list $INDEV_LIST
  6614. print_enabled_components libavdevice/outdev_list.c AVOutputFormat outdev_list $OUTDEV_LIST
  6615. print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $PROTOCOL_LIST
  6616. # Settings for pkg-config files
  6617. cat > $TMPH <<EOF
  6618. # Automatically generated by configure - do not modify!
  6619. shared=$shared
  6620. build_suffix=$build_suffix
  6621. prefix=$prefix
  6622. libdir=$libdir
  6623. incdir=$incdir
  6624. rpath=$(enabled rpath && echo "-Wl,-rpath,\${libdir}")
  6625. source_path=${source_path}
  6626. LIBPREF=${LIBPREF}
  6627. LIBSUF=${LIBSUF}
  6628. extralibs_avutil="$avutil_extralibs"
  6629. extralibs_avcodec="$avcodec_extralibs"
  6630. extralibs_avformat="$avformat_extralibs"
  6631. extralibs_avdevice="$avdevice_extralibs"
  6632. extralibs_avfilter="$avfilter_extralibs"
  6633. extralibs_avresample="$avresample_extralibs"
  6634. extralibs_postproc="$postproc_extralibs"
  6635. extralibs_swscale="$swscale_extralibs"
  6636. extralibs_swresample="$swresample_extralibs"
  6637. EOF
  6638. for lib in $LIBRARY_LIST; do
  6639. lib_deps="$(eval echo \$${lib}_deps)"
  6640. echo ${lib}_deps=\"$lib_deps\" >> $TMPH
  6641. done
  6642. cp_if_changed $TMPH ffbuild/config.sh