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.

6532 lines
207KB

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