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.

6929 lines
223KB

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