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.

6380 lines
202KB

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