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.

6385 lines
202KB

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