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.

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