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.

7288 lines
238KB

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