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.

6025 lines
189KB

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