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.

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