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.

7334 lines
240KB

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