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.

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