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. bs2b_filter_deps="libbs2b"
  3065. colormatrix_filter_deps="gpl"
  3066. convolution_opencl_filter_deps="opencl"
  3067. convolve_filter_deps="avcodec"
  3068. convolve_filter_select="fft"
  3069. coreimage_filter_deps="coreimage appkit"
  3070. coreimage_filter_extralibs="-framework OpenGL"
  3071. coreimagesrc_filter_deps="coreimage appkit"
  3072. coreimagesrc_filter_extralibs="-framework OpenGL"
  3073. cover_rect_filter_deps="avcodec avformat gpl"
  3074. cropdetect_filter_deps="gpl"
  3075. deconvolve_filter_deps="avcodec"
  3076. deconvolve_filter_select="fft"
  3077. deinterlace_qsv_filter_deps="libmfx"
  3078. deinterlace_vaapi_filter_deps="vaapi"
  3079. delogo_filter_deps="gpl"
  3080. denoise_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer"
  3081. deshake_filter_select="pixelutils"
  3082. drawtext_filter_deps="libfreetype"
  3083. drawtext_filter_suggest="libfontconfig libfribidi"
  3084. elbg_filter_deps="avcodec"
  3085. eq_filter_deps="gpl"
  3086. fftfilt_filter_deps="avcodec"
  3087. fftfilt_filter_select="rdft"
  3088. fftdnoiz_filter_deps="avcodec"
  3089. fftdnoiz_filter_select="fft"
  3090. find_rect_filter_deps="avcodec avformat gpl"
  3091. firequalizer_filter_deps="avcodec"
  3092. firequalizer_filter_select="rdft"
  3093. flite_filter_deps="libflite"
  3094. framerate_filter_select="pixelutils"
  3095. frei0r_filter_deps="frei0r libdl"
  3096. frei0r_src_filter_deps="frei0r libdl"
  3097. fspp_filter_deps="gpl"
  3098. geq_filter_deps="gpl"
  3099. histeq_filter_deps="gpl"
  3100. hqdn3d_filter_deps="gpl"
  3101. interlace_filter_deps="gpl"
  3102. kerndeint_filter_deps="gpl"
  3103. ladspa_filter_deps="ladspa libdl"
  3104. lv2_filter_deps="lv2"
  3105. mcdeint_filter_deps="avcodec gpl"
  3106. movie_filter_deps="avcodec avformat"
  3107. mpdecimate_filter_deps="gpl"
  3108. mpdecimate_filter_select="pixelutils"
  3109. mptestsrc_filter_deps="gpl"
  3110. negate_filter_deps="lut_filter"
  3111. nnedi_filter_deps="gpl"
  3112. ocr_filter_deps="libtesseract"
  3113. ocv_filter_deps="libopencv"
  3114. openclsrc_filter_deps="opencl"
  3115. overlay_opencl_filter_deps="opencl"
  3116. overlay_qsv_filter_deps="libmfx"
  3117. overlay_qsv_filter_select="qsvvpp"
  3118. owdenoise_filter_deps="gpl"
  3119. pan_filter_deps="swresample"
  3120. perspective_filter_deps="gpl"
  3121. phase_filter_deps="gpl"
  3122. pp7_filter_deps="gpl"
  3123. pp_filter_deps="gpl postproc"
  3124. procamp_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer"
  3125. program_opencl_filter_deps="opencl"
  3126. pullup_filter_deps="gpl"
  3127. removelogo_filter_deps="avcodec avformat swscale"
  3128. repeatfields_filter_deps="gpl"
  3129. resample_filter_deps="avresample"
  3130. rubberband_filter_deps="librubberband"
  3131. sab_filter_deps="gpl swscale"
  3132. scale2ref_filter_deps="swscale"
  3133. scale_filter_deps="swscale"
  3134. scale_qsv_filter_deps="libmfx"
  3135. select_filter_select="pixelutils"
  3136. sharpness_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer"
  3137. showcqt_filter_deps="avcodec avformat swscale"
  3138. showcqt_filter_suggest="libfontconfig libfreetype"
  3139. showcqt_filter_select="fft"
  3140. showfreqs_filter_deps="avcodec"
  3141. showfreqs_filter_select="fft"
  3142. showspectrum_filter_deps="avcodec"
  3143. showspectrum_filter_select="fft"
  3144. showspectrumpic_filter_deps="avcodec"
  3145. showspectrumpic_filter_select="fft"
  3146. signature_filter_deps="gpl avcodec avformat"
  3147. smartblur_filter_deps="gpl swscale"
  3148. sofalizer_filter_deps="libmysofa avcodec"
  3149. sofalizer_filter_select="fft"
  3150. spectrumsynth_filter_deps="avcodec"
  3151. spectrumsynth_filter_select="fft"
  3152. spp_filter_deps="gpl avcodec"
  3153. spp_filter_select="fft idctdsp fdctdsp me_cmp pixblockdsp"
  3154. srcnn_filter_deps="avformat"
  3155. srcnn_filter_select="dnn"
  3156. stereo3d_filter_deps="gpl"
  3157. subtitles_filter_deps="avformat avcodec libass"
  3158. super2xsai_filter_deps="gpl"
  3159. pixfmts_super2xsai_test_deps="super2xsai_filter"
  3160. tinterlace_filter_deps="gpl"
  3161. tinterlace_merge_test_deps="tinterlace_filter"
  3162. tinterlace_pad_test_deps="tinterlace_filter"
  3163. tonemap_filter_deps="const_nan"
  3164. unsharp_opencl_filter_deps="opencl"
  3165. uspp_filter_deps="gpl avcodec"
  3166. vaguedenoiser_filter_deps="gpl"
  3167. vidstabdetect_filter_deps="libvidstab"
  3168. vidstabtransform_filter_deps="libvidstab"
  3169. libvmaf_filter_deps="libvmaf pthreads"
  3170. zmq_filter_deps="libzmq"
  3171. zoompan_filter_deps="swscale"
  3172. zscale_filter_deps="libzimg const_nan"
  3173. scale_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer"
  3174. vpp_qsv_filter_deps="libmfx"
  3175. vpp_qsv_filter_select="qsvvpp"
  3176. # examples
  3177. avio_dir_cmd_deps="avformat avutil"
  3178. avio_reading_deps="avformat avcodec avutil"
  3179. decode_audio_example_deps="avcodec avutil"
  3180. decode_video_example_deps="avcodec avutil"
  3181. demuxing_decoding_example_deps="avcodec avformat avutil"
  3182. encode_audio_example_deps="avcodec avutil"
  3183. encode_video_example_deps="avcodec avutil"
  3184. extract_mvs_example_deps="avcodec avformat avutil"
  3185. filter_audio_example_deps="avfilter avutil"
  3186. filtering_audio_example_deps="avfilter avcodec avformat avutil"
  3187. filtering_video_example_deps="avfilter avcodec avformat avutil"
  3188. http_multiclient_example_deps="avformat avutil fork"
  3189. hw_decode_example_deps="avcodec avformat avutil"
  3190. metadata_example_deps="avformat avutil"
  3191. muxing_example_deps="avcodec avformat avutil swscale"
  3192. qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder"
  3193. remuxing_example_deps="avcodec avformat avutil"
  3194. resampling_audio_example_deps="avutil swresample"
  3195. scaling_video_example_deps="avutil swscale"
  3196. transcode_aac_example_deps="avcodec avformat swresample"
  3197. transcoding_example_deps="avfilter avcodec avformat avutil"
  3198. vaapi_encode_example_deps="avcodec avutil h264_vaapi_encoder"
  3199. vaapi_transcode_example_deps="avcodec avformat avutil h264_vaapi_encoder"
  3200. # EXTRALIBS_LIST
  3201. cpu_init_extralibs="pthreads_extralibs"
  3202. cws2fws_extralibs="zlib_extralibs"
  3203. # libraries, in linking order
  3204. avcodec_deps="avutil"
  3205. avcodec_suggest="libm"
  3206. avcodec_select="null_bsf"
  3207. avdevice_deps="avformat avcodec avutil"
  3208. avdevice_suggest="libm"
  3209. avfilter_deps="avutil"
  3210. avfilter_suggest="libm"
  3211. avformat_deps="avcodec avutil"
  3212. avformat_suggest="libm network zlib"
  3213. avresample_deps="avutil"
  3214. avresample_suggest="libm"
  3215. avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx opencl user32 vaapi videotoolbox corefoundation corevideo coremedia bcrypt"
  3216. postproc_deps="avutil gpl"
  3217. postproc_suggest="libm"
  3218. swresample_deps="avutil"
  3219. swresample_suggest="libm libsoxr"
  3220. swscale_deps="avutil"
  3221. swscale_suggest="libm"
  3222. avcodec_extralibs="pthreads_extralibs iconv_extralibs"
  3223. avfilter_extralibs="pthreads_extralibs"
  3224. avutil_extralibs="d3d11va_extralibs nanosleep_extralibs pthreads_extralibs vaapi_drm_extralibs vaapi_x11_extralibs vdpau_x11_extralibs"
  3225. # programs
  3226. ffmpeg_deps="avcodec avfilter avformat"
  3227. ffmpeg_select="aformat_filter anull_filter atrim_filter format_filter
  3228. null_filter
  3229. trim_filter"
  3230. ffmpeg_suggest="ole32 psapi shell32"
  3231. ffplay_deps="avcodec avformat swscale swresample sdl2"
  3232. ffplay_select="rdft crop_filter transpose_filter hflip_filter vflip_filter rotate_filter"
  3233. ffplay_suggest="shell32"
  3234. ffprobe_deps="avcodec avformat"
  3235. ffprobe_suggest="shell32"
  3236. # documentation
  3237. podpages_deps="perl"
  3238. manpages_deps="perl pod2man"
  3239. htmlpages_deps="perl"
  3240. htmlpages_deps_any="makeinfo_html texi2html"
  3241. txtpages_deps="perl makeinfo"
  3242. doc_deps_any="manpages htmlpages podpages txtpages"
  3243. # default parameters
  3244. logfile="ffbuild/config.log"
  3245. # installation paths
  3246. prefix_default="/usr/local"
  3247. bindir_default='${prefix}/bin'
  3248. datadir_default='${prefix}/share/ffmpeg'
  3249. docdir_default='${prefix}/share/doc/ffmpeg'
  3250. incdir_default='${prefix}/include'
  3251. libdir_default='${prefix}/lib'
  3252. mandir_default='${prefix}/share/man'
  3253. # toolchain
  3254. ar_default="ar"
  3255. cc_default="gcc"
  3256. cxx_default="g++"
  3257. host_cc_default="gcc"
  3258. doxygen_default="doxygen"
  3259. install="install"
  3260. ln_s_default="ln -s -f"
  3261. nm_default="nm -g"
  3262. pkg_config_default=pkg-config
  3263. ranlib_default="ranlib"
  3264. strip_default="strip"
  3265. version_script='--version-script'
  3266. objformat="elf32"
  3267. x86asmexe_default="nasm"
  3268. windres_default="windres"
  3269. nvcc_default="nvcc"
  3270. nvccflags_default="-gencode arch=compute_30,code=sm_30 -O2"
  3271. striptype="direct"
  3272. # OS
  3273. target_os_default=$(tolower $(uname -s))
  3274. host_os=$target_os_default
  3275. # machine
  3276. if test "$target_os_default" = aix; then
  3277. arch_default=$(uname -p)
  3278. strip_default="strip -X32_64"
  3279. else
  3280. arch_default=$(uname -m)
  3281. fi
  3282. cpu="generic"
  3283. intrinsics="none"
  3284. # configurable options
  3285. enable $PROGRAM_LIST
  3286. enable $DOCUMENT_LIST
  3287. enable $EXAMPLE_LIST
  3288. enable $(filter_out avresample $LIBRARY_LIST)
  3289. enable stripping
  3290. enable asm
  3291. enable debug
  3292. enable doc
  3293. enable faan faandct faanidct
  3294. enable optimizations
  3295. enable runtime_cpudetect
  3296. enable safe_bitstream_reader
  3297. enable static
  3298. enable swscale_alpha
  3299. enable valgrind_backtrace
  3300. sws_max_filter_size_default=256
  3301. set_default sws_max_filter_size
  3302. # internal components are enabled by default
  3303. enable $EXTRALIBS_LIST
  3304. # Avoid external, non-system, libraries getting enabled by dependency resolution
  3305. disable $EXTERNAL_LIBRARY_LIST $HWACCEL_LIBRARY_LIST
  3306. # build settings
  3307. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  3308. LIBPREF="lib"
  3309. LIBSUF=".a"
  3310. FULLNAME='$(NAME)$(BUILDSUF)'
  3311. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  3312. SLIBPREF="lib"
  3313. SLIBSUF=".so"
  3314. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  3315. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  3316. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  3317. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  3318. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
  3319. SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
  3320. VERSION_SCRIPT_POSTPROCESS_CMD="cat"
  3321. asflags_filter=echo
  3322. cflags_filter=echo
  3323. ldflags_filter=echo
  3324. AS_C='-c'
  3325. AS_O='-o $@'
  3326. CC_C='-c'
  3327. CC_E='-E -o $@'
  3328. CC_O='-o $@'
  3329. CXX_C='-c'
  3330. CXX_O='-o $@'
  3331. OBJCC_C='-c'
  3332. OBJCC_E='-E -o $@'
  3333. OBJCC_O='-o $@'
  3334. X86ASM_O='-o $@'
  3335. LD_O='-o $@'
  3336. LD_LIB='-l%'
  3337. LD_PATH='-L'
  3338. HOSTCC_C='-c'
  3339. HOSTCC_E='-E -o $@'
  3340. HOSTCC_O='-o $@'
  3341. HOSTLD_O='-o $@'
  3342. NVCC_C='-c'
  3343. NVCC_O='-o $@'
  3344. host_extralibs='-lm'
  3345. host_cflags_filter=echo
  3346. host_ldflags_filter=echo
  3347. target_path='$(CURDIR)'
  3348. # since the object filename is not given with the -MM flag, the compiler
  3349. # is only able to print the basename, and we must add the path ourselves
  3350. DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>/dev/null | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(@F),$(@D)/$(@F)," > $(@:.o=.d)'
  3351. DEPFLAGS='-MM'
  3352. mkdir -p ffbuild
  3353. # find source path
  3354. if test -f configure; then
  3355. source_path=.
  3356. else
  3357. source_path=$(cd $(dirname "$0"); pwd)
  3358. case "$source_path" in
  3359. *[[:blank:]]*) die "Out of tree builds are impossible with whitespace in source path." ;;
  3360. esac
  3361. test -e "$source_path/config.h" &&
  3362. die "Out of tree builds are impossible with config.h in source dir."
  3363. fi
  3364. for v in "$@"; do
  3365. r=${v#*=}
  3366. l=${v%"$r"}
  3367. r=$(sh_quote "$r")
  3368. FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
  3369. done
  3370. find_things_extern(){
  3371. thing=$1
  3372. pattern=$2
  3373. file=$source_path/$3
  3374. out=${4:-$thing}
  3375. sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$out/p" "$file"
  3376. }
  3377. find_filters_extern(){
  3378. file=$source_path/$1
  3379. #sed -n "s/^extern AVFilter ff_\([avfsinkrc]\{2,5\}\)_\(\w\+\);/\2_filter/p" $file
  3380. sed -E -n "s/^extern AVFilter ff_([avfsinkrc]{2,5})_([a-zA-Z0-9_]+);/\2_filter/p" $file
  3381. }
  3382. FILTER_LIST=$(find_filters_extern libavfilter/allfilters.c)
  3383. OUTDEV_LIST=$(find_things_extern muxer AVOutputFormat libavdevice/alldevices.c outdev)
  3384. INDEV_LIST=$(find_things_extern demuxer AVInputFormat libavdevice/alldevices.c indev)
  3385. MUXER_LIST=$(find_things_extern muxer AVOutputFormat libavformat/allformats.c)
  3386. DEMUXER_LIST=$(find_things_extern demuxer AVInputFormat libavformat/allformats.c)
  3387. ENCODER_LIST=$(find_things_extern encoder AVCodec libavcodec/allcodecs.c)
  3388. DECODER_LIST=$(find_things_extern decoder AVCodec libavcodec/allcodecs.c)
  3389. CODEC_LIST="
  3390. $ENCODER_LIST
  3391. $DECODER_LIST
  3392. "
  3393. PARSER_LIST=$(find_things_extern parser AVCodecParser libavcodec/parser.c)
  3394. BSF_LIST=$(find_things_extern bsf AVBitStreamFilter libavcodec/bitstream_filters.c)
  3395. HWACCEL_LIST=$(find_things_extern hwaccel AVHWAccel libavcodec/hwaccels.h)
  3396. PROTOCOL_LIST=$(find_things_extern protocol URLProtocol libavformat/protocols.c)
  3397. AVCODEC_COMPONENTS_LIST="
  3398. $BSF_LIST
  3399. $DECODER_LIST
  3400. $ENCODER_LIST
  3401. $HWACCEL_LIST
  3402. $PARSER_LIST
  3403. "
  3404. AVDEVICE_COMPONENTS_LIST="
  3405. $INDEV_LIST
  3406. $OUTDEV_LIST
  3407. "
  3408. AVFILTER_COMPONENTS_LIST="
  3409. $FILTER_LIST
  3410. "
  3411. AVFORMAT_COMPONENTS_LIST="
  3412. $DEMUXER_LIST
  3413. $MUXER_LIST
  3414. $PROTOCOL_LIST
  3415. "
  3416. ALL_COMPONENTS="
  3417. $AVCODEC_COMPONENTS_LIST
  3418. $AVDEVICE_COMPONENTS_LIST
  3419. $AVFILTER_COMPONENTS_LIST
  3420. $AVFORMAT_COMPONENTS_LIST
  3421. "
  3422. for n in $COMPONENT_LIST; do
  3423. v=$(toupper ${n%s})_LIST
  3424. eval enable \$$v
  3425. eval ${n}_if_any="\$$v"
  3426. done
  3427. enable $ARCH_EXT_LIST
  3428. die_unknown(){
  3429. echo "Unknown option \"$1\"."
  3430. echo "See $0 --help for available options."
  3431. exit 1
  3432. }
  3433. print_in_columns() {
  3434. cols=$(expr $ncols / 24)
  3435. cat | tr ' ' '\n' | sort | pr -r "-$cols" -w $ncols -t
  3436. }
  3437. show_list() {
  3438. suffix=_$1
  3439. shift
  3440. echo $* | sed s/$suffix//g | print_in_columns
  3441. exit 0
  3442. }
  3443. rand_list(){
  3444. IFS=', '
  3445. set -- $*
  3446. unset IFS
  3447. for thing; do
  3448. comp=${thing%:*}
  3449. prob=${thing#$comp}
  3450. prob=${prob#:}
  3451. is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
  3452. echo "prob ${prob:-0.5}"
  3453. printf '%s\n' $comp
  3454. done
  3455. }
  3456. do_random(){
  3457. action=$1
  3458. shift
  3459. random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
  3460. $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
  3461. }
  3462. for opt do
  3463. optval="${opt#*=}"
  3464. case "$opt" in
  3465. --extra-ldflags=*)
  3466. add_ldflags $optval
  3467. ;;
  3468. --extra-ldexeflags=*)
  3469. add_ldexeflags $optval
  3470. ;;
  3471. --extra-ldsoflags=*)
  3472. add_ldsoflags $optval
  3473. ;;
  3474. --extra-ldlibflags=*)
  3475. warn "The --extra-ldlibflags option is only provided for compatibility and will be\n"\
  3476. "removed in the future. Use --extra-ldsoflags instead."
  3477. add_ldsoflags $optval
  3478. ;;
  3479. --extra-libs=*)
  3480. add_extralibs $optval
  3481. ;;
  3482. --disable-devices)
  3483. disable $INDEV_LIST $OUTDEV_LIST
  3484. ;;
  3485. --enable-debug=*)
  3486. debuglevel="$optval"
  3487. ;;
  3488. --disable-programs)
  3489. disable $PROGRAM_LIST
  3490. ;;
  3491. --disable-everything)
  3492. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  3493. ;;
  3494. --disable-all)
  3495. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  3496. disable $LIBRARY_LIST $PROGRAM_LIST doc
  3497. enable avutil
  3498. ;;
  3499. --enable-random|--disable-random)
  3500. action=${opt%%-random}
  3501. do_random ${action#--} $COMPONENT_LIST
  3502. ;;
  3503. --enable-random=*|--disable-random=*)
  3504. action=${opt%%-random=*}
  3505. do_random ${action#--} $optval
  3506. ;;
  3507. --enable-sdl)
  3508. enable sdl2
  3509. ;;
  3510. --enable-*=*|--disable-*=*)
  3511. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  3512. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  3513. eval list=\$$(toupper $thing)_LIST
  3514. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  3515. list=$(filter "$name" $list)
  3516. [ "$list" = "" ] && warn "Option $opt did not match anything"
  3517. $action $list
  3518. ;;
  3519. --enable-yasm|--disable-yasm)
  3520. warn "The ${opt} option is only provided for compatibility and will be\n"\
  3521. "removed in the future. Use --enable-x86asm / --disable-x86asm instead."
  3522. test $opt = --enable-yasm && x86asm=yes || x86asm=no
  3523. ;;
  3524. --yasmexe=*)
  3525. warn "The --yasmexe option is only provided for compatibility and will be\n"\
  3526. "removed in the future. Use --x86asmexe instead."
  3527. x86asmexe="$optval"
  3528. ;;
  3529. --enable-?*|--disable-?*)
  3530. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  3531. if is_in $option $COMPONENT_LIST; then
  3532. test $action = disable && action=unset
  3533. eval $action \$$(toupper ${option%s})_LIST
  3534. elif is_in $option $CMDLINE_SELECT; then
  3535. $action $option
  3536. else
  3537. die_unknown $opt
  3538. fi
  3539. ;;
  3540. --list-*)
  3541. NAME="${opt#--list-}"
  3542. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  3543. NAME=${NAME%s}
  3544. eval show_list $NAME \$$(toupper $NAME)_LIST
  3545. ;;
  3546. --help|-h) show_help
  3547. ;;
  3548. --quiet|-q) quiet=yes
  3549. ;;
  3550. --fatal-warnings) enable fatal_warnings
  3551. ;;
  3552. --libfuzzer=*)
  3553. libfuzzer_path="$optval"
  3554. ;;
  3555. *)
  3556. optname="${opt%%=*}"
  3557. optname="${optname#--}"
  3558. optname=$(echo "$optname" | sed 's/-/_/g')
  3559. if is_in $optname $CMDLINE_SET; then
  3560. eval $optname='$optval'
  3561. elif is_in $optname $CMDLINE_APPEND; then
  3562. append $optname "$optval"
  3563. else
  3564. die_unknown $opt
  3565. fi
  3566. ;;
  3567. esac
  3568. done
  3569. for e in $env; do
  3570. eval "export $e"
  3571. done
  3572. if disabled autodetect; then
  3573. # Unless iconv is explicitely disabled by the user, we still want to probe
  3574. # for the iconv from the libc.
  3575. disabled iconv || enable libc_iconv
  3576. disable_weak $EXTERNAL_AUTODETECT_LIBRARY_LIST
  3577. disable_weak $HWACCEL_AUTODETECT_LIBRARY_LIST
  3578. fi
  3579. # Mark specifically enabled, but normally autodetected libraries as requested.
  3580. for lib in $AUTODETECT_LIBS; do
  3581. enabled $lib && request $lib
  3582. done
  3583. #TODO: switch to $AUTODETECT_LIBS when $THREADS_LIST is supported the same way
  3584. enable_weak $EXTERNAL_AUTODETECT_LIBRARY_LIST
  3585. enable_weak $HWACCEL_AUTODETECT_LIBRARY_LIST
  3586. disabled logging && logfile=/dev/null
  3587. # command line configuration sanity checks
  3588. # we need to build at least one lib type
  3589. if ! enabled_any static shared; then
  3590. cat <<EOF
  3591. At least one library type must be built.
  3592. Specify --enable-static to build the static libraries or --enable-shared to
  3593. build the shared libraries as well. To only build the shared libraries specify
  3594. --disable-static in addition to --enable-shared.
  3595. EOF
  3596. exit 1
  3597. fi
  3598. die_license_disabled() {
  3599. enabled $1 || { enabled $v && die "$v is $1 and --enable-$1 is not specified."; }
  3600. }
  3601. die_license_disabled_gpl() {
  3602. enabled $1 || { enabled $v && die "$v is incompatible with the gpl and --enable-$1 is not specified."; }
  3603. }
  3604. map "die_license_disabled gpl" $EXTERNAL_LIBRARY_GPL_LIST $EXTERNAL_LIBRARY_GPLV3_LIST
  3605. map "die_license_disabled version3" $EXTERNAL_LIBRARY_VERSION3_LIST $EXTERNAL_LIBRARY_GPLV3_LIST
  3606. enabled gpl && map "die_license_disabled_gpl nonfree" $EXTERNAL_LIBRARY_NONFREE_LIST
  3607. map "die_license_disabled nonfree" $HWACCEL_LIBRARY_NONFREE_LIST
  3608. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  3609. if enabled nonfree; then
  3610. license="nonfree and unredistributable"
  3611. elif enabled gplv3; then
  3612. license="GPL version 3 or later"
  3613. elif enabled lgplv3; then
  3614. license="LGPL version 3 or later"
  3615. elif enabled gpl; then
  3616. license="GPL version 2 or later"
  3617. else
  3618. license="LGPL version 2.1 or later"
  3619. fi
  3620. enabled_all gnutls openssl &&
  3621. die "GnuTLS and OpenSSL must not be enabled at the same time."
  3622. enabled_all gnutls mbedtls &&
  3623. die "GnuTLS and mbedTLS must not be enabled at the same time."
  3624. enabled_all openssl mbedtls &&
  3625. die "OpenSSL and mbedTLS must not be enabled at the same time."
  3626. # Disable all the library-specific components if the library itself
  3627. # is disabled, see AVCODEC_LIST and following _LIST variables.
  3628. disable_components(){
  3629. disabled ${1} && disable $(
  3630. eval components="\$$(toupper ${1})_COMPONENTS"
  3631. map 'eval echo \${$(toupper ${v%s})_LIST}' $components
  3632. )
  3633. }
  3634. map 'disable_components $v' $LIBRARY_LIST
  3635. echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
  3636. set >> $logfile
  3637. test -n "$valgrind" && toolchain="valgrind-memcheck"
  3638. enabled ossfuzz && ! echo $CFLAGS | grep -q -- "-fsanitize=" &&{
  3639. add_cflags -fsanitize=address,undefined -fsanitize-coverage=trace-pc-guard,trace-cmp -fno-omit-frame-pointer
  3640. add_ldflags -fsanitize=address,undefined -fsanitize-coverage=trace-pc-guard,trace-cmp
  3641. }
  3642. case "$toolchain" in
  3643. *-asan)
  3644. cc_default="${toolchain%-asan}"
  3645. add_cflags -fsanitize=address
  3646. add_ldflags -fsanitize=address
  3647. ;;
  3648. *-msan)
  3649. cc_default="${toolchain%-msan}"
  3650. add_cflags -fsanitize=memory -fsanitize-memory-track-origins
  3651. add_ldflags -fsanitize=memory
  3652. ;;
  3653. *-tsan)
  3654. cc_default="${toolchain%-tsan}"
  3655. add_cflags -fsanitize=thread -fPIE
  3656. add_ldflags -fsanitize=thread -pie
  3657. case "$toolchain" in
  3658. gcc-tsan)
  3659. add_cflags -fPIC
  3660. add_ldflags -fPIC
  3661. ;;
  3662. esac
  3663. ;;
  3664. *-usan)
  3665. cc_default="${toolchain%-usan}"
  3666. add_cflags -fsanitize=undefined
  3667. add_ldflags -fsanitize=undefined
  3668. ;;
  3669. valgrind-*)
  3670. target_exec_default="valgrind"
  3671. case "$toolchain" in
  3672. valgrind-massif)
  3673. 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"
  3674. ;;
  3675. valgrind-memcheck)
  3676. 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"
  3677. ;;
  3678. esac
  3679. ;;
  3680. msvc)
  3681. # Check whether the current MSVC version needs the C99 converter.
  3682. # From MSVC 2013 (compiler major version 18) onwards, it does actually
  3683. # support enough of C99 to build ffmpeg. Default to the new
  3684. # behaviour if the regexp was unable to match anything, since this
  3685. # successfully parses the version number of existing supported
  3686. # versions that require the converter (MSVC 2010 and 2012).
  3687. cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
  3688. if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
  3689. cc_default="cl"
  3690. cxx_default="cl"
  3691. else
  3692. die "Unsupported MSVC version (2013 or newer required)"
  3693. fi
  3694. ld_default="$source_path/compat/windows/mslink"
  3695. nm_default="dumpbin -symbols"
  3696. ar_default="lib"
  3697. case "$arch" in
  3698. aarch64|arm64)
  3699. as_default="armasm64"
  3700. ;;
  3701. arm*)
  3702. as_default="armasm"
  3703. ;;
  3704. esac
  3705. target_os_default="win32"
  3706. # Use a relative path for TMPDIR. This makes sure all the
  3707. # ffconf temp files are written with a relative path, avoiding
  3708. # issues with msys/win32 path conversion for MSVC parameters
  3709. # such as -Fo<file> or -out:<file>.
  3710. TMPDIR=.
  3711. ;;
  3712. icl)
  3713. cc_default="icl"
  3714. ld_default="xilink"
  3715. nm_default="dumpbin -symbols"
  3716. ar_default="xilib"
  3717. target_os_default="win32"
  3718. TMPDIR=.
  3719. ;;
  3720. gcov)
  3721. add_cflags -fprofile-arcs -ftest-coverage
  3722. add_ldflags -fprofile-arcs -ftest-coverage
  3723. ;;
  3724. llvm-cov)
  3725. add_cflags -fprofile-arcs -ftest-coverage
  3726. add_ldflags --coverage
  3727. ;;
  3728. hardened)
  3729. add_cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
  3730. add_cflags -fno-strict-overflow -fstack-protector-all
  3731. add_ldflags -Wl,-z,relro -Wl,-z,now
  3732. add_cflags -fPIE
  3733. add_ldexeflags -fPIE -pie
  3734. ;;
  3735. ?*)
  3736. die "Unknown toolchain $toolchain"
  3737. ;;
  3738. esac
  3739. if test -n "$cross_prefix"; then
  3740. test -n "$arch" && test -n "$target_os" ||
  3741. die "Must specify target arch (--arch) and OS (--target-os) when cross-compiling"
  3742. enable cross_compile
  3743. fi
  3744. ar_default="${cross_prefix}${ar_default}"
  3745. cc_default="${cross_prefix}${cc_default}"
  3746. cxx_default="${cross_prefix}${cxx_default}"
  3747. nm_default="${cross_prefix}${nm_default}"
  3748. pkg_config_default="${cross_prefix}${pkg_config_default}"
  3749. if ${cross_prefix}${ranlib_default} 2>&1 | grep -q "\-D "; then
  3750. ranlib_default="${cross_prefix}${ranlib_default} -D"
  3751. else
  3752. ranlib_default="${cross_prefix}${ranlib_default}"
  3753. fi
  3754. strip_default="${cross_prefix}${strip_default}"
  3755. windres_default="${cross_prefix}${windres_default}"
  3756. sysinclude_default="${sysroot}/usr/include"
  3757. set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \
  3758. target_exec target_os x86asmexe nvcc
  3759. enabled cross_compile || host_cc_default=$cc
  3760. set_default host_cc
  3761. pkg_config_fail_message=""
  3762. if ! $pkg_config --version >/dev/null 2>&1; then
  3763. warn "$pkg_config not found, library detection may fail."
  3764. pkg_config=false
  3765. elif is_in -static $cc $LDFLAGS && ! is_in --static $pkg_config $pkg_config_flags; then
  3766. pkg_config_fail_message="
  3767. Note: When building a static binary, add --pkg-config-flags=\"--static\"."
  3768. fi
  3769. if test $doxygen != $doxygen_default && \
  3770. ! $doxygen --version >/dev/null 2>&1; then
  3771. warn "Specified doxygen \"$doxygen\" not found, API documentation will fail to build."
  3772. fi
  3773. exesuf() {
  3774. case $1 in
  3775. mingw32*|mingw64*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  3776. esac
  3777. }
  3778. EXESUF=$(exesuf $target_os)
  3779. HOSTEXESUF=$(exesuf $host_os)
  3780. # set temporary file name
  3781. : ${TMPDIR:=$TEMPDIR}
  3782. : ${TMPDIR:=$TMP}
  3783. : ${TMPDIR:=/tmp}
  3784. if [ -n "$tempprefix" ] ; then
  3785. mktemp(){
  3786. tmpname="$tempprefix.${HOSTNAME}.${UID}"
  3787. echo "$tmpname"
  3788. mkdir "$tmpname"
  3789. }
  3790. elif ! test_cmd mktemp -u XXXXXX; then
  3791. # simple replacement for missing mktemp
  3792. # NOT SAFE FOR GENERAL USE
  3793. mktemp(){
  3794. tmpname="${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  3795. echo "$tmpname"
  3796. mkdir "$tmpname"
  3797. }
  3798. fi
  3799. FFTMPDIR=$(mktemp -d "${TMPDIR}/ffconf.XXXXXXXX" 2> /dev/null) ||
  3800. die "Unable to create temporary directory in $TMPDIR."
  3801. tmpfile(){
  3802. tmp="${FFTMPDIR}/test"$2
  3803. (set -C; exec > $tmp) 2> /dev/null ||
  3804. die "Unable to create temporary file in $FFTMPDIR."
  3805. eval $1=$tmp
  3806. }
  3807. trap 'rm -rf -- "$FFTMPDIR"' EXIT
  3808. trap 'exit 2' INT
  3809. tmpfile TMPASM .asm
  3810. tmpfile TMPC .c
  3811. tmpfile TMPCPP .cpp
  3812. tmpfile TMPE $EXESUF
  3813. tmpfile TMPH .h
  3814. tmpfile TMPM .m
  3815. tmpfile TMPO .o
  3816. tmpfile TMPS .S
  3817. tmpfile TMPSH .sh
  3818. tmpfile TMPV .ver
  3819. unset -f mktemp
  3820. chmod +x $TMPE
  3821. # make sure we can execute files in $TMPDIR
  3822. cat > $TMPSH 2>> $logfile <<EOF
  3823. #! /bin/sh
  3824. EOF
  3825. chmod +x $TMPSH >> $logfile 2>&1
  3826. if ! $TMPSH >> $logfile 2>&1; then
  3827. cat <<EOF
  3828. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  3829. variable to another directory and make sure that it is not mounted noexec.
  3830. EOF
  3831. die "Sanity test failed."
  3832. fi
  3833. armasm_flags(){
  3834. for flag; do
  3835. case $flag in
  3836. # Filter out MSVC cl.exe options from cflags that shouldn't
  3837. # be passed to gas-preprocessor
  3838. -M[TD]*) ;;
  3839. *) echo $flag ;;
  3840. esac
  3841. done
  3842. }
  3843. cparser_flags(){
  3844. for flag; do
  3845. case $flag in
  3846. -Wno-switch) echo -Wno-switch-enum ;;
  3847. -Wno-format-zero-length) ;;
  3848. -Wdisabled-optimization) ;;
  3849. -Wno-pointer-sign) echo -Wno-other ;;
  3850. *) echo $flag ;;
  3851. esac
  3852. done
  3853. }
  3854. msvc_common_flags(){
  3855. for flag; do
  3856. case $flag in
  3857. # In addition to specifying certain flags under the compiler
  3858. # specific filters, they must be specified here as well or else the
  3859. # generic catch all at the bottom will print the original flag.
  3860. -Wall) ;;
  3861. -Wextra) ;;
  3862. -std=c99) ;;
  3863. # Common flags
  3864. -fomit-frame-pointer) ;;
  3865. -g) echo -Z7 ;;
  3866. -fno-math-errno) ;;
  3867. -fno-common) ;;
  3868. -fno-signed-zeros) ;;
  3869. -fPIC) ;;
  3870. -mthumb) ;;
  3871. -march=*) ;;
  3872. -lz) echo zlib.lib ;;
  3873. -lx264) echo libx264.lib ;;
  3874. -lstdc++) ;;
  3875. -l*) echo ${flag#-l}.lib ;;
  3876. -LARGEADDRESSAWARE) echo $flag ;;
  3877. -L*) echo -libpath:${flag#-L} ;;
  3878. *) echo $flag ;;
  3879. esac
  3880. done
  3881. }
  3882. msvc_flags(){
  3883. msvc_common_flags "$@"
  3884. for flag; do
  3885. case $flag in
  3886. -Wall) echo -W3 -wd4018 -wd4146 -wd4244 -wd4305 \
  3887. -wd4554 ;;
  3888. -Wextra) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
  3889. -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
  3890. -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
  3891. -wd4307 \
  3892. -wd4273 -wd4554 -wd4701 -wd4703 ;;
  3893. esac
  3894. done
  3895. }
  3896. icl_flags(){
  3897. msvc_common_flags "$@"
  3898. for flag; do
  3899. case $flag in
  3900. # Despite what Intel's documentation says -Wall, which is supported
  3901. # on Windows, does enable remarks so disable them here.
  3902. -Wall) echo $flag -Qdiag-disable:remark ;;
  3903. -std=c99) echo -Qstd=c99 ;;
  3904. -flto) echo -ipo ;;
  3905. esac
  3906. done
  3907. }
  3908. icc_flags(){
  3909. for flag; do
  3910. case $flag in
  3911. -flto) echo -ipo ;;
  3912. *) echo $flag ;;
  3913. esac
  3914. done
  3915. }
  3916. suncc_flags(){
  3917. for flag; do
  3918. case $flag in
  3919. -march=*|-mcpu=*)
  3920. case "${flag#*=}" in
  3921. native) echo -xtarget=native ;;
  3922. v9|niagara) echo -xarch=sparc ;;
  3923. ultrasparc) echo -xarch=sparcvis ;;
  3924. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  3925. i586|pentium) echo -xchip=pentium ;;
  3926. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  3927. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  3928. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  3929. pentium4*) echo -xtarget=pentium4 ;;
  3930. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  3931. *-sse3) echo -xarch=sse3 ;;
  3932. core2) echo -xarch=ssse3 -xchip=core2 ;;
  3933. bonnell) echo -xarch=ssse3 ;;
  3934. corei7|nehalem) echo -xtarget=nehalem ;;
  3935. westmere) echo -xtarget=westmere ;;
  3936. silvermont) echo -xarch=sse4_2 ;;
  3937. corei7-avx|sandybridge) echo -xtarget=sandybridge ;;
  3938. core-avx*|ivybridge|haswell|broadwell|skylake*|knl)
  3939. echo -xarch=avx ;;
  3940. amdfam10|barcelona) echo -xtarget=barcelona ;;
  3941. btver1) echo -xarch=amdsse4a ;;
  3942. btver2|bdver*|znver*) echo -xarch=avx ;;
  3943. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  3944. k8|opteron|athlon64|athlon-fx)
  3945. echo -xarch=sse2a ;;
  3946. athlon*) echo -xarch=pentium_proa ;;
  3947. esac
  3948. ;;
  3949. -std=c99) echo -xc99 ;;
  3950. -fomit-frame-pointer) echo -xregs=frameptr ;;
  3951. -fPIC) echo -KPIC -xcode=pic32 ;;
  3952. -W*,*) echo $flag ;;
  3953. -f*-*|-W*|-mimpure-text) ;;
  3954. -shared) echo -G ;;
  3955. *) echo $flag ;;
  3956. esac
  3957. done
  3958. }
  3959. probe_cc(){
  3960. pfx=$1
  3961. _cc=$2
  3962. first=$3
  3963. unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
  3964. unset _ld_o _ldflags _ld_lib _ld_path
  3965. unset _depflags _DEPCMD _DEPFLAGS
  3966. _flags_filter=echo
  3967. if $_cc --version 2>&1 | grep -q '^GNU assembler'; then
  3968. true # no-op to avoid reading stdin in following checks
  3969. elif $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  3970. _type=llvm_gcc
  3971. gcc_extra_ver=$(expr "$($_cc --version 2>/dev/null | head -n1)" : '.*\((.*)\)')
  3972. _ident="llvm-gcc $($_cc -dumpversion 2>/dev/null) $gcc_extra_ver"
  3973. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  3974. _cflags_speed='-O3'
  3975. _cflags_size='-Os'
  3976. elif $_cc -v 2>&1 | grep -qi ^gcc; then
  3977. _type=gcc
  3978. gcc_version=$($_cc --version | head -n1)
  3979. gcc_basever=$($_cc -dumpversion)
  3980. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  3981. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  3982. _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  3983. case $gcc_basever in
  3984. 2) ;;
  3985. 2.*) ;;
  3986. *) _depflags='-MMD -MF $(@:.o=.d) -MT $@' ;;
  3987. esac
  3988. if [ "$first" = true ]; then
  3989. case $gcc_basever in
  3990. 4.2*)
  3991. warn "gcc 4.2 is outdated and may miscompile FFmpeg. Please use a newer compiler." ;;
  3992. esac
  3993. fi
  3994. _cflags_speed='-O3'
  3995. _cflags_size='-Os'
  3996. elif $_cc --version 2>/dev/null | grep -q ^icc; then
  3997. _type=icc
  3998. _ident=$($_cc --version | head -n1)
  3999. _depflags='-MMD'
  4000. _cflags_speed='-O3'
  4001. _cflags_size='-Os'
  4002. _cflags_noopt='-O1'
  4003. _flags_filter=icc_flags
  4004. elif $_cc -v 2>&1 | grep -q xlc; then
  4005. _type=xlc
  4006. _ident=$($_cc -qversion 2>/dev/null | head -n1)
  4007. _cflags_speed='-O5'
  4008. _cflags_size='-O5 -qcompact'
  4009. elif $_cc --vsn 2>/dev/null | grep -Eq "ARM (C/C\+\+ )?Compiler"; then
  4010. test -d "$sysroot" || die "No valid sysroot specified."
  4011. _type=armcc
  4012. _ident=$($_cc --vsn | grep -i build | head -n1 | sed 's/.*: //')
  4013. armcc_conf="$PWD/armcc.conf"
  4014. $_cc --arm_linux_configure \
  4015. --arm_linux_config_file="$armcc_conf" \
  4016. --configure_sysroot="$sysroot" \
  4017. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  4018. die "Error creating armcc configuration file."
  4019. $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  4020. _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
  4021. as_default="${cross_prefix}gcc"
  4022. _depflags='-MMD'
  4023. _cflags_speed='-O3'
  4024. _cflags_size='-Os'
  4025. elif $_cc -v 2>&1 | grep -q clang && ! $_cc -? > /dev/null 2>&1; then
  4026. _type=clang
  4027. _ident=$($_cc --version 2>/dev/null | head -n1)
  4028. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  4029. _cflags_speed='-O3'
  4030. _cflags_size='-Oz'
  4031. elif $_cc -V 2>&1 | grep -q Sun; then
  4032. _type=suncc
  4033. _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  4034. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  4035. _DEPFLAGS='-xM1 -xc99'
  4036. _ldflags='-std=c99'
  4037. _cflags_speed='-O5'
  4038. _cflags_size='-O5 -xspace'
  4039. _flags_filter=suncc_flags
  4040. elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  4041. _type=pathscale
  4042. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  4043. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  4044. _cflags_speed='-O2'
  4045. _cflags_size='-Os'
  4046. _flags_filter='filter_out -Wdisabled-optimization'
  4047. elif $_cc -v 2>&1 | grep -q Open64; then
  4048. _type=open64
  4049. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  4050. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  4051. _cflags_speed='-O2'
  4052. _cflags_size='-Os'
  4053. _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  4054. elif $_cc 2>&1 | grep -q 'Microsoft.*ARM.*Assembler'; then
  4055. _type=armasm
  4056. _ident=$($_cc | head -n1)
  4057. # 4509: "This form of conditional instruction is deprecated"
  4058. _flags="-nologo -ignore 4509"
  4059. _flags_filter=armasm_flags
  4060. elif $_cc 2>&1 | grep -q Intel; then
  4061. _type=icl
  4062. _ident=$($_cc 2>&1 | head -n1)
  4063. _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
  4064. # Not only is O3 broken on 13.x+ but it is slower on all previous
  4065. # versions (tested) as well.
  4066. _cflags_speed="-O2"
  4067. _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
  4068. if $_cc 2>&1 | grep -q Linker; then
  4069. _ld_o='-out:$@'
  4070. else
  4071. _ld_o='-Fe$@'
  4072. fi
  4073. _cc_o='-Fo$@'
  4074. _cc_e='-P'
  4075. _flags_filter=icl_flags
  4076. _ld_lib='lib%.a'
  4077. _ld_path='-libpath:'
  4078. # -Qdiag-error to make icl error when seeing certain unknown arguments
  4079. _flags='-nologo -Qdiag-error:4044,10157'
  4080. # -Qvec- -Qsimd- to prevent miscompilation, -GS, fp:precise for consistency
  4081. # with MSVC which enables it by default.
  4082. _cflags='-Qms0 -Qvec- -Qsimd- -GS -fp:precise'
  4083. disable stripping
  4084. elif $_cc -? 2>/dev/null | grep -q 'LLVM.*Linker'; then
  4085. # lld can emulate multiple different linkers; in ms link.exe mode,
  4086. # the -? parameter gives the help output which contains an identifyable
  4087. # string, while it gives an error in other modes.
  4088. _type=lld-link
  4089. # The link.exe mode doesn't have a switch for getting the version,
  4090. # but we can force it back to gnu mode and get the version from there.
  4091. _ident=$($_cc -flavor gnu --version 2>/dev/null)
  4092. _ld_o='-out:$@'
  4093. _flags_filter=msvc_flags
  4094. _ld_lib='lib%.a'
  4095. _ld_path='-libpath:'
  4096. elif $_cc -nologo- 2>&1 | grep -q Microsoft || { $_cc -v 2>&1 | grep -q clang && $_cc -? > /dev/null 2>&1; }; then
  4097. _type=msvc
  4098. _ident=$($_cc 2>&1 | head -n1 | tr -d '\r')
  4099. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
  4100. _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
  4101. _cflags_speed="-O2"
  4102. _cflags_size="-O1"
  4103. _cflags_noopt="-O1"
  4104. if $_cc -nologo- 2>&1 | grep -q Linker; then
  4105. _ld_o='-out:$@'
  4106. else
  4107. _ld_o='-Fe$@'
  4108. fi
  4109. _cc_o='-Fo$@'
  4110. _cc_e='-P -Fi$@'
  4111. _flags_filter=msvc_flags
  4112. _ld_lib='lib%.a'
  4113. _ld_path='-libpath:'
  4114. _flags='-nologo'
  4115. disable stripping
  4116. elif $_cc --version 2>/dev/null | grep -q ^cparser; then
  4117. _type=cparser
  4118. _ident=$($_cc --version | head -n1)
  4119. _depflags='-MMD'
  4120. _cflags_speed='-O4'
  4121. _cflags_size='-O2'
  4122. _flags_filter=cparser_flags
  4123. fi
  4124. eval ${pfx}_type=\$_type
  4125. eval ${pfx}_ident=\$_ident
  4126. }
  4127. set_ccvars(){
  4128. eval ${1}_C=\${_cc_c-\${${1}_C}}
  4129. eval ${1}_E=\${_cc_e-\${${1}_E}}
  4130. eval ${1}_O=\${_cc_o-\${${1}_O}}
  4131. if [ -n "$_depflags" ]; then
  4132. eval ${1}_DEPFLAGS=\$_depflags
  4133. else
  4134. eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
  4135. eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
  4136. eval DEP${1}FLAGS=\$_flags
  4137. fi
  4138. }
  4139. probe_cc cc "$cc" "true"
  4140. cflags_filter=$_flags_filter
  4141. cflags_speed=$_cflags_speed
  4142. cflags_size=$_cflags_size
  4143. cflags_noopt=$_cflags_noopt
  4144. add_cflags $_flags $_cflags
  4145. cc_ldflags=$_ldflags
  4146. set_ccvars CC
  4147. set_ccvars CXX
  4148. probe_cc hostcc "$host_cc"
  4149. host_cflags_filter=$_flags_filter
  4150. host_cflags_speed=$_cflags_speed
  4151. add_host_cflags $_flags $_cflags
  4152. set_ccvars HOSTCC
  4153. test -n "$cc_type" && enable $cc_type ||
  4154. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  4155. : ${as_default:=$cc}
  4156. : ${objcc_default:=$cc}
  4157. : ${dep_cc_default:=$cc}
  4158. : ${ld_default:=$cc}
  4159. : ${host_ld_default:=$host_cc}
  4160. set_default ar as objcc dep_cc ld ln_s host_ld windres
  4161. probe_cc as "$as"
  4162. asflags_filter=$_flags_filter
  4163. add_asflags $_flags $_cflags
  4164. set_ccvars AS
  4165. probe_cc objcc "$objcc"
  4166. objcflags_filter=$_flags_filter
  4167. add_objcflags $_flags $_cflags
  4168. set_ccvars OBJC
  4169. probe_cc ld "$ld"
  4170. ldflags_filter=$_flags_filter
  4171. add_ldflags $_flags $_ldflags
  4172. test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
  4173. LD_O=${_ld_o-$LD_O}
  4174. LD_LIB=${_ld_lib-$LD_LIB}
  4175. LD_PATH=${_ld_path-$LD_PATH}
  4176. probe_cc hostld "$host_ld"
  4177. host_ldflags_filter=$_flags_filter
  4178. add_host_ldflags $_flags $_ldflags
  4179. HOSTLD_O=${_ld_o-$HOSTLD_O}
  4180. if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
  4181. probe_cc depcc "$dep_cc"
  4182. CCDEP=${_DEPCMD:-$DEPCMD}
  4183. CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
  4184. DEPCCFLAGS=$_flags
  4185. fi
  4186. if $ar 2>&1 | grep -q Microsoft; then
  4187. arflags="-nologo"
  4188. ar_o='-out:$@'
  4189. elif $ar 2>&1 | grep -q "\[D\] "; then
  4190. arflags="rcD"
  4191. ar_o='$@'
  4192. else
  4193. arflags="rc"
  4194. ar_o='$@'
  4195. fi
  4196. add_cflags $extra_cflags
  4197. add_cxxflags $extra_cxxflags
  4198. add_objcflags $extra_objcflags
  4199. add_asflags $extra_cflags
  4200. if test -n "$sysroot"; then
  4201. case "$cc_type" in
  4202. gcc|llvm_gcc|clang)
  4203. add_cppflags --sysroot="$sysroot"
  4204. add_ldflags --sysroot="$sysroot"
  4205. ;;
  4206. esac
  4207. fi
  4208. if test "$cpu" = host; then
  4209. enabled cross_compile &&
  4210. die "--cpu=host makes no sense when cross-compiling."
  4211. case "$cc_type" in
  4212. gcc|llvm_gcc)
  4213. check_native(){
  4214. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  4215. sed -n "/cc1.*$1=/{
  4216. s/.*$1=\\([^ ]*\\).*/\\1/
  4217. p
  4218. q
  4219. }" $TMPE
  4220. }
  4221. cpu=$(check_native -march || check_native -mcpu)
  4222. ;;
  4223. clang)
  4224. check_native(){
  4225. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  4226. sed -n "/cc1.*-target-cpu /{
  4227. s/.*-target-cpu \\([^ ]*\\).*/\\1/
  4228. p
  4229. q
  4230. }" $TMPE
  4231. }
  4232. cpu=$(check_native -march)
  4233. ;;
  4234. esac
  4235. test "${cpu:-host}" = host &&
  4236. die "--cpu=host not supported with compiler $cc"
  4237. fi
  4238. # Deal with common $arch aliases
  4239. case "$arch" in
  4240. aarch64|arm64)
  4241. arch="aarch64"
  4242. ;;
  4243. arm*|iPad*|iPhone*)
  4244. arch="arm"
  4245. ;;
  4246. mips*|IP*)
  4247. case "$arch" in
  4248. *el)
  4249. add_cppflags -EL
  4250. add_ldflags -EL
  4251. ;;
  4252. *eb)
  4253. add_cppflags -EB
  4254. add_ldflags -EB
  4255. ;;
  4256. esac
  4257. arch="mips"
  4258. ;;
  4259. parisc*|hppa*)
  4260. arch="parisc"
  4261. ;;
  4262. "Power Macintosh"|ppc*|powerpc*)
  4263. arch="ppc"
  4264. ;;
  4265. s390|s390x)
  4266. arch="s390"
  4267. ;;
  4268. sh4|sh)
  4269. arch="sh4"
  4270. ;;
  4271. sun4*|sparc*)
  4272. arch="sparc"
  4273. ;;
  4274. tilegx|tile-gx)
  4275. arch="tilegx"
  4276. ;;
  4277. i[3-6]86*|i86pc|BePC|x86pc|x86_64|x86_32|amd64)
  4278. arch="x86"
  4279. ;;
  4280. esac
  4281. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  4282. enable $arch
  4283. # Add processor-specific flags
  4284. if enabled aarch64; then
  4285. case $cpu in
  4286. armv*)
  4287. cpuflags="-march=$cpu"
  4288. ;;
  4289. *)
  4290. cpuflags="-mcpu=$cpu"
  4291. ;;
  4292. esac
  4293. elif enabled alpha; then
  4294. cpuflags="-mcpu=$cpu"
  4295. elif enabled arm; then
  4296. check_arm_arch() {
  4297. test_cpp_condition stddef.h \
  4298. "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
  4299. $cpuflags
  4300. }
  4301. probe_arm_arch() {
  4302. if check_arm_arch 4; then echo armv4
  4303. elif check_arm_arch 4T; then echo armv4t
  4304. elif check_arm_arch 5; then echo armv5
  4305. elif check_arm_arch 5E; then echo armv5e
  4306. elif check_arm_arch 5T; then echo armv5t
  4307. elif check_arm_arch 5TE; then echo armv5te
  4308. elif check_arm_arch 5TEJ; then echo armv5te
  4309. elif check_arm_arch 6; then echo armv6
  4310. elif check_arm_arch 6J; then echo armv6j
  4311. elif check_arm_arch 6K; then echo armv6k
  4312. elif check_arm_arch 6Z; then echo armv6z
  4313. elif check_arm_arch 6KZ; then echo armv6zk
  4314. elif check_arm_arch 6ZK; then echo armv6zk
  4315. elif check_arm_arch 6T2; then echo armv6t2
  4316. elif check_arm_arch 7; then echo armv7
  4317. elif check_arm_arch 7A 7_A; then echo armv7-a
  4318. elif check_arm_arch 7S; then echo armv7-a
  4319. elif check_arm_arch 7R 7_R; then echo armv7-r
  4320. elif check_arm_arch 7M 7_M; then echo armv7-m
  4321. elif check_arm_arch 7EM 7E_M; then echo armv7-m
  4322. elif check_arm_arch 8A 8_A; then echo armv8-a
  4323. fi
  4324. }
  4325. [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
  4326. case $cpu in
  4327. armv*)
  4328. cpuflags="-march=$cpu"
  4329. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  4330. ;;
  4331. *)
  4332. cpuflags="-mcpu=$cpu"
  4333. case $cpu in
  4334. cortex-a*) subarch=armv7a ;;
  4335. cortex-r*) subarch=armv7r ;;
  4336. cortex-m*) enable thumb; subarch=armv7m ;;
  4337. arm11*) subarch=armv6 ;;
  4338. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  4339. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  4340. *) subarch=$(probe_arm_arch) ;;
  4341. esac
  4342. ;;
  4343. esac
  4344. case "$subarch" in
  4345. armv5t*) enable fast_clz ;;
  4346. armv[6-8]*)
  4347. enable fast_clz
  4348. disabled fast_unaligned || enable fast_unaligned
  4349. ;;
  4350. esac
  4351. elif enabled avr32; then
  4352. case $cpu in
  4353. ap7[02]0[0-2])
  4354. subarch="avr32_ap"
  4355. cpuflags="-mpart=$cpu"
  4356. ;;
  4357. ap)
  4358. subarch="avr32_ap"
  4359. cpuflags="-march=$cpu"
  4360. ;;
  4361. uc3[ab]*)
  4362. subarch="avr32_uc"
  4363. cpuflags="-mcpu=$cpu"
  4364. ;;
  4365. uc)
  4366. subarch="avr32_uc"
  4367. cpuflags="-march=$cpu"
  4368. ;;
  4369. esac
  4370. elif enabled bfin; then
  4371. cpuflags="-mcpu=$cpu"
  4372. elif enabled mips; then
  4373. cpuflags="-march=$cpu"
  4374. if [ "$cpu" != "generic" ]; then
  4375. disable mips32r2
  4376. disable mips32r5
  4377. disable mips64r2
  4378. disable mips32r6
  4379. disable mips64r6
  4380. disable loongson2
  4381. disable loongson3
  4382. case $cpu in
  4383. 24kc|24kf*|24kec|34kc|1004kc|24kef*|34kf*|1004kf*|74kc|74kf)
  4384. enable mips32r2
  4385. disable msa
  4386. ;;
  4387. p5600|i6400|p6600)
  4388. disable mipsdsp
  4389. disable mipsdspr2
  4390. ;;
  4391. loongson*)
  4392. enable loongson2
  4393. enable loongson3
  4394. enable local_aligned
  4395. enable simd_align_16
  4396. enable fast_64bit
  4397. enable fast_clz
  4398. enable fast_cmov
  4399. enable fast_unaligned
  4400. disable aligned_stack
  4401. disable mipsfpu
  4402. disable mipsdsp
  4403. disable mipsdspr2
  4404. case $cpu in
  4405. loongson3*)
  4406. cpuflags="-march=loongson3a -mhard-float -fno-expensive-optimizations"
  4407. ;;
  4408. loongson2e)
  4409. cpuflags="-march=loongson2e -mhard-float -fno-expensive-optimizations"
  4410. ;;
  4411. loongson2f)
  4412. cpuflags="-march=loongson2f -mhard-float -fno-expensive-optimizations"
  4413. ;;
  4414. esac
  4415. ;;
  4416. *)
  4417. # Unknown CPU. Disable everything.
  4418. warn "unknown CPU. Disabling all MIPS optimizations."
  4419. disable mipsfpu
  4420. disable mipsdsp
  4421. disable mipsdspr2
  4422. disable msa
  4423. disable mmi
  4424. ;;
  4425. esac
  4426. case $cpu in
  4427. 24kc)
  4428. disable mipsfpu
  4429. disable mipsdsp
  4430. disable mipsdspr2
  4431. ;;
  4432. 24kf*)
  4433. disable mipsdsp
  4434. disable mipsdspr2
  4435. ;;
  4436. 24kec|34kc|1004kc)
  4437. disable mipsfpu
  4438. disable mipsdspr2
  4439. ;;
  4440. 24kef*|34kf*|1004kf*)
  4441. disable mipsdspr2
  4442. ;;
  4443. 74kc)
  4444. disable mipsfpu
  4445. ;;
  4446. p5600)
  4447. enable mips32r5
  4448. check_cflags "-mtune=p5600" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops"
  4449. ;;
  4450. i6400)
  4451. enable mips64r6
  4452. check_cflags "-mtune=i6400 -mabi=64" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
  4453. ;;
  4454. p6600)
  4455. enable mips64r6
  4456. check_cflags "-mtune=p6600 -mabi=64" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
  4457. ;;
  4458. esac
  4459. else
  4460. # We do not disable anything. Is up to the user to disable the unwanted features.
  4461. warn 'generic cpu selected'
  4462. fi
  4463. elif enabled ppc; then
  4464. disable ldbrx
  4465. case $(tolower $cpu) in
  4466. 601|ppc601|powerpc601)
  4467. cpuflags="-mcpu=601"
  4468. disable altivec
  4469. ;;
  4470. 603*|ppc603*|powerpc603*)
  4471. cpuflags="-mcpu=603"
  4472. disable altivec
  4473. ;;
  4474. 604*|ppc604*|powerpc604*)
  4475. cpuflags="-mcpu=604"
  4476. disable altivec
  4477. ;;
  4478. g3|75*|ppc75*|powerpc75*)
  4479. cpuflags="-mcpu=750"
  4480. disable altivec
  4481. ;;
  4482. g4|745*|ppc745*|powerpc745*)
  4483. cpuflags="-mcpu=7450"
  4484. disable vsx
  4485. ;;
  4486. 74*|ppc74*|powerpc74*)
  4487. cpuflags="-mcpu=7400"
  4488. disable vsx
  4489. ;;
  4490. g5|970|ppc970|powerpc970)
  4491. cpuflags="-mcpu=970"
  4492. disable vsx
  4493. ;;
  4494. power[3-6]*)
  4495. cpuflags="-mcpu=$cpu"
  4496. disable vsx
  4497. ;;
  4498. power[7-8]*)
  4499. cpuflags="-mcpu=$cpu"
  4500. ;;
  4501. cell)
  4502. cpuflags="-mcpu=cell"
  4503. enable ldbrx
  4504. disable vsx
  4505. ;;
  4506. e500mc)
  4507. cpuflags="-mcpu=e500mc"
  4508. disable altivec
  4509. ;;
  4510. e500v2)
  4511. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  4512. disable altivec
  4513. disable dcbzl
  4514. ;;
  4515. e500)
  4516. cpuflags="-mcpu=8540 -mhard-float"
  4517. disable altivec
  4518. disable dcbzl
  4519. ;;
  4520. esac
  4521. elif enabled sparc; then
  4522. case $cpu in
  4523. cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
  4524. cpuflags="-mcpu=$cpu"
  4525. ;;
  4526. ultrasparc*|niagara[234])
  4527. cpuflags="-mcpu=$cpu"
  4528. ;;
  4529. esac
  4530. elif enabled x86; then
  4531. case $cpu in
  4532. i[345]86|pentium)
  4533. cpuflags="-march=$cpu"
  4534. disable i686
  4535. disable mmx
  4536. ;;
  4537. # targets that do NOT support nopl and conditional mov (cmov)
  4538. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  4539. cpuflags="-march=$cpu"
  4540. disable i686
  4541. ;;
  4542. # targets that do support nopl and conditional mov (cmov)
  4543. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx\
  4544. |core*|atom|bonnell|nehalem|westmere|silvermont|sandybridge|ivybridge|haswell|broadwell|skylake*|knl\
  4545. |amdfam10|barcelona|b[dt]ver*|znver*)
  4546. cpuflags="-march=$cpu"
  4547. enable i686
  4548. enable fast_cmov
  4549. ;;
  4550. # targets that do support conditional mov but on which it's slow
  4551. pentium4|pentium4m|prescott|nocona)
  4552. cpuflags="-march=$cpu"
  4553. enable i686
  4554. disable fast_cmov
  4555. ;;
  4556. esac
  4557. fi
  4558. if [ "$cpu" != generic ]; then
  4559. add_cflags $cpuflags
  4560. add_asflags $cpuflags
  4561. test "$cc_type" = "$ld_type" && add_ldflags $cpuflags
  4562. fi
  4563. # compiler sanity check
  4564. test_exec <<EOF
  4565. int main(void){ return 0; }
  4566. EOF
  4567. if test "$?" != 0; then
  4568. echo "$cc is unable to create an executable file."
  4569. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  4570. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  4571. echo "Only do this if you know what cross compiling means."
  4572. fi
  4573. die "C compiler test failed."
  4574. fi
  4575. add_cppflags -D_ISOC99_SOURCE
  4576. add_cxxflags -D__STDC_CONSTANT_MACROS
  4577. check_cxxflags -std=c++11 || check_cxxflags -std=c++0x
  4578. # some compilers silently accept -std=c11, so we also need to check that the
  4579. # version macro is defined properly
  4580. test_cflags_cc -std=c11 ctype.h "__STDC_VERSION__ >= 201112L" &&
  4581. add_cflags -std=c11 ||
  4582. check_cflags -std=c99
  4583. check_cppflags -D_FILE_OFFSET_BITS=64
  4584. check_cppflags -D_LARGEFILE_SOURCE
  4585. add_host_cppflags -D_ISOC99_SOURCE
  4586. check_host_cflags -std=c99
  4587. check_host_cflags -Wall
  4588. check_host_cflags $host_cflags_speed
  4589. check_64bit(){
  4590. arch32=$1
  4591. arch64=$2
  4592. expr=${3:-'sizeof(void *) > 4'}
  4593. test_code cc "" "int test[2*($expr) - 1]" &&
  4594. subarch=$arch64 || subarch=$arch32
  4595. enable $subarch
  4596. }
  4597. case "$arch" in
  4598. aarch64|alpha|ia64)
  4599. enabled shared && enable_weak pic
  4600. ;;
  4601. mips)
  4602. check_64bit mips mips64 '_MIPS_SIM > 1'
  4603. enabled shared && enable_weak pic
  4604. ;;
  4605. parisc)
  4606. check_64bit parisc parisc64
  4607. enabled shared && enable_weak pic
  4608. ;;
  4609. ppc)
  4610. check_64bit ppc ppc64
  4611. enabled shared && enable_weak pic
  4612. ;;
  4613. s390)
  4614. check_64bit s390 s390x
  4615. enabled shared && enable_weak pic
  4616. ;;
  4617. sparc)
  4618. check_64bit sparc sparc64
  4619. enabled shared && enable_weak pic
  4620. ;;
  4621. x86)
  4622. check_64bit x86_32 x86_64
  4623. # Treat x32 as x64 for now. Note it also needs pic if shared
  4624. test "$subarch" = "x86_32" && test_cpp_condition stddef.h 'defined(__x86_64__)' &&
  4625. subarch=x86_64 && enable x86_64 && disable x86_32
  4626. if enabled x86_64; then
  4627. enabled shared && enable_weak pic
  4628. objformat=elf64
  4629. fi
  4630. ;;
  4631. esac
  4632. # OS specific
  4633. case $target_os in
  4634. aix)
  4635. SHFLAGS=-shared
  4636. add_cppflags '-I\$(SRC_PATH)/compat/aix'
  4637. enabled shared && add_ldflags -Wl,-brtl
  4638. arflags='-Xany -r -c'
  4639. striptype=""
  4640. ;;
  4641. android)
  4642. disable symver
  4643. enable section_data_rel_ro
  4644. SLIB_INSTALL_NAME='$(SLIBNAME)'
  4645. SLIB_INSTALL_LINKS=
  4646. SHFLAGS='-shared -Wl,-soname,$(SLIBNAME)'
  4647. ;;
  4648. haiku)
  4649. prefix_default="/boot/common"
  4650. network_extralibs="-lnetwork"
  4651. host_extralibs=
  4652. ;;
  4653. sunos)
  4654. SHFLAGS='-shared -Wl,-h,$$(@F)'
  4655. enabled x86 && append SHFLAGS -mimpure-text
  4656. network_extralibs="-lsocket -lnsl"
  4657. add_cppflags -D__EXTENSIONS__
  4658. # When using suncc to build, the Solaris linker will mark
  4659. # an executable with each instruction set encountered by
  4660. # the Solaris assembler. As our libraries contain their own
  4661. # guards for processor-specific code, instead suppress
  4662. # generation of the HWCAPS ELF section on Solaris x86 only.
  4663. enabled_all suncc x86 &&
  4664. echo "hwcap_1 = OVERRIDE;" > mapfile &&
  4665. add_ldflags -Wl,-M,mapfile
  4666. nm_default='nm -P -g'
  4667. version_script='-M'
  4668. VERSION_SCRIPT_POSTPROCESS_CMD='perl $(SRC_PATH)/compat/solaris/make_sunver.pl - $(OBJS)'
  4669. ;;
  4670. netbsd)
  4671. disable symver
  4672. oss_indev_extralibs="-lossaudio"
  4673. oss_outdev_extralibs="-lossaudio"
  4674. enabled gcc || check_ldflags -Wl,-zmuldefs
  4675. ;;
  4676. openbsd|bitrig)
  4677. disable symver
  4678. striptype=""
  4679. SHFLAGS='-shared'
  4680. SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
  4681. SLIB_INSTALL_LINKS=
  4682. oss_indev_extralibs="-lossaudio"
  4683. oss_outdev_extralibs="-lossaudio"
  4684. ;;
  4685. dragonfly)
  4686. disable symver
  4687. ;;
  4688. freebsd)
  4689. ;;
  4690. bsd/os)
  4691. add_extralibs -lpoll -lgnugetopt
  4692. strip="strip -d"
  4693. ;;
  4694. darwin)
  4695. enabled ppc && add_asflags -force_cpusubtype_ALL
  4696. install_name_dir_default='$(SHLIBDIR)'
  4697. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(INSTALL_NAME_DIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  4698. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  4699. strip="${strip} -x"
  4700. add_ldflags -Wl,-dynamic,-search_paths_first
  4701. check_cflags -Werror=partial-availability
  4702. SLIBSUF=".dylib"
  4703. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  4704. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  4705. enabled x86_64 && objformat="macho64" || objformat="macho32"
  4706. enabled_any pic shared x86_64 ||
  4707. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  4708. check_header dispatch/dispatch.h &&
  4709. add_cppflags '-I\$(SRC_PATH)/compat/dispatch_semaphore'
  4710. if test -n "$sysroot"; then
  4711. is_in -isysroot $cc $CPPFLAGS $CFLAGS || check_cppflags -isysroot $sysroot
  4712. is_in -isysroot $ld $LDFLAGS || check_ldflags -isysroot $sysroot
  4713. fi
  4714. version_script='-exported_symbols_list'
  4715. VERSION_SCRIPT_POSTPROCESS_CMD='tr " " "\n" | sed -n /global:/,/local:/p | grep ";" | tr ";" "\n" | sed -E "s/(.+)/_\1/g" | sed -E "s/(.+[^*])$$$$/\1*/"'
  4716. ;;
  4717. msys*)
  4718. die "Native MSYS builds are discouraged, please use the MINGW environment."
  4719. ;;
  4720. mingw32*|mingw64*)
  4721. target_os=mingw32
  4722. LIBTARGET=i386
  4723. if enabled x86_64; then
  4724. LIBTARGET="i386:x86-64"
  4725. elif enabled arm; then
  4726. LIBTARGET="arm"
  4727. elif enabled aarch64; then
  4728. LIBTARGET="arm64"
  4729. fi
  4730. if enabled shared; then
  4731. # Cannot build both shared and static libs when using dllimport.
  4732. disable static
  4733. fi
  4734. enabled shared && ! enabled small && test_cmd $windres --version && enable gnu_windres
  4735. enabled x86_32 && check_ldflags -Wl,--large-address-aware
  4736. shlibdir_default="$bindir_default"
  4737. SLIBPREF=""
  4738. SLIBSUF=".dll"
  4739. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  4740. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  4741. if test_cmd lib.exe -list; then
  4742. SLIB_EXTRA_CMD=-'lib.exe -nologo -machine:$(LIBTARGET) -def:$$(@:$(SLIBSUF)=.def) -out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  4743. if enabled x86_64; then
  4744. LIBTARGET=x64
  4745. fi
  4746. else
  4747. SLIB_EXTRA_CMD=-'$(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
  4748. fi
  4749. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  4750. SLIB_INSTALL_LINKS=
  4751. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  4752. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  4753. 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)'
  4754. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--disable-auto-image-base $$(@:$(SLIBSUF)=.def)'
  4755. enabled x86_64 && objformat="win64" || objformat="win32"
  4756. dlltool="${cross_prefix}dlltool"
  4757. ranlib=:
  4758. enable dos_paths
  4759. check_ldflags -Wl,--nxcompat,--dynamicbase
  4760. # Lets work around some stupidity in binutils.
  4761. # ld will strip relocations from executables even though we need them
  4762. # for dynamicbase (ASLR). Using -pie does retain the reloc section
  4763. # however ld then forgets what the entry point should be (oops) so we
  4764. # have to manually (re)set it.
  4765. if enabled x86_32; then
  4766. disabled debug && add_ldexeflags -Wl,--pic-executable,-e,_mainCRTStartup
  4767. elif enabled x86_64; then
  4768. disabled debug && add_ldexeflags -Wl,--pic-executable,-e,mainCRTStartup
  4769. check_ldflags -Wl,--high-entropy-va # binutils 2.25
  4770. # Set image base >4GB for extra entropy with HEASLR
  4771. add_ldexeflags -Wl,--image-base,0x140000000
  4772. append SHFLAGS -Wl,--image-base,0x180000000
  4773. fi
  4774. ;;
  4775. win32|win64)
  4776. disable symver
  4777. if enabled shared; then
  4778. # Link to the import library instead of the normal static library
  4779. # for shared libs.
  4780. LD_LIB='%.lib'
  4781. # Cannot build both shared and static libs with MSVC or icl.
  4782. disable static
  4783. fi
  4784. enabled x86_32 && check_ldflags -LARGEADDRESSAWARE
  4785. shlibdir_default="$bindir_default"
  4786. SLIBPREF=""
  4787. SLIBSUF=".dll"
  4788. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  4789. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  4790. SLIB_CREATE_DEF_CMD='EXTERN_PREFIX="$(EXTERN_PREFIX)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
  4791. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  4792. SLIB_INSTALL_LINKS=
  4793. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  4794. SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  4795. SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  4796. enabled x86_64 && objformat="win64" || objformat="win32"
  4797. ranlib=:
  4798. enable dos_paths
  4799. ;;
  4800. cygwin*)
  4801. target_os=cygwin
  4802. shlibdir_default="$bindir_default"
  4803. SLIBPREF="cyg"
  4804. SLIBSUF=".dll"
  4805. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  4806. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  4807. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  4808. SLIB_INSTALL_LINKS=
  4809. SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
  4810. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
  4811. enabled x86_64 && objformat="win64" || objformat="win32"
  4812. enable dos_paths
  4813. enabled shared && ! enabled small && test_cmd $windres --version && enable gnu_windres
  4814. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  4815. ;;
  4816. *-dos|freedos|opendos)
  4817. network_extralibs="-lsocket"
  4818. objformat="coff"
  4819. enable dos_paths
  4820. add_cppflags -U__STRICT_ANSI__
  4821. ;;
  4822. linux)
  4823. enable section_data_rel_ro
  4824. enabled_any arm aarch64 && enable_weak linux_perf
  4825. ;;
  4826. irix*)
  4827. target_os=irix
  4828. ranlib="echo ignoring ranlib"
  4829. ;;
  4830. os/2*)
  4831. strip="lxlite -CS"
  4832. striptype=""
  4833. objformat="aout"
  4834. add_cppflags -D_GNU_SOURCE
  4835. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zhigh-mem -Zmap
  4836. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  4837. LIBSUF="_s.a"
  4838. SLIBPREF=""
  4839. SLIBSUF=".dll"
  4840. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  4841. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(FULLNAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  4842. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(FULLNAME).def; \
  4843. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(FULLNAME).def; \
  4844. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(FULLNAME).def; \
  4845. echo EXPORTS >> $(SUBDIR)$(FULLNAME).def; \
  4846. emxexp $(OBJS) >> $(SUBDIR)$(FULLNAME).def'
  4847. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(FULLNAME)_dll.a $(SUBDIR)$(FULLNAME).def; \
  4848. emximp -o $(SUBDIR)$(LIBPREF)$(FULLNAME)_dll.lib $(SUBDIR)$(FULLNAME).def;'
  4849. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  4850. SLIB_INSTALL_LINKS=
  4851. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(FULLNAME)_dll.a $(LIBPREF)$(FULLNAME)_dll.lib'
  4852. enable dos_paths
  4853. enable_weak os2threads
  4854. ;;
  4855. gnu/kfreebsd)
  4856. add_cppflags -D_BSD_SOURCE
  4857. ;;
  4858. gnu)
  4859. ;;
  4860. qnx)
  4861. add_cppflags -D_QNX_SOURCE
  4862. network_extralibs="-lsocket"
  4863. ;;
  4864. symbian)
  4865. SLIBSUF=".dll"
  4866. enable dos_paths
  4867. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  4868. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  4869. add_ldflags -Wl,--target1-abs,--no-undefined \
  4870. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  4871. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  4872. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  4873. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  4874. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  4875. ;;
  4876. minix)
  4877. ;;
  4878. none)
  4879. ;;
  4880. *)
  4881. die "Unknown OS '$target_os'."
  4882. ;;
  4883. esac
  4884. # test if creating links works
  4885. link_dest=$(mktemp -u $TMPDIR/dest_XXXXXXXX)
  4886. link_name=$(mktemp -u $TMPDIR/name_XXXXXXXX)
  4887. mkdir "$link_dest"
  4888. $ln_s "$link_dest" "$link_name"
  4889. touch "$link_dest/test_file"
  4890. if [ "$source_path" != "." ] && ([ ! -d src ] || [ -L src ]) && [ -e "$link_name/test_file" ]; then
  4891. # create link to source path
  4892. [ -e src ] && rm src
  4893. $ln_s "$source_path" src
  4894. source_link=src
  4895. else
  4896. # creating directory links doesn't work
  4897. # fall back to using the full source path
  4898. source_link="$source_path"
  4899. fi
  4900. # cleanup
  4901. rm -r "$link_dest"
  4902. rm -r "$link_name"
  4903. # determine libc flavour
  4904. probe_libc(){
  4905. pfx=$1
  4906. pfx_no_=${pfx%_}
  4907. # uclibc defines __GLIBC__, so it needs to be checked before glibc.
  4908. if test_${pfx}cpp_condition features.h "defined __UCLIBC__"; then
  4909. eval ${pfx}libc_type=uclibc
  4910. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  4911. elif test_${pfx}cpp_condition features.h "defined __GLIBC__"; then
  4912. eval ${pfx}libc_type=glibc
  4913. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  4914. # MinGW headers can be installed on Cygwin, so check for newlib first.
  4915. elif test_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
  4916. eval ${pfx}libc_type=newlib
  4917. add_${pfx}cppflags -U__STRICT_ANSI__ -D_XOPEN_SOURCE=600
  4918. # MinGW64 is backwards compatible with MinGW32, so check for it first.
  4919. elif test_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then
  4920. eval ${pfx}libc_type=mingw64
  4921. if test_${pfx}cpp_condition _mingw.h "__MINGW64_VERSION_MAJOR < 3"; then
  4922. add_compat msvcrt/snprintf.o
  4923. add_cflags "-include $source_path/compat/msvcrt/snprintf.h"
  4924. fi
  4925. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  4926. eval test \$${pfx_no_}cc_type = "gcc" &&
  4927. add_${pfx}cppflags -D__printf__=__gnu_printf__
  4928. test_${pfx}cpp_condition windows.h "!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600" &&
  4929. add_${pfx}cppflags -D_WIN32_WINNT=0x0600
  4930. elif test_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION" ||
  4931. test_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then
  4932. eval ${pfx}libc_type=mingw32
  4933. test_${pfx}cpp_condition _mingw.h "__MINGW32_MAJOR_VERSION > 3 || \
  4934. (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  4935. die "ERROR: MinGW32 runtime version must be >= 3.15."
  4936. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  4937. test_${pfx}cpp_condition _mingw.h "__MSVCRT_VERSION__ < 0x0700" &&
  4938. add_${pfx}cppflags -D__MSVCRT_VERSION__=0x0700
  4939. test_${pfx}cpp_condition windows.h "!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600" &&
  4940. add_${pfx}cppflags -D_WIN32_WINNT=0x0600
  4941. eval test \$${pfx_no_}cc_type = "gcc" &&
  4942. add_${pfx}cppflags -D__printf__=__gnu_printf__
  4943. elif test_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then
  4944. eval ${pfx}libc_type=msvcrt
  4945. if test_${pfx}cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION < 14"; then
  4946. if [ "$pfx" = host_ ]; then
  4947. add_host_cppflags -Dsnprintf=_snprintf
  4948. else
  4949. add_compat strtod.o strtod=avpriv_strtod
  4950. add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
  4951. _snprintf=avpriv_snprintf \
  4952. vsnprintf=avpriv_vsnprintf
  4953. fi
  4954. fi
  4955. add_${pfx}cppflags -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS
  4956. # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
  4957. # 0x601 by default unless something else is set by the user.
  4958. # This can easily lead to us detecting functions only present
  4959. # in such new versions and producing binaries requiring windows 7.0.
  4960. # Therefore explicitly set the default to Vista unless the user has
  4961. # set something else on the command line.
  4962. # Don't do this if WINAPI_FAMILY is set and is set to a non-desktop
  4963. # family. For these cases, configure is free to use any functions
  4964. # found in the SDK headers by default. (Alternatively, we could force
  4965. # _WIN32_WINNT to 0x0602 in that case.)
  4966. test_${pfx}cpp_condition stdlib.h "defined(_WIN32_WINNT)" ||
  4967. { test_${pfx}cpp <<EOF && add_${pfx}cppflags -D_WIN32_WINNT=0x0600; }
  4968. #ifdef WINAPI_FAMILY
  4969. #include <winapifamily.h>
  4970. #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  4971. #error not desktop
  4972. #endif
  4973. #endif
  4974. EOF
  4975. if [ "$pfx" = "" ]; then
  4976. check_func strtoll || add_cflags -Dstrtoll=_strtoi64
  4977. check_func strtoull || add_cflags -Dstrtoull=_strtoui64
  4978. fi
  4979. elif test_${pfx}cpp_condition stddef.h "defined __KLIBC__"; then
  4980. eval ${pfx}libc_type=klibc
  4981. elif test_${pfx}cpp_condition sys/cdefs.h "defined __BIONIC__"; then
  4982. eval ${pfx}libc_type=bionic
  4983. elif test_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then
  4984. eval ${pfx}libc_type=solaris
  4985. add_${pfx}cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
  4986. fi
  4987. test_${pfx}cc <<EOF
  4988. #include <time.h>
  4989. void *v = localtime_r;
  4990. EOF
  4991. 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
  4992. #include <time.h>
  4993. void *v = localtime_r;
  4994. EOF
  4995. eval test -n "\${${pfx}libc_type}" && enable ${pfx}libc_${libc_type}
  4996. }
  4997. probe_libc
  4998. probe_libc host_
  4999. # hacks for compiler/libc/os combinations
  5000. case $libc_type in
  5001. bionic)
  5002. add_compat strtod.o strtod=avpriv_strtod
  5003. ;;
  5004. esac
  5005. check_compile_assert flt_lim "float.h limits.h" "DBL_MAX == (double)DBL_MAX" ||
  5006. add_cppflags '-I\$(SRC_PATH)/compat/float'
  5007. test_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic
  5008. set_default libdir
  5009. : ${shlibdir_default:="$libdir"}
  5010. : ${pkgconfigdir_default:="$libdir/pkgconfig"}
  5011. set_default $PATHS_LIST
  5012. set_default nm
  5013. disabled optimizations || enabled ossfuzz || check_cflags -fomit-frame-pointer
  5014. enable_weak_pic() {
  5015. disabled pic && return
  5016. enable pic
  5017. add_cppflags -DPIC
  5018. case "$target_os" in
  5019. mingw*|cygwin*|win*)
  5020. ;;
  5021. *)
  5022. add_cflags -fPIC
  5023. add_asflags -fPIC
  5024. ;;
  5025. esac
  5026. }
  5027. enabled pic && enable_weak_pic
  5028. test_cc <<EOF || die "Symbol mangling check failed."
  5029. int ff_extern;
  5030. EOF
  5031. sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  5032. extern_prefix=${sym%%ff_extern*}
  5033. ! disabled inline_asm && check_inline_asm inline_asm '"" ::'
  5034. for restrict_keyword in restrict __restrict__ __restrict ""; do
  5035. test_code cc "" "char * $restrict_keyword p" && break
  5036. done
  5037. check_cc pragma_deprecated "" '_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")'
  5038. # The global variable ensures the bits appear unchanged in the object file.
  5039. test_cc <<EOF || die "endian test failed"
  5040. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  5041. EOF
  5042. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  5043. check_cc const_nan math.h "struct { double d; } static const bar[] = { { NAN } }"
  5044. if ! enabled ppc64 || enabled bigendian; then
  5045. disable vsx
  5046. fi
  5047. check_gas() {
  5048. log "check_gas using '$as' as AS"
  5049. # :vararg is used on aarch64, arm and ppc altivec
  5050. check_as vararg "
  5051. .macro m n, y:vararg=0
  5052. \n: .int \y
  5053. .endm
  5054. m x" || return 1
  5055. # .altmacro is only used in arm asm
  5056. ! enabled arm || check_as gnu_as ".altmacro"
  5057. }
  5058. if enabled_any arm aarch64 || enabled_all ppc altivec && enabled asm; then
  5059. nogas=:
  5060. enabled_any arm aarch64 && nogas=die
  5061. enabled_all ppc altivec && [ $target_os_default != aix ] && nogas=warn
  5062. as_noop=-v
  5063. case $as_type in
  5064. arm*) gaspp_as_type=armasm; as_noop=-h ;;
  5065. gcc) gaspp_as_type=gas ;;
  5066. *) gaspp_as_type=$as_type ;;
  5067. esac
  5068. [ $target_os = "darwin" ] && gaspp_as_type="apple-$gaspp_as_type"
  5069. test "${as#*gas-preprocessor.pl}" != "$as" ||
  5070. test_cmd gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- ${as:=$cc} $as_noop &&
  5071. gas="${gas:=gas-preprocessor.pl} -arch $arch -as-type $gaspp_as_type -- ${as:=$cc}"
  5072. if ! check_gas ; then
  5073. as=${gas:=$as}
  5074. check_gas || \
  5075. $nogas "GNU assembler not found, install/update gas-preprocessor"
  5076. fi
  5077. check_as as_func ".func test
  5078. .endfunc"
  5079. fi
  5080. check_inline_asm inline_asm_labels '"1:\n"'
  5081. check_inline_asm inline_asm_nonlocal_labels '"Label:\n"'
  5082. if enabled aarch64; then
  5083. enabled armv8 && check_insn armv8 'prfm pldl1strm, [x0]'
  5084. # internal assembler in clang 3.3 does not support this instruction
  5085. enabled neon && check_insn neon 'ext v0.8B, v0.8B, v1.8B, #1'
  5086. enabled vfp && check_insn vfp 'fmadd d0, d0, d1, d2'
  5087. map 'enabled_any ${v}_external ${v}_inline || disable $v' $ARCH_EXT_LIST_ARM
  5088. elif enabled alpha; then
  5089. check_cflags -mieee
  5090. elif enabled arm; then
  5091. enabled msvc && check_cpp_condition thumb stddef.h "defined _M_ARMT"
  5092. test_cpp_condition stddef.h "defined __thumb__" && test_cc <<EOF && enable_weak thumb
  5093. float func(float a, float b){ return a+b; }
  5094. EOF
  5095. enabled thumb && check_cflags -mthumb || check_cflags -marm
  5096. if check_cpp_condition vfp_args stddef.h "defined __ARM_PCS_VFP"; then
  5097. :
  5098. elif check_cpp_condition vfp_args stddef.h "defined _M_ARM_FP && _M_ARM_FP >= 30"; then
  5099. :
  5100. elif ! test_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__" && [ $target_os != darwin ]; then
  5101. case "${cross_prefix:-$cc}" in
  5102. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  5103. *) check_ld "cc" vfp_args <<EOF && fpabi=vfp || fpabi=soft ;;
  5104. __asm__ (".eabi_attribute 28, 1");
  5105. int main(void) { return 0; }
  5106. EOF
  5107. esac
  5108. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  5109. fi
  5110. enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
  5111. enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
  5112. enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
  5113. enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
  5114. enabled vfp && check_insn vfp 'fadds s0, s0, s0'
  5115. enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
  5116. enabled setend && check_insn setend 'setend be'
  5117. [ $target_os = linux ] || [ $target_os = android ] ||
  5118. map 'enabled_any ${v}_external ${v}_inline || disable $v' \
  5119. $ARCH_EXT_LIST_ARM
  5120. check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
  5121. check_as as_arch_directive ".arch armv7-a"
  5122. check_as as_dn_directive "ra .dn d0.i16"
  5123. check_as as_fpu_directive ".fpu neon"
  5124. # llvm's integrated assembler supports .object_arch from llvm 3.5
  5125. [ "$objformat" = elf32 ] || [ "$objformat" = elf64 ] &&
  5126. check_as as_object_arch ".object_arch armv4"
  5127. # MS armasm fails to assemble our PIC constructs
  5128. [ $target_os != win32 ] && enabled_all armv6t2 shared !pic && enable_weak_pic
  5129. elif enabled mips; then
  5130. enabled loongson2 && check_inline_asm loongson2 '"dmult.g $8, $9, $10"'
  5131. enabled loongson3 && check_inline_asm loongson3 '"gsldxc1 $f0, 0($2, $3)"'
  5132. enabled mmi && check_inline_asm mmi '"punpcklhw $f0, $f0, $f0"'
  5133. # Enable minimum ISA based on selected options
  5134. if enabled mips64; then
  5135. enabled mips64r6 && check_inline_asm_flags mips64r6 '"dlsa $0, $0, $0, 1"' '-mips64r6'
  5136. enabled mips64r2 && check_inline_asm_flags mips64r2 '"dext $0, $0, 0, 1"' '-mips64r2'
  5137. disabled mips64r6 && disabled mips64r2 && check_inline_asm_flags mips64r1 '"daddi $0, $0, 0"' '-mips64'
  5138. else
  5139. enabled mips32r6 && check_inline_asm_flags mips32r6 '"aui $0, $0, 0"' '-mips32r6'
  5140. enabled mips32r5 && check_inline_asm_flags mips32r5 '"eretnc"' '-mips32r5'
  5141. enabled mips32r2 && check_inline_asm_flags mips32r2 '"ext $0, $0, 0, 1"' '-mips32r2'
  5142. disabled mips32r6 && disabled mips32r5 && disabled mips32r2 && check_inline_asm_flags mips32r1 '"addi $0, $0, 0"' '-mips32'
  5143. fi
  5144. enabled mipsfpu && check_inline_asm_flags mipsfpu '"cvt.d.l $f0, $f2"' '-mhard-float'
  5145. enabled mipsfpu && (enabled mips32r5 || enabled mips32r6 || enabled mips64r6) && check_inline_asm_flags mipsfpu '"cvt.d.l $f0, $f1"' '-mfp64'
  5146. enabled mipsfpu && enabled msa && check_inline_asm_flags msa '"addvi.b $w0, $w1, 1"' '-mmsa' && check_header msa.h || disable msa
  5147. enabled mipsdsp && check_inline_asm_flags mipsdsp '"addu.qb $t0, $t1, $t2"' '-mdsp'
  5148. enabled mipsdspr2 && check_inline_asm_flags mipsdspr2 '"absq_s.qb $t0, $t1"' '-mdspr2'
  5149. if enabled bigendian && enabled msa; then
  5150. disable msa
  5151. fi
  5152. elif enabled parisc; then
  5153. if enabled gcc; then
  5154. case $($cc -dumpversion) in
  5155. 4.[3-9].*) check_cflags -fno-optimize-sibling-calls ;;
  5156. esac
  5157. fi
  5158. elif enabled ppc; then
  5159. enable local_aligned
  5160. check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  5161. check_inline_asm ibm_asm '"add 0, 0, 0"'
  5162. check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
  5163. check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  5164. if enabled altivec; then
  5165. check_cflags -maltivec -mabi=altivec
  5166. # check if our compiler supports Motorola AltiVec C API
  5167. check_cc altivec altivec.h "vector signed int v1 = (vector signed int) { 0 };
  5168. vector signed int v2 = (vector signed int) { 1 };
  5169. v1 = vec_add(v1, v2);"
  5170. enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
  5171. fi
  5172. if enabled vsx; then
  5173. check_cflags -mvsx &&
  5174. check_cc vsx altivec.h "int v[4] = { 0 };
  5175. vector signed int v1 = vec_vsx_ld(0, v);"
  5176. fi
  5177. if enabled power8; then
  5178. check_cpp_condition power8 "altivec.h" "defined(_ARCH_PWR8)"
  5179. fi
  5180. elif enabled x86; then
  5181. check_builtin rdtsc intrin.h "__rdtsc()"
  5182. check_builtin mm_empty mmintrin.h "_mm_empty()"
  5183. enable local_aligned
  5184. # check whether EBP is available on x86
  5185. # As 'i' is stored on the stack, this program will crash
  5186. # if the base pointer is used to access it because the
  5187. # base pointer is cleared in the inline assembly code.
  5188. check_exec_crash <<EOF && enable ebp_available
  5189. volatile int i=0;
  5190. __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
  5191. return i;
  5192. EOF
  5193. # check whether EBX is available on x86
  5194. check_inline_asm ebx_available '""::"b"(0)' &&
  5195. check_inline_asm ebx_available '"":::"%ebx"'
  5196. # check whether xmm clobbers are supported
  5197. check_inline_asm xmm_clobbers '"":::"%xmm0"'
  5198. check_inline_asm inline_asm_direct_symbol_refs '"movl '$extern_prefix'test, %eax"' ||
  5199. check_inline_asm inline_asm_direct_symbol_refs '"movl '$extern_prefix'test(%rip), %eax"'
  5200. # check whether binutils is new enough to compile SSSE3/MMXEXT
  5201. enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
  5202. enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
  5203. probe_x86asm(){
  5204. x86asmexe_probe=$1
  5205. if test_cmd $x86asmexe_probe -v; then
  5206. x86asmexe=$x86asmexe_probe
  5207. x86asm_type=nasm
  5208. x86asm_debug="-g -F dwarf"
  5209. X86ASMDEP=
  5210. X86ASM_DEPFLAGS='-MD $(@:.o=.d)'
  5211. elif test_cmd $x86asmexe_probe --version; then
  5212. x86asmexe=$x86asmexe_probe
  5213. x86asm_type=yasm
  5214. x86asm_debug="-g dwarf2"
  5215. X86ASMDEP='$(DEPX86ASM) $(X86ASMFLAGS) -M $(X86ASM_O) $< > $(@:.o=.d)'
  5216. X86ASM_DEPFLAGS=
  5217. fi
  5218. check_x86asm x86asm "movbe ecx, [5]"
  5219. }
  5220. if ! disabled_any asm mmx x86asm; then
  5221. disable x86asm
  5222. for program in $x86asmexe nasm yasm; do
  5223. probe_x86asm $program && break
  5224. done
  5225. disabled x86asm && die "nasm/yasm not found or too old. Use --disable-x86asm for a crippled build."
  5226. X86ASMFLAGS="-f $objformat"
  5227. enabled pic && append X86ASMFLAGS "-DPIC"
  5228. test -n "$extern_prefix" && append X86ASMFLAGS "-DPREFIX"
  5229. case "$objformat" in
  5230. elf*) enabled debug && append X86ASMFLAGS $x86asm_debug ;;
  5231. esac
  5232. check_x86asm avx512_external "vmovdqa32 [eax]{k1}{z}, zmm0"
  5233. check_x86asm avx2_external "vextracti128 xmm0, ymm0, 0"
  5234. check_x86asm xop_external "vpmacsdd xmm0, xmm1, xmm2, xmm3"
  5235. check_x86asm fma4_external "vfmaddps ymm0, ymm1, ymm2, ymm3"
  5236. check_x86asm cpunop "CPU amdnop"
  5237. fi
  5238. case "$cpu" in
  5239. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  5240. disable fast_clz
  5241. ;;
  5242. esac
  5243. fi
  5244. check_cc intrinsics_neon arm_neon.h "int16x8_t test = vdupq_n_s16(0)"
  5245. check_ldflags -Wl,--as-needed
  5246. check_ldflags -Wl,-z,noexecstack
  5247. if ! disabled network; then
  5248. check_func getaddrinfo $network_extralibs
  5249. check_func inet_aton $network_extralibs
  5250. check_type netdb.h "struct addrinfo"
  5251. check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
  5252. check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
  5253. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  5254. check_type poll.h "struct pollfd"
  5255. check_type netinet/sctp.h "struct sctp_event_subscribe"
  5256. check_struct "sys/socket.h" "struct msghdr" msg_flags
  5257. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  5258. check_type netinet/in.h "struct sockaddr_in6"
  5259. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  5260. check_type "sys/types.h sys/socket.h" socklen_t
  5261. # Prefer arpa/inet.h over winsock2
  5262. if check_header arpa/inet.h ; then
  5263. check_func closesocket
  5264. elif check_header winsock2.h ; then
  5265. check_func_headers winsock2.h closesocket -lws2 &&
  5266. network_extralibs="-lws2" ||
  5267. { check_func_headers winsock2.h closesocket -lws2_32 &&
  5268. network_extralibs="-lws2_32"; } || disable winsock2_h network
  5269. check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
  5270. check_type ws2tcpip.h socklen_t
  5271. check_type ws2tcpip.h "struct addrinfo"
  5272. check_type ws2tcpip.h "struct group_source_req"
  5273. check_type ws2tcpip.h "struct ip_mreq_source"
  5274. check_type ws2tcpip.h "struct ipv6_mreq"
  5275. check_type winsock2.h "struct pollfd"
  5276. check_struct winsock2.h "struct sockaddr" sa_len
  5277. check_type ws2tcpip.h "struct sockaddr_in6"
  5278. check_type ws2tcpip.h "struct sockaddr_storage"
  5279. else
  5280. disable network
  5281. fi
  5282. fi
  5283. check_builtin atomic_cas_ptr atomic.h "void **ptr; void *oldval, *newval; atomic_cas_ptr(ptr, oldval, newval)"
  5284. check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
  5285. check_builtin MemoryBarrier windows.h "MemoryBarrier()"
  5286. check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
  5287. check_builtin gmtime_r time.h "time_t *time; struct tm *tm; gmtime_r(time, tm)"
  5288. check_builtin localtime_r time.h "time_t *time; struct tm *tm; localtime_r(time, tm)"
  5289. check_builtin x264_csp_bgr "stdint.h x264.h" "X264_CSP_BGR"
  5290. case "$custom_allocator" in
  5291. jemalloc)
  5292. # jemalloc by default does not use a prefix
  5293. require libjemalloc jemalloc/jemalloc.h malloc -ljemalloc
  5294. ;;
  5295. tcmalloc)
  5296. require_pkg_config libtcmalloc libtcmalloc gperftools/tcmalloc.h tc_malloc
  5297. malloc_prefix=tc_
  5298. ;;
  5299. esac
  5300. check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
  5301. check_func ${malloc_prefix}memalign && enable memalign
  5302. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  5303. check_func access
  5304. check_func_headers stdlib.h arc4random
  5305. check_lib clock_gettime time.h clock_gettime || check_lib clock_gettime time.h clock_gettime -lrt
  5306. check_func fcntl
  5307. check_func fork
  5308. check_func gethrtime
  5309. check_func getopt
  5310. check_func getrusage
  5311. check_func gettimeofday
  5312. check_func isatty
  5313. check_func mkstemp
  5314. check_func mmap
  5315. check_func mprotect
  5316. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  5317. check_func_headers time.h nanosleep || check_lib nanosleep time.h nanosleep -lrt
  5318. check_func sched_getaffinity
  5319. check_func setrlimit
  5320. check_struct "sys/stat.h" "struct stat" st_mtim.tv_nsec -D_BSD_SOURCE
  5321. check_func strerror_r
  5322. check_func sysconf
  5323. check_func sysctl
  5324. check_func usleep
  5325. check_func_headers conio.h kbhit
  5326. check_func_headers io.h setmode
  5327. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  5328. check_func_headers mach/mach_time.h mach_absolute_time
  5329. check_func_headers stdlib.h getenv
  5330. check_func_headers sys/stat.h lstat
  5331. check_func_headers windows.h GetProcessAffinityMask
  5332. check_func_headers windows.h GetProcessTimes
  5333. check_func_headers windows.h GetSystemTimeAsFileTime
  5334. check_func_headers windows.h LoadLibrary
  5335. check_func_headers windows.h MapViewOfFile
  5336. check_func_headers windows.h PeekNamedPipe
  5337. check_func_headers windows.h SetConsoleTextAttribute
  5338. check_func_headers windows.h SetConsoleCtrlHandler
  5339. check_func_headers windows.h Sleep
  5340. check_func_headers windows.h VirtualAlloc
  5341. check_func_headers glob.h glob
  5342. enabled xlib &&
  5343. check_lib xlib "X11/Xlib.h X11/extensions/Xvlib.h" XvGetPortAttribute -lXv -lX11 -lXext
  5344. check_header direct.h
  5345. check_header dirent.h
  5346. check_header dxgidebug.h
  5347. check_header dxva.h
  5348. check_header dxva2api.h -D_WIN32_WINNT=0x0600
  5349. check_header io.h
  5350. check_header linux/perf_event.h
  5351. check_header libcrystalhd/libcrystalhd_if.h
  5352. check_header malloc.h
  5353. check_header net/udplite.h
  5354. check_header poll.h
  5355. check_header sys/param.h
  5356. check_header sys/resource.h
  5357. check_header sys/select.h
  5358. check_header sys/time.h
  5359. check_header sys/un.h
  5360. check_header termios.h
  5361. check_header unistd.h
  5362. check_header valgrind/valgrind.h
  5363. check_func_headers VideoToolbox/VTCompressionSession.h VTCompressionSessionPrepareToEncodeFrames -framework VideoToolbox
  5364. check_header windows.h
  5365. check_header X11/extensions/XvMClib.h
  5366. check_header asm/types.h
  5367. # it seems there are versions of clang in some distros that try to use the
  5368. # gcc headers, which explodes for stdatomic
  5369. # so we also check that atomics actually work here
  5370. check_builtin stdatomic stdatomic.h "atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0); foo += bar"
  5371. check_lib advapi32 "windows.h" RegCloseKey -ladvapi32
  5372. check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom -lbcrypt &&
  5373. check_cpp_condition bcrypt bcrypt.h "defined BCRYPT_RNG_ALGORITHM"
  5374. check_lib ole32 "windows.h" CoTaskMemFree -lole32
  5375. check_lib shell32 "windows.h shellapi.h" CommandLineToArgvW -lshell32
  5376. check_lib psapi "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  5377. check_lib android android/native_window.h ANativeWindow_acquire -landroid
  5378. check_lib mediandk "stdint.h media/NdkImage.h" AImage_delete -lmediandk
  5379. check_lib camera2ndk "stdbool.h stdint.h camera/NdkCameraManager.h" ACameraManager_create -lcamera2ndk
  5380. enabled appkit && check_apple_framework AppKit
  5381. enabled audiotoolbox && check_apple_framework AudioToolbox
  5382. enabled avfoundation && check_apple_framework AVFoundation
  5383. enabled coreimage && check_apple_framework CoreImage
  5384. enabled videotoolbox && check_apple_framework VideoToolbox
  5385. check_apple_framework CoreFoundation
  5386. check_apple_framework CoreMedia
  5387. check_apple_framework CoreVideo
  5388. enabled avfoundation && {
  5389. disable coregraphics applicationservices
  5390. check_lib coregraphics CoreGraphics/CoreGraphics.h CGGetActiveDisplayList "-framework CoreGraphics" ||
  5391. check_lib applicationservices ApplicationServices/ApplicationServices.h CGGetActiveDisplayList "-framework ApplicationServices"; }
  5392. enabled videotoolbox && {
  5393. check_lib coreservices CoreServices/CoreServices.h UTGetOSTypeFromString "-framework CoreServices"
  5394. check_func_headers CoreMedia/CMFormatDescription.h kCMVideoCodecType_HEVC "-framework CoreMedia"
  5395. }
  5396. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  5397. check_type "windows.h dxva.h" "DXVA_PicParams_HEVC" -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_CRT_BUILD_DESKTOP_APP=0
  5398. check_type "windows.h dxva.h" "DXVA_PicParams_VP9" -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_CRT_BUILD_DESKTOP_APP=0
  5399. check_type "windows.h d3d11.h" "ID3D11VideoDecoder"
  5400. check_type "windows.h d3d11.h" "ID3D11VideoContext"
  5401. check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602
  5402. check_type "va/va.h va/va_dec_hevc.h" "VAPictureParameterBufferHEVC"
  5403. check_type "va/va.h va/va_dec_vp8.h" "VAPictureParameterBufferVP8"
  5404. check_struct "va/va.h" "VADecPictureParameterBufferVP9" bit_depth
  5405. check_type "va/va.h va/va_vpp.h" "VAProcPipelineParameterBuffer"
  5406. check_type "va/va.h va/va_enc_h264.h" "VAEncPictureParameterBufferH264"
  5407. check_type "va/va.h va/va_enc_hevc.h" "VAEncPictureParameterBufferHEVC"
  5408. check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG"
  5409. check_type "va/va.h va/va_enc_mpeg2.h" "VAEncPictureParameterBufferMPEG2"
  5410. check_type "va/va.h va/va_enc_vp8.h" "VAEncPictureParameterBufferVP8"
  5411. check_type "va/va.h va/va_enc_vp9.h" "VAEncPictureParameterBufferVP9"
  5412. check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC"
  5413. if ! disabled ffnvcodec; then
  5414. check_pkg_config ffnvcodec "ffnvcodec >= 8.1.24.2" \
  5415. "ffnvcodec/nvEncodeAPI.h ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h ffnvcodec/dynlink_nvcuvid.h" "" || \
  5416. check_pkg_config ffnvcodec "ffnvcodec >= 8.0.14.2 ffnvcodec < 8.1" \
  5417. "ffnvcodec/nvEncodeAPI.h ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h ffnvcodec/dynlink_nvcuvid.h" ""
  5418. fi
  5419. check_cpp_condition winrt windows.h "!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)"
  5420. if ! disabled w32threads && ! enabled pthreads; then
  5421. check_func_headers "windows.h process.h" _beginthreadex &&
  5422. check_type "windows.h" CONDITION_VARIABLE &&
  5423. check_type "windows.h" INIT_ONCE &&
  5424. enable w32threads || disable w32threads
  5425. if ! enabled w32threads && enabled winrt; then
  5426. check_func_headers "windows.h" CreateThread &&
  5427. enable w32threads || disable w32threads
  5428. fi
  5429. fi
  5430. # check for some common methods of building with pthread support
  5431. # do this before the optional library checks as some of them require pthreads
  5432. if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then
  5433. if check_lib pthreads pthread.h pthread_join -pthread &&
  5434. check_lib pthreads pthread.h pthread_create -pthread; then
  5435. add_cflags -pthread
  5436. elif check_lib pthreads pthread.h pthread_join -pthreads &&
  5437. check_lib pthreads pthread.h pthread_create -pthreads; then
  5438. add_cflags -pthreads
  5439. elif check_lib pthreads pthread.h pthread_join -ldl -pthread &&
  5440. check_lib pthreads pthread.h pthread_create -ldl -pthread; then
  5441. add_cflags -ldl -pthread
  5442. elif check_lib pthreads pthread.h pthread_join -lpthreadGC2 &&
  5443. check_lib pthreads pthread.h pthread_create -lpthreadGC2; then
  5444. :
  5445. elif check_lib pthreads pthread.h pthread_join -lpthread &&
  5446. check_lib pthreads pthread.h pthread_create -lpthread; then
  5447. :
  5448. elif check_func pthread_join && check_func pthread_create; then
  5449. enable pthreads
  5450. fi
  5451. check_cc pthreads "pthread.h" "static pthread_mutex_t atomic_lock = PTHREAD_MUTEX_INITIALIZER"
  5452. if enabled pthreads; then
  5453. check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); sem_timedwait(s,0); sem_destroy(s)" $pthreads_extralibs
  5454. check_func pthread_cancel $pthreads_extralibs
  5455. fi
  5456. fi
  5457. enabled zlib && { check_pkg_config zlib zlib "zlib.h" zlibVersion ||
  5458. check_lib zlib zlib.h zlibVersion -lz; }
  5459. enabled bzlib && check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2
  5460. enabled lzma && check_lib lzma lzma.h lzma_version_number -llzma
  5461. # On some systems dynamic loading requires no extra linker flags
  5462. check_lib libdl dlfcn.h "dlopen dlsym" || check_lib libdl dlfcn.h "dlopen dlsym" -ldl
  5463. check_lib libm math.h sin -lm
  5464. atan2f_args=2
  5465. copysign_args=2
  5466. hypot_args=2
  5467. ldexpf_args=2
  5468. powf_args=2
  5469. for func in $MATH_FUNCS; do
  5470. eval check_mathfunc $func \${${func}_args:-1} $libm_extralibs
  5471. done
  5472. for func in $COMPLEX_FUNCS; do
  5473. eval check_complexfunc $func \${${func}_args:-1}
  5474. done
  5475. # these are off by default, so fail if requested and not available
  5476. enabled cuda_sdk && require cuda_sdk cuda.h cuCtxCreate -lcuda
  5477. enabled chromaprint && require chromaprint chromaprint.h chromaprint_get_version -lchromaprint
  5478. enabled decklink && { require_header DeckLinkAPI.h &&
  5479. { test_cpp_condition DeckLinkAPIVersion.h "BLACKMAGIC_DECKLINK_API_VERSION >= 0x0a060100" || die "ERROR: Decklink API version must be >= 10.6.1."; } }
  5480. enabled libndi_newtek && require_header Processing.NDI.Lib.h
  5481. enabled frei0r && require_header frei0r.h
  5482. enabled gmp && require gmp gmp.h mpz_export -lgmp
  5483. enabled gnutls && require_pkg_config gnutls gnutls gnutls/gnutls.h gnutls_global_init
  5484. enabled jni && { [ $target_os = "android" ] && check_header jni.h && enabled pthreads || die "ERROR: jni not found"; }
  5485. enabled ladspa && require_header ladspa.h
  5486. enabled libaom && require_pkg_config libaom "aom >= 0.1.0" aom/aom_codec.h aom_codec_version
  5487. enabled lv2 && require_pkg_config lv2 lilv-0 "lilv/lilv.h" lilv_world_new
  5488. enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
  5489. enabled libass && require_pkg_config libass libass ass/ass.h ass_library_init
  5490. enabled libbluray && require_pkg_config libbluray libbluray libbluray/bluray.h bd_open
  5491. enabled libbs2b && require_pkg_config libbs2b libbs2b bs2b.h bs2b_open
  5492. enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 &&
  5493. { check_lib libcelt celt/celt.h celt_decoder_create_custom -lcelt0 ||
  5494. die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
  5495. enabled libcaca && require_pkg_config libcaca caca caca.h caca_create_canvas
  5496. enabled libcodec2 && require libcodec2 codec2/codec2.h codec2_create -lcodec2
  5497. enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new
  5498. enabled libdrm && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion
  5499. enabled libfdk_aac && { check_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen ||
  5500. { require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac &&
  5501. warn "using libfdk without pkg-config"; } }
  5502. 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"
  5503. enabled libflite && require libflite "flite/flite.h" flite_init $flite_extralibs
  5504. enabled fontconfig && enable libfontconfig
  5505. enabled libfontconfig && require_pkg_config libfontconfig fontconfig "fontconfig/fontconfig.h" FcInit
  5506. enabled libfreetype && require_pkg_config libfreetype freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
  5507. enabled libfribidi && require_pkg_config libfribidi fribidi fribidi.h fribidi_version_info
  5508. enabled libgme && { check_pkg_config libgme libgme gme/gme.h gme_new_emu ||
  5509. require libgme gme/gme.h gme_new_emu -lgme -lstdc++; }
  5510. enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
  5511. check_lib libgsm "${gsm_hdr}" gsm_create -lgsm && break;
  5512. done || die "ERROR: libgsm not found"; }
  5513. enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc $pthreads_extralibs
  5514. enabled libkvazaar && require_pkg_config libkvazaar "kvazaar >= 0.8.1" kvazaar.h kvz_api_get
  5515. # While it may appear that require is being used as a pkg-config
  5516. # fallback for libmfx, it is actually being used to detect a different
  5517. # installation route altogether. If libmfx is installed via the Intel
  5518. # Media SDK or Intel Media Server Studio, these don't come with
  5519. # pkg-config support. Instead, users should make sure that the build
  5520. # can find the libraries and headers through other means.
  5521. enabled libmfx && { check_pkg_config libmfx libmfx "mfx/mfxvideo.h" MFXInit ||
  5522. { require libmfx "mfx/mfxvideo.h" MFXInit "-llibmfx $advapi32_extralibs" && warn "using libmfx without pkg-config"; } }
  5523. enabled libmodplug && require_pkg_config libmodplug libmodplug libmodplug/modplug.h ModPlug_Load
  5524. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame $libm_extralibs
  5525. enabled libmysofa && { check_pkg_config libmysofa libmysofa mysofa.h mysofa_load ||
  5526. require libmysofa mysofa.h mysofa_load -lmysofa $zlib_extralibs; }
  5527. enabled libnpp && { check_lib libnpp npp.h nppGetLibVersion -lnppig -lnppicc -lnppc ||
  5528. check_lib libnpp npp.h nppGetLibVersion -lnppi -lnppc ||
  5529. die "ERROR: libnpp not found"; }
  5530. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  5531. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  5532. enabled libopencv && { check_header opencv2/core/core_c.h &&
  5533. { check_pkg_config libopencv opencv opencv2/core/core_c.h cvCreateImageHeader ||
  5534. require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
  5535. require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; }
  5536. enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion
  5537. enabled libopenjpeg && { check_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version ||
  5538. { require_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } }
  5539. enabled libopenmpt && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++"
  5540. enabled libopus && {
  5541. enabled libopus_decoder && {
  5542. require_pkg_config libopus opus opus_multistream.h opus_multistream_decoder_create
  5543. }
  5544. enabled libopus_encoder && {
  5545. require_pkg_config libopus opus opus_multistream.h opus_multistream_surround_encoder_create
  5546. }
  5547. }
  5548. enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new
  5549. enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo
  5550. enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket
  5551. enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++"
  5552. enabled libshine && require_pkg_config libshine shine shine/layer3.h shine_encode_buffer
  5553. enabled libsmbclient && { check_pkg_config libsmbclient smbclient libsmbclient.h smbc_init ||
  5554. require libsmbclient libsmbclient.h smbc_init -lsmbclient; }
  5555. enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++
  5556. enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
  5557. enabled libssh && require_pkg_config libssh libssh libssh/sftp.h sftp_init
  5558. enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
  5559. enabled libsrt && require_pkg_config libsrt "srt >= 1.2.0" srt/srt.h srt_socket
  5560. enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow
  5561. enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate
  5562. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  5563. enabled libtls && require_pkg_config libtls libtls tls.h tls_configure
  5564. enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame &&
  5565. { check_lib libtwolame twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
  5566. die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; }
  5567. enabled libv4l2 && require_pkg_config libv4l2 libv4l2 libv4l2.h v4l2_ioctl
  5568. enabled libvidstab && require_pkg_config libvidstab "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit
  5569. enabled libvmaf && require_pkg_config libvmaf "libvmaf >= 0.6.2" libvmaf.h compute_vmaf
  5570. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  5571. enabled libvorbis && require_pkg_config libvorbis vorbis vorbis/codec.h vorbis_info_init &&
  5572. require_pkg_config libvorbisenc vorbisenc vorbis/vorbisenc.h vorbis_encode_init
  5573. enabled libvpx && {
  5574. enabled libvpx_vp8_decoder && {
  5575. check_pkg_config libvpx_vp8_decoder "vpx >= 1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx ||
  5576. check_lib libvpx_vp8_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_dec_init_ver VPX_IMG_FMT_HIGHBITDEPTH" -lvpx ||
  5577. die "ERROR: libvpx decoder version must be >=1.4.0";
  5578. }
  5579. enabled libvpx_vp8_encoder && {
  5580. check_pkg_config libvpx_vp8_encoder "vpx >= 1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx ||
  5581. check_lib libvpx_vp8_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_IMG_FMT_HIGHBITDEPTH" -lvpx ||
  5582. die "ERROR: libvpx encoder version must be >=1.4.0";
  5583. }
  5584. enabled libvpx_vp9_decoder && {
  5585. check_pkg_config libvpx_vp9_decoder "vpx >= 1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx ||
  5586. check_lib libvpx_vp9_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs"
  5587. }
  5588. enabled libvpx_vp9_encoder && {
  5589. check_pkg_config libvpx_vp9_encoder "vpx >= 1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx ||
  5590. check_lib libvpx_vp9_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs"
  5591. }
  5592. if disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder; then
  5593. die "libvpx enabled but no supported decoders found"
  5594. fi
  5595. }
  5596. enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack
  5597. enabled libwebp && {
  5598. enabled libwebp_encoder && require_pkg_config libwebp "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion
  5599. enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
  5600. enabled libx264 && { check_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode ||
  5601. { require libx264 "stdint.h x264.h" x264_encoder_encode "-lx264 $pthreads_extralibs $libm_extralibs" &&
  5602. warn "using libx264 without pkg-config"; } } &&
  5603. require_cpp_condition x264.h "X264_BUILD >= 118" &&
  5604. check_cpp_condition libx262 x264.h "X264_MPEG2"
  5605. enabled libx265 && require_pkg_config libx265 x265 x265.h x265_api_get &&
  5606. require_cpp_condition x265.h "X265_BUILD >= 68"
  5607. enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"
  5608. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  5609. enabled libzimg && require_pkg_config libzimg "zimg >= 2.7.0" zimg.h zimg_get_api_version
  5610. enabled libzmq && require_pkg_config libzmq libzmq zmq.h zmq_ctx_new
  5611. enabled libzvbi && require_pkg_config libzvbi zvbi-0.2 libzvbi.h vbi_decoder_new &&
  5612. { test_cpp_condition libzvbi.h "VBI_VERSION_MAJOR > 0 || VBI_VERSION_MINOR > 2 || VBI_VERSION_MINOR == 2 && VBI_VERSION_MICRO >= 28" ||
  5613. enabled gpl || die "ERROR: libzvbi requires version 0.2.28 or --enable-gpl."; }
  5614. enabled libxml2 && require_pkg_config libxml2 libxml-2.0 libxml2/libxml/xmlversion.h xmlCheckVersion
  5615. enabled mbedtls && { check_pkg_config mbedtls mbedtls mbedtls/x509_crt.h mbedtls_x509_crt_init ||
  5616. check_pkg_config mbedtls mbedtls mbedtls/ssl.h mbedtls_ssl_init ||
  5617. check_lib mbedtls mbedtls/ssl.h mbedtls_ssl_init -lmbedtls -lmbedx509 -lmbedcrypto ||
  5618. die "ERROR: mbedTLS not found"; }
  5619. enabled mediacodec && { enabled jni || die "ERROR: mediacodec requires --enable-jni"; }
  5620. enabled mmal && { check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ||
  5621. { ! enabled cross_compile &&
  5622. add_cflags -isystem/opt/vc/include/ -isystem/opt/vc/include/interface/vmcs_host/linux -isystem/opt/vc/include/interface/vcos/pthreads -fgnu89-inline &&
  5623. add_ldflags -L/opt/vc/lib/ &&
  5624. check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host; } ||
  5625. die "ERROR: mmal not found" &&
  5626. check_func_headers interface/mmal/mmal.h "MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"; }
  5627. enabled openal && { { for al_extralibs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
  5628. check_lib openal 'AL/al.h' alGetError "${al_extralibs}" && break; done } ||
  5629. die "ERROR: openal not found"; } &&
  5630. { test_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
  5631. die "ERROR: openal must be installed and version must be 1.1 or compatible"; }
  5632. enabled opencl && { check_pkg_config opencl OpenCL CL/cl.h clEnqueueNDRangeKernel ||
  5633. check_lib opencl OpenCL/cl.h clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
  5634. check_lib opencl CL/cl.h clEnqueueNDRangeKernel -lOpenCL ||
  5635. die "ERROR: opencl not found"; } &&
  5636. { test_cpp_condition "OpenCL/cl.h" "defined(CL_VERSION_1_2)" ||
  5637. test_cpp_condition "CL/cl.h" "defined(CL_VERSION_1_2)" ||
  5638. die "ERROR: opencl must be installed and version must be 1.2 or compatible"; }
  5639. enabled opengl && { check_lib opengl GL/glx.h glXGetProcAddress "-lGL" ||
  5640. check_lib opengl windows.h wglGetProcAddress "-lopengl32 -lgdi32" ||
  5641. check_lib opengl OpenGL/gl3.h glGetError "-Wl,-framework,OpenGL" ||
  5642. check_lib opengl ES2/gl.h glGetError "-isysroot=${sysroot} -Wl,-framework,OpenGLES" ||
  5643. die "ERROR: opengl not found."
  5644. }
  5645. enabled omx && require_header OMX_Core.h
  5646. enabled omx_rpi && { check_header OMX_Core.h ||
  5647. { ! enabled cross_compile && add_cflags -isystem/opt/vc/include/IL && check_header OMX_Core.h ; } ||
  5648. die "ERROR: OpenMAX IL headers not found"; } && enable omx
  5649. enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OPENSSL_init_ssl ||
  5650. check_pkg_config openssl openssl openssl/ssl.h SSL_library_init ||
  5651. check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  5652. check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  5653. check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  5654. die "ERROR: openssl not found"; }
  5655. enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/rk_mpi.h mpp_create &&
  5656. require_pkg_config rockchip_mpp "rockchip_mpp >= 1.3.7" rockchip/rk_mpi.h mpp_create &&
  5657. { enabled libdrm ||
  5658. die "ERROR: rkmpp requires --enable-libdrm"; }
  5659. }
  5660. enabled vapoursynth && require_pkg_config vapoursynth "vapoursynth-script >= 42" VSScript.h vsscript_init
  5661. if enabled gcrypt; then
  5662. GCRYPT_CONFIG="${cross_prefix}libgcrypt-config"
  5663. if "${GCRYPT_CONFIG}" --version > /dev/null 2>&1; then
  5664. gcrypt_cflags=$("${GCRYPT_CONFIG}" --cflags)
  5665. gcrypt_extralibs=$("${GCRYPT_CONFIG}" --libs)
  5666. check_func_headers gcrypt.h gcry_mpi_new $gcrypt_cflags $gcrypt_extralibs ||
  5667. die "ERROR: gcrypt not found"
  5668. add_cflags $gcrypt_cflags
  5669. else
  5670. require gcrypt gcrypt.h gcry_mpi_new -lgcrypt
  5671. fi
  5672. fi
  5673. if enabled sdl2; then
  5674. SDL2_CONFIG="${cross_prefix}sdl2-config"
  5675. test_pkg_config sdl2 "sdl2 >= 2.0.1 sdl2 < 2.1.0" SDL_events.h SDL_PollEvent
  5676. if disabled sdl2 && "${SDL2_CONFIG}" --version > /dev/null 2>&1; then
  5677. sdl2_cflags=$("${SDL2_CONFIG}" --cflags)
  5678. sdl2_extralibs=$("${SDL2_CONFIG}" --libs)
  5679. test_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags &&
  5680. test_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags &&
  5681. check_func_headers SDL_events.h SDL_PollEvent $sdl2_extralibs $sdl2_cflags &&
  5682. enable sdl2
  5683. fi
  5684. if test $target_os = "mingw32"; then
  5685. sdl2_extralibs=$(filter_out '-mwindows' $sdl2_extralibs)
  5686. fi
  5687. fi
  5688. if enabled decklink; then
  5689. case $target_os in
  5690. mingw32*|mingw64*|win32|win64)
  5691. decklink_outdev_extralibs="$decklink_outdev_extralibs -lole32 -loleaut32"
  5692. decklink_indev_extralibs="$decklink_indev_extralibs -lole32 -loleaut32"
  5693. ;;
  5694. esac
  5695. fi
  5696. enabled securetransport &&
  5697. check_func SecIdentityCreate "-Wl,-framework,CoreFoundation -Wl,-framework,Security" &&
  5698. check_lib securetransport "Security/SecureTransport.h Security/Security.h" "SSLCreateContext" "-Wl,-framework,CoreFoundation -Wl,-framework,Security" ||
  5699. disable securetransport
  5700. enabled securetransport &&
  5701. check_func SecItemImport "-Wl,-framework,CoreFoundation -Wl,-framework,Security"
  5702. enabled schannel &&
  5703. check_func_headers "windows.h security.h" InitializeSecurityContext -DSECURITY_WIN32 -lsecur32 &&
  5704. test_cpp_condition winerror.h "defined(SEC_I_CONTEXT_EXPIRED)" &&
  5705. schannel_extralibs="-lsecur32" ||
  5706. disable schannel
  5707. makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo
  5708. enabled makeinfo \
  5709. && [ 0$(makeinfo --version | grep "texinfo" | sed 's/.*texinfo[^0-9]*\([0-9]*\)\..*/\1/') -ge 5 ] \
  5710. && enable makeinfo_html || disable makeinfo_html
  5711. disabled makeinfo_html && texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html
  5712. perl -v > /dev/null 2>&1 && enable perl || disable perl
  5713. pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
  5714. rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
  5715. # check V4L2 codecs available in the API
  5716. check_header linux/fb.h
  5717. check_header linux/videodev2.h
  5718. test_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete
  5719. check_cc v4l2_m2m linux/videodev2.h "int i = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_M2M | V4L2_BUF_FLAG_LAST;"
  5720. check_cc vc1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VC1_ANNEX_G;"
  5721. check_cc mpeg1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG1;"
  5722. check_cc mpeg2_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG2;"
  5723. check_cc mpeg4_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG4;"
  5724. check_cc hevc_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_HEVC;"
  5725. check_cc h263_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_H263;"
  5726. check_cc h264_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_H264;"
  5727. check_cc vp8_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP8;"
  5728. check_cc vp9_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP9;"
  5729. check_header sys/videoio.h
  5730. test_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete
  5731. check_lib user32 "windows.h winuser.h" GetShellWindow -luser32
  5732. check_lib vfw32 "windows.h vfw.h" capCreateCaptureWindow -lvfw32
  5733. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  5734. # w32api 3.12 had it defined wrong
  5735. check_cpp_condition vfwcap_defines vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER"
  5736. check_type "dshow.h" IBaseFilter
  5737. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  5738. check_header "dev/bktr/ioctl_meteor.h dev/bktr/ioctl_bt848.h" ||
  5739. check_header "machine/ioctl_meteor.h machine/ioctl_bt848.h" ||
  5740. check_header "dev/video/meteor/ioctl_meteor.h dev/video/bktr/ioctl_bt848.h" ||
  5741. check_header "dev/ic/bt8xx.h"
  5742. if check_struct sys/soundcard.h audio_buf_info bytes; then
  5743. enable_sanitized sys/soundcard.h
  5744. else
  5745. test_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_sanitized sys/soundcard.h
  5746. #include <sys/soundcard.h>
  5747. audio_buf_info abc;
  5748. EOF
  5749. fi
  5750. enabled alsa && check_pkg_config alsa alsa "alsa/asoundlib.h" snd_pcm_htimestamp ||
  5751. check_lib alsa alsa/asoundlib.h snd_pcm_htimestamp -lasound
  5752. enabled libjack &&
  5753. require_pkg_config libjack jack jack/jack.h jack_port_get_latency_range
  5754. enabled sndio && check_lib sndio sndio.h sio_open -lsndio
  5755. if enabled libcdio; then
  5756. check_pkg_config libcdio libcdio_paranoia "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open ||
  5757. check_pkg_config libcdio libcdio_paranoia "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open ||
  5758. check_lib libcdio "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  5759. check_lib libcdio "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  5760. die "ERROR: No usable libcdio/cdparanoia found"
  5761. fi
  5762. enabled libxcb && check_pkg_config libxcb "xcb >= 1.4" xcb/xcb.h xcb_connect ||
  5763. disable libxcb_shm libxcb_shape libxcb_xfixes
  5764. if enabled libxcb; then
  5765. enabled libxcb_shm && check_pkg_config libxcb_shm xcb-shm xcb/shm.h xcb_shm_attach
  5766. enabled libxcb_shape && check_pkg_config libxcb_shape xcb-shape xcb/shape.h xcb_shape_get_rectangles
  5767. enabled libxcb_xfixes && check_pkg_config libxcb_xfixes xcb-xfixes xcb/xfixes.h xcb_xfixes_get_cursor_image
  5768. fi
  5769. check_func_headers "windows.h" CreateDIBSection "$gdigrab_indev_extralibs"
  5770. # d3d11va requires linking directly to dxgi and d3d11 if not building for
  5771. # the desktop api partition
  5772. test_cpp <<EOF && enable uwp && d3d11va_extralibs="-ldxgi -ld3d11"
  5773. #ifdef WINAPI_FAMILY
  5774. #include <winapifamily.h>
  5775. #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  5776. #error desktop, not uwp
  5777. #else
  5778. // WINAPI_FAMILY_APP, WINAPI_FAMILY_PHONE_APP => UWP
  5779. #endif
  5780. #else
  5781. #error no family set
  5782. #endif
  5783. EOF
  5784. enabled vaapi &&
  5785. check_lib vaapi va/va.h vaInitialize -lva
  5786. enabled vaapi &&
  5787. check_cc vaapi "va/va.h" "vaCreateSurfaces(0, 0, 0, 0, 0, 0, 0, 0)"
  5788. if enabled vaapi; then
  5789. check_lib vaapi_drm "va/va.h va/va_drm.h" vaGetDisplayDRM -lva -lva-drm
  5790. check_lib vaapi_x11 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 -lX11
  5791. fi
  5792. enabled vaapi &&
  5793. check_cpp_condition vaapi_1 "va/va.h" "VA_CHECK_VERSION(1, 0, 0)"
  5794. if enabled_all opencl libdrm ; then
  5795. check_type "CL/cl_intel.h" "clCreateImageFromFdINTEL_fn" &&
  5796. enable opencl_drm_beignet
  5797. check_func_headers "CL/cl_ext.h" clImportMemoryARM &&
  5798. enable opencl_drm_arm
  5799. fi
  5800. if enabled_all opencl vaapi ; then
  5801. enabled opencl_drm_beignet && enable opencl_vaapi_beignet
  5802. if enabled libmfx ; then
  5803. check_type "CL/cl.h CL/va_ext.h" "clCreateFromVA_APIMediaSurfaceINTEL_fn" &&
  5804. enable opencl_vaapi_intel_media
  5805. fi
  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