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.

4501 lines
135KB

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