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.

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