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.

6844 lines
221KB

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