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.

7278 lines
237KB

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