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