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.

6684 lines
212KB

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