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.

6283 lines
199KB

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