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.

6627 lines
211KB

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