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.

6843 lines
220KB

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