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.

5888 lines
183KB

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