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.

6021 lines
188KB

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