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.

6857 lines
221KB

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