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.

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