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.

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