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.

6951 lines
224KB

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