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.

7156 lines
232KB

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