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.

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