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.

6546 lines
207KB

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