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.

6942 lines
223KB

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