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.

6764 lines
217KB

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