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.

6143 lines
193KB

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