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.

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