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.

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