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.

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