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.

6147 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. hevc_qsv_encoder_deps="libmfx"
  2017. hevc_qsv_encoder_select="qsvenc"
  2018. huffyuv_decoder_select="bswapdsp huffyuvdsp llviddsp"
  2019. huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llviddsp"
  2020. iac_decoder_select="imc_decoder"
  2021. imc_decoder_select="bswapdsp fft mdct sinewin"
  2022. indeo3_decoder_select="hpeldsp"
  2023. interplay_video_decoder_select="hpeldsp"
  2024. jpegls_decoder_select="golomb mjpeg_decoder"
  2025. jpegls_encoder_select="golomb"
  2026. jv_decoder_select="blockdsp"
  2027. lagarith_decoder_select="huffyuvdsp"
  2028. ljpeg_encoder_select="aandcttables idctdsp jpegtables"
  2029. loco_decoder_select="golomb"
  2030. mdec_decoder_select="blockdsp idctdsp mpegvideo"
  2031. metasound_decoder_select="lsp mdct sinewin"
  2032. mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp"
  2033. mjpeg_decoder_select="blockdsp hpeldsp exif idctdsp jpegtables"
  2034. mjpeg_encoder_select="aandcttables jpegtables mpegvideoenc"
  2035. mjpegb_decoder_select="mjpeg_decoder"
  2036. mlp_decoder_select="mlp_parser"
  2037. motionpixels_decoder_select="bswapdsp"
  2038. mp1_decoder_select="mpegaudio"
  2039. mp1float_decoder_select="mpegaudio"
  2040. mp2_decoder_select="mpegaudio"
  2041. mp2float_decoder_select="mpegaudio"
  2042. mp3_decoder_select="mpegaudio"
  2043. mp3adu_decoder_select="mpegaudio"
  2044. mp3adufloat_decoder_select="mpegaudio"
  2045. mp3float_decoder_select="mpegaudio"
  2046. mp3on4_decoder_select="mpegaudio"
  2047. mp3on4float_decoder_select="mpegaudio"
  2048. mpc7_decoder_select="bswapdsp mpegaudiodsp"
  2049. mpc8_decoder_select="mpegaudiodsp"
  2050. mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
  2051. mpeg_xvmc_decoder_select="mpeg2video_decoder"
  2052. mpegvideo_decoder_select="error_resilience mpeg_er mpegvideo"
  2053. mpeg1video_decoder_select="error_resilience mpeg_er mpegvideo"
  2054. mpeg1video_encoder_select="aandcttables mpegvideoenc h263dsp"
  2055. mpeg2video_decoder_select="error_resilience mpeg_er mpegvideo"
  2056. mpeg2video_encoder_select="aandcttables mpegvideoenc h263dsp"
  2057. mpeg2_qsv_encoder_deps="libmfx"
  2058. mpeg2_qsv_encoder_select="qsvenc"
  2059. mpeg4_decoder_select="h263_decoder mpeg4video_parser"
  2060. mpeg4_encoder_select="h263_encoder"
  2061. msmpeg4v1_decoder_select="h263_decoder"
  2062. msmpeg4v2_decoder_select="h263_decoder"
  2063. msmpeg4v2_encoder_select="h263_encoder"
  2064. msmpeg4v3_decoder_select="h263_decoder"
  2065. msmpeg4v3_encoder_select="h263_encoder"
  2066. mss2_decoder_select="error_resilience mpeg_er qpeldsp vc1_decoder"
  2067. mxpeg_decoder_select="mjpeg_decoder"
  2068. nellymoser_decoder_select="mdct sinewin"
  2069. nellymoser_encoder_select="audio_frame_queue mdct sinewin"
  2070. nuv_decoder_select="idctdsp lzo"
  2071. on2avc_decoder_select="mdct"
  2072. opus_decoder_deps="swresample"
  2073. opus_decoder_select="imdct15"
  2074. png_decoder_select="zlib"
  2075. png_encoder_select="huffyuvencdsp zlib"
  2076. prores_decoder_select="blockdsp idctdsp"
  2077. prores_encoder_select="fdctdsp"
  2078. qcelp_decoder_select="lsp"
  2079. qdm2_decoder_select="mdct rdft mpegaudiodsp"
  2080. ra_144_encoder_select="audio_frame_queue lpc audiodsp"
  2081. ra_144_decoder_select="audiodsp"
  2082. ralf_decoder_select="golomb"
  2083. rawvideo_decoder_select="bswapdsp"
  2084. rtjpeg_decoder_select="me_cmp"
  2085. rv10_decoder_select="error_resilience h263_decoder h263dsp mpeg_er"
  2086. rv10_encoder_select="h263_encoder"
  2087. rv20_decoder_select="error_resilience h263_decoder h263dsp mpeg_er"
  2088. rv20_encoder_select="h263_encoder"
  2089. rv30_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpeg_er mpegvideo videodsp"
  2090. rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpeg_er mpegvideo videodsp"
  2091. shorten_decoder_select="golomb"
  2092. sipr_decoder_select="lsp"
  2093. snow_decoder_select="dwt h264qpel hpeldsp me_cmp rangecoder videodsp"
  2094. snow_encoder_select="aandcttables dwt h264qpel hpeldsp me_cmp mpegvideoenc rangecoder"
  2095. sonic_decoder_select="golomb rangecoder"
  2096. sonic_encoder_select="golomb rangecoder"
  2097. sonic_ls_encoder_select="golomb rangecoder"
  2098. sp5x_decoder_select="mjpeg_decoder"
  2099. svq1_decoder_select="hpeldsp"
  2100. svq1_encoder_select="aandcttables hpeldsp me_cmp mpegvideoenc"
  2101. svq3_decoder_select="h264_decoder hpeldsp tpeldsp"
  2102. svq3_decoder_suggest="zlib"
  2103. tak_decoder_select="audiodsp"
  2104. tdsc_decoder_select="zlib mjpeg_decoder"
  2105. theora_decoder_select="vp3_decoder"
  2106. thp_decoder_select="mjpeg_decoder"
  2107. tiff_decoder_suggest="zlib lzma"
  2108. tiff_encoder_suggest="zlib"
  2109. truehd_decoder_select="mlp_parser"
  2110. truemotion2_decoder_select="bswapdsp"
  2111. truespeech_decoder_select="bswapdsp"
  2112. tscc_decoder_select="zlib"
  2113. twinvq_decoder_select="mdct lsp sinewin"
  2114. txd_decoder_select="texturedsp"
  2115. utvideo_decoder_select="bswapdsp"
  2116. utvideo_encoder_select="bswapdsp huffman huffyuvencdsp"
  2117. vble_decoder_select="huffyuvdsp"
  2118. vc1_decoder_select="blockdsp error_resilience h263_decoder h264chroma h264qpel intrax8 mpeg_er qpeldsp startcode"
  2119. vc1image_decoder_select="vc1_decoder"
  2120. vorbis_decoder_select="mdct"
  2121. vorbis_encoder_select="mdct"
  2122. vp3_decoder_select="hpeldsp vp3dsp videodsp"
  2123. vp5_decoder_select="h264chroma hpeldsp videodsp vp3dsp"
  2124. vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp"
  2125. vp6a_decoder_select="vp6_decoder"
  2126. vp6f_decoder_select="vp6_decoder"
  2127. vp7_decoder_select="h264pred videodsp"
  2128. vp8_decoder_select="h264pred videodsp"
  2129. vp9_decoder_select="videodsp vp9_parser"
  2130. webp_decoder_select="vp8_decoder"
  2131. wmalossless_decoder_select="llauddsp"
  2132. wmapro_decoder_select="mdct sinewin wma_freqs"
  2133. wmav1_decoder_select="mdct sinewin wma_freqs"
  2134. wmav1_encoder_select="mdct sinewin wma_freqs"
  2135. wmav2_decoder_select="mdct sinewin wma_freqs"
  2136. wmav2_encoder_select="mdct sinewin wma_freqs"
  2137. wmavoice_decoder_select="lsp rdft dct mdct sinewin"
  2138. wmv1_decoder_select="h263_decoder"
  2139. wmv1_encoder_select="h263_encoder"
  2140. wmv2_decoder_select="blockdsp h263_decoder idctdsp intrax8 videodsp"
  2141. wmv2_encoder_select="h263_encoder"
  2142. wmv3_decoder_select="vc1_decoder"
  2143. wmv3image_decoder_select="wmv3_decoder"
  2144. zerocodec_decoder_select="zlib"
  2145. zlib_decoder_select="zlib"
  2146. zlib_encoder_select="zlib"
  2147. zmbv_decoder_select="zlib"
  2148. zmbv_encoder_select="zlib"
  2149. # hardware accelerators
  2150. crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
  2151. d3d11va_deps="d3d11_h dxva_h ID3D11VideoDecoder"
  2152. dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode"
  2153. vaapi_deps="va_va_h"
  2154. vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
  2155. vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore"
  2156. vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  2157. xvmc_deps="X11_extensions_XvMClib_h"
  2158. h263_vaapi_hwaccel_deps="vaapi"
  2159. h263_vaapi_hwaccel_select="h263_decoder"
  2160. h263_vdpau_hwaccel_deps="vdpau"
  2161. h263_vdpau_hwaccel_select="h263_decoder"
  2162. h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
  2163. h264_d3d11va_hwaccel_deps="d3d11va"
  2164. h264_d3d11va_hwaccel_select="h264_decoder"
  2165. h264_dxva2_hwaccel_deps="dxva2"
  2166. h264_dxva2_hwaccel_select="h264_decoder"
  2167. h264_mmal_decoder_deps="mmal"
  2168. h264_mmal_hwaccel_deps="mmal"
  2169. h264_mmal_decoder_select="h264_decoder"
  2170. h264_mmal_encoder_deps="mmal"
  2171. h264_qsv_hwaccel_deps="libmfx"
  2172. h264_vaapi_hwaccel_deps="vaapi"
  2173. h264_vaapi_hwaccel_select="h264_decoder"
  2174. h264_vda_decoder_deps="vda"
  2175. h264_vda_decoder_select="h264_decoder"
  2176. h264_vda_hwaccel_deps="vda"
  2177. h264_vda_hwaccel_select="h264_decoder"
  2178. h264_vda_old_hwaccel_deps="vda"
  2179. h264_vda_old_hwaccel_select="h264_decoder"
  2180. h264_vdpau_decoder_deps="vdpau"
  2181. h264_vdpau_decoder_select="h264_decoder"
  2182. h264_vdpau_hwaccel_deps="vdpau"
  2183. h264_vdpau_hwaccel_select="h264_decoder"
  2184. hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
  2185. hevc_d3d11va_hwaccel_select="hevc_decoder"
  2186. hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
  2187. hevc_dxva2_hwaccel_select="hevc_decoder"
  2188. hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC"
  2189. hevc_vdpau_hwaccel_select="hevc_decoder"
  2190. mpeg_vdpau_decoder_deps="vdpau"
  2191. mpeg_vdpau_decoder_select="mpeg2video_decoder"
  2192. mpeg_xvmc_hwaccel_deps="xvmc"
  2193. mpeg_xvmc_hwaccel_select="mpeg2video_decoder"
  2194. mpeg1_vdpau_decoder_deps="vdpau"
  2195. mpeg1_vdpau_decoder_select="mpeg1video_decoder"
  2196. mpeg1_vdpau_hwaccel_deps="vdpau"
  2197. mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
  2198. mpeg1_xvmc_hwaccel_deps="xvmc"
  2199. mpeg1_xvmc_hwaccel_select="mpeg1video_decoder"
  2200. mpeg2_crystalhd_decoder_select="crystalhd"
  2201. mpeg2_d3d11va_hwaccel_deps="d3d11va"
  2202. mpeg2_d3d11va_hwaccel_select="mpeg2video_decoder"
  2203. mpeg2_dxva2_hwaccel_deps="dxva2"
  2204. mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
  2205. mpeg2_vaapi_hwaccel_deps="vaapi"
  2206. mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
  2207. mpeg2_vdpau_hwaccel_deps="vdpau"
  2208. mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
  2209. mpeg2_xvmc_hwaccel_deps="xvmc"
  2210. mpeg2_xvmc_hwaccel_select="mpeg2video_decoder"
  2211. mpeg4_crystalhd_decoder_select="crystalhd"
  2212. mpeg4_vaapi_hwaccel_deps="vaapi"
  2213. mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
  2214. mpeg4_vdpau_decoder_deps="vdpau"
  2215. mpeg4_vdpau_decoder_select="mpeg4_decoder"
  2216. mpeg4_vdpau_hwaccel_deps="vdpau"
  2217. mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
  2218. msmpeg4_crystalhd_decoder_select="crystalhd"
  2219. vc1_crystalhd_decoder_select="crystalhd"
  2220. vc1_d3d11va_hwaccel_deps="d3d11va"
  2221. vc1_d3d11va_hwaccel_select="vc1_decoder"
  2222. vc1_dxva2_hwaccel_deps="dxva2"
  2223. vc1_dxva2_hwaccel_select="vc1_decoder"
  2224. vc1_vaapi_hwaccel_deps="vaapi"
  2225. vc1_vaapi_hwaccel_select="vc1_decoder"
  2226. vc1_vdpau_decoder_deps="vdpau"
  2227. vc1_vdpau_decoder_select="vc1_decoder"
  2228. vc1_vdpau_hwaccel_deps="vdpau"
  2229. vc1_vdpau_hwaccel_select="vc1_decoder"
  2230. wmv3_crystalhd_decoder_select="crystalhd"
  2231. wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
  2232. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  2233. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  2234. wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
  2235. wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
  2236. # parsers
  2237. h264_parser_select="h264_decoder"
  2238. hevc_parser_select="hevc_decoder"
  2239. mpegvideo_parser_select="mpegvideo"
  2240. mpeg4video_parser_select="error_resilience h263dsp mpeg_er mpegvideo qpeldsp"
  2241. vc1_parser_select="mpegvideo startcode vc1_decoder"
  2242. # bitstream_filters
  2243. mjpeg2jpeg_bsf_select="jpegtables"
  2244. # external libraries
  2245. libaacplus_encoder_deps="libaacplus"
  2246. libcelt_decoder_deps="libcelt"
  2247. libdcadec_decoder_deps="libdcadec"
  2248. libfaac_encoder_deps="libfaac"
  2249. libfaac_encoder_select="audio_frame_queue"
  2250. libfdk_aac_decoder_deps="libfdk_aac"
  2251. libfdk_aac_encoder_deps="libfdk_aac"
  2252. libfdk_aac_encoder_select="audio_frame_queue"
  2253. libgme_demuxer_deps="libgme"
  2254. libgsm_decoder_deps="libgsm"
  2255. libgsm_encoder_deps="libgsm"
  2256. libgsm_ms_decoder_deps="libgsm"
  2257. libgsm_ms_encoder_deps="libgsm"
  2258. libilbc_decoder_deps="libilbc"
  2259. libilbc_encoder_deps="libilbc"
  2260. libmodplug_demuxer_deps="libmodplug"
  2261. libmp3lame_encoder_deps="libmp3lame"
  2262. libmp3lame_encoder_select="audio_frame_queue"
  2263. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  2264. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  2265. libopencore_amrnb_encoder_select="audio_frame_queue"
  2266. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  2267. libopenh264_encoder_deps="libopenh264"
  2268. libopenjpeg_decoder_deps="libopenjpeg"
  2269. libopenjpeg_encoder_deps="libopenjpeg"
  2270. libopus_decoder_deps="libopus"
  2271. libopus_encoder_deps="libopus"
  2272. libopus_encoder_select="audio_frame_queue"
  2273. libquvi_demuxer_deps="libquvi"
  2274. libschroedinger_decoder_deps="libschroedinger"
  2275. libschroedinger_encoder_deps="libschroedinger"
  2276. libshine_encoder_deps="libshine"
  2277. libshine_encoder_select="audio_frame_queue"
  2278. libspeex_decoder_deps="libspeex"
  2279. libspeex_encoder_deps="libspeex"
  2280. libspeex_encoder_select="audio_frame_queue"
  2281. libstagefright_h264_decoder_deps="libstagefright_h264"
  2282. libtheora_encoder_deps="libtheora"
  2283. libtwolame_encoder_deps="libtwolame"
  2284. libvo_aacenc_encoder_deps="libvo_aacenc"
  2285. libvo_aacenc_encoder_select="audio_frame_queue"
  2286. libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
  2287. libvorbis_decoder_deps="libvorbis"
  2288. libvorbis_encoder_deps="libvorbis"
  2289. libvorbis_encoder_select="audio_frame_queue"
  2290. libvpx_vp8_decoder_deps="libvpx"
  2291. libvpx_vp8_encoder_deps="libvpx"
  2292. libvpx_vp9_decoder_deps="libvpx"
  2293. libvpx_vp9_encoder_deps="libvpx"
  2294. libwavpack_encoder_deps="libwavpack"
  2295. libwebp_encoder_deps="libwebp"
  2296. libwebp_anim_encoder_deps="libwebp"
  2297. libx264_encoder_deps="libx264"
  2298. libx264rgb_encoder_deps="libx264"
  2299. libx264rgb_encoder_select="libx264_encoder"
  2300. libx265_encoder_deps="libx265"
  2301. libxavs_encoder_deps="libxavs"
  2302. libxvid_encoder_deps="libxvid"
  2303. libutvideo_decoder_deps="libutvideo"
  2304. libutvideo_encoder_deps="libutvideo"
  2305. libzvbi_teletext_decoder_deps="libzvbi"
  2306. nvenc_encoder_deps="nvenc"
  2307. nvenc_h264_encoder_deps="nvenc"
  2308. nvenc_hevc_encoder_deps="nvenc"
  2309. # demuxers / muxers
  2310. ac3_demuxer_select="ac3_parser"
  2311. asf_demuxer_select="riffdec"
  2312. asf_o_demuxer_select="riffdec"
  2313. asf_muxer_select="riffenc"
  2314. asf_stream_muxer_select="asf_muxer"
  2315. avi_demuxer_select="riffdec exif"
  2316. avi_muxer_select="riffenc"
  2317. avisynth_demuxer_deps="avisynth"
  2318. avisynth_demuxer_select="riffdec"
  2319. caf_demuxer_select="riffdec"
  2320. dash_muxer_select="mp4_muxer"
  2321. dirac_demuxer_select="dirac_parser"
  2322. dts_demuxer_select="dca_parser"
  2323. dtshd_demuxer_select="dca_parser"
  2324. dv_demuxer_select="dvprofile"
  2325. dv_muxer_select="dvprofile"
  2326. dxa_demuxer_select="riffdec"
  2327. eac3_demuxer_select="ac3_parser"
  2328. f4v_muxer_select="mov_muxer"
  2329. flac_demuxer_select="flac_parser"
  2330. hds_muxer_select="flv_muxer"
  2331. hls_muxer_select="mpegts_muxer"
  2332. image2_alias_pix_demuxer_select="image2_demuxer"
  2333. image2_brender_pix_demuxer_select="image2_demuxer"
  2334. ipod_muxer_select="mov_muxer"
  2335. ismv_muxer_select="mov_muxer"
  2336. libnut_demuxer_deps="libnut"
  2337. libnut_muxer_deps="libnut"
  2338. matroska_audio_muxer_select="matroska_muxer"
  2339. matroska_demuxer_select="riffdec"
  2340. matroska_demuxer_suggest="bzlib lzo zlib"
  2341. matroska_muxer_select="riffenc"
  2342. mmf_muxer_select="riffenc"
  2343. mov_demuxer_select="riffdec"
  2344. mov_demuxer_suggest="zlib"
  2345. mov_muxer_select="riffenc rtpenc_chain"
  2346. mp3_demuxer_select="mpegaudio_parser"
  2347. mp4_muxer_select="mov_muxer"
  2348. mpegts_muxer_select="adts_muxer latm_muxer"
  2349. mpegtsraw_demuxer_select="mpegts_demuxer"
  2350. mxf_d10_muxer_select="mxf_muxer"
  2351. mxf_opatom_muxer_select="mxf_muxer"
  2352. nut_muxer_select="riffenc"
  2353. nuv_demuxer_select="riffdec"
  2354. oga_muxer_select="ogg_muxer"
  2355. ogg_demuxer_select="golomb"
  2356. opus_muxer_select="ogg_muxer"
  2357. psp_muxer_select="mov_muxer"
  2358. rtp_demuxer_select="sdp_demuxer"
  2359. rtpdec_select="asf_demuxer jpegtables mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol"
  2360. rtsp_demuxer_select="http_protocol rtpdec"
  2361. rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
  2362. sap_demuxer_select="sdp_demuxer"
  2363. sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
  2364. sdp_demuxer_select="rtpdec"
  2365. smoothstreaming_muxer_select="ismv_muxer"
  2366. spdif_muxer_select="aac_parser"
  2367. spx_muxer_select="ogg_muxer"
  2368. tak_demuxer_select="tak_parser"
  2369. tg2_muxer_select="mov_muxer"
  2370. tgp_muxer_select="mov_muxer"
  2371. vobsub_demuxer_select="mpegps_demuxer"
  2372. w64_demuxer_select="wav_demuxer"
  2373. w64_muxer_select="wav_muxer"
  2374. wav_demuxer_select="riffdec"
  2375. wav_muxer_select="riffenc"
  2376. webm_muxer_select="riffenc"
  2377. wtv_demuxer_select="riffdec"
  2378. wtv_muxer_select="riffenc"
  2379. xmv_demuxer_select="riffdec"
  2380. xwma_demuxer_select="riffdec"
  2381. # indevs / outdevs
  2382. alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  2383. alsa_outdev_deps="alsa_asoundlib_h"
  2384. avfoundation_indev_extralibs="-framework CoreVideo -framework Foundation -framework AVFoundation -framework CoreMedia"
  2385. avfoundation_indev_select="avfoundation"
  2386. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  2387. caca_outdev_deps="libcaca"
  2388. decklink_outdev_deps="decklink pthreads"
  2389. decklink_outdev_extralibs="-lstdc++"
  2390. decklink_indev_deps="decklink pthreads"
  2391. decklink_indev_extralibs="-lstdc++"
  2392. dshow_indev_deps="IBaseFilter"
  2393. dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid -loleaut32 -lshlwapi"
  2394. dv1394_indev_deps="dv1394"
  2395. dv1394_indev_select="dv_demuxer"
  2396. fbdev_indev_deps="linux_fb_h"
  2397. fbdev_outdev_deps="linux_fb_h"
  2398. gdigrab_indev_deps="CreateDIBSection"
  2399. gdigrab_indev_extralibs="-lgdi32"
  2400. gdigrab_indev_select="bmp_decoder"
  2401. iec61883_indev_deps="libiec61883"
  2402. jack_indev_deps="jack_jack_h sem_timedwait"
  2403. lavfi_indev_deps="avfilter"
  2404. libcdio_indev_deps="libcdio"
  2405. libdc1394_indev_deps="libdc1394"
  2406. libv4l2_indev_deps="libv4l2"
  2407. openal_indev_deps="openal"
  2408. opengl_outdev_deps="opengl"
  2409. oss_indev_deps_any="soundcard_h sys_soundcard_h"
  2410. oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  2411. pulse_indev_deps="libpulse"
  2412. pulse_outdev_deps="libpulse"
  2413. qtkit_indev_extralibs="-framework QTKit -framework Foundation -framework QuartzCore"
  2414. qtkit_indev_select="qtkit"
  2415. sdl_outdev_deps="sdl"
  2416. sndio_indev_deps="sndio_h"
  2417. sndio_outdev_deps="sndio_h"
  2418. v4l_indev_deps="linux_videodev_h"
  2419. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  2420. v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h"
  2421. vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
  2422. vfwcap_indev_extralibs="-lavicap32"
  2423. xv_outdev_deps="X11_extensions_Xvlib_h XvGetPortAttribute"
  2424. xv_outdev_extralibs="-lXv -lX11 -lXext"
  2425. x11grab_indev_deps="x11grab"
  2426. x11grab_xcb_indev_deps="libxcb"
  2427. # protocols
  2428. bluray_protocol_deps="libbluray"
  2429. ffrtmpcrypt_protocol_deps="!librtmp_protocol"
  2430. ffrtmpcrypt_protocol_deps_any="gcrypt gmp openssl"
  2431. ffrtmpcrypt_protocol_select="tcp_protocol"
  2432. ffrtmphttp_protocol_deps="!librtmp_protocol"
  2433. ffrtmphttp_protocol_select="http_protocol"
  2434. ftp_protocol_select="tcp_protocol"
  2435. gopher_protocol_select="network"
  2436. http_protocol_select="tcp_protocol"
  2437. httpproxy_protocol_select="tcp_protocol"
  2438. https_protocol_select="tls_protocol"
  2439. icecast_protocol_select="http_protocol"
  2440. librtmp_protocol_deps="librtmp"
  2441. librtmpe_protocol_deps="librtmp"
  2442. librtmps_protocol_deps="librtmp"
  2443. librtmpt_protocol_deps="librtmp"
  2444. librtmpte_protocol_deps="librtmp"
  2445. libsmbclient_protocol_deps="libsmbclient gplv3"
  2446. libssh_protocol_deps="libssh"
  2447. mmsh_protocol_select="http_protocol"
  2448. mmst_protocol_select="network"
  2449. rtmp_protocol_deps="!librtmp_protocol"
  2450. rtmp_protocol_select="tcp_protocol"
  2451. rtmpe_protocol_select="ffrtmpcrypt_protocol"
  2452. rtmps_protocol_deps="!librtmp_protocol"
  2453. rtmps_protocol_select="tls_protocol"
  2454. rtmpt_protocol_select="ffrtmphttp_protocol"
  2455. rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
  2456. rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
  2457. rtp_protocol_select="udp_protocol"
  2458. sctp_protocol_deps="struct_sctp_event_subscribe"
  2459. sctp_protocol_select="network"
  2460. srtp_protocol_select="rtp_protocol"
  2461. tcp_protocol_select="network"
  2462. tls_gnutls_protocol_deps="gnutls !tls_securetransport_protocol"
  2463. tls_gnutls_protocol_select="tcp_protocol"
  2464. tls_openssl_protocol_deps="openssl !tls_securetransport_protocol !tls_gnutls_protocol"
  2465. tls_openssl_protocol_select="tcp_protocol"
  2466. tls_securetransport_protocol_deps="securetransport"
  2467. tls_securetransport_protocol_select="tcp_protocol"
  2468. tls_protocol_deps_any="tls_securetransport_protocol tls_gnutls_protocol tls_openssl_protocol"
  2469. udp_protocol_select="network"
  2470. udplite_protocol_select="network"
  2471. unix_protocol_deps="sys_un_h"
  2472. unix_protocol_select="network"
  2473. # filters
  2474. amovie_filter_deps="avcodec avformat"
  2475. aresample_filter_deps="swresample"
  2476. ass_filter_deps="libass"
  2477. asyncts_filter_deps="avresample"
  2478. atempo_filter_deps="avcodec"
  2479. atempo_filter_select="rdft"
  2480. azmq_filter_deps="libzmq"
  2481. blackframe_filter_deps="gpl"
  2482. boxblur_filter_deps="gpl"
  2483. bs2b_filter_deps="libbs2b"
  2484. colormatrix_filter_deps="gpl"
  2485. cover_rect_filter_deps="avcodec avformat gpl"
  2486. cropdetect_filter_deps="gpl"
  2487. delogo_filter_deps="gpl"
  2488. deshake_filter_select="pixelutils"
  2489. drawtext_filter_deps="libfreetype"
  2490. ebur128_filter_deps="gpl"
  2491. eq_filter_deps="gpl"
  2492. fftfilt_filter_deps="avcodec"
  2493. fftfilt_filter_select="rdft"
  2494. flite_filter_deps="libflite"
  2495. find_rect_filter_deps="avcodec avformat gpl"
  2496. frei0r_filter_deps="frei0r dlopen"
  2497. frei0r_src_filter_deps="frei0r dlopen"
  2498. fspp_filter_deps="gpl"
  2499. geq_filter_deps="gpl"
  2500. histeq_filter_deps="gpl"
  2501. hqdn3d_filter_deps="gpl"
  2502. interlace_filter_deps="gpl"
  2503. kerndeint_filter_deps="gpl"
  2504. ladspa_filter_deps="ladspa dlopen"
  2505. mcdeint_filter_deps="avcodec gpl"
  2506. movie_filter_deps="avcodec avformat"
  2507. mpdecimate_filter_deps="gpl"
  2508. mpdecimate_filter_select="pixelutils"
  2509. mptestsrc_filter_deps="gpl"
  2510. negate_filter_deps="lut_filter"
  2511. perspective_filter_deps="gpl"
  2512. pp7_filter_deps="gpl"
  2513. ocv_filter_deps="libopencv"
  2514. owdenoise_filter_deps="gpl"
  2515. pan_filter_deps="swresample"
  2516. phase_filter_deps="gpl"
  2517. pp_filter_deps="gpl postproc"
  2518. pullup_filter_deps="gpl"
  2519. removelogo_filter_deps="avcodec avformat swscale"
  2520. repeatfields_filter_deps="gpl"
  2521. resample_filter_deps="avresample"
  2522. sab_filter_deps="gpl swscale"
  2523. scale_filter_deps="swscale"
  2524. select_filter_select="pixelutils"
  2525. smartblur_filter_deps="gpl swscale"
  2526. showcqt_filter_deps="avcodec"
  2527. showcqt_filter_select="fft"
  2528. showspectrum_filter_deps="avcodec"
  2529. showspectrum_filter_select="rdft"
  2530. spp_filter_deps="gpl avcodec"
  2531. spp_filter_select="fft idctdsp fdctdsp me_cmp pixblockdsp"
  2532. stereo3d_filter_deps="gpl"
  2533. subtitles_filter_deps="avformat avcodec libass"
  2534. super2xsai_filter_deps="gpl"
  2535. tinterlace_filter_deps="gpl"
  2536. vidstabdetect_filter_deps="libvidstab"
  2537. vidstabtransform_filter_deps="libvidstab"
  2538. pixfmts_super2xsai_test_deps="super2xsai_filter"
  2539. tinterlace_merge_test_deps="tinterlace_filter"
  2540. tinterlace_pad_test_deps="tinterlace_filter"
  2541. uspp_filter_deps="gpl avcodec"
  2542. zmq_filter_deps="libzmq"
  2543. zoompan_filter_deps="swscale"
  2544. # examples
  2545. avio_reading="avformat avcodec avutil"
  2546. avio_list_dir="avformat avutil"
  2547. avcodec_example_deps="avcodec avutil"
  2548. decoding_encoding_example_deps="avcodec avformat avutil"
  2549. demuxing_decoding_example_deps="avcodec avformat avutil"
  2550. extract_mvs_example_deps="avcodec avformat avutil"
  2551. filter_audio_example_deps="avfilter avutil"
  2552. filtering_audio_example_deps="avfilter avcodec avformat avutil"
  2553. filtering_video_example_deps="avfilter avcodec avformat avutil"
  2554. metadata_example_deps="avformat avutil"
  2555. muxing_example_deps="avcodec avformat avutil swscale"
  2556. qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder vaapi_x11"
  2557. remuxing_example_deps="avcodec avformat avutil"
  2558. resampling_audio_example_deps="avutil swresample"
  2559. scaling_video_example_deps="avutil swscale"
  2560. transcode_aac_example_deps="avcodec avformat swresample"
  2561. transcoding_example_deps="avfilter avcodec avformat avutil"
  2562. # libraries, in linking order
  2563. avcodec_deps="avutil"
  2564. avdevice_deps="avformat avcodec avutil"
  2565. avfilter_deps="avutil"
  2566. avformat_deps="avcodec avutil"
  2567. avresample_deps="avutil"
  2568. postproc_deps="avutil gpl"
  2569. swresample_deps="avutil"
  2570. swscale_deps="avutil"
  2571. # programs
  2572. ffmpeg_deps="avcodec avfilter avformat swresample"
  2573. ffmpeg_select="aformat_filter anull_filter atrim_filter format_filter
  2574. null_filter
  2575. setpts_filter trim_filter"
  2576. ffplay_deps="avcodec avformat swscale swresample sdl"
  2577. ffplay_libs='$sdl_libs'
  2578. ffplay_select="rdft crop_filter transpose_filter hflip_filter vflip_filter rotate_filter"
  2579. ffprobe_deps="avcodec avformat"
  2580. ffserver_deps="avformat fork sarestart"
  2581. ffserver_select="ffm_muxer rtp_protocol rtsp_demuxer"
  2582. # documentation
  2583. podpages_deps="perl"
  2584. manpages_deps="perl pod2man"
  2585. htmlpages_deps="perl"
  2586. htmlpages_deps_any="makeinfo_html texi2html"
  2587. txtpages_deps="perl makeinfo"
  2588. doc_deps_any="manpages htmlpages podpages txtpages"
  2589. # default parameters
  2590. logfile="config.log"
  2591. # installation paths
  2592. prefix_default="/usr/local"
  2593. bindir_default='${prefix}/bin'
  2594. datadir_default='${prefix}/share/ffmpeg'
  2595. docdir_default='${prefix}/share/doc/ffmpeg'
  2596. incdir_default='${prefix}/include'
  2597. libdir_default='${prefix}/lib'
  2598. mandir_default='${prefix}/share/man'
  2599. # toolchain
  2600. ar_default="ar"
  2601. cc_default="gcc"
  2602. cxx_default="g++"
  2603. host_cc_default="gcc"
  2604. cp_f="cp -f"
  2605. doxygen_default="doxygen"
  2606. install="install"
  2607. ln_s="ln -s -f"
  2608. nm_default="nm -g"
  2609. objformat="elf"
  2610. pkg_config_default=pkg-config
  2611. ranlib_default="ranlib"
  2612. strip_default="strip"
  2613. yasmexe_default="yasm"
  2614. windres_default="windres"
  2615. # OS
  2616. target_os_default=$(tolower $(uname -s))
  2617. host_os=$target_os_default
  2618. # machine
  2619. if test "$target_os_default" = aix; then
  2620. arch_default=$(uname -p)
  2621. strip_default="strip -X32_64"
  2622. else
  2623. arch_default=$(uname -m)
  2624. fi
  2625. cpu="generic"
  2626. intrinsics="none"
  2627. # configurable options
  2628. enable $PROGRAM_LIST
  2629. enable $DOCUMENT_LIST
  2630. enable $EXAMPLE_LIST
  2631. enable $(filter_out avresample $LIBRARY_LIST)
  2632. enable stripping
  2633. enable asm
  2634. enable debug
  2635. enable doc
  2636. enable faan faandct faanidct
  2637. enable optimizations
  2638. enable runtime_cpudetect
  2639. enable safe_bitstream_reader
  2640. enable static
  2641. enable swscale_alpha
  2642. enable valgrind_backtrace
  2643. sws_max_filter_size_default=256
  2644. set_default sws_max_filter_size
  2645. # Enable hwaccels by default.
  2646. enable d3d11va dxva2 vaapi vda vdpau xvmc
  2647. enable xlib
  2648. # build settings
  2649. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  2650. LIBPREF="lib"
  2651. LIBSUF=".a"
  2652. FULLNAME='$(NAME)$(BUILDSUF)'
  2653. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  2654. SLIBPREF="lib"
  2655. SLIBSUF=".so"
  2656. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  2657. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  2658. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  2659. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  2660. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
  2661. SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
  2662. asflags_filter=echo
  2663. cflags_filter=echo
  2664. ldflags_filter=echo
  2665. AS_C='-c'
  2666. AS_O='-o $@'
  2667. CC_C='-c'
  2668. CC_E='-E -o $@'
  2669. CC_O='-o $@'
  2670. CXX_C='-c'
  2671. CXX_O='-o $@'
  2672. LD_O='-o $@'
  2673. LD_LIB='-l%'
  2674. LD_PATH='-L'
  2675. HOSTCC_C='-c'
  2676. HOSTCC_E='-E -o $@'
  2677. HOSTCC_O='-o $@'
  2678. HOSTLD_O='-o $@'
  2679. host_libs='-lm'
  2680. host_cflags_filter=echo
  2681. host_ldflags_filter=echo
  2682. target_path='$(CURDIR)'
  2683. # since the object filename is not given with the -MM flag, the compiler
  2684. # is only able to print the basename, and we must add the path ourselves
  2685. DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  2686. DEPFLAGS='-MM'
  2687. # find source path
  2688. if test -f configure; then
  2689. source_path=.
  2690. else
  2691. source_path=$(cd $(dirname "$0"); pwd)
  2692. echo "$source_path" | grep -q '[[:blank:]]' &&
  2693. die "Out of tree builds are impossible with whitespace in source path."
  2694. test -e "$source_path/config.h" &&
  2695. die "Out of tree builds are impossible with config.h in source dir."
  2696. fi
  2697. for v in "$@"; do
  2698. r=${v#*=}
  2699. l=${v%"$r"}
  2700. r=$(sh_quote "$r")
  2701. FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
  2702. done
  2703. find_things(){
  2704. thing=$1
  2705. pattern=$2
  2706. file=$source_path/$3
  2707. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  2708. }
  2709. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  2710. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  2711. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  2712. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  2713. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  2714. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  2715. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  2716. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  2717. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  2718. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  2719. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  2720. ALL_COMPONENTS="
  2721. $BSF_LIST
  2722. $DECODER_LIST
  2723. $DEMUXER_LIST
  2724. $ENCODER_LIST
  2725. $FILTER_LIST
  2726. $HWACCEL_LIST
  2727. $INDEV_LIST
  2728. $MUXER_LIST
  2729. $OUTDEV_LIST
  2730. $PARSER_LIST
  2731. $PROTOCOL_LIST
  2732. "
  2733. for n in $COMPONENT_LIST; do
  2734. v=$(toupper ${n%s})_LIST
  2735. eval enable \$$v
  2736. eval ${n}_if_any="\$$v"
  2737. done
  2738. enable $ARCH_EXT_LIST
  2739. die_unknown(){
  2740. echo "Unknown option \"$1\"."
  2741. echo "See $0 --help for available options."
  2742. exit 1
  2743. }
  2744. print_3_columns() {
  2745. cat | tr ' ' '\n' | sort | pr -r -3 -t
  2746. }
  2747. show_list() {
  2748. suffix=_$1
  2749. shift
  2750. echo $* | sed s/$suffix//g | print_3_columns
  2751. exit 0
  2752. }
  2753. rand_list(){
  2754. IFS=', '
  2755. set -- $*
  2756. unset IFS
  2757. for thing; do
  2758. comp=${thing%:*}
  2759. prob=${thing#$comp}
  2760. prob=${prob#:}
  2761. is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
  2762. echo "prob ${prob:-0.5}"
  2763. printf '%s\n' $comp
  2764. done
  2765. }
  2766. do_random(){
  2767. action=$1
  2768. shift
  2769. random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
  2770. $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
  2771. }
  2772. for opt do
  2773. optval="${opt#*=}"
  2774. case "$opt" in
  2775. --extra-ldflags=*)
  2776. add_ldflags $optval
  2777. ;;
  2778. --extra-ldexeflags=*)
  2779. add_ldexeflags $optval
  2780. ;;
  2781. --extra-ldlibflags=*)
  2782. add_ldlibflags $optval
  2783. ;;
  2784. --extra-libs=*)
  2785. add_extralibs $optval
  2786. ;;
  2787. --disable-devices)
  2788. disable $INDEV_LIST $OUTDEV_LIST
  2789. ;;
  2790. --enable-debug=*)
  2791. debuglevel="$optval"
  2792. ;;
  2793. --disable-programs)
  2794. disable $PROGRAM_LIST
  2795. ;;
  2796. --disable-everything)
  2797. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  2798. ;;
  2799. --disable-all)
  2800. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  2801. disable $LIBRARY_LIST $PROGRAM_LIST doc
  2802. ;;
  2803. --enable-random|--disable-random)
  2804. action=${opt%%-random}
  2805. do_random ${action#--} $COMPONENT_LIST
  2806. ;;
  2807. --enable-random=*|--disable-random=*)
  2808. action=${opt%%-random=*}
  2809. do_random ${action#--} $optval
  2810. ;;
  2811. --enable-*=*|--disable-*=*)
  2812. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  2813. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  2814. eval list=\$$(toupper $thing)_LIST
  2815. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  2816. list=$(filter "$name" $list)
  2817. [ "$list" = "" ] && warn "Option $opt did not match anything"
  2818. $action $list
  2819. ;;
  2820. --enable-?*|--disable-?*)
  2821. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  2822. if is_in $option $COMPONENT_LIST; then
  2823. test $action = disable && action=unset
  2824. eval $action \$$(toupper ${option%s})_LIST
  2825. elif is_in $option $CMDLINE_SELECT; then
  2826. $action $option
  2827. else
  2828. die_unknown $opt
  2829. fi
  2830. ;;
  2831. --list-*)
  2832. NAME="${opt#--list-}"
  2833. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  2834. NAME=${NAME%s}
  2835. eval show_list $NAME \$$(toupper $NAME)_LIST
  2836. ;;
  2837. --help|-h) show_help
  2838. ;;
  2839. --fatal-warnings) enable fatal_warnings
  2840. ;;
  2841. *)
  2842. optname="${opt%%=*}"
  2843. optname="${optname#--}"
  2844. optname=$(echo "$optname" | sed 's/-/_/g')
  2845. if is_in $optname $CMDLINE_SET; then
  2846. eval $optname='$optval'
  2847. elif is_in $optname $CMDLINE_APPEND; then
  2848. append $optname "$optval"
  2849. else
  2850. die_unknown $opt
  2851. fi
  2852. ;;
  2853. esac
  2854. done
  2855. for e in $env; do
  2856. eval "export $e"
  2857. done
  2858. disabled logging && logfile=/dev/null
  2859. echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
  2860. set >> $logfile
  2861. test -n "$valgrind" && toolchain="valgrind-memcheck"
  2862. case "$toolchain" in
  2863. clang-asan)
  2864. cc_default="clang"
  2865. add_cflags -fsanitize=address
  2866. add_ldflags -fsanitize=address
  2867. ;;
  2868. clang-tsan)
  2869. cc_default="clang"
  2870. add_cflags -fsanitize=thread -pie
  2871. add_ldflags -fsanitize=thread -pie
  2872. ;;
  2873. clang-usan)
  2874. cc_default="clang"
  2875. add_cflags -fsanitize=undefined
  2876. add_ldflags -fsanitize=undefined
  2877. ;;
  2878. gcc-asan)
  2879. cc_default="gcc"
  2880. add_cflags -fsanitize=address
  2881. add_ldflags -fsanitize=address
  2882. ;;
  2883. gcc-tsan)
  2884. cc_default="gcc"
  2885. add_cflags -fsanitize=thread -pie -fPIC
  2886. add_ldflags -fsanitize=thread -pie -fPIC
  2887. ;;
  2888. gcc-usan)
  2889. cc_default="gcc"
  2890. add_cflags -fsanitize=undefined
  2891. add_ldflags -fsanitize=undefined
  2892. ;;
  2893. valgrind-massif)
  2894. target_exec_default=${valgrind:-"valgrind"}
  2895. 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"
  2896. ;;
  2897. valgrind-memcheck)
  2898. target_exec_default=${valgrind:-"valgrind"}
  2899. 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"
  2900. ;;
  2901. msvc)
  2902. # Check whether the current MSVC version needs the C99 converter.
  2903. # From MSVC 2013 (compiler major version 18) onwards, it does actually
  2904. # support enough of C99 to build ffmpeg. Default to the new
  2905. # behaviour if the regexp was unable to match anything, since this
  2906. # successfully parses the version number of existing supported
  2907. # versions that require the converter (MSVC 2010 and 2012).
  2908. cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
  2909. if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
  2910. cc_default="cl"
  2911. else
  2912. cc_default="c99wrap cl"
  2913. fi
  2914. ld_default="link"
  2915. nm_default="dumpbin -symbols"
  2916. ar_default="lib"
  2917. target_os_default="win32"
  2918. # Use a relative path for TMPDIR. This makes sure all the
  2919. # ffconf temp files are written with a relative path, avoiding
  2920. # issues with msys/win32 path conversion for MSVC parameters
  2921. # such as -Fo<file> or -out:<file>.
  2922. TMPDIR=.
  2923. ;;
  2924. icl)
  2925. cc_default="icl"
  2926. ld_default="xilink"
  2927. nm_default="dumpbin -symbols"
  2928. ar_default="xilib"
  2929. target_os_default="win32"
  2930. TMPDIR=.
  2931. ;;
  2932. gcov)
  2933. add_cflags -fprofile-arcs -ftest-coverage
  2934. add_ldflags -fprofile-arcs -ftest-coverage
  2935. ;;
  2936. hardened)
  2937. add_cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
  2938. add_cflags -fno-strict-overflow -fstack-protector-all
  2939. add_ldflags -Wl,-z,relro -Wl,-z,now
  2940. ;;
  2941. ?*)
  2942. die "Unknown toolchain $toolchain"
  2943. ;;
  2944. esac
  2945. test -n "$cross_prefix" && enable cross_compile
  2946. if enabled cross_compile; then
  2947. test -n "$arch" && test -n "$target_os" ||
  2948. die "Must specify target arch and OS when cross-compiling"
  2949. fi
  2950. ar_default="${cross_prefix}${ar_default}"
  2951. cc_default="${cross_prefix}${cc_default}"
  2952. cxx_default="${cross_prefix}${cxx_default}"
  2953. nm_default="${cross_prefix}${nm_default}"
  2954. pkg_config_default="${cross_prefix}${pkg_config_default}"
  2955. if ${cross_prefix}${ranlib_default} 2>&1 | grep -q "\-D "; then
  2956. ranlib_default="${cross_prefix}${ranlib_default} -D"
  2957. else
  2958. ranlib_default="${cross_prefix}${ranlib_default}"
  2959. fi
  2960. strip_default="${cross_prefix}${strip_default}"
  2961. windres_default="${cross_prefix}${windres_default}"
  2962. sysinclude_default="${sysroot}/usr/include"
  2963. set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \
  2964. target_exec target_os yasmexe
  2965. enabled cross_compile || host_cc_default=$cc
  2966. set_default host_cc
  2967. pkg_config_fail_message=""
  2968. if ! $pkg_config --version >/dev/null 2>&1; then
  2969. warn "$pkg_config not found, library detection may fail."
  2970. pkg_config=false
  2971. elif is_in -static $cc $LDFLAGS && ! is_in --static $pkg_config $pkg_config_flags; then
  2972. pkg_config_fail_message="
  2973. Note: When building a static binary, add --pkg-config-flags=\"--static\"."
  2974. fi
  2975. if test $doxygen != $doxygen_default && \
  2976. ! $doxygen --version >/dev/null 2>&1; then
  2977. warn "Specified doxygen \"$doxygen\" not found, API documentation will fail to build."
  2978. fi
  2979. exesuf() {
  2980. case $1 in
  2981. mingw32*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  2982. esac
  2983. }
  2984. EXESUF=$(exesuf $target_os)
  2985. HOSTEXESUF=$(exesuf $host_os)
  2986. # set temporary file name
  2987. : ${TMPDIR:=$TEMPDIR}
  2988. : ${TMPDIR:=$TMP}
  2989. : ${TMPDIR:=/tmp}
  2990. if [ -n "$tempprefix" ] ; then
  2991. mktemp(){
  2992. echo $tempprefix.${HOSTNAME}.${UID}
  2993. }
  2994. elif ! check_cmd mktemp -u XXXXXX; then
  2995. # simple replacement for missing mktemp
  2996. # NOT SAFE FOR GENERAL USE
  2997. mktemp(){
  2998. echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  2999. }
  3000. fi
  3001. tmpfile(){
  3002. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  3003. (set -C; exec > $tmp) 2>/dev/null ||
  3004. die "Unable to create temporary file in $TMPDIR."
  3005. append TMPFILES $tmp
  3006. eval $1=$tmp
  3007. }
  3008. trap 'rm -f -- $TMPFILES' EXIT
  3009. tmpfile TMPASM .asm
  3010. tmpfile TMPC .c
  3011. tmpfile TMPCPP .cpp
  3012. tmpfile TMPE $EXESUF
  3013. tmpfile TMPH .h
  3014. tmpfile TMPM .m
  3015. tmpfile TMPO .o
  3016. tmpfile TMPS .S
  3017. tmpfile TMPSH .sh
  3018. tmpfile TMPV .ver
  3019. unset -f mktemp
  3020. chmod +x $TMPE
  3021. # make sure we can execute files in $TMPDIR
  3022. cat > $TMPSH 2>> $logfile <<EOF
  3023. #! /bin/sh
  3024. EOF
  3025. chmod +x $TMPSH >> $logfile 2>&1
  3026. if ! $TMPSH >> $logfile 2>&1; then
  3027. cat <<EOF
  3028. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  3029. variable to another directory and make sure that it is not mounted noexec.
  3030. EOF
  3031. die "Sanity test failed."
  3032. fi
  3033. armasm_flags(){
  3034. for flag; do
  3035. case $flag in
  3036. # Filter out MSVC cl.exe options from cflags that shouldn't
  3037. # be passed to gas-preprocessor
  3038. -M[TD]*) ;;
  3039. *) echo $flag ;;
  3040. esac
  3041. done
  3042. }
  3043. ccc_flags(){
  3044. for flag; do
  3045. case $flag in
  3046. -std=c99) echo -c99 ;;
  3047. -mcpu=*) echo -arch ${flag#*=} ;;
  3048. -mieee) echo -ieee ;;
  3049. -O*|-fast) echo $flag ;;
  3050. -fno-math-errno) echo -assume nomath_errno ;;
  3051. -g) echo -g3 ;;
  3052. -Wall) echo -msg_enable level2 ;;
  3053. -Wno-pointer-sign) echo -msg_disable ptrmismatch1 ;;
  3054. -Wl,*) echo $flag ;;
  3055. -f*|-W*) ;;
  3056. *) echo $flag ;;
  3057. esac
  3058. done
  3059. }
  3060. cparser_flags(){
  3061. for flag; do
  3062. case $flag in
  3063. -Wno-switch) echo -Wno-switch-enum ;;
  3064. -Wno-format-zero-length) ;;
  3065. -Wdisabled-optimization) ;;
  3066. -Wno-pointer-sign) echo -Wno-other ;;
  3067. *) echo $flag ;;
  3068. esac
  3069. done
  3070. }
  3071. msvc_common_flags(){
  3072. for flag; do
  3073. case $flag in
  3074. # In addition to specifying certain flags under the compiler
  3075. # specific filters, they must be specified here as well or else the
  3076. # generic catch all at the bottom will print the original flag.
  3077. -Wall) ;;
  3078. -std=c99) ;;
  3079. # Common flags
  3080. -fomit-frame-pointer) ;;
  3081. -g) echo -Z7 ;;
  3082. -fno-math-errno) ;;
  3083. -fno-common) ;;
  3084. -fno-signed-zeros) ;;
  3085. -fPIC) ;;
  3086. -mthumb) ;;
  3087. -march=*) ;;
  3088. -lz) echo zlib.lib ;;
  3089. -lavifil32) echo vfw32.lib ;;
  3090. -lavicap32) echo vfw32.lib user32.lib ;;
  3091. -l*) echo ${flag#-l}.lib ;;
  3092. -L*) echo -libpath:${flag#-L} ;;
  3093. *) echo $flag ;;
  3094. esac
  3095. done
  3096. }
  3097. msvc_flags(){
  3098. msvc_common_flags "$@"
  3099. for flag; do
  3100. case $flag in
  3101. -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
  3102. -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
  3103. -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
  3104. -wd4307 \
  3105. -wd4273 -wd4554 -wd4701 ;;
  3106. esac
  3107. done
  3108. }
  3109. icl_flags(){
  3110. msvc_common_flags "$@"
  3111. for flag; do
  3112. case $flag in
  3113. # Despite what Intel's documentation says -Wall, which is supported
  3114. # on Windows, does enable remarks so disable them here.
  3115. -Wall) echo $flag -Qdiag-disable:remark ;;
  3116. -std=c99) echo -Qstd=c99 ;;
  3117. -flto) echo -ipo ;;
  3118. esac
  3119. done
  3120. }
  3121. icc_flags(){
  3122. for flag; do
  3123. case $flag in
  3124. -flto) echo -ipo ;;
  3125. *) echo $flag ;;
  3126. esac
  3127. done
  3128. }
  3129. pgi_flags(){
  3130. for flag; do
  3131. case $flag in
  3132. -flto) echo -Mipa=fast,libopt,libinline,vestigial ;;
  3133. -fomit-frame-pointer) echo -Mnoframe ;;
  3134. -g) echo -gopt ;;
  3135. *) echo $flag ;;
  3136. esac
  3137. done
  3138. }
  3139. suncc_flags(){
  3140. for flag; do
  3141. case $flag in
  3142. -march=*|-mcpu=*)
  3143. case "${flag#*=}" in
  3144. native) echo -xtarget=native ;;
  3145. v9|niagara) echo -xarch=sparc ;;
  3146. ultrasparc) echo -xarch=sparcvis ;;
  3147. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  3148. i586|pentium) echo -xchip=pentium ;;
  3149. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  3150. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  3151. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  3152. pentium4*) echo -xtarget=pentium4 ;;
  3153. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  3154. *-sse3) echo -xarch=sse3 ;;
  3155. core2) echo -xarch=ssse3 -xchip=core2 ;;
  3156. bonnell) echo -xarch=ssse3 ;;
  3157. corei7|nehalem) echo -xtarget=nehalem ;;
  3158. westmere) echo -xtarget=westmere ;;
  3159. silvermont) echo -xarch=sse4_2 ;;
  3160. corei7-avx|sandybridge) echo -xtarget=sandybridge ;;
  3161. core-avx*|ivybridge|haswell|broadwell)
  3162. echo -xarch=avx ;;
  3163. amdfam10|barcelona) echo -xtarget=barcelona ;;
  3164. btver1) echo -xarch=amdsse4a ;;
  3165. btver2|bdver*) echo -xarch=avx ;;
  3166. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  3167. k8|opteron|athlon64|athlon-fx)
  3168. echo -xarch=sse2a ;;
  3169. athlon*) echo -xarch=pentium_proa ;;
  3170. esac
  3171. ;;
  3172. -std=c99) echo -xc99 ;;
  3173. -fomit-frame-pointer) echo -xregs=frameptr ;;
  3174. -fPIC) echo -KPIC -xcode=pic32 ;;
  3175. -W*,*) echo $flag ;;
  3176. -f*-*|-W*|-mimpure-text) ;;
  3177. -shared) echo -G ;;
  3178. *) echo $flag ;;
  3179. esac
  3180. done
  3181. }
  3182. tms470_flags(){
  3183. for flag; do
  3184. case $flag in
  3185. -march=*|-mcpu=*)
  3186. case "${flag#*=}" in
  3187. armv7-a|cortex-a*) echo -mv=7a8 ;;
  3188. armv7-r|cortex-r*) echo -mv=7r4 ;;
  3189. armv7-m|cortex-m*) echo -mv=7m3 ;;
  3190. armv6*|arm11*) echo -mv=6 ;;
  3191. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  3192. echo -mv=5e ;;
  3193. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  3194. esac
  3195. ;;
  3196. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  3197. -mfpu=vfp) echo --float_support=vfpv2 ;;
  3198. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  3199. -mfpu=vfpv3-d16) echo --float_support=vfpv3d16 ;;
  3200. -msoft-float) echo --float_support=vfplib ;;
  3201. -O[0-3]|-mf=*) echo $flag ;;
  3202. -g) echo -g -mn ;;
  3203. -pds=*) echo $flag ;;
  3204. -D*|-I*) echo $flag ;;
  3205. --gcc|--abi=*) echo $flag ;;
  3206. -me) echo $flag ;;
  3207. esac
  3208. done
  3209. }
  3210. probe_cc(){
  3211. pfx=$1
  3212. _cc=$2
  3213. unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
  3214. unset _ld_o _ldflags _ld_lib _ld_path
  3215. unset _depflags _DEPCMD _DEPFLAGS
  3216. _flags_filter=echo
  3217. if $_cc --version 2>&1 | grep -q '^GNU assembler'; then
  3218. true # no-op to avoid reading stdin in following checks
  3219. elif $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  3220. _type=llvm_gcc
  3221. gcc_extra_ver=$(expr "$($_cc --version | head -n1)" : '.*\((.*)\)')
  3222. _ident="llvm-gcc $($_cc -dumpversion) $gcc_extra_ver"
  3223. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  3224. _cflags_speed='-O3'
  3225. _cflags_size='-Os'
  3226. elif $_cc -v 2>&1 | grep -qi ^gcc; then
  3227. _type=gcc
  3228. gcc_version=$($_cc --version | head -n1)
  3229. gcc_basever=$($_cc -dumpversion)
  3230. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  3231. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  3232. _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  3233. if ! $_cc -dumpversion | grep -q '^2\.'; then
  3234. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  3235. fi
  3236. _cflags_speed='-O3'
  3237. _cflags_size='-Os'
  3238. elif $_cc --version 2>/dev/null | grep -q ^icc; then
  3239. _type=icc
  3240. _ident=$($_cc --version | head -n1)
  3241. _depflags='-MMD'
  3242. _cflags_speed='-O3'
  3243. _cflags_size='-Os'
  3244. _cflags_noopt='-O1'
  3245. _flags_filter=icc_flags
  3246. elif $_cc -v 2>&1 | grep -q xlc; then
  3247. _type=xlc
  3248. _ident=$($_cc -qversion 2>/dev/null | head -n1)
  3249. _cflags_speed='-O5'
  3250. _cflags_size='-O5 -qcompact'
  3251. elif $_cc -V 2>/dev/null | grep -q Compaq; then
  3252. _type=ccc
  3253. _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
  3254. _DEPFLAGS='-M'
  3255. _cflags_speed='-fast'
  3256. _cflags_size='-O1'
  3257. _flags_filter=ccc_flags
  3258. elif $_cc --vsn 2>/dev/null | grep -Eq "ARM (C/C\+\+ )?Compiler"; then
  3259. test -d "$sysroot" || die "No valid sysroot specified."
  3260. _type=armcc
  3261. _ident=$($_cc --vsn | grep -i build | head -n1 | sed 's/.*: //')
  3262. armcc_conf="$PWD/armcc.conf"
  3263. $_cc --arm_linux_configure \
  3264. --arm_linux_config_file="$armcc_conf" \
  3265. --configure_sysroot="$sysroot" \
  3266. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  3267. die "Error creating armcc configuration file."
  3268. $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  3269. _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
  3270. as_default="${cross_prefix}gcc"
  3271. _depflags='-MMD'
  3272. _cflags_speed='-O3'
  3273. _cflags_size='-Os'
  3274. elif $_cc -version 2>/dev/null | grep -Eq 'TMS470|TI ARM'; then
  3275. _type=tms470
  3276. _ident=$($_cc -version | head -n1 | tr -s ' ')
  3277. _flags='--gcc --abi=eabi -me'
  3278. _cc_e='-ppl -fe=$@'
  3279. _cc_o='-fe=$@'
  3280. _depflags='-ppa -ppd=$(@:.o=.d)'
  3281. _cflags_speed='-O3 -mf=5'
  3282. _cflags_size='-O3 -mf=2'
  3283. _flags_filter=tms470_flags
  3284. elif $_cc -v 2>&1 | grep -q clang; then
  3285. _type=clang
  3286. _ident=$($_cc --version | head -n1)
  3287. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  3288. _cflags_speed='-O3'
  3289. _cflags_size='-Os'
  3290. elif $_cc -V 2>&1 | grep -q Sun; then
  3291. _type=suncc
  3292. _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  3293. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  3294. _DEPFLAGS='-xM1 -xc99'
  3295. _ldflags='-std=c99'
  3296. _cflags_speed='-O5'
  3297. _cflags_size='-O5 -xspace'
  3298. _flags_filter=suncc_flags
  3299. elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  3300. _type=pathscale
  3301. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  3302. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  3303. _cflags_speed='-O2'
  3304. _cflags_size='-Os'
  3305. _flags_filter='filter_out -Wdisabled-optimization'
  3306. elif $_cc -v 2>&1 | grep -q Open64; then
  3307. _type=open64
  3308. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  3309. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  3310. _cflags_speed='-O2'
  3311. _cflags_size='-Os'
  3312. _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  3313. elif $_cc -V 2>&1 | grep -q Portland; then
  3314. _type=pgi
  3315. _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
  3316. opt_common='-alias=ansi -Mdse -Mlre -Mpre'
  3317. _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
  3318. _cflags_size="-O2 -Munroll=c:1 $opt_common"
  3319. _cflags_noopt="-O"
  3320. _flags_filter=pgi_flags
  3321. elif $_cc 2>&1 | grep -q 'Microsoft.*ARM.*Assembler'; then
  3322. _type=armasm
  3323. _ident=$($_cc | head -n1)
  3324. # 4509: "This form of conditional instruction is deprecated"
  3325. _flags="-nologo -ignore 4509"
  3326. _flags_filter=armasm_flags
  3327. elif $_cc 2>&1 | grep -q Intel; then
  3328. _type=icl
  3329. _ident=$($_cc 2>&1 | head -n1)
  3330. _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
  3331. # Not only is O3 broken on 13.x+ but it is slower on all previous
  3332. # versions (tested) as well.
  3333. _cflags_speed="-O2"
  3334. _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
  3335. if $_cc 2>&1 | grep -q Linker; then
  3336. _ld_o='-out:$@'
  3337. else
  3338. _ld_o='-Fe$@'
  3339. fi
  3340. _cc_o='-Fo$@'
  3341. _cc_e='-P'
  3342. _flags_filter=icl_flags
  3343. _ld_lib='lib%.a'
  3344. _ld_path='-libpath:'
  3345. # -Qdiag-error to make icl error when seeing certain unknown arguments
  3346. _flags='-nologo -Qdiag-error:4044,10157'
  3347. # -Qvec- -Qsimd- to prevent miscompilation, -GS, fp:precise for consistency
  3348. # with MSVC which enables it by default.
  3349. _cflags='-D_USE_MATH_DEFINES -FIstdlib.h -Dstrtoll=_strtoi64 -Qms0 -Qvec- -Qsimd- -GS -fp:precise'
  3350. disable stripping
  3351. elif $_cc 2>&1 | grep -q Microsoft; then
  3352. _type=msvc
  3353. _ident=$($_cc 2>&1 | head -n1)
  3354. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
  3355. _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
  3356. _cflags_speed="-O2"
  3357. _cflags_size="-O1"
  3358. if $_cc 2>&1 | grep -q Linker; then
  3359. _ld_o='-out:$@'
  3360. else
  3361. _ld_o='-Fe$@'
  3362. fi
  3363. _cc_o='-Fo$@'
  3364. _cc_e='-P -Fi$@'
  3365. _flags_filter=msvc_flags
  3366. _ld_lib='lib%.a'
  3367. _ld_path='-libpath:'
  3368. _flags='-nologo'
  3369. _cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
  3370. disable stripping
  3371. elif $_cc --version 2>/dev/null | grep -q ^cparser; then
  3372. _type=cparser
  3373. _ident=$($_cc --version | head -n1)
  3374. _depflags='-MMD'
  3375. _cflags_speed='-O4'
  3376. _cflags_size='-O2'
  3377. _flags_filter=cparser_flags
  3378. fi
  3379. eval ${pfx}_type=\$_type
  3380. eval ${pfx}_ident=\$_ident
  3381. }
  3382. set_ccvars(){
  3383. eval ${1}_C=\${_cc_c-\${${1}_C}}
  3384. eval ${1}_E=\${_cc_e-\${${1}_E}}
  3385. eval ${1}_O=\${_cc_o-\${${1}_O}}
  3386. if [ -n "$_depflags" ]; then
  3387. eval ${1}_DEPFLAGS=\$_depflags
  3388. else
  3389. eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
  3390. eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
  3391. eval DEP${1}FLAGS=\$_flags
  3392. fi
  3393. }
  3394. probe_cc cc "$cc"
  3395. cflags_filter=$_flags_filter
  3396. cflags_speed=$_cflags_speed
  3397. cflags_size=$_cflags_size
  3398. cflags_noopt=$_cflags_noopt
  3399. add_cflags $_flags $_cflags
  3400. cc_ldflags=$_ldflags
  3401. set_ccvars CC
  3402. probe_cc hostcc "$host_cc"
  3403. host_cflags_filter=$_flags_filter
  3404. add_host_cflags $_flags $_cflags
  3405. set_ccvars HOSTCC
  3406. test -n "$cc_type" && enable $cc_type ||
  3407. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  3408. : ${as_default:=$cc}
  3409. : ${dep_cc_default:=$cc}
  3410. : ${ld_default:=$cc}
  3411. : ${host_ld_default:=$host_cc}
  3412. set_default ar as dep_cc ld host_ld windres
  3413. probe_cc as "$as"
  3414. asflags_filter=$_flags_filter
  3415. add_asflags $_flags $_cflags
  3416. set_ccvars AS
  3417. probe_cc ld "$ld"
  3418. ldflags_filter=$_flags_filter
  3419. add_ldflags $_flags $_ldflags
  3420. test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
  3421. LD_O=${_ld_o-$LD_O}
  3422. LD_LIB=${_ld_lib-$LD_LIB}
  3423. LD_PATH=${_ld_path-$LD_PATH}
  3424. probe_cc hostld "$host_ld"
  3425. host_ldflags_filter=$_flags_filter
  3426. add_host_ldflags $_flags $_ldflags
  3427. HOSTLD_O=${_ld_o-$HOSTLD_O}
  3428. if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
  3429. probe_cc depcc "$dep_cc"
  3430. CCDEP=${_DEPCMD:-$DEPCMD}
  3431. CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
  3432. DEPCCFLAGS=$_flags
  3433. fi
  3434. if $ar 2>&1 | grep -q Microsoft; then
  3435. arflags="-nologo"
  3436. ar_o='-out:$@'
  3437. elif $ar 2>&1 | grep -q 'Texas Instruments'; then
  3438. arflags="rq"
  3439. ar_o='$@'
  3440. elif $ar 2>&1 | grep -q 'Usage: ar.*-X.*any'; then
  3441. arflags='-Xany -r -c'
  3442. ar_o='$@'
  3443. elif $ar 2>&1 | grep -q "\[D\] "; then
  3444. arflags="rcD"
  3445. ar_o='$@'
  3446. else
  3447. arflags="rc"
  3448. ar_o='$@'
  3449. fi
  3450. add_cflags $extra_cflags
  3451. add_cxxflags $extra_cxxflags
  3452. add_asflags $extra_cflags
  3453. if test -n "$sysroot"; then
  3454. case "$cc_type" in
  3455. gcc|llvm_gcc|clang)
  3456. add_cppflags --sysroot="$sysroot"
  3457. add_ldflags --sysroot="$sysroot"
  3458. # On Darwin --sysroot may be ignored, -isysroot always affects headers and linking
  3459. add_cppflags -isysroot "$sysroot"
  3460. add_ldflags -isysroot "$sysroot"
  3461. ;;
  3462. tms470)
  3463. add_cppflags -I"$sysinclude"
  3464. add_ldflags --sysroot="$sysroot"
  3465. ;;
  3466. esac
  3467. fi
  3468. if test "$cpu" = host; then
  3469. enabled cross_compile &&
  3470. die "--cpu=host makes no sense when cross-compiling."
  3471. case "$cc_type" in
  3472. gcc|llvm_gcc)
  3473. check_native(){
  3474. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  3475. sed -n "/cc1.*$1=/{
  3476. s/.*$1=\\([^ ]*\\).*/\\1/
  3477. p
  3478. q
  3479. }" $TMPE
  3480. }
  3481. cpu=$(check_native -march || check_native -mcpu)
  3482. ;;
  3483. esac
  3484. test "${cpu:-host}" = host &&
  3485. die "--cpu=host not supported with compiler $cc"
  3486. fi
  3487. # Deal with common $arch aliases
  3488. case "$arch" in
  3489. aarch64|arm64)
  3490. arch="aarch64"
  3491. ;;
  3492. arm*|iPad*|iPhone*)
  3493. arch="arm"
  3494. ;;
  3495. mips*|IP*)
  3496. arch="mips"
  3497. ;;
  3498. parisc*|hppa*)
  3499. arch="parisc"
  3500. ;;
  3501. "Power Macintosh"|ppc*|powerpc*)
  3502. arch="ppc"
  3503. ;;
  3504. s390|s390x)
  3505. arch="s390"
  3506. ;;
  3507. sh4|sh)
  3508. arch="sh4"
  3509. ;;
  3510. sun4u|sparc*)
  3511. arch="sparc"
  3512. ;;
  3513. tilegx|tile-gx)
  3514. arch="tilegx"
  3515. ;;
  3516. i[3-6]86*|i86pc|BePC|x86pc|x86_64|x86_32|amd64)
  3517. arch="x86"
  3518. ;;
  3519. esac
  3520. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  3521. enable $arch
  3522. # Add processor-specific flags
  3523. if enabled aarch64; then
  3524. case $cpu in
  3525. armv*)
  3526. cpuflags="-march=$cpu"
  3527. ;;
  3528. *)
  3529. cpuflags="-mcpu=$cpu"
  3530. ;;
  3531. esac
  3532. elif enabled alpha; then
  3533. cpuflags="-mcpu=$cpu"
  3534. elif enabled arm; then
  3535. check_arm_arch() {
  3536. check_cpp_condition stddef.h \
  3537. "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
  3538. $cpuflags
  3539. }
  3540. probe_arm_arch() {
  3541. if check_arm_arch 4; then echo armv4;
  3542. elif check_arm_arch 4T; then echo armv4t;
  3543. elif check_arm_arch 5; then echo armv5;
  3544. elif check_arm_arch 5E; then echo armv5e;
  3545. elif check_arm_arch 5T; then echo armv5t;
  3546. elif check_arm_arch 5TE; then echo armv5te;
  3547. elif check_arm_arch 5TEJ; then echo armv5te;
  3548. elif check_arm_arch 6; then echo armv6;
  3549. elif check_arm_arch 6J; then echo armv6j;
  3550. elif check_arm_arch 6K; then echo armv6k;
  3551. elif check_arm_arch 6Z; then echo armv6z;
  3552. elif check_arm_arch 6ZK; then echo armv6zk;
  3553. elif check_arm_arch 6T2; then echo armv6t2;
  3554. elif check_arm_arch 7; then echo armv7;
  3555. elif check_arm_arch 7A 7_A; then echo armv7-a;
  3556. elif check_arm_arch 7S; then echo armv7-a;
  3557. elif check_arm_arch 7R 7_R; then echo armv7-r;
  3558. elif check_arm_arch 7M 7_M; then echo armv7-m;
  3559. elif check_arm_arch 7EM 7E_M; then echo armv7-m;
  3560. elif check_arm_arch 8A 8_A; then echo armv8-a;
  3561. fi
  3562. }
  3563. [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
  3564. case $cpu in
  3565. armv*)
  3566. cpuflags="-march=$cpu"
  3567. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  3568. ;;
  3569. *)
  3570. cpuflags="-mcpu=$cpu"
  3571. case $cpu in
  3572. cortex-a*) subarch=armv7a ;;
  3573. cortex-r*) subarch=armv7r ;;
  3574. cortex-m*) enable thumb; subarch=armv7m ;;
  3575. arm11*) subarch=armv6 ;;
  3576. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  3577. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  3578. *) subarch=$(probe_arm_arch) ;;
  3579. esac
  3580. ;;
  3581. esac
  3582. case "$subarch" in
  3583. armv5t*) enable fast_clz ;;
  3584. armv[6-8]*)
  3585. enable fast_clz
  3586. disabled fast_unaligned || enable fast_unaligned
  3587. ;;
  3588. esac
  3589. elif enabled avr32; then
  3590. case $cpu in
  3591. ap7[02]0[0-2])
  3592. subarch="avr32_ap"
  3593. cpuflags="-mpart=$cpu"
  3594. ;;
  3595. ap)
  3596. subarch="avr32_ap"
  3597. cpuflags="-march=$cpu"
  3598. ;;
  3599. uc3[ab]*)
  3600. subarch="avr32_uc"
  3601. cpuflags="-mcpu=$cpu"
  3602. ;;
  3603. uc)
  3604. subarch="avr32_uc"
  3605. cpuflags="-march=$cpu"
  3606. ;;
  3607. esac
  3608. elif enabled bfin; then
  3609. cpuflags="-mcpu=$cpu"
  3610. elif enabled mips; then
  3611. cpuflags="-march=$cpu"
  3612. case $cpu in
  3613. 24kc)
  3614. disable mips32r5
  3615. disable mips64r6
  3616. disable mipsfpu
  3617. disable mipsdspr1
  3618. disable mipsdspr2
  3619. disable msa
  3620. ;;
  3621. 24kf*)
  3622. disable mips32r5
  3623. disable mips64r6
  3624. disable mipsdspr1
  3625. disable mipsdspr2
  3626. disable msa
  3627. ;;
  3628. 24kec|34kc|1004kc)
  3629. disable mips32r5
  3630. disable mips64r6
  3631. disable mipsfpu
  3632. disable mipsdspr2
  3633. disable msa
  3634. ;;
  3635. 24kef*|34kf*|1004kf*)
  3636. disable mips32r5
  3637. disable mips64r6
  3638. disable mipsdspr2
  3639. disable msa
  3640. ;;
  3641. 74kc)
  3642. disable mips32r5
  3643. disable mips64r6
  3644. disable mipsfpu
  3645. disable msa
  3646. ;;
  3647. 74kf)
  3648. disable mips32r5
  3649. disable mips64r6
  3650. disable msa
  3651. ;;
  3652. p5600)
  3653. disable mips64r6
  3654. disable mipsdspr1
  3655. disable mipsdspr2
  3656. check_cflags "-mtune=p5600"
  3657. ;;
  3658. i6400)
  3659. disable mips32r5
  3660. disable mipsdspr1
  3661. disable mipsdspr2
  3662. disable mipsfpu
  3663. check_cflags "-mtune=i6400 -mabi=64"
  3664. check_ldflags "-mabi=64"
  3665. ;;
  3666. loongson*)
  3667. disable mipsfpu
  3668. disable mips32r2
  3669. disable mips32r5
  3670. disable mips64r6
  3671. disable mipsdspr1
  3672. disable mipsdspr2
  3673. disable msa
  3674. enable local_aligned_8 local_aligned_16 local_aligned_32
  3675. enable simd_align_16
  3676. enable fast_64bit
  3677. enable fast_clz
  3678. enable fast_cmov
  3679. enable fast_unaligned
  3680. disable aligned_stack
  3681. case $cpu in
  3682. loongson3*)
  3683. cpuflags="-march=loongson3a -mhard-float"
  3684. ;;
  3685. loongson2e)
  3686. cpuflags="-march=loongson2e -mhard-float"
  3687. ;;
  3688. loongson2f)
  3689. cpuflags="-march=loongson2f -mhard-float"
  3690. ;;
  3691. esac
  3692. ;;
  3693. generic)
  3694. disable mips32r5
  3695. disable mips64r6
  3696. disable msa
  3697. ;;
  3698. esac
  3699. elif enabled ppc; then
  3700. disable ldbrx
  3701. case $(tolower $cpu) in
  3702. 601|ppc601|powerpc601)
  3703. cpuflags="-mcpu=601"
  3704. disable altivec
  3705. ;;
  3706. 603*|ppc603*|powerpc603*)
  3707. cpuflags="-mcpu=603"
  3708. disable altivec
  3709. ;;
  3710. 604*|ppc604*|powerpc604*)
  3711. cpuflags="-mcpu=604"
  3712. disable altivec
  3713. ;;
  3714. g3|75*|ppc75*|powerpc75*)
  3715. cpuflags="-mcpu=750"
  3716. disable altivec
  3717. ;;
  3718. g4|745*|ppc745*|powerpc745*)
  3719. cpuflags="-mcpu=7450"
  3720. disable vsx
  3721. ;;
  3722. 74*|ppc74*|powerpc74*)
  3723. cpuflags="-mcpu=7400"
  3724. disable vsx
  3725. ;;
  3726. g5|970|ppc970|powerpc970)
  3727. cpuflags="-mcpu=970"
  3728. disable vsx
  3729. ;;
  3730. power[3-6]*)
  3731. cpuflags="-mcpu=$cpu"
  3732. disable vsx
  3733. ;;
  3734. power[7-8]*)
  3735. cpuflags="-mcpu=$cpu"
  3736. ;;
  3737. cell)
  3738. cpuflags="-mcpu=cell"
  3739. enable ldbrx
  3740. disable vsx
  3741. ;;
  3742. e500mc)
  3743. cpuflags="-mcpu=e500mc"
  3744. disable altivec
  3745. ;;
  3746. e500v2)
  3747. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  3748. disable altivec
  3749. disable dcbzl
  3750. ;;
  3751. e500)
  3752. cpuflags="-mcpu=8540 -mhard-float"
  3753. disable altivec
  3754. disable dcbzl
  3755. ;;
  3756. esac
  3757. elif enabled sparc; then
  3758. case $cpu in
  3759. cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
  3760. cpuflags="-mcpu=$cpu"
  3761. ;;
  3762. ultrasparc*|niagara[234])
  3763. cpuflags="-mcpu=$cpu"
  3764. ;;
  3765. esac
  3766. elif enabled x86; then
  3767. case $cpu in
  3768. i[345]86|pentium)
  3769. cpuflags="-march=$cpu"
  3770. disable i686
  3771. disable mmx
  3772. ;;
  3773. # targets that do NOT support nopl and conditional mov (cmov)
  3774. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  3775. cpuflags="-march=$cpu"
  3776. disable i686
  3777. ;;
  3778. # targets that do support nopl and conditional mov (cmov)
  3779. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx\
  3780. |core*|atom|bonnell|nehalem|westmere|silvermont|sandybridge|ivybridge|haswell|broadwell|amdfam10|barcelona|b[dt]ver*)
  3781. cpuflags="-march=$cpu"
  3782. enable i686
  3783. enable fast_cmov
  3784. ;;
  3785. # targets that do support conditional mov but on which it's slow
  3786. pentium4|pentium4m|prescott|nocona)
  3787. cpuflags="-march=$cpu"
  3788. enable i686
  3789. disable fast_cmov
  3790. ;;
  3791. esac
  3792. fi
  3793. if [ "$cpu" != generic ]; then
  3794. add_cflags $cpuflags
  3795. add_asflags $cpuflags
  3796. fi
  3797. # compiler sanity check
  3798. check_exec <<EOF
  3799. int main(void){ return 0; }
  3800. EOF
  3801. if test "$?" != 0; then
  3802. echo "$cc is unable to create an executable file."
  3803. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  3804. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  3805. echo "Only do this if you know what cross compiling means."
  3806. fi
  3807. die "C compiler test failed."
  3808. fi
  3809. add_cppflags -D_ISOC99_SOURCE
  3810. add_cxxflags -D__STDC_CONSTANT_MACROS
  3811. check_cflags -std=c99
  3812. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  3813. #include <stdlib.h>
  3814. EOF
  3815. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  3816. #include <stdlib.h>
  3817. EOF
  3818. add_host_cppflags -D_ISOC99_SOURCE
  3819. check_host_cflags -std=c99
  3820. check_host_cflags -Wall
  3821. check_host_cflags -O3
  3822. check_64bit(){
  3823. arch32=$1
  3824. arch64=$2
  3825. expr=$3
  3826. check_code cc "" "int test[2*($expr) - 1]" &&
  3827. subarch=$arch64 || subarch=$arch32
  3828. }
  3829. case "$arch" in
  3830. aarch64|alpha|ia64)
  3831. spic=$shared
  3832. ;;
  3833. mips)
  3834. check_64bit mips mips64 '_MIPS_SIM > 1'
  3835. spic=$shared
  3836. ;;
  3837. parisc)
  3838. check_64bit parisc parisc64 'sizeof(void *) > 4'
  3839. spic=$shared
  3840. ;;
  3841. ppc)
  3842. check_64bit ppc ppc64 'sizeof(void *) > 4'
  3843. spic=$shared
  3844. ;;
  3845. s390)
  3846. check_64bit s390 s390x 'sizeof(void *) > 4'
  3847. spic=$shared
  3848. ;;
  3849. sparc)
  3850. check_64bit sparc sparc64 'sizeof(void *) > 4'
  3851. spic=$shared
  3852. ;;
  3853. x86)
  3854. check_64bit x86_32 x86_64 'sizeof(void *) > 4'
  3855. # Treat x32 as x64 for now. Note it also needs spic=$shared
  3856. test "$subarch" = "x86_32" && check_cpp_condition stddef.h 'defined(__x86_64__)' &&
  3857. subarch=x86_64
  3858. if test "$subarch" = "x86_64"; then
  3859. spic=$shared
  3860. fi
  3861. ;;
  3862. ppc)
  3863. check_cc <<EOF && subarch="ppc64"
  3864. int test[(int)sizeof(char*) - 7];
  3865. EOF
  3866. ;;
  3867. esac
  3868. enable $subarch
  3869. enabled spic && enable_weak pic
  3870. # OS specific
  3871. case $target_os in
  3872. aix)
  3873. SHFLAGS=-shared
  3874. add_cppflags '-I\$(SRC_PATH)/compat/aix'
  3875. enabled shared && add_ldflags -Wl,-brtl
  3876. ;;
  3877. android)
  3878. disable symver
  3879. enable section_data_rel_ro
  3880. SLIB_INSTALL_NAME='$(SLIBNAME)'
  3881. SLIB_INSTALL_LINKS=
  3882. # soname not set on purpose
  3883. SHFLAGS=-shared
  3884. ;;
  3885. haiku)
  3886. prefix_default="/boot/common"
  3887. network_extralibs="-lnetwork"
  3888. host_libs=
  3889. ;;
  3890. sunos)
  3891. SHFLAGS='-shared -Wl,-h,$$(@F)'
  3892. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  3893. network_extralibs="-lsocket -lnsl"
  3894. add_cppflags -D__EXTENSIONS__
  3895. # When using suncc to build, the Solaris linker will mark
  3896. # an executable with each instruction set encountered by
  3897. # the Solaris assembler. As our libraries contain their own
  3898. # guards for processor-specific code, instead suppress
  3899. # generation of the HWCAPS ELF section on Solaris x86 only.
  3900. enabled_all suncc x86 &&
  3901. echo "hwcap_1 = OVERRIDE;" > mapfile &&
  3902. add_ldflags -Wl,-M,mapfile
  3903. nm_default='nm -P -g'
  3904. ;;
  3905. netbsd)
  3906. disable symver
  3907. oss_indev_extralibs="-lossaudio"
  3908. oss_outdev_extralibs="-lossaudio"
  3909. enabled gcc || check_ldflags -Wl,-zmuldefs
  3910. ;;
  3911. openbsd|bitrig)
  3912. disable symver
  3913. SHFLAGS='-shared'
  3914. SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
  3915. SLIB_INSTALL_LINKS=
  3916. oss_indev_extralibs="-lossaudio"
  3917. oss_outdev_extralibs="-lossaudio"
  3918. ;;
  3919. dragonfly)
  3920. disable symver
  3921. ;;
  3922. freebsd)
  3923. ;;
  3924. bsd/os)
  3925. add_extralibs -lpoll -lgnugetopt
  3926. strip="strip -d"
  3927. ;;
  3928. darwin)
  3929. enabled ppc && add_asflags -force_cpusubtype_ALL
  3930. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  3931. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  3932. strip="${strip} -x"
  3933. add_ldflags -Wl,-dynamic,-search_paths_first
  3934. SLIBSUF=".dylib"
  3935. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  3936. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  3937. objformat="macho"
  3938. enabled x86_64 && objformat="macho64"
  3939. enabled_any pic shared x86_64 ||
  3940. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  3941. ;;
  3942. mingw32*)
  3943. if test $target_os = "mingw32ce"; then
  3944. disable network
  3945. else
  3946. target_os=mingw32
  3947. fi
  3948. LIBTARGET=i386
  3949. if enabled x86_64; then
  3950. LIBTARGET="i386:x86-64"
  3951. elif enabled arm; then
  3952. LIBTARGET=arm-wince
  3953. fi
  3954. enabled shared && ! enabled small && check_cmd $windres --version && enable gnu_windres
  3955. check_ldflags -Wl,--nxcompat
  3956. check_ldflags -Wl,--dynamicbase
  3957. enabled x86_32 && check_ldflags -Wl,--large-address-aware
  3958. shlibdir_default="$bindir_default"
  3959. SLIBPREF=""
  3960. SLIBSUF=".dll"
  3961. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3962. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3963. dlltool="${cross_prefix}dlltool"
  3964. if check_cmd lib.exe -list; then
  3965. SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  3966. if enabled x86_64; then
  3967. LIBTARGET=x64
  3968. fi
  3969. elif check_cmd $dlltool --version; then
  3970. 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)'
  3971. fi
  3972. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3973. SLIB_INSTALL_LINKS=
  3974. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  3975. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  3976. 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'
  3977. objformat="win32"
  3978. ranlib=:
  3979. enable dos_paths
  3980. ;;
  3981. win32|win64)
  3982. disable symver
  3983. if enabled shared; then
  3984. # Link to the import library instead of the normal static library
  3985. # for shared libs.
  3986. LD_LIB='%.lib'
  3987. # Cannot build both shared and static libs with MSVC or icl.
  3988. disable static
  3989. fi
  3990. enabled x86_32 && check_ldflags -LARGEADDRESSAWARE
  3991. shlibdir_default="$bindir_default"
  3992. SLIBPREF=""
  3993. SLIBSUF=".dll"
  3994. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3995. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3996. SLIB_CREATE_DEF_CMD='$(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
  3997. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3998. SLIB_INSTALL_LINKS=
  3999. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  4000. SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  4001. SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  4002. objformat="win32"
  4003. ranlib=:
  4004. enable dos_paths
  4005. ;;
  4006. cygwin*)
  4007. target_os=cygwin
  4008. shlibdir_default="$bindir_default"
  4009. SLIBPREF="cyg"
  4010. SLIBSUF=".dll"
  4011. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  4012. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  4013. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  4014. SLIB_INSTALL_LINKS=
  4015. SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
  4016. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
  4017. objformat="win32"
  4018. enable dos_paths
  4019. enabled shared && ! enabled small && check_cmd $windres --version && enable gnu_windres
  4020. ;;
  4021. *-dos|freedos|opendos)
  4022. network_extralibs="-lsocket"
  4023. objformat="coff"
  4024. enable dos_paths
  4025. add_cppflags -U__STRICT_ANSI__
  4026. ;;
  4027. linux)
  4028. enable dv1394
  4029. enable section_data_rel_ro
  4030. ;;
  4031. irix*)
  4032. target_os=irix
  4033. ranlib="echo ignoring ranlib"
  4034. ;;
  4035. os/2*)
  4036. strip="lxlite -CS"
  4037. ln_s="cp -f"
  4038. objformat="aout"
  4039. add_cppflags -D_GNU_SOURCE
  4040. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  4041. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  4042. LIBSUF="_s.a"
  4043. SLIBPREF=""
  4044. SLIBSUF=".dll"
  4045. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  4046. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  4047. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  4048. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  4049. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  4050. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  4051. emxexp $(OBJS) >> $(SUBDIR)$(NAME).def'
  4052. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  4053. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  4054. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
  4055. enable dos_paths
  4056. enable_weak os2threads
  4057. ;;
  4058. gnu/kfreebsd)
  4059. add_cppflags -D_BSD_SOURCE
  4060. ;;
  4061. gnu)
  4062. ;;
  4063. qnx)
  4064. add_cppflags -D_QNX_SOURCE
  4065. network_extralibs="-lsocket"
  4066. ;;
  4067. symbian)
  4068. SLIBSUF=".dll"
  4069. enable dos_paths
  4070. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  4071. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  4072. add_ldflags -Wl,--target1-abs,--no-undefined \
  4073. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  4074. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  4075. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  4076. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  4077. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  4078. ;;
  4079. osf1)
  4080. add_cppflags -D_OSF_SOURCE -D_POSIX_PII -D_REENTRANT
  4081. ;;
  4082. minix)
  4083. ;;
  4084. plan9)
  4085. add_cppflags -D_C99_SNPRINTF_EXTENSION \
  4086. -D_REENTRANT_SOURCE \
  4087. -D_RESEARCH_SOURCE \
  4088. -DFD_SETSIZE=96 \
  4089. -DHAVE_SOCK_OPTS
  4090. add_compat strtod.o strtod=avpriv_strtod
  4091. network_extralibs='-lbsd'
  4092. exeobjs=compat/plan9/main.o
  4093. disable ffserver
  4094. cp_f='cp'
  4095. ;;
  4096. none)
  4097. ;;
  4098. *)
  4099. die "Unknown OS '$target_os'."
  4100. ;;
  4101. esac
  4102. # determine libc flavour
  4103. probe_libc(){
  4104. pfx=$1
  4105. pfx_no_=${pfx%_}
  4106. # uclibc defines __GLIBC__, so it needs to be checked before glibc.
  4107. if check_${pfx}cpp_condition features.h "defined __UCLIBC__"; then
  4108. eval ${pfx}libc_type=uclibc
  4109. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  4110. elif check_${pfx}cpp_condition features.h "defined __GLIBC__"; then
  4111. eval ${pfx}libc_type=glibc
  4112. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  4113. # MinGW headers can be installed on Cygwin, so check for newlib first.
  4114. elif check_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
  4115. eval ${pfx}libc_type=newlib
  4116. add_${pfx}cppflags -U__STRICT_ANSI__
  4117. # MinGW64 is backwards compatible with MinGW32, so check for it first.
  4118. elif check_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then
  4119. eval ${pfx}libc_type=mingw64
  4120. if check_${pfx}cpp_condition _mingw.h "__MINGW64_VERSION_MAJOR < 3"; then
  4121. add_compat msvcrt/snprintf.o
  4122. add_cflags "-include $source_path/compat/msvcrt/snprintf.h"
  4123. fi
  4124. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  4125. eval test \$${pfx_no_}cc_type = "gcc" &&
  4126. add_${pfx}cppflags -D__printf__=__gnu_printf__
  4127. elif check_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION" ||
  4128. check_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then
  4129. eval ${pfx}libc_type=mingw32
  4130. check_${pfx}cpp_condition _mingw.h "__MINGW32_MAJOR_VERSION > 3 || \
  4131. (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  4132. die "ERROR: MinGW32 runtime version must be >= 3.15."
  4133. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  4134. eval test \$${pfx_no_}cc_type = "gcc" &&
  4135. add_${pfx}cppflags -D__printf__=__gnu_printf__
  4136. elif check_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then
  4137. eval ${pfx}libc_type=msvcrt
  4138. if check_${pfx}cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION < 14"; then
  4139. if [ "$pfx" = host_ ]; then
  4140. add_host_cppflags -Dsnprintf=_snprintf
  4141. else
  4142. add_compat strtod.o strtod=avpriv_strtod
  4143. add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
  4144. _snprintf=avpriv_snprintf \
  4145. vsnprintf=avpriv_vsnprintf
  4146. fi
  4147. fi
  4148. # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
  4149. # 0x601 by default unless something else is set by the user.
  4150. # This can easily lead to us detecting functions only present
  4151. # in such new versions and producing binaries requiring windows 7.0.
  4152. # Therefore explicitly set the default to XP unless the user has
  4153. # set something else on the command line.
  4154. check_${pfx}cpp_condition stdlib.h "defined(_WIN32_WINNT)" ||
  4155. add_${pfx}cppflags -D_WIN32_WINNT=0x0502
  4156. elif check_${pfx}cpp_condition stddef.h "defined __KLIBC__"; then
  4157. eval ${pfx}libc_type=klibc
  4158. elif check_${pfx}cpp_condition sys/cdefs.h "defined __BIONIC__"; then
  4159. eval ${pfx}libc_type=bionic
  4160. elif check_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then
  4161. eval ${pfx}libc_type=solaris
  4162. add_${pfx}cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
  4163. fi
  4164. check_${pfx}cc <<EOF
  4165. #include <time.h>
  4166. void *v = localtime_r;
  4167. EOF
  4168. 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
  4169. #include <time.h>
  4170. void *v = localtime_r;
  4171. EOF
  4172. }
  4173. probe_libc
  4174. test -n "$libc_type" && enable libc_$libc_type
  4175. probe_libc host_
  4176. test -n "$host_libc_type" && enable host_libc_$host_libc_type
  4177. case $libc_type in
  4178. bionic)
  4179. add_compat strtod.o strtod=avpriv_strtod
  4180. ;;
  4181. esac
  4182. # hacks for compiler/libc/os combinations
  4183. if enabled_all tms470 libc_glibc; then
  4184. CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
  4185. add_cppflags -D__USER_LABEL_PREFIX__=
  4186. add_cppflags -D__builtin_memset=memset
  4187. add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
  4188. add_cflags -pds=48 # incompatible redefinition of macro
  4189. fi
  4190. if enabled_all ccc libc_glibc; then
  4191. add_ldflags -Wl,-z,now # calls to libots crash without this
  4192. fi
  4193. check_compile_assert flt_lim "float.h limits.h" "DBL_MAX == (double)DBL_MAX" ||
  4194. add_cppflags '-I\$(SRC_PATH)/compat/float'
  4195. esc(){
  4196. echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
  4197. }
  4198. echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $FFMPEG_CONFIGURATION)" >config.fate
  4199. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic
  4200. set_default libdir
  4201. : ${shlibdir_default:="$libdir"}
  4202. : ${pkgconfigdir_default:="$libdir/pkgconfig"}
  4203. set_default $PATHS_LIST
  4204. set_default nm
  4205. # we need to build at least one lib type
  4206. if ! enabled_any static shared; then
  4207. cat <<EOF
  4208. At least one library type must be built.
  4209. Specify --enable-static to build the static libraries or --enable-shared to
  4210. build the shared libraries as well. To only build the shared libraries specify
  4211. --disable-static in addition to --enable-shared.
  4212. EOF
  4213. exit 1;
  4214. fi
  4215. die_license_disabled() {
  4216. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  4217. }
  4218. die_license_disabled_gpl() {
  4219. enabled $1 || { enabled $2 && die "$2 is incompatible with the gpl and --enable-$1 is not specified."; }
  4220. }
  4221. die_license_disabled gpl frei0r
  4222. die_license_disabled gpl libcdio
  4223. die_license_disabled gpl libsmbclient
  4224. die_license_disabled gpl libutvideo
  4225. die_license_disabled gpl libvidstab
  4226. die_license_disabled gpl libx264
  4227. die_license_disabled gpl libx265
  4228. die_license_disabled gpl libxavs
  4229. die_license_disabled gpl libxvid
  4230. die_license_disabled gpl libzvbi
  4231. die_license_disabled gpl x11grab
  4232. die_license_disabled nonfree libaacplus
  4233. die_license_disabled nonfree libfaac
  4234. die_license_disabled nonfree nvenc
  4235. enabled gpl && die_license_disabled_gpl nonfree libfdk_aac
  4236. enabled gpl && die_license_disabled_gpl nonfree openssl
  4237. die_license_disabled version3 libopencore_amrnb
  4238. die_license_disabled version3 libopencore_amrwb
  4239. die_license_disabled version3 libsmbclient
  4240. die_license_disabled version3 libvo_aacenc
  4241. die_license_disabled version3 libvo_amrwbenc
  4242. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  4243. disabled optimizations || check_cflags -fomit-frame-pointer
  4244. enable_weak_pic() {
  4245. disabled pic && return
  4246. enable pic
  4247. add_cppflags -DPIC
  4248. case "$target_os" in
  4249. mingw*|cygwin*)
  4250. ;;
  4251. *)
  4252. add_cflags -fPIC
  4253. ;;
  4254. esac
  4255. add_asflags -fPIC
  4256. }
  4257. enabled pic && enable_weak_pic
  4258. check_cc <<EOF || die "Symbol mangling check failed."
  4259. int ff_extern;
  4260. EOF
  4261. sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  4262. extern_prefix=${sym%%ff_extern*}
  4263. check_cc <<EOF && enable_weak inline_asm
  4264. void foo(void) { __asm__ volatile ("" ::); }
  4265. EOF
  4266. _restrict=
  4267. for restrict_keyword in restrict __restrict__ __restrict; do
  4268. check_cc <<EOF && _restrict=$restrict_keyword && break
  4269. void foo(char * $restrict_keyword p);
  4270. EOF
  4271. done
  4272. check_cc <<EOF && enable pragma_deprecated
  4273. void foo(void) { _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") }
  4274. EOF
  4275. check_cc <<EOF && enable attribute_packed
  4276. struct { int x; } __attribute__((packed)) x;
  4277. EOF
  4278. check_cc <<EOF && enable attribute_may_alias
  4279. union { int x; } __attribute__((may_alias)) x;
  4280. EOF
  4281. check_cc <<EOF || die "endian test failed"
  4282. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  4283. EOF
  4284. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  4285. if ! enabled ppc64 || enabled bigendian; then
  4286. disable vsx
  4287. fi
  4288. check_gas() {
  4289. log "check_gas using '$as' as AS"
  4290. # :vararg is used on aarch64, arm and ppc altivec
  4291. check_as <<EOF || return 1
  4292. .macro m n, y:vararg=0
  4293. \n: .int \y
  4294. .endm
  4295. m x
  4296. EOF
  4297. # .altmacro is only used in arm asm
  4298. ! enabled arm || check_as <<EOF || return 1
  4299. .altmacro
  4300. EOF
  4301. enable gnu_as
  4302. return 0
  4303. }
  4304. if enabled_any arm aarch64 || enabled_all ppc altivec && enabled asm; then
  4305. nogas=:
  4306. enabled_any arm aarch64 && nogas=die
  4307. enabled_all ppc altivec && [ $target_os_default != aix ] && nogas=warn
  4308. as_noop=-v
  4309. case $as_type in
  4310. arm*) gaspp_as_type=armasm; as_noop=-h ;;
  4311. gcc) gaspp_as_type=gas ;;
  4312. *) gaspp_as_type=$as_type ;;
  4313. esac
  4314. [ $target_os = "darwin" ] && gaspp_as_type="apple-$gaspp_as_type"
  4315. test "${as#*gas-preprocessor.pl}" != "$as" ||
  4316. check_cmd gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- ${as:=$cc} $as_noop &&
  4317. gas="${gas:=gas-preprocessor.pl} -arch $arch -as-type $gaspp_as_type -- ${as:=$cc}"
  4318. if ! check_gas ; then
  4319. as=${gas:=$as}
  4320. check_gas || \
  4321. $nogas "GNU assembler not found, install/update gas-preprocessor"
  4322. fi
  4323. check_as <<EOF && enable as_func
  4324. .func test
  4325. .endfunc
  4326. EOF
  4327. fi
  4328. check_inline_asm inline_asm_labels '"1:\n"'
  4329. check_inline_asm inline_asm_nonlocal_labels '"Label:\n"'
  4330. if enabled aarch64; then
  4331. enabled armv8 && check_insn armv8 'prfm pldl1strm, [x0]'
  4332. # internal assembler in clang 3.3 does not support this instruction
  4333. enabled neon && check_insn neon 'ext v0.8B, v0.8B, v1.8B, #1'
  4334. enabled vfp && check_insn vfp 'fmadd d0, d0, d1, d2'
  4335. map 'enabled_any ${v}_external ${v}_inline || disable $v' $ARCH_EXT_LIST_ARM
  4336. elif enabled alpha; then
  4337. check_cflags -mieee
  4338. elif enabled arm; then
  4339. check_cpp_condition stddef.h "defined __thumb__" && check_cc <<EOF && enable_weak thumb
  4340. float func(float a, float b){ return a+b; }
  4341. EOF
  4342. enabled thumb && check_cflags -mthumb || check_cflags -marm
  4343. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  4344. enable vfp_args
  4345. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
  4346. case "${cross_prefix:-$cc}" in
  4347. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  4348. *) check_ld "cc" <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  4349. __asm__ (".eabi_attribute 28, 1");
  4350. int main(void) { return 0; }
  4351. EOF
  4352. esac
  4353. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  4354. fi
  4355. enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
  4356. enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
  4357. enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
  4358. enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
  4359. enabled vfp && check_insn vfp 'fadds s0, s0, s0'
  4360. enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
  4361. enabled setend && check_insn setend 'setend be'
  4362. [ $target_os = linux ] || [ $target_os = android ] ||
  4363. map 'enabled_any ${v}_external ${v}_inline || disable $v' \
  4364. $ARCH_EXT_LIST_ARM
  4365. check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
  4366. check_as <<EOF && enable as_dn_directive
  4367. ra .dn d0.i16
  4368. .unreq ra
  4369. EOF
  4370. # llvm's integrated assembler supports .object_arch from llvm 3.5
  4371. [ "$objformat" = elf ] && check_as <<EOF && enable as_object_arch
  4372. .object_arch armv4
  4373. EOF
  4374. [ $target_os != win32 ] && enabled_all armv6t2 shared !pic && enable_weak_pic
  4375. elif enabled mips; then
  4376. enabled loongson2 && check_inline_asm loongson2 '"dmult.g $8, $9, $10"'
  4377. enabled loongson3 && check_inline_asm loongson3 '"gsldxc1 $f0, 0($2, $3)"'
  4378. enabled mmi && check_inline_asm mmi '"punpcklhw $f0, $f0, $f0"'
  4379. # Enable minimum ISA based on selected options
  4380. if enabled mips64 && (enabled mipsdspr1 || enabled mipsdspr2); then
  4381. add_cflags "-mips64r2"
  4382. add_asflags "-mips64r2"
  4383. elif enabled mips64 && enabled mipsfpu && disabled loongson2 && disabled loongson3; then
  4384. add_cflags "-mips64"
  4385. add_asflags "-mips64"
  4386. elif enabled mipsdspr1 || enabled mipsdspr2; then
  4387. add_cflags "-mips32r2 -mfp32"
  4388. add_asflags "-mips32r2 -mfp32"
  4389. elif enabled mips32r5 || enabled mips64r6; then
  4390. check_cflags "-mfp64"
  4391. check_ldflags "-mfp64"
  4392. fi
  4393. enabled mips32r5 && check_cflags "-mips32r5 -msched-weight -mload-store-pairs -funroll-loops" &&
  4394. check_ldflags "-mips32r5" &&
  4395. check_inline_asm mips32r5 '"ulw $t0, ($t1)"'
  4396. enabled mips64r6 && check_cflags "-mips64r6 -msched-weight -mload-store-pairs -funroll-loops" &&
  4397. check_ldflags "-mips64r6" &&
  4398. check_inline_asm mips64r6 '"aui $t0, $t1, 1"'
  4399. enabled mipsdspr1 && add_cflags "-mdsp" && add_asflags "-mdsp" &&
  4400. check_inline_asm mipsdspr1 '"addu.qb $t0, $t1, $t2"'
  4401. enabled mipsdspr2 && add_cflags "-mdspr2" && add_asflags "-mdspr2" &&
  4402. check_inline_asm mipsdspr2 '"absq_s.qb $t0, $t1"'
  4403. enabled mipsfpu && add_cflags "-mhard-float" && add_asflags "-mhard-float" &&
  4404. check_inline_asm mipsfpu '"madd.d $f0, $f2, $f4, $f6"'
  4405. enabled msa && check_cflags "-mmsa" && check_ldflags "-mmsa" &&
  4406. check_inline_asm msa '"addvi.b $w0, $w1, 1"'
  4407. enabled mips32r5 && add_asflags "-mips32r5 -mfp64"
  4408. enabled mips64r6 && add_asflags "-mips64r6 -mfp64"
  4409. enabled msa && add_asflags "-mmsa"
  4410. elif enabled parisc; then
  4411. if enabled gcc; then
  4412. case $($cc -dumpversion) in
  4413. 4.[3-9].*) check_cflags -fno-optimize-sibling-calls ;;
  4414. esac
  4415. fi
  4416. elif enabled ppc; then
  4417. enable local_aligned_8 local_aligned_16 local_aligned_32
  4418. check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  4419. check_inline_asm ibm_asm '"add 0, 0, 0"'
  4420. check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
  4421. check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  4422. # AltiVec flags: The FSF version of GCC differs from the Apple version
  4423. if enabled altivec; then
  4424. check_cflags -maltivec -mabi=altivec &&
  4425. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  4426. check_cflags -faltivec
  4427. # check if our compiler supports Motorola AltiVec C API
  4428. check_cc <<EOF || disable altivec
  4429. $inc_altivec_h
  4430. int main(void) {
  4431. vector signed int v1 = (vector signed int) { 0 };
  4432. vector signed int v2 = (vector signed int) { 1 };
  4433. v1 = vec_add(v1, v2);
  4434. return 0;
  4435. }
  4436. EOF
  4437. enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
  4438. fi
  4439. if enabled vsx; then
  4440. check_cflags -mvsx &&
  4441. check_builtin vec_vsx_ld "altivec.h" "__builtin_vec_vsx_ld" || disable vsx
  4442. fi
  4443. if enabled power8; then
  4444. check_cpp_condition "altivec.h" "defined(_ARCH_PWR8)" || disable power8
  4445. fi
  4446. elif enabled x86; then
  4447. check_builtin rdtsc intrin.h "__rdtsc()"
  4448. check_builtin mm_empty mmintrin.h "_mm_empty()"
  4449. enable local_aligned_8 local_aligned_16 local_aligned_32
  4450. # check whether EBP is available on x86
  4451. # As 'i' is stored on the stack, this program will crash
  4452. # if the base pointer is used to access it because the
  4453. # base pointer is cleared in the inline assembly code.
  4454. check_exec_crash <<EOF && enable ebp_available
  4455. volatile int i=0;
  4456. __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
  4457. return i;
  4458. EOF
  4459. # check whether EBX is available on x86
  4460. check_inline_asm ebx_available '""::"b"(0)' &&
  4461. check_inline_asm ebx_available '"":::"%ebx"'
  4462. # check whether xmm clobbers are supported
  4463. check_inline_asm xmm_clobbers '"":::"%xmm0"'
  4464. check_inline_asm inline_asm_direct_symbol_refs '"movl '$extern_prefix'test, %eax"' ||
  4465. check_inline_asm inline_asm_direct_symbol_refs '"movl '$extern_prefix'test(%rip), %eax"'
  4466. # check whether binutils is new enough to compile SSSE3/MMXEXT
  4467. enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
  4468. enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
  4469. if ! disabled_any asm mmx yasm; then
  4470. if check_cmd $yasmexe --version; then
  4471. enabled x86_64 && yasm_extra="-m amd64"
  4472. yasm_debug="-g dwarf2"
  4473. elif check_cmd nasm -v; then
  4474. yasmexe=nasm
  4475. yasm_debug="-g -F dwarf"
  4476. if enabled x86_64; then
  4477. case "$objformat" in
  4478. elf) objformat=elf64 ;;
  4479. win32) objformat=win64 ;;
  4480. esac
  4481. fi
  4482. fi
  4483. YASMFLAGS="-f $objformat $yasm_extra"
  4484. enabled pic && append YASMFLAGS "-DPIC"
  4485. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  4486. case "$objformat" in
  4487. elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
  4488. esac
  4489. check_yasm "movbe ecx, [5]" && enable yasm ||
  4490. die "yasm/nasm not found or too old. Use --disable-yasm for a crippled build."
  4491. check_yasm "vextracti128 xmm0, ymm0, 0" || disable avx2_external
  4492. check_yasm "vpmacsdd xmm0, xmm1, xmm2, xmm3" || disable xop_external
  4493. check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
  4494. check_yasm "CPU amdnop" || disable cpunop
  4495. fi
  4496. case "$cpu" in
  4497. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  4498. disable fast_clz
  4499. ;;
  4500. esac
  4501. fi
  4502. check_code cc arm_neon.h "int16x8_t test = vdupq_n_s16(0)" && enable intrinsics_neon
  4503. check_ldflags -Wl,--as-needed
  4504. check_ldflags -Wl,-z,noexecstack
  4505. if check_func dlopen; then
  4506. ldl=
  4507. elif check_func dlopen -ldl; then
  4508. ldl=-ldl
  4509. fi
  4510. frei0r_filter_extralibs='$ldl'
  4511. frei0r_src_filter_extralibs='$ldl'
  4512. ladspa_filter_extralibs='$ldl'
  4513. nvenc_encoder_extralibs='$ldl'
  4514. if ! disabled network; then
  4515. check_func getaddrinfo $network_extralibs
  4516. check_func getservbyport $network_extralibs
  4517. check_func inet_aton $network_extralibs
  4518. check_type netdb.h "struct addrinfo"
  4519. check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
  4520. check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
  4521. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  4522. check_type poll.h "struct pollfd"
  4523. check_type netinet/sctp.h "struct sctp_event_subscribe"
  4524. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  4525. check_type netinet/in.h "struct sockaddr_in6"
  4526. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  4527. check_type "sys/types.h sys/socket.h" socklen_t
  4528. # Prefer arpa/inet.h over winsock2
  4529. if check_header arpa/inet.h ; then
  4530. check_func closesocket
  4531. elif check_header winsock2.h ; then
  4532. check_func_headers winsock2.h closesocket -lws2 &&
  4533. network_extralibs="-lws2" ||
  4534. { check_func_headers winsock2.h closesocket -lws2_32 &&
  4535. network_extralibs="-lws2_32"; } || disable winsock2_h network
  4536. check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
  4537. check_type ws2tcpip.h socklen_t
  4538. check_type ws2tcpip.h "struct addrinfo"
  4539. check_type ws2tcpip.h "struct group_source_req"
  4540. check_type ws2tcpip.h "struct ip_mreq_source"
  4541. check_type ws2tcpip.h "struct ipv6_mreq"
  4542. check_type winsock2.h "struct pollfd"
  4543. check_struct winsock2.h "struct sockaddr" sa_len
  4544. check_type ws2tcpip.h "struct sockaddr_in6"
  4545. check_type ws2tcpip.h "struct sockaddr_storage"
  4546. else
  4547. disable network
  4548. fi
  4549. fi
  4550. check_builtin atomic_cas_ptr atomic.h "void **ptr; void *oldval, *newval; atomic_cas_ptr(ptr, oldval, newval)"
  4551. check_builtin atomic_compare_exchange "" "int *ptr, *oldval; int newval; __atomic_compare_exchange_n(ptr, oldval, newval, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)"
  4552. check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
  4553. check_builtin MemoryBarrier windows.h "MemoryBarrier()"
  4554. check_builtin sarestart signal.h "SA_RESTART"
  4555. check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
  4556. check_builtin gmtime_r time.h "time_t *time; struct tm *tm; gmtime_r(time, tm)"
  4557. check_builtin localtime_r time.h "time_t *time; struct tm *tm; localtime_r(time, tm)"
  4558. check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
  4559. check_func ${malloc_prefix}memalign && enable memalign
  4560. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  4561. check_func access
  4562. check_func_headers time.h clock_gettime || { check_func_headers time.h clock_gettime -lrt && add_extralibs -lrt && LIBRT="-lrt"; }
  4563. check_func fcntl
  4564. check_func fork
  4565. check_func gethrtime
  4566. check_func getopt
  4567. check_func getrusage
  4568. check_func gettimeofday
  4569. check_func isatty
  4570. check_func mach_absolute_time
  4571. check_func mkstemp
  4572. check_func mmap
  4573. check_func mprotect
  4574. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  4575. check_func_headers time.h nanosleep || { check_func_headers time.h nanosleep -lrt && add_extralibs -lrt && LIBRT="-lrt"; }
  4576. check_func sched_getaffinity
  4577. check_func setrlimit
  4578. check_struct "sys/stat.h" "struct stat" st_mtim.tv_nsec -D_BSD_SOURCE
  4579. check_func strerror_r
  4580. check_func sysconf
  4581. check_func sysctl
  4582. check_func usleep
  4583. check_func_headers conio.h kbhit
  4584. check_func_headers io.h setmode
  4585. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  4586. check_func_headers stdlib.h getenv
  4587. check_func_headers windows.h CoTaskMemFree -lole32
  4588. check_func_headers windows.h GetProcessAffinityMask
  4589. check_func_headers windows.h GetProcessTimes
  4590. check_func_headers windows.h GetSystemTimeAsFileTime
  4591. check_func_headers windows.h MapViewOfFile
  4592. check_func_headers windows.h PeekNamedPipe
  4593. check_func_headers windows.h SetConsoleTextAttribute
  4594. check_func_headers windows.h SetConsoleCtrlHandler
  4595. check_func_headers windows.h Sleep
  4596. check_func_headers windows.h VirtualAlloc
  4597. check_struct windows.h "CONDITION_VARIABLE" Ptr
  4598. check_func_headers glob.h glob
  4599. enabled xlib &&
  4600. check_func_headers "X11/Xlib.h X11/extensions/Xvlib.h" XvGetPortAttribute -lXv -lX11 -lXext
  4601. check_header direct.h
  4602. check_header dlfcn.h
  4603. check_header d3d11.h
  4604. check_header dxva.h
  4605. check_header dxva2api.h -D_WIN32_WINNT=0x0600
  4606. check_header io.h
  4607. check_header libcrystalhd/libcrystalhd_if.h
  4608. check_header mach/mach_time.h
  4609. check_header malloc.h
  4610. check_header net/udplite.h
  4611. check_header poll.h
  4612. check_header sys/mman.h
  4613. check_header sys/param.h
  4614. check_header sys/resource.h
  4615. check_header sys/select.h
  4616. check_header sys/time.h
  4617. check_header sys/un.h
  4618. check_header termios.h
  4619. check_header unistd.h
  4620. check_header valgrind/valgrind.h
  4621. check_header vdpau/vdpau.h
  4622. check_header vdpau/vdpau_x11.h
  4623. check_header VideoDecodeAcceleration/VDADecoder.h
  4624. check_header windows.h
  4625. check_header X11/extensions/XvMClib.h
  4626. check_header asm/types.h
  4627. check_lib2 "windows.h shellapi.h" CommandLineToArgvW -lshell32
  4628. check_lib2 "windows.h wincrypt.h" CryptGenRandom -ladvapi32
  4629. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  4630. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  4631. check_type "windows.h dxva.h" "DXVA_PicParams_HEVC"
  4632. check_type "windows.h d3d11.h" "ID3D11VideoDecoder"
  4633. check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0600
  4634. check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC"
  4635. if ! disabled w32threads && ! enabled pthreads; then
  4636. check_func_headers "windows.h process.h" _beginthreadex &&
  4637. enable w32threads || disable w32threads
  4638. fi
  4639. # check for some common methods of building with pthread support
  4640. # do this before the optional library checks as some of them require pthreads
  4641. if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then
  4642. enable pthreads
  4643. if check_func pthread_join -pthread && check_func pthread_create -pthread; then
  4644. add_cflags -pthread
  4645. add_extralibs -pthread
  4646. elif check_func pthread_join -pthreads && check_func pthread_create -pthreads; then
  4647. add_cflags -pthreads
  4648. add_extralibs -pthreads
  4649. elif check_func pthread_join -ldl -pthread && check_func pthread_create -ldl -pthread; then
  4650. add_cflags -ldl -pthread
  4651. add_extralibs -ldl -pthread
  4652. elif check_func pthread_join -lpthreadGC2 && check_func pthread_create -lpthreadGC2; then
  4653. add_extralibs -lpthreadGC2
  4654. elif check_lib pthread.h pthread_join -lpthread && check_lib pthread.h pthread_create -lpthread; then
  4655. :
  4656. elif ! check_func pthread_join && ! check_func pthread_create; then
  4657. disable pthreads
  4658. fi
  4659. check_code cc "pthread.h" "static pthread_mutex_t atomic_lock = PTHREAD_MUTEX_INITIALIZER" || disable pthreads
  4660. fi
  4661. if enabled pthreads; then
  4662. check_func pthread_cancel
  4663. fi
  4664. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  4665. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  4666. disabled lzma || check_lib2 lzma.h lzma_version_number -llzma || disable lzma
  4667. check_lib math.h sin -lm && LIBM="-lm"
  4668. disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h DtsCrystalHDVersion -lcrystalhd || disable crystalhd
  4669. atan2f_args=2
  4670. ldexpf_args=2
  4671. powf_args=2
  4672. for func in $MATH_FUNCS; do
  4673. eval check_mathfunc $func \${${func}_args:-1}
  4674. done
  4675. # these are off by default, so fail if requested and not available
  4676. enabled avfoundation_indev && { check_header_oc AVFoundation/AVFoundation.h || disable avfoundation_indev; }
  4677. enabled avfoundation_indev && { check_lib2 CoreGraphics/CoreGraphics.h CGGetActiveDisplayList -framework CoreGraphics ||
  4678. check_lib2 ApplicationServices/ApplicationServices.h CGGetActiveDisplayList -framework ApplicationServices; }
  4679. enabled avisynth && { { check_lib2 "windows.h" LoadLibrary; } ||
  4680. { check_lib2 "dlfcn.h" dlopen -ldl; } ||
  4681. die "ERROR: LoadLibrary/dlopen not found for avisynth"; }
  4682. enabled decklink && { check_header DeckLinkAPI.h || die "ERROR: DeckLinkAPI.h header not found"; }
  4683. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  4684. enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
  4685. enabled ladspa && { check_header ladspa.h || die "ERROR: ladspa.h header not found"; }
  4686. enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
  4687. enabled libaacplus && require "libaacplus >= 2.0.0" aacplus.h aacplusEncOpen -laacplus
  4688. enabled libass && require_pkg_config libass ass/ass.h ass_library_init
  4689. enabled libbluray && require_pkg_config libbluray libbluray/bluray.h bd_open
  4690. enabled libbs2b && require_pkg_config libbs2b bs2b.h bs2b_open
  4691. enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 &&
  4692. { check_lib celt/celt.h celt_decoder_create_custom -lcelt0 ||
  4693. die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
  4694. enabled libcaca && require_pkg_config caca caca.h caca_create_canvas
  4695. enabled libdcadec && require_pkg_config dcadec libdcadec/dca_context.h dcadec_context_create &&
  4696. check_struct libdcadec/dca_context.h "struct dcadec_exss_info" matrix_encoding
  4697. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  4698. enabled libfdk_aac && { use_pkg_config fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen ||
  4699. { require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac &&
  4700. warn "using libfdk without pkg-config"; } }
  4701. 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"
  4702. enabled libflite && require2 libflite "flite/flite.h" flite_init $flite_libs
  4703. enabled fontconfig && enable libfontconfig
  4704. enabled libfontconfig && require_pkg_config fontconfig "fontconfig/fontconfig.h" FcInit
  4705. enabled libfreetype && require_libfreetype
  4706. enabled libfribidi && require_pkg_config fribidi fribidi.h fribidi_version_info
  4707. enabled libgme && require libgme gme/gme.h gme_new_emu -lgme -lstdc++
  4708. enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
  4709. check_lib "${gsm_hdr}" gsm_create -lgsm && break;
  4710. done || die "ERROR: libgsm not found"; }
  4711. enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
  4712. enabled libmfx && require_pkg_config libmfx "mfx/mfxvideo.h" MFXInit
  4713. enabled libmodplug && require_pkg_config libmodplug libmodplug/modplug.h ModPlug_Load
  4714. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  4715. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  4716. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  4717. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  4718. enabled libopencv && require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader
  4719. enabled libopenh264 && require_pkg_config openh264 wels/codec_api.h WelsGetCodecVersion
  4720. enabled libopenjpeg && { check_lib openjpeg.h opj_version -lopenmj2 -DOPJ_STATIC ||
  4721. check_lib openjpeg-1.5/openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC ||
  4722. check_lib openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC ||
  4723. die "ERROR: libopenjpeg not found"; }
  4724. enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
  4725. enabled libpulse && require_pkg_config libpulse pulse/pulseaudio.h pa_context_new
  4726. enabled libquvi && require_pkg_config libquvi quvi/quvi.h quvi_init
  4727. enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
  4728. enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
  4729. enabled libshine && require_pkg_config shine shine/layer3.h shine_encode_buffer
  4730. enabled libsmbclient && { use_pkg_config smbclient libsmbclient.h smbc_init ||
  4731. require smbclient libsmbclient.h smbc_init -lsmbclient; }
  4732. enabled libsnappy && require snappy snappy-c.h snappy_compress -lsnappy
  4733. enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
  4734. enabled libssh && require_pkg_config libssh libssh/sftp.h sftp_init
  4735. enabled libspeex && require_pkg_config speex speex/speex.h speex_decoder_init -lspeex
  4736. enabled libstagefright_h264 && require_cpp libstagefright_h264 "binder/ProcessState.h media/stagefright/MetaData.h
  4737. media/stagefright/MediaBufferGroup.h media/stagefright/MediaDebug.h media/stagefright/MediaDefs.h
  4738. media/stagefright/OMXClient.h media/stagefright/OMXCodec.h" android::OMXClient -lstagefright -lmedia -lutils -lbinder -lgnustl_static
  4739. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  4740. enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame &&
  4741. { check_lib twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
  4742. die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; }
  4743. enabled libutvideo && require_cpp utvideo "stdint.h stdlib.h utvideo/utvideo.h utvideo/Codec.h" 'CCodec*' -lutvideo -lstdc++
  4744. enabled libv4l2 && require_pkg_config libv4l2 libv4l2.h v4l2_ioctl
  4745. enabled libvidstab && require_pkg_config "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit
  4746. enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
  4747. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  4748. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  4749. enabled libvpx && {
  4750. enabled libvpx_vp8_decoder && {
  4751. use_pkg_config "vpx >= 0.9.1" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx ||
  4752. check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
  4753. die "ERROR: libvpx decoder version must be >=0.9.1";
  4754. }
  4755. enabled libvpx_vp8_encoder && {
  4756. use_pkg_config "vpx >= 0.9.7" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx ||
  4757. check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VP8E_SET_MAX_INTRA_BITRATE_PCT" -lvpx ||
  4758. die "ERROR: libvpx encoder version must be >=0.9.7";
  4759. }
  4760. enabled libvpx_vp9_decoder && {
  4761. use_pkg_config "vpx >= 1.3.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx ||
  4762. check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx ||
  4763. disable libvpx_vp9_decoder;
  4764. }
  4765. enabled libvpx_vp9_encoder && {
  4766. use_pkg_config "vpx >= 1.3.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx ||
  4767. check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VP9E_SET_AQ_MODE" -lvpx ||
  4768. disable libvpx_vp9_encoder;
  4769. }
  4770. if disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder; then
  4771. die "libvpx enabled but no supported decoders found"
  4772. fi
  4773. }
  4774. enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack
  4775. enabled libwebp && {
  4776. enabled libwebp_encoder && require_pkg_config "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion
  4777. enabled libwebp_anim_encoder && { use_pkg_config "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit || disable libwebp_anim_encoder; } }
  4778. enabled libx264 && { use_pkg_config x264 "stdint.h x264.h" x264_encoder_encode ||
  4779. { require libx264 x264.h x264_encoder_encode -lx264 &&
  4780. warn "using libx264 without pkg-config"; } } &&
  4781. { check_cpp_condition x264.h "X264_BUILD >= 118" ||
  4782. die "ERROR: libx264 must be installed and version must be >= 0.118."; }
  4783. enabled libx265 && require_pkg_config x265 x265.h x265_api_get &&
  4784. { check_cpp_condition x265.h "X265_BUILD >= 57" ||
  4785. die "ERROR: libx265 version must be >= 57."; }
  4786. enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
  4787. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  4788. enabled libzmq && require_pkg_config libzmq zmq.h zmq_ctx_new
  4789. enabled libzvbi && require libzvbi libzvbi.h vbi_decoder_new -lzvbi
  4790. enabled mmal && { check_lib interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ||
  4791. { ! enabled cross_compile && {
  4792. add_cflags -isystem/opt/vc/include/ -isystem/opt/vc/include/interface/vmcs_host/linux -isystem/opt/vc/include/interface/vcos/pthreads -fgnu89-inline ;
  4793. add_extralibs -L/opt/vc/lib/ -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ;
  4794. check_lib interface/mmal/mmal.h mmal_port_connect ; }
  4795. check_lib interface/mmal/mmal.h mmal_port_connect ; } ||
  4796. die "ERROR: mmal not found"; }
  4797. enabled nvenc && { check_header nvEncodeAPI.h || die "ERROR: nvEncodeAPI.h not found."; } &&
  4798. { check_cpp_condition nvEncodeAPI.h "NVENCAPI_MAJOR_VERSION >= 5" ||
  4799. die "ERROR: NVENC API version 4 or older is not supported"; } &&
  4800. { [ $target_os != cygwin ] || die "ERROR: NVENC is not supported on Cygwin currently."; }
  4801. enabled openal && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
  4802. check_lib 'AL/al.h' alGetError "${al_libs}" && break; done } ||
  4803. die "ERROR: openal not found"; } &&
  4804. { check_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
  4805. die "ERROR: openal must be installed and version must be 1.1 or compatible"; }
  4806. enabled opencl && { check_lib2 OpenCL/cl.h clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
  4807. check_lib2 CL/cl.h clEnqueueNDRangeKernel -lOpenCL ||
  4808. die "ERROR: opencl not found"; } &&
  4809. { check_cpp_condition "OpenCL/cl.h" "defined(CL_VERSION_1_2)" ||
  4810. check_cpp_condition "CL/cl.h" "defined(CL_VERSION_1_2)" ||
  4811. die "ERROR: opencl must be installed and version must be 1.2 or compatible"; }
  4812. enabled opengl && { check_lib GL/glx.h glXGetProcAddress "-lGL" ||
  4813. check_lib2 windows.h wglGetProcAddress "-lopengl32 -lgdi32" ||
  4814. check_lib2 OpenGL/gl3.h glGetError "-Wl,-framework,OpenGL" ||
  4815. check_lib2 ES2/gl.h glGetError "-isysroot=${sysroot} -Wl,-framework,OpenGLES" ||
  4816. die "ERROR: opengl not found."
  4817. }
  4818. enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  4819. check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  4820. check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  4821. die "ERROR: openssl not found"; }
  4822. enabled qtkit_indev && { check_header_oc QTKit/QTKit.h || disable qtkit_indev; }
  4823. if enabled gnutls; then
  4824. { check_lib2 gmp.h mpz_export -lgmp && enable gmp; } ||
  4825. { check_lib gcrypt.h gcry_mpi_new -lgcrypt && enable gcrypt; }
  4826. fi
  4827. # libdc1394 check
  4828. if enabled libdc1394; then
  4829. { require_pkg_config libdc1394-2 dc1394/dc1394.h dc1394_new &&
  4830. enable libdc1394_2; } ||
  4831. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  4832. enable libdc1394_1; } ||
  4833. die "ERROR: No version of libdc1394 found "
  4834. fi
  4835. if ! disabled sdl; then
  4836. SDL_CONFIG="${cross_prefix}sdl-config"
  4837. if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
  4838. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  4839. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
  4840. enable sdl
  4841. else
  4842. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  4843. sdl_cflags=$("${SDL_CONFIG}" --cflags)
  4844. sdl_libs=$("${SDL_CONFIG}" --libs)
  4845. check_func_headers SDL_version.h SDL_Linked_Version $sdl_cflags $sdl_libs &&
  4846. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  4847. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
  4848. enable sdl
  4849. elif enabled sdl ; then
  4850. die "ERROR: SDL not found"
  4851. else
  4852. disable sdl
  4853. fi
  4854. fi
  4855. fi
  4856. enabled sdl && add_cflags $sdl_cflags && add_extralibs $sdl_libs
  4857. disabled securetransport || { check_func SecIdentityCreate "-Wl,-framework,CoreFoundation -Wl,-framework,Security" &&
  4858. check_lib2 "Security/SecureTransport.h Security/Security.h" "SSLCreateContext SecItemImport" "-Wl,-framework,CoreFoundation -Wl,-framework,Security" &&
  4859. enable securetransport; }
  4860. makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo
  4861. enabled makeinfo \
  4862. && [ 0$(makeinfo --version | grep "texinfo" | sed 's/.*texinfo[^0-9]*\([0-9]*\)\..*/\1/') -ge 5 ] \
  4863. && enable makeinfo_html || disable makeinfo_html
  4864. disabled makeinfo_html && texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html
  4865. perl -v > /dev/null 2>&1 && enable perl || disable perl
  4866. pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
  4867. rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
  4868. check_header linux/fb.h
  4869. check_header linux/videodev.h
  4870. check_header linux/videodev2.h
  4871. check_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete
  4872. check_header sys/videoio.h
  4873. check_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete
  4874. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  4875. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  4876. # w32api 3.12 had it defined wrong
  4877. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  4878. check_type "dshow.h" IBaseFilter
  4879. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  4880. { check_header dev/bktr/ioctl_meteor.h &&
  4881. check_header dev/bktr/ioctl_bt848.h; } ||
  4882. { check_header machine/ioctl_meteor.h &&
  4883. check_header machine/ioctl_bt848.h; } ||
  4884. { check_header dev/video/meteor/ioctl_meteor.h &&
  4885. check_header dev/video/bktr/ioctl_bt848.h; } ||
  4886. check_header dev/ic/bt8xx.h
  4887. check_header sndio.h
  4888. if check_struct sys/soundcard.h audio_buf_info bytes; then
  4889. enable_safe sys/soundcard.h
  4890. else
  4891. check_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_safe sys/soundcard.h
  4892. #include <sys/soundcard.h>
  4893. audio_buf_info abc;
  4894. EOF
  4895. fi
  4896. check_header soundcard.h
  4897. enabled_any alsa_indev alsa_outdev &&
  4898. check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  4899. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack && check_func sem_timedwait &&
  4900. check_func jack_port_get_latency_range -ljack
  4901. enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
  4902. if enabled libcdio; then
  4903. check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  4904. check_lib2 "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  4905. die "ERROR: No usable libcdio/cdparanoia found"
  4906. fi
  4907. enabled xlib &&
  4908. check_lib X11/Xlib.h XOpenDisplay -lX11 || disable xlib
  4909. if ! disabled libxcb; then
  4910. check_pkg_config "xcb >= 1.4" xcb/xcb.h xcb_connect || {
  4911. enabled libxcb && die "ERROR: libxcb >= 1.4 not found";
  4912. } && disable x11grab && enable libxcb
  4913. if enabled libxcb; then
  4914. disabled libxcb_shm || {
  4915. check_pkg_config xcb-shm xcb/shm.h xcb_shm_attach || {
  4916. enabled libxcb_shm && die "ERROR: libxcb_shm not found";
  4917. } && check_header sys/shm.h && enable libxcb_shm; }
  4918. disabled libxcb_xfixes || {
  4919. check_pkg_config xcb-xfixes xcb/xfixes.h xcb_xfixes_get_cursor_image || {
  4920. enabled libxcb_xfixes && die "ERROR: libxcb_xfixes not found";
  4921. } && enable libxcb_xfixes; }
  4922. disabled libxcb_shape || {
  4923. check_pkg_config xcb-shape xcb/shape.h xcb_shape_get_rectangles || {
  4924. enabled libxcb_shape && die "ERROR: libxcb_shape not found";
  4925. } && enable libxcb_shape; }
  4926. add_cflags $xcb_cflags $xcb_shm_cflags $xcb_xfixes_cflags $xcb_shape_cflags
  4927. add_extralibs $xcb_libs $xcb_shm_libs $xcb_xfixes_libs $xcb_shape_libs
  4928. fi
  4929. fi
  4930. if enabled x11grab; then
  4931. enabled xlib || die "ERROR: Xlib not found"
  4932. require Xext X11/extensions/XShm.h XShmCreateImage -lXext
  4933. require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes
  4934. fi
  4935. check_func_headers "windows.h" CreateDIBSection "$gdigrab_indev_extralibs"
  4936. enabled dxva2api_h &&
  4937. check_cc <<EOF && enable dxva2api_cobj
  4938. #define _WIN32_WINNT 0x0600
  4939. #define COBJMACROS
  4940. #include <windows.h>
  4941. #include <d3d9.h>
  4942. #include <dxva2api.h>
  4943. int main(void) { IDirectXVideoDecoder *o = NULL; IDirectXVideoDecoder_Release(o); return 0; }
  4944. EOF
  4945. enabled vaapi &&
  4946. check_lib va/va.h vaInitialize -lva ||
  4947. disable vaapi
  4948. enabled vaapi && enabled xlib &&
  4949. check_lib2 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 &&
  4950. enable vaapi_x11
  4951. enabled vdpau &&
  4952. check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  4953. disable vdpau
  4954. enabled vdpau && enabled xlib &&
  4955. check_func_headers "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau &&
  4956. prepend ffmpeg_libs $($ldflags_filter "-lvdpau") &&
  4957. enable vdpau_x11
  4958. # Funny iconv installations are not unusual, so check it after all flags have been set
  4959. disabled iconv || check_func_headers iconv.h iconv || check_lib2 iconv.h iconv -liconv || disable iconv
  4960. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  4961. # add some useful compiler flags if supported
  4962. check_cflags -Wdeclaration-after-statement
  4963. check_cflags -Wall
  4964. check_cflags -Wdisabled-optimization
  4965. check_cflags -Wpointer-arith
  4966. check_cflags -Wredundant-decls
  4967. check_cflags -Wwrite-strings
  4968. check_cflags -Wtype-limits
  4969. check_cflags -Wundef
  4970. check_cflags -Wmissing-prototypes
  4971. check_cflags -Wno-pointer-to-int-cast
  4972. check_cflags -Wstrict-prototypes
  4973. check_cflags -Wempty-body
  4974. enabled extra_warnings && check_cflags -Winline
  4975. check_disable_warning(){
  4976. warning_flag=-W${1#-Wno-}
  4977. test_cflags $warning_flag && add_cflags $1
  4978. }
  4979. check_disable_warning -Wno-parentheses
  4980. check_disable_warning -Wno-switch
  4981. check_disable_warning -Wno-format-zero-length
  4982. check_disable_warning -Wno-pointer-sign
  4983. # add some linker flags
  4984. check_ldflags -Wl,--warn-common
  4985. check_ldflags -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
  4986. enabled rpath && add_ldexeflags -Wl,-rpath,$libdir
  4987. enabled rpath && add_ldlibflags -Wl,-rpath,$libdir
  4988. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  4989. # add some strip flags
  4990. # -wN '..@*' is more selective than -x, but not available everywhere.
  4991. check_stripflags -wN \'..@*\' || check_stripflags -x
  4992. enabled neon_clobber_test &&
  4993. check_ldflags -Wl,--wrap,avcodec_open2 \
  4994. -Wl,--wrap,avcodec_decode_audio4 \
  4995. -Wl,--wrap,avcodec_decode_video2 \
  4996. -Wl,--wrap,avcodec_decode_subtitle2 \
  4997. -Wl,--wrap,avcodec_encode_audio2 \
  4998. -Wl,--wrap,avcodec_encode_video2 \
  4999. -Wl,--wrap,avcodec_encode_subtitle \
  5000. -Wl,--wrap,swr_convert \
  5001. -Wl,--wrap,avresample_convert ||
  5002. disable neon_clobber_test
  5003. enabled xmm_clobber_test &&
  5004. check_ldflags -Wl,--wrap,avcodec_open2 \
  5005. -Wl,--wrap,avcodec_decode_audio4 \
  5006. -Wl,--wrap,avcodec_decode_video2 \
  5007. -Wl,--wrap,avcodec_decode_subtitle2 \
  5008. -Wl,--wrap,avcodec_encode_audio2 \
  5009. -Wl,--wrap,avcodec_encode_video \
  5010. -Wl,--wrap,avcodec_encode_video2 \
  5011. -Wl,--wrap,avcodec_encode_subtitle \
  5012. -Wl,--wrap,swr_convert \
  5013. -Wl,--wrap,avresample_convert \
  5014. -Wl,--wrap,sws_scale ||
  5015. disable xmm_clobber_test
  5016. echo "X{};" > $TMPV
  5017. if test_ldflags -Wl,--version-script,$TMPV; then
  5018. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  5019. check_cc <<EOF && enable symver_asm_label
  5020. void ff_foo(void) __asm__ ("av_foo@VERSION");
  5021. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  5022. EOF
  5023. check_cc <<EOF && enable symver_gnu_asm
  5024. __asm__(".symver ff_foo,av_foo@VERSION");
  5025. void ff_foo(void) {}
  5026. EOF
  5027. fi
  5028. if [ -z "$optflags" ]; then
  5029. if enabled small; then
  5030. optflags=$cflags_size
  5031. elif enabled optimizations; then
  5032. optflags=$cflags_speed
  5033. else
  5034. optflags=$cflags_noopt
  5035. fi
  5036. fi
  5037. check_optflags(){
  5038. check_cflags "$@"
  5039. enabled lto && check_ldflags "$@"
  5040. }
  5041. if enabled lto; then
  5042. test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
  5043. check_cflags -flto
  5044. check_ldflags -flto $cpuflags
  5045. disable inline_asm_direct_symbol_refs
  5046. fi
  5047. check_optflags $optflags
  5048. check_optflags -fno-math-errno
  5049. check_optflags -fno-signed-zeros
  5050. enabled ftrapv && check_cflags -ftrapv
  5051. check_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
  5052. int x;
  5053. EOF
  5054. if enabled icc; then
  5055. # Just warnings, no remarks
  5056. check_cflags -w1
  5057. # -wd: Disable following warnings
  5058. # 144, 167, 556: -Wno-pointer-sign
  5059. # 188: enumerated type mixed with another type
  5060. # 1292: attribute "foo" ignored
  5061. # 1419: external declaration in primary source file
  5062. # 10006: ignoring unknown option -fno-signed-zeros
  5063. # 10148: ignoring unknown option -Wno-parentheses
  5064. # 10156: ignoring option '-W'; no argument required
  5065. # 13200: No EMMS instruction before call to function
  5066. # 13203: No EMMS instruction before return from function
  5067. check_cflags -wd144,167,188,556,1292,1419,10006,10148,10156,13200,13203
  5068. # 11030: Warning unknown option --as-needed
  5069. # 10156: ignoring option '-export'; no argument required
  5070. check_ldflags -wd10156,11030
  5071. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  5072. enable ebp_available
  5073. # The test above does not test linking
  5074. enabled lto && disable symver_asm_label
  5075. if enabled x86_32; then
  5076. icc_version=$($cc -dumpversion)
  5077. test ${icc_version%%.*} -ge 11 &&
  5078. check_cflags -falign-stack=maintain-16-byte ||
  5079. disable aligned_stack
  5080. fi
  5081. elif enabled ccc; then
  5082. # disable some annoying warnings
  5083. add_cflags -msg_disable bitnotint
  5084. add_cflags -msg_disable mixfuncvoid
  5085. add_cflags -msg_disable nonstandcast
  5086. add_cflags -msg_disable unsupieee
  5087. elif enabled gcc; then
  5088. check_optflags -fno-tree-vectorize
  5089. check_cflags -Werror=format-security
  5090. check_cflags -Werror=implicit-function-declaration
  5091. check_cflags -Werror=missing-prototypes
  5092. check_cflags -Werror=return-type
  5093. check_cflags -Werror=vla
  5094. check_cflags -Wformat
  5095. check_cflags -fdiagnostics-color=auto
  5096. enabled extra_warnings || check_disable_warning -Wno-maybe-uninitialized
  5097. elif enabled llvm_gcc; then
  5098. check_cflags -mllvm -stack-alignment=16
  5099. elif enabled clang; then
  5100. check_cflags -mllvm -stack-alignment=16
  5101. check_cflags -Qunused-arguments
  5102. check_cflags -Werror=implicit-function-declaration
  5103. check_cflags -Werror=missing-prototypes
  5104. check_cflags -Werror=return-type
  5105. elif enabled cparser; then
  5106. add_cflags -Wno-missing-variable-declarations
  5107. add_cflags -Wno-empty-statement
  5108. elif enabled armcc; then
  5109. add_cflags -W${armcc_opt},--diag_suppress=4343 # hardfp compat
  5110. add_cflags -W${armcc_opt},--diag_suppress=3036 # using . as system include dir
  5111. # 2523: use of inline assembly is deprecated
  5112. add_cflags -W${armcc_opt},--diag_suppress=2523
  5113. add_cflags -W${armcc_opt},--diag_suppress=1207
  5114. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  5115. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  5116. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  5117. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  5118. elif enabled tms470; then
  5119. add_cflags -pds=824 -pds=837
  5120. disable inline_asm
  5121. elif enabled pathscale; then
  5122. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  5123. elif enabled_any msvc icl; then
  5124. enabled x86_32 && disable aligned_stack
  5125. enabled_all x86_32 debug && add_cflags -Oy-
  5126. enabled debug && add_ldflags -debug
  5127. enable pragma_deprecated
  5128. if enabled icl; then
  5129. # -Qansi-alias is basically -fstrict-aliasing, but does not work
  5130. # (correctly) on icl 13.x.
  5131. check_cpp_condition "windows.h" "__ICL < 1300 || __ICL >= 1400" &&
  5132. add_cflags -Qansi-alias
  5133. # Some inline asm is not compilable in debug
  5134. if enabled debug; then
  5135. disable ebp_available
  5136. disable ebx_available
  5137. fi
  5138. fi
  5139. # msvcrt10 x64 incorrectly enables log2, only msvcrt12 (MSVC 2013) onwards actually has log2.
  5140. check_cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION >= 12" || disable log2
  5141. fi
  5142. case $as_type in
  5143. clang)
  5144. add_asflags -Qunused-arguments
  5145. ;;
  5146. esac
  5147. case $ld_type in
  5148. clang)
  5149. check_ldflags -Qunused-arguments
  5150. ;;
  5151. esac
  5152. case $target_os in
  5153. osf1)
  5154. enabled ccc && add_ldflags '-Wl,-expect_unresolved,*'
  5155. ;;
  5156. plan9)
  5157. add_cppflags -Dmain=plan9_main
  5158. ;;
  5159. esac
  5160. enable frame_thread_encoder
  5161. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  5162. check_deps $CONFIG_LIST \
  5163. $CONFIG_EXTRA \
  5164. $HAVE_LIST \
  5165. $ALL_COMPONENTS \
  5166. 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"
  5167. if test $target_os = "haiku"; then
  5168. disable memalign
  5169. disable posix_memalign
  5170. fi
  5171. enabled_all dxva2 dxva2api_cobj CoTaskMemFree &&
  5172. prepend ffmpeg_libs $($ldflags_filter "-lole32" "-luser32") &&
  5173. enable dxva2_lib
  5174. ! enabled_any memalign posix_memalign aligned_malloc &&
  5175. enabled simd_align_16 && enable memalign_hack
  5176. # add_dep lib dep
  5177. # -> enable ${lib}_deps_${dep}
  5178. # -> add $dep to ${lib}_deps only once
  5179. add_dep() {
  5180. lib=$1
  5181. dep=$2
  5182. enabled "${lib}_deps_${dep}" && return 0
  5183. enable "${lib}_deps_${dep}"
  5184. prepend "${lib}_deps" $dep
  5185. }
  5186. # merge deps lib components
  5187. # merge all ${component}_deps into ${lib}_deps and ${lib}_deps_*
  5188. merge_deps() {
  5189. lib=$1
  5190. shift
  5191. for comp in $*; do
  5192. enabled $comp || continue
  5193. eval "dep=\"\$${comp}_deps\""
  5194. for d in $dep; do
  5195. add_dep $lib $d
  5196. done
  5197. done
  5198. }
  5199. merge_deps libavfilter $FILTER_LIST
  5200. map 'enabled $v && intrinsics=${v#intrinsics_}' $INTRINSICS_LIST
  5201. for thread in $THREADS_LIST; do
  5202. if enabled $thread; then
  5203. test -n "$thread_type" &&
  5204. die "ERROR: Only one thread type must be selected." ||
  5205. thread_type="$thread"
  5206. fi
  5207. done
  5208. enabled zlib && add_cppflags -DZLIB_CONST
  5209. # conditional library dependencies, in linking order
  5210. enabled amovie_filter && prepend avfilter_deps "avformat avcodec"
  5211. enabled aresample_filter && prepend avfilter_deps "swresample"
  5212. enabled asyncts_filter && prepend avfilter_deps "avresample"
  5213. enabled atempo_filter && prepend avfilter_deps "avcodec"
  5214. enabled cover_rect_filter && prepend avfilter_deps "avformat avcodec"
  5215. enabled ebur128_filter && enabled swresample && prepend avfilter_deps "swresample"
  5216. enabled elbg_filter && prepend avfilter_deps "avcodec"
  5217. enabled fftfilt_filter && prepend avfilter_deps "avcodec"
  5218. enabled find_rect_filter && prepend avfilter_deps "avformat avcodec"
  5219. enabled mcdeint_filter && prepend avfilter_deps "avcodec"
  5220. enabled movie_filter && prepend avfilter_deps "avformat avcodec"
  5221. enabled pan_filter && prepend avfilter_deps "swresample"
  5222. enabled pp_filter && prepend avfilter_deps "postproc"
  5223. enabled removelogo_filter && prepend avfilter_deps "avformat avcodec swscale"
  5224. enabled resample_filter && prepend avfilter_deps "avresample"
  5225. enabled sab_filter && prepend avfilter_deps "swscale"
  5226. enabled scale_filter && prepend avfilter_deps "swscale"
  5227. enabled showspectrum_filter && prepend avfilter_deps "avcodec"
  5228. enabled smartblur_filter && prepend avfilter_deps "swscale"
  5229. enabled subtitles_filter && prepend avfilter_deps "avformat avcodec"
  5230. enabled uspp_filter && prepend avfilter_deps "avcodec"
  5231. enabled lavfi_indev && prepend avdevice_deps "avfilter"
  5232. enabled opus_decoder && prepend avcodec_deps "swresample"
  5233. expand_deps(){
  5234. lib_deps=${1}_deps
  5235. eval "deps=\$$lib_deps"
  5236. append $lib_deps $(map 'eval echo \$${v}_deps' $deps)
  5237. unique $lib_deps
  5238. }
  5239. #we have to remove gpl from the deps here as some code assumes all lib deps are libs
  5240. postproc_deps="$(filter_out 'gpl' $postproc_deps)"
  5241. map 'expand_deps $v' $LIBRARY_LIST
  5242. echo "install prefix $prefix"
  5243. echo "source path $source_path"
  5244. echo "C compiler $cc"
  5245. echo "C library $libc_type"
  5246. if test "$host_cc" != "$cc"; then
  5247. echo "host C compiler $host_cc"
  5248. echo "host C library $host_libc_type"
  5249. fi
  5250. echo "ARCH $arch ($cpu)"
  5251. if test "$build_suffix" != ""; then
  5252. echo "build suffix $build_suffix"
  5253. fi
  5254. if test "$progs_suffix" != ""; then
  5255. echo "progs suffix $progs_suffix"
  5256. fi
  5257. if test "$extra_version" != ""; then
  5258. echo "version string suffix $extra_version"
  5259. fi
  5260. echo "big-endian ${bigendian-no}"
  5261. echo "runtime cpu detection ${runtime_cpudetect-no}"
  5262. if enabled x86; then
  5263. echo "${yasmexe} ${yasm-no}"
  5264. echo "MMX enabled ${mmx-no}"
  5265. echo "MMXEXT enabled ${mmxext-no}"
  5266. echo "3DNow! enabled ${amd3dnow-no}"
  5267. echo "3DNow! extended enabled ${amd3dnowext-no}"
  5268. echo "SSE enabled ${sse-no}"
  5269. echo "SSSE3 enabled ${ssse3-no}"
  5270. echo "AVX enabled ${avx-no}"
  5271. echo "XOP enabled ${xop-no}"
  5272. echo "FMA3 enabled ${fma3-no}"
  5273. echo "FMA4 enabled ${fma4-no}"
  5274. echo "i686 features enabled ${i686-no}"
  5275. echo "CMOV is fast ${fast_cmov-no}"
  5276. echo "EBX available ${ebx_available-no}"
  5277. echo "EBP available ${ebp_available-no}"
  5278. fi
  5279. if enabled aarch64; then
  5280. echo "NEON enabled ${neon-no}"
  5281. echo "VFP enabled ${vfp-no}"
  5282. fi
  5283. if enabled arm; then
  5284. echo "ARMv5TE enabled ${armv5te-no}"
  5285. echo "ARMv6 enabled ${armv6-no}"
  5286. echo "ARMv6T2 enabled ${armv6t2-no}"
  5287. echo "VFP enabled ${vfp-no}"
  5288. echo "NEON enabled ${neon-no}"
  5289. echo "THUMB enabled ${thumb-no}"
  5290. fi
  5291. if enabled mips; then
  5292. echo "MIPS FPU enabled ${mipsfpu-no}"
  5293. echo "MIPS32R5 enabled ${mips32r5-no}"
  5294. echo "MIPS64R6 enabled ${mips64r6-no}"
  5295. echo "MIPS DSP R1 enabled ${mipsdspr1-no}"
  5296. echo "MIPS DSP R2 enabled ${mipsdspr2-no}"
  5297. echo "MIPS MSA enabled ${msa-no}"
  5298. echo "LOONGSON MMI enabled ${mmi-no}"
  5299. fi
  5300. if enabled ppc; then
  5301. echo "AltiVec enabled ${altivec-no}"
  5302. echo "VSX enabled ${vsx-no}"
  5303. echo "POWER8 enabled ${power8-no}"
  5304. echo "PPC 4xx optimizations ${ppc4xx-no}"
  5305. echo "dcbzl available ${dcbzl-no}"
  5306. fi
  5307. echo "debug symbols ${debug-no}"
  5308. echo "strip symbols ${stripping-no}"
  5309. echo "optimize for size ${small-no}"
  5310. echo "optimizations ${optimizations-no}"
  5311. echo "static ${static-no}"
  5312. echo "shared ${shared-no}"
  5313. echo "postprocessing support ${postproc-no}"
  5314. echo "new filter support ${avfilter-no}"
  5315. echo "network support ${network-no}"
  5316. echo "threading support ${thread_type-no}"
  5317. echo "safe bitstream reader ${safe_bitstream_reader-no}"
  5318. echo "SDL support ${sdl-no}"
  5319. echo "opencl enabled ${opencl-no}"
  5320. echo "texi2html enabled ${texi2html-no}"
  5321. echo "perl enabled ${perl-no}"
  5322. echo "pod2man enabled ${pod2man-no}"
  5323. echo "makeinfo enabled ${makeinfo-no}"
  5324. echo "makeinfo supports HTML ${makeinfo_html-no}"
  5325. test -n "$random_seed" &&
  5326. echo "random seed ${random_seed}"
  5327. echo
  5328. echo "External libraries:"
  5329. print_enabled '' $EXTERNAL_LIBRARY_LIST | print_3_columns
  5330. echo
  5331. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  5332. echo "Enabled ${type}s:"
  5333. eval list=\$$(toupper $type)_LIST
  5334. print_enabled '_*' $list | print_3_columns
  5335. echo
  5336. done
  5337. license="LGPL version 2.1 or later"
  5338. if enabled nonfree; then
  5339. license="nonfree and unredistributable"
  5340. elif enabled gplv3; then
  5341. license="GPL version 3 or later"
  5342. elif enabled lgplv3; then
  5343. license="LGPL version 3 or later"
  5344. elif enabled gpl; then
  5345. license="GPL version 2 or later"
  5346. fi
  5347. echo "License: $license"
  5348. echo "Creating config.mak, config.h, and doc/config.texi..."
  5349. test -e Makefile || echo "include $source_path/Makefile" > Makefile
  5350. enabled stripping || strip="echo skipping strip"
  5351. config_files="$TMPH config.mak doc/config.texi"
  5352. cat > config.mak <<EOF
  5353. # Automatically generated by configure - do not modify!
  5354. ifndef FFMPEG_CONFIG_MAK
  5355. FFMPEG_CONFIG_MAK=1
  5356. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  5357. prefix=$prefix
  5358. LIBDIR=\$(DESTDIR)$libdir
  5359. SHLIBDIR=\$(DESTDIR)$shlibdir
  5360. INCDIR=\$(DESTDIR)$incdir
  5361. BINDIR=\$(DESTDIR)$bindir
  5362. DATADIR=\$(DESTDIR)$datadir
  5363. DOCDIR=\$(DESTDIR)$docdir
  5364. MANDIR=\$(DESTDIR)$mandir
  5365. PKGCONFIGDIR=\$(DESTDIR)$pkgconfigdir
  5366. SRC_PATH=$source_path
  5367. ifndef MAIN_MAKEFILE
  5368. SRC_PATH:=\$(SRC_PATH:.%=..%)
  5369. endif
  5370. CC_IDENT=$cc_ident
  5371. ARCH=$arch
  5372. INTRINSICS=$intrinsics
  5373. CC=$cc
  5374. CXX=$cxx
  5375. AS=$as
  5376. LD=$ld
  5377. DEPCC=$dep_cc
  5378. DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
  5379. DEPAS=$as
  5380. DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
  5381. YASM=$yasmexe
  5382. DEPYASM=$yasmexe
  5383. AR=$ar
  5384. ARFLAGS=$arflags
  5385. AR_O=$ar_o
  5386. RANLIB=$ranlib
  5387. STRIP=$strip
  5388. CP=cp -p
  5389. LN_S=$ln_s
  5390. CPPFLAGS=$CPPFLAGS
  5391. CFLAGS=$CFLAGS
  5392. CXXFLAGS=$CXXFLAGS
  5393. ASFLAGS=$ASFLAGS
  5394. AS_C=$AS_C
  5395. AS_O=$AS_O
  5396. CC_C=$CC_C
  5397. CC_E=$CC_E
  5398. CC_O=$CC_O
  5399. CXX_C=$CXX_C
  5400. CXX_O=$CXX_O
  5401. LD_O=$LD_O
  5402. LD_LIB=$LD_LIB
  5403. LD_PATH=$LD_PATH
  5404. DLLTOOL=$dlltool
  5405. WINDRES=$windres
  5406. DEPWINDRES=$dep_cc
  5407. DOXYGEN=$doxygen
  5408. LDFLAGS=$LDFLAGS
  5409. LDEXEFLAGS=$LDEXEFLAGS
  5410. LDLIBFLAGS=$LDLIBFLAGS
  5411. SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
  5412. ASMSTRIPFLAGS=$ASMSTRIPFLAGS
  5413. YASMFLAGS=$YASMFLAGS
  5414. BUILDSUF=$build_suffix
  5415. PROGSSUF=$progs_suffix
  5416. FULLNAME=$FULLNAME
  5417. LIBPREF=$LIBPREF
  5418. LIBSUF=$LIBSUF
  5419. LIBNAME=$LIBNAME
  5420. SLIBPREF=$SLIBPREF
  5421. SLIBSUF=$SLIBSUF
  5422. EXESUF=$EXESUF
  5423. EXTRA_VERSION=$extra_version
  5424. CCDEP=$CCDEP
  5425. CXXDEP=$CXXDEP
  5426. CCDEP_FLAGS=$CCDEP_FLAGS
  5427. ASDEP=$ASDEP
  5428. ASDEP_FLAGS=$ASDEP_FLAGS
  5429. CC_DEPFLAGS=$CC_DEPFLAGS
  5430. AS_DEPFLAGS=$AS_DEPFLAGS
  5431. HOSTCC=$host_cc
  5432. HOSTLD=$host_ld
  5433. HOSTCFLAGS=$host_cflags
  5434. HOSTCPPFLAGS=$host_cppflags
  5435. HOSTEXESUF=$HOSTEXESUF
  5436. HOSTLDFLAGS=$host_ldflags
  5437. HOSTLIBS=$host_libs
  5438. DEPHOSTCC=$host_cc
  5439. DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
  5440. HOSTCCDEP=$HOSTCCDEP
  5441. HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
  5442. HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
  5443. HOSTCC_C=$HOSTCC_C
  5444. HOSTCC_O=$HOSTCC_O
  5445. HOSTLD_O=$HOSTLD_O
  5446. TARGET_EXEC=$target_exec $target_exec_args
  5447. TARGET_PATH=$target_path
  5448. TARGET_SAMPLES=${target_samples:-\$(SAMPLES)}
  5449. CFLAGS-ffplay=$sdl_cflags
  5450. ZLIB=$($ldflags_filter -lz)
  5451. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  5452. EXTRALIBS=$extralibs
  5453. COMPAT_OBJS=$compat_objs
  5454. EXEOBJS=$exeobjs
  5455. INSTALL=$install
  5456. LIBTARGET=${LIBTARGET}
  5457. SLIBNAME=${SLIBNAME}
  5458. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  5459. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  5460. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  5461. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  5462. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  5463. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  5464. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  5465. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  5466. SAMPLES:=${samples:-\$(FATE_SAMPLES)}
  5467. NOREDZONE_FLAGS=$noredzone_flags
  5468. EOF
  5469. get_version(){
  5470. lcname=lib${1}
  5471. name=$(toupper $lcname)
  5472. file=$source_path/$lcname/version.h
  5473. eval $(awk "/#define ${name}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file")
  5474. enabled raise_major && eval ${name}_VERSION_MAJOR=$((${name}_VERSION_MAJOR+100))
  5475. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  5476. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  5477. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  5478. eval echo "${lcname}_VERSION_MINOR=\$${name}_VERSION_MINOR" >> config.mak
  5479. }
  5480. map 'get_version $v' $LIBRARY_LIST
  5481. map 'eval echo "${v}_FFLIBS=\$${v}_deps" >> config.mak' $LIBRARY_LIST
  5482. print_program_libs(){
  5483. eval "program_libs=\$${1}_libs"
  5484. eval echo "LIBS-${1}=${program_libs}" >> config.mak
  5485. }
  5486. map 'print_program_libs $v' $PROGRAM_LIST
  5487. cat > $TMPH <<EOF
  5488. /* Automatically generated by configure - do not modify! */
  5489. #ifndef FFMPEG_CONFIG_H
  5490. #define FFMPEG_CONFIG_H
  5491. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  5492. #define FFMPEG_LICENSE "$(c_escape $license)"
  5493. #define CONFIG_THIS_YEAR 2015
  5494. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  5495. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  5496. #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
  5497. #define av_restrict $_restrict
  5498. #define EXTERN_PREFIX "${extern_prefix}"
  5499. #define EXTERN_ASM ${extern_prefix}
  5500. #define BUILDSUF "$build_suffix"
  5501. #define SLIBSUF "$SLIBSUF"
  5502. #define HAVE_MMX2 HAVE_MMXEXT
  5503. #define SWS_MAX_FILTER_SIZE $sws_max_filter_size
  5504. EOF
  5505. test -n "$assert_level" &&
  5506. echo "#define ASSERT_LEVEL $assert_level" >>$TMPH
  5507. test -n "$malloc_prefix" &&
  5508. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  5509. if enabled yasm; then
  5510. append config_files $TMPASM
  5511. printf '' >$TMPASM
  5512. fi
  5513. enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
  5514. mkdir -p doc
  5515. mkdir -p tests
  5516. mkdir -p tests/api
  5517. echo "@c auto-generated by configure" > doc/config.texi
  5518. print_config ARCH_ "$config_files" $ARCH_LIST
  5519. print_config HAVE_ "$config_files" $HAVE_LIST
  5520. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  5521. $CONFIG_EXTRA \
  5522. $ALL_COMPONENTS \
  5523. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  5524. echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
  5525. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  5526. cp_if_changed $TMPH config.h
  5527. touch .config
  5528. enabled yasm && cp_if_changed $TMPASM config.asm
  5529. cat > $TMPH <<EOF
  5530. /* Generated by ffconf */
  5531. #ifndef AVUTIL_AVCONFIG_H
  5532. #define AVUTIL_AVCONFIG_H
  5533. EOF
  5534. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  5535. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  5536. cp_if_changed $TMPH libavutil/avconfig.h
  5537. if test -n "$WARNINGS"; then
  5538. printf "\n$WARNINGS"
  5539. enabled fatal_warnings && exit 1
  5540. fi
  5541. # build pkg-config files
  5542. lib_version(){
  5543. eval printf "\"lib${1}${build_suffix} >= \$LIB$(toupper ${1})_VERSION, \""
  5544. }
  5545. pkgconfig_generate(){
  5546. name=$1
  5547. shortname=${name#lib}${build_suffix}
  5548. comment=$2
  5549. version=$3
  5550. libs=$4
  5551. requires=$(map 'lib_version $v' $(eval echo \$${name#lib}_deps))
  5552. requires=${requires%, }
  5553. enabled ${name#lib} || return 0
  5554. mkdir -p $name
  5555. cat <<EOF > $name/$name${build_suffix}.pc
  5556. prefix=$prefix
  5557. exec_prefix=\${prefix}
  5558. libdir=$libdir
  5559. includedir=$incdir
  5560. Name: $name
  5561. Description: $comment
  5562. Version: $version
  5563. Requires: $(enabled shared || echo $requires)
  5564. Requires.private: $(enabled shared && echo $requires)
  5565. Conflicts:
  5566. Libs: -L\${libdir} $(enabled rpath && echo "-Wl,-rpath,\${libdir}") -l${shortname} $(enabled shared || echo $libs)
  5567. Libs.private: $(enabled shared && echo $libs)
  5568. Cflags: -I\${includedir}
  5569. EOF
  5570. mkdir -p doc/examples/pc-uninstalled
  5571. includedir=${source_path}
  5572. [ "$includedir" = . ] && includedir="\${pcfiledir}/../../.."
  5573. cat <<EOF > doc/examples/pc-uninstalled/$name.pc
  5574. prefix=
  5575. exec_prefix=
  5576. libdir=\${pcfiledir}/../../../$name
  5577. includedir=${includedir}
  5578. Name: $name
  5579. Description: $comment
  5580. Version: $version
  5581. Requires: $requires
  5582. Conflicts:
  5583. Libs: -L\${libdir} -Wl,-rpath,\${libdir} -l${shortname} $(enabled shared || echo $libs)
  5584. Cflags: -I\${includedir}
  5585. EOF
  5586. }
  5587. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" "$LIBRT $LIBM"
  5588. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs"
  5589. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs"
  5590. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs"
  5591. pkgconfig_generate libavfilter "FFmpeg audio/video filtering library" "$LIBAVFILTER_VERSION" "$extralibs"
  5592. pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" ""
  5593. pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$LIBM"
  5594. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM"
  5595. pkgconfig_generate libswresample "FFmpeg audio resampling library" "$LIBSWRESAMPLE_VERSION" "$LIBM"