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.

6655 lines
211KB

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