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.

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