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.

7071 lines
230KB

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