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.

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