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.

6351 lines
201KB

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