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.

6393 lines
203KB

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