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.

6279 lines
199KB

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