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.

6488 lines
205KB

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