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.

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