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.

6877 lines
221KB

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