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.

7367 lines
241KB

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