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.

6565 lines
208KB

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