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.

6396 lines
203KB

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