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.

7193 lines
234KB

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