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.

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