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.

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