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.

5432 lines
167KB

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