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.

6835 lines
220KB

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