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.

6596 lines
208KB

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