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.

6829 lines
220KB

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