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.

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