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.

6913 lines
222KB

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