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.

6788 lines
218KB

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