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.

6405 lines
203KB

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