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.

6272 lines
198KB

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