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.

6442 lines
204KB

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