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.

6315 lines
200KB

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