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.

3385 lines
99KB

  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. show_help(){
  51. cat <<EOF
  52. Usage: configure [options]
  53. Options: [defaults in brackets after descriptions]
  54. Standard options:
  55. --help print this message
  56. --logfile=FILE log tests and output to FILE [config.log]
  57. --disable-logging do not log configure debug information
  58. --prefix=PREFIX install in PREFIX [$prefix]
  59. --bindir=DIR install binaries in DIR [PREFIX/bin]
  60. --datadir=DIR install data files in DIR [PREFIX/share/ffmpeg]
  61. --libdir=DIR install libs in DIR [PREFIX/lib]
  62. --shlibdir=DIR install shared libs in DIR [PREFIX/lib]
  63. --incdir=DIR install includes in DIR [PREFIX/include]
  64. --mandir=DIR install man page in DIR [PREFIX/share/man]
  65. Configuration options:
  66. --disable-static do not build static libraries [no]
  67. --enable-shared build shared libraries [no]
  68. --enable-gpl allow use of GPL code, the resulting libs
  69. and binaries will be under GPL [no]
  70. --enable-version3 upgrade (L)GPL to version 3 [no]
  71. --enable-nonfree allow use of nonfree code, the resulting libs
  72. and binaries will be unredistributable [no]
  73. --disable-doc do not build documentation
  74. --disable-ffmpeg disable ffmpeg build
  75. --disable-ffplay disable ffplay build
  76. --disable-ffprobe disable ffprobe build
  77. --disable-ffserver disable ffserver build
  78. --disable-avdevice disable libavdevice build
  79. --disable-avcodec disable libavcodec build
  80. --disable-avcore disable libavcore build
  81. --disable-avformat disable libavformat build
  82. --disable-swscale disable libswscale build
  83. --enable-postproc enable GPLed postprocessing support [no]
  84. --disable-avfilter disable video filter support [no]
  85. --disable-pthreads disable pthreads [auto]
  86. --enable-w32threads use Win32 threads [no]
  87. --enable-x11grab enable X11 grabbing [no]
  88. --disable-network disable network support [no]
  89. --disable-mpegaudio-hp faster (but less accurate) MPEG audio decoding [no]
  90. --enable-gray enable full grayscale support (slower color)
  91. --disable-swscale-alpha disable alpha channel support in swscale
  92. --disable-fastdiv disable table-based division
  93. --enable-small optimize for size instead of speed
  94. --disable-aandct disable AAN DCT code
  95. --disable-dct disable DCT code
  96. --disable-fft disable FFT code
  97. --disable-golomb disable Golomb code
  98. --disable-huffman disable Huffman code
  99. --disable-lpc disable LPC code
  100. --disable-mdct disable MDCT code
  101. --disable-rdft disable RDFT code
  102. --disable-vaapi disable VAAPI code
  103. --disable-vdpau disable VDPAU code
  104. --disable-dxva2 disable DXVA2 code
  105. --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
  106. --enable-hardcoded-tables use hardcoded tables instead of runtime generation
  107. --enable-memalign-hack emulate memalign, interferes with memory debuggers
  108. --disable-everything disable all components listed below
  109. --disable-encoder=NAME disable encoder NAME
  110. --enable-encoder=NAME enable encoder NAME
  111. --disable-encoders disable all encoders
  112. --disable-decoder=NAME disable decoder NAME
  113. --enable-decoder=NAME enable decoder NAME
  114. --disable-decoders disable all decoders
  115. --disable-hwaccel=NAME disable hwaccel NAME
  116. --enable-hwaccel=NAME enable hwaccel NAME
  117. --disable-hwaccels disable all hwaccels
  118. --disable-muxer=NAME disable muxer NAME
  119. --enable-muxer=NAME enable muxer NAME
  120. --disable-muxers disable all muxers
  121. --disable-demuxer=NAME disable demuxer NAME
  122. --enable-demuxer=NAME enable demuxer NAME
  123. --disable-demuxers disable all demuxers
  124. --enable-parser=NAME enable parser NAME
  125. --disable-parser=NAME disable parser NAME
  126. --disable-parsers disable all parsers
  127. --enable-bsf=NAME enable bitstream filter NAME
  128. --disable-bsf=NAME disable bitstream filter NAME
  129. --disable-bsfs disable all bitstream filters
  130. --enable-protocol=NAME enable protocol NAME
  131. --disable-protocol=NAME disable protocol NAME
  132. --disable-protocols disable all protocols
  133. --disable-indev=NAME disable input device NAME
  134. --disable-outdev=NAME disable output device NAME
  135. --disable-indevs disable input devices
  136. --disable-outdevs disable output devices
  137. --disable-devices disable all devices
  138. --enable-filter=NAME enable filter NAME
  139. --disable-filter=NAME disable filter NAME
  140. --disable-filters disable all filters
  141. --list-decoders show all available decoders
  142. --list-encoders show all available encoders
  143. --list-hwaccels show all available hardware accelerators
  144. --list-muxers show all available muxers
  145. --list-demuxers show all available demuxers
  146. --list-parsers show all available parsers
  147. --list-protocols show all available protocols
  148. --list-bsfs show all available bitstream filters
  149. --list-indevs show all available input devices
  150. --list-outdevs show all available output devices
  151. --list-filters show all available filters
  152. External library support:
  153. --enable-avisynth enable reading of AVISynth script files [no]
  154. --enable-bzlib enable bzlib [autodetect]
  155. --enable-frei0r enable frei0r video filtering
  156. --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
  157. --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
  158. --enable-libopencv enable video filtering via libopencv [no]
  159. --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
  160. and libraw1394 [no]
  161. --enable-libdirac enable Dirac support via libdirac [no]
  162. --enable-libfaac enable FAAC support via libfaac [no]
  163. --enable-libgsm enable GSM support via libgsm [no]
  164. --enable-libmp3lame enable MP3 encoding via libmp3lame [no]
  165. --enable-libnut enable NUT (de)muxing via libnut,
  166. native (de)muxer exists [no]
  167. --enable-libopenjpeg enable JPEG 2000 decoding via OpenJPEG [no]
  168. --enable-librtmp enable RTMP[E] support via librtmp [no]
  169. --enable-libschroedinger enable Dirac support via libschroedinger [no]
  170. --enable-libspeex enable Speex decoding via libspeex [no]
  171. --enable-libtheora enable Theora encoding via libtheora [no]
  172. --enable-libvorbis enable Vorbis encoding via libvorbis,
  173. native implementation exists [no]
  174. --enable-libvpx enable VP8 support via libvpx [no]
  175. --enable-libx264 enable H.264 encoding via x264 [no]
  176. --enable-libxavs enable AVS encoding via xavs [no]
  177. --enable-libxvid enable Xvid encoding via xvidcore,
  178. native MPEG-4/Xvid encoder exists [no]
  179. --enable-mlib enable Sun medialib [no]
  180. --enable-zlib enable zlib [autodetect]
  181. Advanced options (experts only):
  182. --source-path=PATH path to source code [$source_path]
  183. --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
  184. --enable-cross-compile assume a cross-compiler is used
  185. --sysroot=PATH root of cross-build tree
  186. --sysinclude=PATH location of cross-build system headers
  187. --target-os=OS compiler targets OS [$target_os]
  188. --target-exec=CMD command to run executables on target
  189. --target-path=DIR path to view of build directory on target
  190. --nm=NM use nm tool
  191. --ar=AR use archive tool AR [$ar_default]
  192. --as=AS use assembler AS [$as_default]
  193. --cc=CC use C compiler CC [$cc_default]
  194. --ld=LD use linker LD
  195. --host-cc=HOSTCC use host C compiler HOSTCC
  196. --host-cflags=HCFLAGS use HCFLAGS when compiling for host
  197. --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
  198. --host-libs=HLIBS use libs HLIBS when linking for host
  199. --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
  200. --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
  201. --extra-libs=ELIBS add ELIBS [$ELIBS]
  202. --extra-version=STRING version string suffix []
  203. --build-suffix=SUFFIX library name suffix []
  204. --arch=ARCH select architecture [$arch]
  205. --cpu=CPU select the minimum required CPU (affects
  206. instruction selection, may crash on older CPUs)
  207. --disable-asm disable all assembler optimizations
  208. --disable-altivec disable AltiVec optimizations
  209. --disable-amd3dnow disable 3DNow! optimizations
  210. --disable-amd3dnowext disable 3DNow! extended optimizations
  211. --disable-mmx disable MMX optimizations
  212. --disable-mmx2 disable MMX2 optimizations
  213. --disable-sse disable SSE optimizations
  214. --disable-ssse3 disable SSSE3 optimizations
  215. --disable-armv5te disable armv5te optimizations
  216. --disable-armv6 disable armv6 optimizations
  217. --disable-armv6t2 disable armv6t2 optimizations
  218. --disable-armvfp disable ARM VFP optimizations
  219. --disable-iwmmxt disable iwmmxt optimizations
  220. --disable-mmi disable MMI optimizations
  221. --disable-neon disable neon optimizations
  222. --disable-vis disable VIS optimizations
  223. --disable-yasm disable use of yasm assembler
  224. --enable-pic build position-independent code
  225. --malloc-prefix=PFX prefix malloc and related names with PFX
  226. --enable-sram allow use of on-chip SRAM
  227. --disable-symver disable symbol versioning
  228. Developer options (useful when working on FFmpeg itself):
  229. --disable-debug disable debugging symbols
  230. --enable-debug=LEVEL set the debug level [$debuglevel]
  231. --disable-optimizations disable compiler optimizations
  232. --enable-extra-warnings enable more compiler warnings
  233. --disable-stripping disable stripping of executables and shared libraries
  234. --samples=PATH location of test samples for FATE
  235. NOTE: Object files are built at the place where configure is launched.
  236. EOF
  237. exit 0
  238. }
  239. quotes='""'
  240. log(){
  241. echo "$@" >> $logfile
  242. }
  243. log_file(){
  244. log BEGIN $1
  245. pr -n -t $1 >> $logfile
  246. log END $1
  247. }
  248. echolog(){
  249. log "$@"
  250. echo "$@"
  251. }
  252. warn(){
  253. log "WARNING: $*"
  254. WARNINGS="${WARNINGS}WARNING: $*\n"
  255. }
  256. die(){
  257. echolog "$@"
  258. cat <<EOF
  259. If you think configure made a mistake, make sure you are using the latest
  260. version from Git. If the latest version fails, report the problem to the
  261. ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
  262. EOF
  263. if disabled logging; then
  264. cat <<EOF
  265. Rerun configure with logging enabled (do not use --disable-logging), and
  266. include the log this produces with your report.
  267. EOF
  268. else
  269. cat <<EOF
  270. Include the log file "$logfile" produced by configure as this will help
  271. solving the problem.
  272. EOF
  273. fi
  274. exit 1
  275. }
  276. # Avoid locale weirdness, besides we really just want to translate ASCII.
  277. toupper(){
  278. echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
  279. }
  280. tolower(){
  281. echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
  282. }
  283. c_escape(){
  284. echo "$*" | sed 's/["\\]/\\\0/g'
  285. }
  286. sh_quote(){
  287. v=$(echo "$1" | sed "s/'/'\\\\''/g")
  288. test "x$v" = "x${v#*[!A-Za-z0-9_/.+-]}" || v="'$v'"
  289. echo "$v"
  290. }
  291. filter(){
  292. pat=$1
  293. shift
  294. for v; do
  295. eval "case $v in $pat) echo $v ;; esac"
  296. done
  297. }
  298. map(){
  299. m=$1
  300. shift
  301. for v; do eval $m; done
  302. }
  303. set_all(){
  304. value=$1
  305. shift
  306. for var in $*; do
  307. eval $var=$value
  308. done
  309. }
  310. set_weak(){
  311. value=$1
  312. shift
  313. for var; do
  314. eval : \${$var:=$value}
  315. done
  316. }
  317. pushvar(){
  318. for var in $*; do
  319. eval level=\${${var}_level:=0}
  320. eval ${var}_${level}="\$$var"
  321. eval ${var}_level=$(($level+1))
  322. done
  323. }
  324. popvar(){
  325. for var in $*; do
  326. eval level=\${${var}_level:-0}
  327. test $level = 0 && continue
  328. eval level=$(($level-1))
  329. eval $var="\${${var}_${level}}"
  330. eval ${var}_level=$level
  331. eval unset ${var}_${level}
  332. done
  333. }
  334. enable(){
  335. set_all yes $*
  336. }
  337. disable(){
  338. set_all no $*
  339. }
  340. enable_weak(){
  341. set_weak yes $*
  342. }
  343. disable_weak(){
  344. set_weak no $*
  345. }
  346. enable_safe(){
  347. for var; do
  348. enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  349. done
  350. }
  351. disable_safe(){
  352. for var; do
  353. disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  354. done
  355. }
  356. do_enable_deep(){
  357. for var; do
  358. enabled $var && continue
  359. eval sel="\$${var}_select"
  360. eval sgs="\$${var}_suggest"
  361. pushvar var sgs
  362. enable_deep $sel
  363. popvar sgs
  364. enable_deep_weak $sgs
  365. popvar var
  366. done
  367. }
  368. enable_deep(){
  369. do_enable_deep $*
  370. enable $*
  371. }
  372. enable_deep_weak(){
  373. do_enable_deep $*
  374. enable_weak $*
  375. }
  376. enabled(){
  377. test "${1#!}" = "$1" && op== || op=!=
  378. eval test "x\$${1#!}" $op "xyes"
  379. }
  380. disabled(){
  381. test "${1#!}" = "$1" && op== || op=!=
  382. eval test "x\$${1#!}" $op "xno"
  383. }
  384. enabled_all(){
  385. for opt; do
  386. enabled $opt || return 1
  387. done
  388. }
  389. disabled_all(){
  390. for opt; do
  391. disabled $opt || return 1
  392. done
  393. }
  394. enabled_any(){
  395. for opt; do
  396. enabled $opt && return 0
  397. done
  398. }
  399. disabled_any(){
  400. for opt; do
  401. disabled $opt && return 0
  402. done
  403. return 1
  404. }
  405. set_default(){
  406. for opt; do
  407. eval : \${$opt:=\$${opt}_default}
  408. done
  409. }
  410. is_in(){
  411. value=$1
  412. shift
  413. for var in $*; do
  414. [ $var = $value ] && return 0
  415. done
  416. return 1
  417. }
  418. check_deps(){
  419. for cfg; do
  420. cfg="${cfg#!}"
  421. enabled ${cfg}_checking && die "Circular dependency for $cfg."
  422. disabled ${cfg}_checking && continue
  423. enable ${cfg}_checking
  424. eval dep_all="\$${cfg}_deps"
  425. eval dep_any="\$${cfg}_deps_any"
  426. eval dep_sel="\$${cfg}_select"
  427. eval dep_sgs="\$${cfg}_suggest"
  428. eval dep_ifa="\$${cfg}_if"
  429. eval dep_ifn="\$${cfg}_if_any"
  430. pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  431. check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
  432. popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  433. [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
  434. [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
  435. enabled_all $dep_all || disable $cfg
  436. enabled_any $dep_any || disable $cfg
  437. disabled_any $dep_sel && disable $cfg
  438. if enabled $cfg; then
  439. eval dep_extralibs="\$${cfg}_extralibs"
  440. test -n "$dep_extralibs" && add_extralibs $dep_extralibs
  441. enable_deep $dep_sel
  442. enable_deep_weak $dep_sgs
  443. fi
  444. disable ${cfg}_checking
  445. done
  446. }
  447. print_config_h(){
  448. enabled $1 && v=1 || v=0
  449. echo "#define $2 $v"
  450. }
  451. print_config_mak(){
  452. enabled $1 && v= || v=!
  453. echo "$v$2=yes"
  454. }
  455. print_config_asm(){
  456. enabled $1 && echo "%define $2"
  457. }
  458. print_config(){
  459. pfx=$1
  460. files=$2
  461. shift 2
  462. for cfg; do
  463. ucname="$(toupper $cfg)"
  464. for f in $files; do
  465. "print_config_${f##*.}" $cfg ${pfx}${ucname} >>$f
  466. done
  467. done
  468. }
  469. print_enabled(){
  470. test "$1" = -n && end=" " && shift || end="\n"
  471. suf=$1
  472. shift
  473. for v; do
  474. enabled $v && printf "%s$end" ${v%$suf};
  475. done
  476. }
  477. append(){
  478. var=$1
  479. shift
  480. eval "$var=\"\$$var $*\""
  481. }
  482. prepend(){
  483. var=$1
  484. shift
  485. eval "$var=\"$* \$$var\""
  486. }
  487. add_cppflags(){
  488. append CPPFLAGS $($filter_cppflags "$@")
  489. }
  490. add_cflags(){
  491. append CFLAGS $($filter_cflags "$@")
  492. }
  493. add_asflags(){
  494. append ASFLAGS $($filter_asflags "$@")
  495. }
  496. add_ldflags(){
  497. append LDFLAGS "$@"
  498. }
  499. add_extralibs(){
  500. prepend extralibs "$@"
  501. }
  502. check_cmd(){
  503. log "$@"
  504. "$@" >> $logfile 2>&1
  505. }
  506. check_cc(){
  507. log check_cc "$@"
  508. cat > $TMPC
  509. log_file $TMPC
  510. check_cmd $cc $CPPFLAGS $CFLAGS "$@" -c -o $TMPO $TMPC
  511. }
  512. check_cpp(){
  513. log check_cpp "$@"
  514. cat > $TMPC
  515. log_file $TMPC
  516. check_cmd $cc $CPPFLAGS $CFLAGS "$@" -E -o $TMPO $TMPC
  517. }
  518. check_as(){
  519. log check_as "$@"
  520. cat > $TMPC
  521. log_file $TMPC
  522. check_cmd $as $CPPFLAGS $ASFLAGS "$@" -c -o $TMPO $TMPC
  523. }
  524. check_asm(){
  525. log check_asm "$@"
  526. name="$1"
  527. code="$2"
  528. shift 2
  529. disable $name
  530. check_as "$@" <<EOF && enable $name
  531. void foo(void){ __asm__ volatile($code); }
  532. EOF
  533. }
  534. check_yasm(){
  535. log check_yasm "$@"
  536. echo "$1" > $TMPS
  537. log_file $TMPS
  538. shift 1
  539. check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
  540. }
  541. check_ld(){
  542. log check_ld "$@"
  543. flags=''
  544. libs=''
  545. for f; do
  546. test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
  547. done
  548. check_cc $($filter_cflags $flags) || return
  549. check_cmd $ld $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs
  550. }
  551. check_cppflags(){
  552. log check_cppflags "$@"
  553. set -- $($filter_cppflags "$@")
  554. check_cc "$@" <<EOF && append CPPFLAGS "$@"
  555. int x;
  556. EOF
  557. }
  558. check_cflags(){
  559. log check_cflags "$@"
  560. set -- $($filter_cflags "$@")
  561. check_cc "$@" <<EOF && append CFLAGS "$@"
  562. int x;
  563. EOF
  564. }
  565. test_ldflags(){
  566. log test_ldflags "$@"
  567. check_ld "$@" <<EOF
  568. int main(void){ return 0; }
  569. EOF
  570. }
  571. check_ldflags(){
  572. log check_ldflags "$@"
  573. test_ldflags "$@" && add_ldflags "$@"
  574. }
  575. check_header(){
  576. log check_header "$@"
  577. header=$1
  578. shift
  579. disable_safe $header
  580. check_cpp "$@" <<EOF && enable_safe $header
  581. #include <$header>
  582. int x;
  583. EOF
  584. }
  585. check_func(){
  586. log check_func "$@"
  587. func=$1
  588. shift
  589. disable $func
  590. check_ld "$@" <<EOF && enable $func
  591. extern int $func();
  592. int main(void){ $func(); }
  593. EOF
  594. }
  595. check_mathfunc(){
  596. log check_mathfunc "$@"
  597. func=$1
  598. shift
  599. disable $func
  600. check_ld "$@" <<EOF && enable $func
  601. #include <math.h>
  602. float foo(float f) { return $func(f); }
  603. int main(void){ return 0; }
  604. EOF
  605. }
  606. check_func_headers(){
  607. log check_func_headers "$@"
  608. headers=$1
  609. func=$2
  610. shift 2
  611. disable $func
  612. incs=""
  613. for hdr in $headers; do
  614. incs="$incs
  615. #include <$hdr>"
  616. done
  617. check_ld "$@" <<EOF && enable $func && enable_safe $headers
  618. $incs
  619. int main(int argc, char **argv){
  620. return (long) $func;
  621. }
  622. EOF
  623. }
  624. check_cpp_condition(){
  625. log check_cpp_condition "$@"
  626. header=$1
  627. condition=$2
  628. shift 2
  629. check_cpp $($filter_cppflags "$@") <<EOF
  630. #include <$header>
  631. #if !($condition)
  632. #error "unsatisfied condition: $condition"
  633. #endif
  634. EOF
  635. }
  636. check_lib(){
  637. log check_lib "$@"
  638. header="$1"
  639. func="$2"
  640. shift 2
  641. check_header $header && check_func $func "$@" && add_extralibs "$@"
  642. }
  643. check_lib2(){
  644. log check_lib2 "$@"
  645. headers="$1"
  646. func="$2"
  647. shift 2
  648. check_func_headers "$headers" $func "$@" && add_extralibs "$@"
  649. }
  650. check_exec(){
  651. check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
  652. }
  653. check_exec_crash(){
  654. code=$(cat)
  655. # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
  656. # are safe but may not be available everywhere. Thus we use
  657. # raise(SIGTERM) instead. The check is run in a subshell so we
  658. # can redirect the "Terminated" message from the shell. SIGBUS
  659. # is not defined by standard C so it is used conditionally.
  660. (check_exec "$@") >> $logfile 2>&1 <<EOF
  661. #include <signal.h>
  662. static void sighandler(int sig){
  663. raise(SIGTERM);
  664. }
  665. int main(void){
  666. signal(SIGILL, sighandler);
  667. signal(SIGFPE, sighandler);
  668. signal(SIGSEGV, sighandler);
  669. #ifdef SIGBUS
  670. signal(SIGBUS, sighandler);
  671. #endif
  672. { $code }
  673. }
  674. EOF
  675. }
  676. check_type(){
  677. log check_type "$@"
  678. headers=$1
  679. type=$2
  680. shift 2
  681. disable_safe "$type"
  682. incs=""
  683. for hdr in $headers; do
  684. incs="$incs
  685. #include <$hdr>"
  686. done
  687. check_cc "$@" <<EOF && enable_safe "$type"
  688. $incs
  689. $type v;
  690. EOF
  691. }
  692. check_struct(){
  693. log check_type "$@"
  694. headers=$1
  695. struct=$2
  696. member=$3
  697. shift 3
  698. disable_safe "${struct}_${member}"
  699. incs=""
  700. for hdr in $headers; do
  701. incs="$incs
  702. #include <$hdr>"
  703. done
  704. check_cc "$@" <<EOF && enable_safe "${struct}_${member}"
  705. $incs
  706. const void *p = &(($struct *)0)->$member;
  707. EOF
  708. }
  709. require(){
  710. name="$1"
  711. header="$2"
  712. func="$3"
  713. shift 3
  714. check_lib $header $func "$@" || die "ERROR: $name not found"
  715. }
  716. require2(){
  717. name="$1"
  718. headers="$2"
  719. func="$3"
  720. shift 3
  721. check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
  722. }
  723. check_host_cc(){
  724. log check_host_cc "$@"
  725. cat > $TMPC
  726. log_file $TMPC
  727. check_cmd $host_cc $host_cflags "$@" -c -o $TMPO $TMPC
  728. }
  729. check_host_cflags(){
  730. log check_host_cflags "$@"
  731. check_host_cc "$@" <<EOF && append host_cflags "$@"
  732. int x;
  733. EOF
  734. }
  735. apply(){
  736. file=$1
  737. shift
  738. "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
  739. }
  740. cp_if_changed(){
  741. cmp -s "$1" "$2" &&
  742. echo "$2 is unchanged" ||
  743. cp -f "$1" "$2"
  744. }
  745. # CONFIG_LIST contains configurable options, while HAVE_LIST is for
  746. # system-dependent things.
  747. COMPONENT_LIST="
  748. bsfs
  749. decoders
  750. demuxers
  751. encoders
  752. filters
  753. hwaccels
  754. indevs
  755. muxers
  756. outdevs
  757. parsers
  758. protocols
  759. "
  760. CONFIG_LIST="
  761. $COMPONENT_LIST
  762. aandct
  763. avcodec
  764. avcore
  765. avdevice
  766. avfilter
  767. avformat
  768. avisynth
  769. bzlib
  770. dct
  771. doc
  772. dwt
  773. dxva2
  774. fastdiv
  775. ffmpeg
  776. ffplay
  777. ffprobe
  778. ffserver
  779. fft
  780. frei0r
  781. golomb
  782. gpl
  783. gray
  784. h264dsp
  785. h264pred
  786. hardcoded_tables
  787. huffman
  788. libdc1394
  789. libdirac
  790. libfaac
  791. libgsm
  792. libmp3lame
  793. libnut
  794. libopencore_amrnb
  795. libopencore_amrwb
  796. libopencv
  797. libopenjpeg
  798. librtmp
  799. libschroedinger
  800. libspeex
  801. libtheora
  802. libvorbis
  803. libvpx
  804. libx264
  805. libxavs
  806. libxvid
  807. lpc
  808. lsp
  809. mdct
  810. memalign_hack
  811. mlib
  812. mpegaudio_hp
  813. network
  814. nonfree
  815. pic
  816. postproc
  817. rdft
  818. rtpdec
  819. runtime_cpudetect
  820. shared
  821. small
  822. sram
  823. static
  824. swscale
  825. swscale_alpha
  826. vaapi
  827. vdpau
  828. version3
  829. x11grab
  830. zlib
  831. "
  832. THREADS_LIST='
  833. pthreads
  834. w32threads
  835. '
  836. ARCH_LIST='
  837. alpha
  838. arm
  839. avr32
  840. avr32_ap
  841. avr32_uc
  842. bfin
  843. ia64
  844. m68k
  845. mips
  846. mips64
  847. parisc
  848. ppc
  849. ppc64
  850. s390
  851. sh4
  852. sparc
  853. sparc64
  854. tomi
  855. x86
  856. x86_32
  857. x86_64
  858. '
  859. ARCH_EXT_LIST='
  860. altivec
  861. amd3dnow
  862. amd3dnowext
  863. armv5te
  864. armv6
  865. armv6t2
  866. armvfp
  867. iwmmxt
  868. mmi
  869. mmx
  870. mmx2
  871. neon
  872. ppc4xx
  873. sse
  874. ssse3
  875. vis
  876. '
  877. HAVE_LIST_PUB='
  878. bigendian
  879. fast_unaligned
  880. '
  881. HAVE_LIST="
  882. $ARCH_EXT_LIST
  883. $HAVE_LIST_PUB
  884. $THREADS_LIST
  885. aligned_stack
  886. alsa_asoundlib_h
  887. altivec_h
  888. arpa_inet_h
  889. attribute_may_alias
  890. attribute_packed
  891. bswap
  892. closesocket
  893. cmov
  894. conio_h
  895. dcbzl
  896. dev_bktr_ioctl_bt848_h
  897. dev_bktr_ioctl_meteor_h
  898. dev_ic_bt8xx_h
  899. dev_video_meteor_ioctl_meteor_h
  900. dev_video_bktr_ioctl_bt848_h
  901. dlfcn_h
  902. dlopen
  903. dos_paths
  904. ebp_available
  905. ebx_available
  906. exp2
  907. exp2f
  908. fast_64bit
  909. fast_clz
  910. fast_cmov
  911. fcntl
  912. fork
  913. getaddrinfo
  914. gethrtime
  915. GetProcessMemoryInfo
  916. GetProcessTimes
  917. getrusage
  918. gnu_as
  919. struct_rusage_ru_maxrss
  920. ibm_asm
  921. inet_aton
  922. inline_asm
  923. isatty
  924. ldbrx
  925. libdc1394_1
  926. libdc1394_2
  927. llrint
  928. llrintf
  929. local_aligned_16
  930. local_aligned_8
  931. log2
  932. log2f
  933. loongson
  934. lrint
  935. lrintf
  936. lzo1x_999_compress
  937. machine_ioctl_bt848_h
  938. machine_ioctl_meteor_h
  939. malloc_h
  940. MapViewOfFile
  941. memalign
  942. mkstemp
  943. mmap
  944. pld
  945. posix_memalign
  946. round
  947. roundf
  948. sdl
  949. sdl_video_size
  950. setmode
  951. socklen_t
  952. soundcard_h
  953. poll_h
  954. setrlimit
  955. strerror_r
  956. strtok_r
  957. struct_addrinfo
  958. struct_ipv6_mreq
  959. struct_sockaddr_in6
  960. struct_sockaddr_sa_len
  961. struct_sockaddr_storage
  962. symver
  963. symver_gnu_asm
  964. symver_asm_label
  965. sys_mman_h
  966. sys_resource_h
  967. sys_select_h
  968. sys_soundcard_h
  969. sys_videoio_h
  970. ten_operands
  971. termios_h
  972. threads
  973. truncf
  974. vfp_args
  975. VirtualAlloc
  976. winsock2_h
  977. xform_asm
  978. xmm_clobbers
  979. yasm
  980. "
  981. # options emitted with CONFIG_ prefix but not available on command line
  982. CONFIG_EXTRA="
  983. avutil
  984. gplv3
  985. lgplv3
  986. "
  987. CMDLINE_SELECT="
  988. $ARCH_EXT_LIST
  989. $CONFIG_LIST
  990. $THREADS_LIST
  991. asm
  992. cross_compile
  993. debug
  994. extra_warnings
  995. logging
  996. optimizations
  997. stripping
  998. symver
  999. yasm
  1000. "
  1001. PATHS_LIST='
  1002. bindir
  1003. datadir
  1004. incdir
  1005. libdir
  1006. mandir
  1007. prefix
  1008. shlibdir
  1009. '
  1010. CMDLINE_SET="
  1011. $PATHS_LIST
  1012. ar
  1013. arch
  1014. as
  1015. build_suffix
  1016. cc
  1017. cpu
  1018. cross_prefix
  1019. dep_cc
  1020. extra_version
  1021. host_cc
  1022. host_cflags
  1023. host_ldflags
  1024. host_libs
  1025. host_os
  1026. ld
  1027. logfile
  1028. malloc_prefix
  1029. nm
  1030. samples
  1031. source_path
  1032. strip
  1033. sysinclude
  1034. sysroot
  1035. target_exec
  1036. target_os
  1037. target_path
  1038. "
  1039. CMDLINE_APPEND="
  1040. extra_cflags
  1041. "
  1042. # code dependency declarations
  1043. # architecture extensions
  1044. armv5te_deps="arm"
  1045. armv6_deps="arm"
  1046. armv6t2_deps="arm"
  1047. armvfp_deps="arm"
  1048. iwmmxt_deps="arm"
  1049. neon_deps="arm"
  1050. mmi_deps="mips"
  1051. altivec_deps="ppc"
  1052. ppc4xx_deps="ppc"
  1053. vis_deps="sparc"
  1054. x86_64_suggest="cmov fast_cmov"
  1055. amd3dnow_deps="mmx"
  1056. amd3dnowext_deps="amd3dnow"
  1057. mmx_deps="x86"
  1058. mmx2_deps="mmx"
  1059. sse_deps="mmx"
  1060. ssse3_deps="sse"
  1061. aligned_stack_if_any="ppc x86"
  1062. fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
  1063. fast_clz_if_any="alpha armv5te avr32 mips ppc x86"
  1064. fast_unaligned_if_any="armv6 ppc x86"
  1065. need_memalign="altivec neon sse"
  1066. inline_asm_deps="!tms470"
  1067. symver_if_any="symver_asm_label symver_gnu_asm"
  1068. # subsystems
  1069. dct_select="rdft"
  1070. mdct_select="fft"
  1071. rdft_select="fft"
  1072. # decoders / encoders / hardware accelerators
  1073. aac_decoder_select="mdct rdft"
  1074. aac_encoder_select="mdct"
  1075. aac_latm_decoder_select="aac_decoder aac_latm_parser"
  1076. ac3_decoder_select="mdct ac3_parser"
  1077. ac3_encoder_select="mdct"
  1078. alac_encoder_select="lpc"
  1079. amrnb_decoder_select="lsp"
  1080. amrwb_decoder_select="lsp"
  1081. atrac1_decoder_select="mdct"
  1082. atrac3_decoder_select="mdct"
  1083. binkaudio_dct_decoder_select="mdct rdft dct"
  1084. binkaudio_rdft_decoder_select="mdct rdft"
  1085. cavs_decoder_select="golomb"
  1086. cook_decoder_select="mdct"
  1087. cscd_decoder_suggest="zlib"
  1088. dca_decoder_select="mdct"
  1089. dnxhd_encoder_select="aandct"
  1090. dxa_decoder_select="zlib"
  1091. eac3_decoder_select="ac3_decoder"
  1092. eamad_decoder_select="aandct"
  1093. eatgq_decoder_select="aandct"
  1094. eatqi_decoder_select="aandct"
  1095. ffv1_decoder_select="golomb"
  1096. flac_decoder_select="golomb"
  1097. flac_encoder_select="golomb lpc"
  1098. flashsv_decoder_select="zlib"
  1099. flashsv_encoder_select="zlib"
  1100. flv_decoder_select="h263_decoder"
  1101. flv_encoder_select="h263_encoder"
  1102. fraps_decoder_select="huffman"
  1103. h261_encoder_select="aandct"
  1104. h263_decoder_select="h263_parser"
  1105. h263_encoder_select="aandct"
  1106. h263_vaapi_hwaccel_select="vaapi h263_decoder"
  1107. h263i_decoder_select="h263_decoder"
  1108. h263p_encoder_select="h263_encoder"
  1109. h264_decoder_select="golomb h264dsp h264pred"
  1110. h264_dxva2_hwaccel_deps="dxva2api_h"
  1111. h264_dxva2_hwaccel_select="dxva2 h264_decoder"
  1112. h264_vaapi_hwaccel_select="vaapi"
  1113. h264_vdpau_decoder_select="vdpau h264_decoder"
  1114. imc_decoder_select="fft mdct"
  1115. jpegls_decoder_select="golomb"
  1116. jpegls_encoder_select="golomb"
  1117. ljpeg_encoder_select="aandct"
  1118. loco_decoder_select="golomb"
  1119. mjpeg_encoder_select="aandct"
  1120. mlp_decoder_select="mlp_parser"
  1121. mp1float_decoder_select="dct"
  1122. mp2float_decoder_select="dct"
  1123. mp3adufloat_decoder_select="dct"
  1124. mp3float_decoder_select="dct"
  1125. mp3on4float_decoder_select="dct"
  1126. mpeg1video_encoder_select="aandct"
  1127. mpeg2video_encoder_select="aandct"
  1128. mpeg4_decoder_select="h263_decoder mpeg4video_parser"
  1129. mpeg4_encoder_select="h263_encoder"
  1130. mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder"
  1131. mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder"
  1132. mpeg2_dxva2_hwaccel_deps="dxva2api_h"
  1133. mpeg2_dxva2_hwaccel_select="dxva2 mpeg2video_decoder"
  1134. mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
  1135. mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
  1136. mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
  1137. mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
  1138. mpeg_xvmc_decoder_select="mpegvideo_decoder"
  1139. msmpeg4v1_decoder_select="h263_decoder"
  1140. msmpeg4v1_encoder_select="h263_encoder"
  1141. msmpeg4v2_decoder_select="h263_decoder"
  1142. msmpeg4v2_encoder_select="h263_encoder"
  1143. msmpeg4v3_decoder_select="h263_decoder"
  1144. msmpeg4v3_encoder_select="h263_encoder"
  1145. nellymoser_decoder_select="mdct"
  1146. nellymoser_encoder_select="mdct"
  1147. png_decoder_select="zlib"
  1148. png_encoder_select="zlib"
  1149. qcelp_decoder_select="lsp"
  1150. qdm2_decoder_select="mdct rdft"
  1151. ra_144_encoder_select="lpc"
  1152. rv10_decoder_select="h263_decoder"
  1153. rv10_encoder_select="h263_encoder"
  1154. rv20_decoder_select="h263_decoder"
  1155. rv20_encoder_select="h263_encoder"
  1156. rv30_decoder_select="golomb h264pred"
  1157. rv40_decoder_select="golomb h264pred"
  1158. shorten_decoder_select="golomb"
  1159. sipr_decoder_select="lsp"
  1160. snow_decoder_select="dwt"
  1161. snow_encoder_select="aandct dwt"
  1162. sonic_decoder_select="golomb"
  1163. sonic_encoder_select="golomb"
  1164. sonic_ls_encoder_select="golomb"
  1165. svq1_encoder_select="aandct"
  1166. svq3_decoder_select="golomb h264dsp h264pred"
  1167. svq3_decoder_suggest="zlib"
  1168. theora_decoder_select="vp3_decoder"
  1169. tiff_decoder_suggest="zlib"
  1170. tiff_encoder_suggest="zlib"
  1171. truehd_decoder_select="mlp_decoder"
  1172. tscc_decoder_select="zlib"
  1173. twinvq_decoder_select="mdct lsp"
  1174. vc1_decoder_select="h263_decoder"
  1175. vc1_dxva2_hwaccel_deps="dxva2api_h DXVA_PictureParameters_wDecodedPictureIndex"
  1176. vc1_dxva2_hwaccel_select="dxva2 vc1_decoder"
  1177. vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
  1178. vc1_vdpau_decoder_select="vdpau vc1_decoder"
  1179. vorbis_decoder_select="mdct"
  1180. vorbis_encoder_select="mdct"
  1181. vp6_decoder_select="huffman"
  1182. vp6a_decoder_select="vp6_decoder"
  1183. vp6f_decoder_select="vp6_decoder"
  1184. vp8_decoder_select="h264pred"
  1185. wmapro_decoder_select="mdct"
  1186. wmav1_decoder_select="mdct"
  1187. wmav1_encoder_select="mdct"
  1188. wmav2_decoder_select="mdct"
  1189. wmav2_encoder_select="mdct"
  1190. wmavoice_decoder_select="lsp rdft dct mdct"
  1191. wmv1_decoder_select="h263_decoder"
  1192. wmv1_encoder_select="h263_encoder"
  1193. wmv2_decoder_select="h263_decoder"
  1194. wmv2_encoder_select="h263_encoder"
  1195. wmv3_decoder_select="vc1_decoder"
  1196. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  1197. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  1198. wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
  1199. zlib_decoder_select="zlib"
  1200. zlib_encoder_select="zlib"
  1201. zmbv_decoder_select="zlib"
  1202. zmbv_encoder_select="zlib"
  1203. vaapi_deps="va_va_h"
  1204. vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1205. # parsers
  1206. h264_parser_select="golomb h264dsp h264pred"
  1207. # external libraries
  1208. libdirac_decoder_deps="libdirac !libschroedinger"
  1209. libdirac_encoder_deps="libdirac"
  1210. libfaac_encoder_deps="libfaac"
  1211. libgsm_decoder_deps="libgsm"
  1212. libgsm_encoder_deps="libgsm"
  1213. libgsm_ms_decoder_deps="libgsm"
  1214. libgsm_ms_encoder_deps="libgsm"
  1215. libmp3lame_encoder_deps="libmp3lame"
  1216. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  1217. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  1218. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  1219. libopenjpeg_decoder_deps="libopenjpeg"
  1220. libschroedinger_decoder_deps="libschroedinger"
  1221. libschroedinger_encoder_deps="libschroedinger"
  1222. libspeex_decoder_deps="libspeex"
  1223. libtheora_encoder_deps="libtheora"
  1224. libvorbis_encoder_deps="libvorbis"
  1225. libvpx_decoder_deps="libvpx"
  1226. libvpx_encoder_deps="libvpx"
  1227. libx264_encoder_deps="libx264"
  1228. libxavs_encoder_deps="libxavs"
  1229. libxvid_encoder_deps="libxvid"
  1230. # demuxers / muxers
  1231. ac3_demuxer_select="ac3_parser"
  1232. asf_stream_muxer_select="asf_muxer"
  1233. avisynth_demuxer_deps="avisynth"
  1234. dirac_demuxer_select="dirac_parser"
  1235. eac3_demuxer_select="ac3_parser"
  1236. flac_demuxer_select="flac_parser"
  1237. ipod_muxer_select="mov_muxer"
  1238. libnut_demuxer_deps="libnut"
  1239. libnut_muxer_deps="libnut"
  1240. matroska_audio_muxer_select="matroska_muxer"
  1241. matroska_demuxer_suggest="zlib bzlib"
  1242. mov_demuxer_suggest="zlib"
  1243. mp3_demuxer_select="mpegaudio_parser"
  1244. mp4_muxer_select="mov_muxer"
  1245. mpegtsraw_demuxer_select="mpegts_demuxer"
  1246. mxf_d10_muxer_select="mxf_muxer"
  1247. ogg_demuxer_select="golomb"
  1248. psp_muxer_select="mov_muxer"
  1249. rtp_demuxer_select="sdp_demuxer"
  1250. rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer"
  1251. rtsp_demuxer_select="http_protocol rtpdec"
  1252. rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol"
  1253. sap_demuxer_select="sdp_demuxer"
  1254. sap_muxer_select="rtp_muxer rtp_protocol"
  1255. sdp_demuxer_select="rtpdec"
  1256. spdif_muxer_select="aac_parser"
  1257. tg2_muxer_select="mov_muxer"
  1258. tgp_muxer_select="mov_muxer"
  1259. w64_demuxer_deps="wav_demuxer"
  1260. # indevs / outdevs
  1261. alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  1262. alsa_outdev_deps="alsa_asoundlib_h"
  1263. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  1264. dv1394_indev_deps="dv1394 dv_demuxer"
  1265. jack_indev_deps="jack_jack_h"
  1266. libdc1394_indev_deps="libdc1394"
  1267. oss_indev_deps_any="soundcard_h sys_soundcard_h"
  1268. oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  1269. v4l_indev_deps="linux_videodev_h"
  1270. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  1271. vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
  1272. vfwcap_indev_extralibs="-lavicap32"
  1273. x11_grab_device_indev_deps="x11grab XShmCreateImage"
  1274. x11_grab_device_indev_extralibs="-lX11 -lXext -lXfixes"
  1275. # protocols
  1276. gopher_protocol_deps="network"
  1277. http_protocol_deps="network"
  1278. http_protocol_select="tcp_protocol"
  1279. mmsh_protocol_select="http_protocol"
  1280. mmst_protocol_deps="network"
  1281. rtmp_protocol_select="tcp_protocol"
  1282. rtp_protocol_select="udp_protocol"
  1283. tcp_protocol_deps="network"
  1284. udp_protocol_deps="network"
  1285. # filters
  1286. blackframe_filter_deps="gpl"
  1287. cropdetect_filter_deps="gpl"
  1288. frei0r_filter_deps="frei0r dlopen strtok_r"
  1289. frei0r_src_filter_deps="frei0r dlopen strtok_r"
  1290. hqdn3d_filter_deps="gpl"
  1291. scale_filter_deps="swscale"
  1292. ocv_filter_deps="libopencv"
  1293. yadif_filter_deps="gpl"
  1294. # libraries
  1295. avdevice_deps="avcodec avformat"
  1296. avformat_deps="avcodec"
  1297. # programs
  1298. ffmpeg_deps="avcodec avformat swscale"
  1299. ffmpeg_select="buffer_filter"
  1300. ffplay_deps="avcodec avformat swscale sdl"
  1301. ffplay_select="rdft"
  1302. ffprobe_deps="avcodec avformat"
  1303. ffserver_deps="avformat ffm_muxer rtp_protocol rtsp_demuxer"
  1304. ffserver_extralibs='$ldl'
  1305. doc_deps="texi2html"
  1306. # tests
  1307. test_deps(){
  1308. suf1=$1
  1309. suf2=$2
  1310. shift 2
  1311. for v; do
  1312. dep=${v%=*}
  1313. tests=${v#*=}
  1314. for name in ${tests}; do
  1315. eval ${name}_test_deps="'${dep}$suf1 ${dep}$suf2'"
  1316. done
  1317. done
  1318. }
  1319. set_ne_test_deps(){
  1320. eval ${1}_be_test_deps="bigendian"
  1321. eval ${1}_le_test_deps="!bigendian"
  1322. }
  1323. test_deps _encoder _decoder \
  1324. adpcm_g726=g726 \
  1325. adpcm_ima_qt \
  1326. adpcm_ima_wav \
  1327. adpcm_ms \
  1328. adpcm_swf \
  1329. adpcm_yamaha=adpcm_yam \
  1330. alac \
  1331. asv1 \
  1332. asv2 \
  1333. bmp \
  1334. dnxhd="dnxhd_1080i dnxhd_720p dnxhd_720p_rd" \
  1335. dvvideo="dv dv50" \
  1336. ffv1 \
  1337. flac \
  1338. flashsv \
  1339. flv \
  1340. gif \
  1341. h261 \
  1342. h263="h263 h263p" \
  1343. huffyuv \
  1344. jpegls \
  1345. mjpeg="jpg mjpeg ljpeg" \
  1346. mp2 \
  1347. mpeg1video="mpeg mpeg1b" \
  1348. mpeg2video="mpeg2 mpeg2thread" \
  1349. mpeg4="mpeg4 mpeg4adv mpeg4nr mpeg4thread error rc" \
  1350. msmpeg4v3=msmpeg4 \
  1351. msmpeg4v2 \
  1352. pbm=pbmpipe \
  1353. pcx \
  1354. pgm="pgm pgmpipe" \
  1355. png \
  1356. ppm="ppm ppmpipe" \
  1357. rawvideo="rgb yuv" \
  1358. roq \
  1359. rv10 \
  1360. rv20 \
  1361. sgi \
  1362. snow="snow snowll" \
  1363. svq1 \
  1364. targa=tga \
  1365. tiff \
  1366. wmav1 \
  1367. wmav2 \
  1368. wmv1 \
  1369. wmv2 \
  1370. test_deps _muxer _demuxer \
  1371. aiff \
  1372. pcm_alaw=alaw \
  1373. asf \
  1374. au \
  1375. avi \
  1376. dv=dv_fmt \
  1377. ffm \
  1378. flv=flv_fmt \
  1379. gxf \
  1380. matroska=mkv \
  1381. mmf \
  1382. mov \
  1383. pcm_mulaw=mulaw \
  1384. mxf \
  1385. nut \
  1386. ogg \
  1387. rawvideo=pixfmt \
  1388. rm \
  1389. swf \
  1390. mpegts=ts \
  1391. voc \
  1392. wav \
  1393. yuv4mpegpipe=yuv4mpeg \
  1394. ac3_fixed_test_deps="ac3_fixed_encoder ac3_decoder rm_muxer rm_demuxer"
  1395. mpg_test_deps="mpeg1system_muxer mpegps_demuxer"
  1396. set_ne_test_deps pixdesc
  1397. set_ne_test_deps pixfmts_copy
  1398. set_ne_test_deps pixfmts_crop
  1399. set_ne_test_deps pixfmts_hflip
  1400. set_ne_test_deps pixfmts_null
  1401. set_ne_test_deps pixfmts_pad
  1402. set_ne_test_deps pixfmts_scale
  1403. set_ne_test_deps pixfmts_vflip
  1404. # default parameters
  1405. logfile="config.log"
  1406. # installation paths
  1407. prefix_default="/usr/local"
  1408. bindir_default='${prefix}/bin'
  1409. datadir_default='${prefix}/share/ffmpeg'
  1410. incdir_default='${prefix}/include'
  1411. libdir_default='${prefix}/lib'
  1412. mandir_default='${prefix}/share/man'
  1413. shlibdir_default="$libdir_default"
  1414. # toolchain
  1415. ar_default="ar"
  1416. cc_default="gcc"
  1417. cc_version=\"unknown\"
  1418. host_cc_default="gcc"
  1419. ln_s="ln -sf"
  1420. nm_default="nm"
  1421. objformat="elf"
  1422. ranlib="ranlib"
  1423. strip_default="strip"
  1424. yasmexe="yasm"
  1425. nogas=":"
  1426. nm_opts='-g'
  1427. # machine
  1428. arch_default=$(uname -m)
  1429. cpu="generic"
  1430. # OS
  1431. target_os_default=$(tolower $(uname -s))
  1432. host_os=$target_os_default
  1433. # configurable options
  1434. enable avcodec
  1435. enable avcore
  1436. enable avdevice
  1437. enable avfilter
  1438. enable avformat
  1439. enable avutil
  1440. enable asm
  1441. enable debug
  1442. enable doc
  1443. enable fastdiv
  1444. enable ffmpeg
  1445. enable ffplay
  1446. enable ffprobe
  1447. enable ffserver
  1448. enable mpegaudio_hp
  1449. enable network
  1450. enable optimizations
  1451. enable protocols
  1452. enable static
  1453. enable stripping
  1454. enable swscale
  1455. enable swscale_alpha
  1456. # build settings
  1457. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  1458. FFSERVERLDFLAGS=-Wl,-E
  1459. LIBPREF="lib"
  1460. LIBSUF=".a"
  1461. FULLNAME='$(NAME)$(BUILDSUF)'
  1462. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  1463. SLIBPREF="lib"
  1464. SLIBSUF=".so"
  1465. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  1466. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  1467. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  1468. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  1469. CC_O='-o $@'
  1470. host_cflags='-D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -O3 -g -Wall'
  1471. host_libs='-lm'
  1472. target_path='$(CURDIR)'
  1473. # since the object filename is not given with the -MM flag, the compiler
  1474. # is only able to print the basename, and we must add the path ourselves
  1475. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  1476. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM'
  1477. # find source path
  1478. source_path="$(dirname "$0")"
  1479. enable source_path_used
  1480. if test -f configure; then
  1481. source_path="$(pwd)"
  1482. disable source_path_used
  1483. else
  1484. source_path="$(cd "$source_path"; pwd)"
  1485. echo "$source_path" | grep -q '[[:blank:]]' &&
  1486. die "Out of tree builds are impossible with whitespace in source path."
  1487. test -e "$source_path/config.h" &&
  1488. die "Out of tree builds are impossible with config.h in source dir."
  1489. fi
  1490. for v in "$@"; do
  1491. r=${v#*=}
  1492. l=${v%"$r"}
  1493. r=$(sh_quote "$r")
  1494. FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
  1495. done
  1496. find_things(){
  1497. thing=$1
  1498. pattern=$2
  1499. file=$source_path/$3
  1500. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  1501. }
  1502. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  1503. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  1504. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  1505. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  1506. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  1507. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  1508. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  1509. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  1510. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  1511. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  1512. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  1513. find_tests(){
  1514. map "echo ${2}\${v}_test" $(ls "$source_path"/tests/ref/$1 | grep -v '[^-a-z0-9_]')
  1515. }
  1516. ACODEC_TESTS=$(find_tests acodec)
  1517. VCODEC_TESTS=$(find_tests vsynth1)
  1518. LAVF_TESTS=$(find_tests lavf)
  1519. LAVFI_TESTS=$(find_tests lavfi)
  1520. SEEK_TESTS=$(find_tests seek seek_)
  1521. pcm_test_deps=$(map 'echo ${v%_*}_decoder $v' $(filter pcm_* $ENCODER_LIST))
  1522. for n in $COMPONENT_LIST; do
  1523. v=$(toupper ${n%s})_LIST
  1524. eval enable \$$v
  1525. eval ${n}_if_any="\$$v"
  1526. done
  1527. enable $ARCH_EXT_LIST $ACODEC_TESTS $VCODEC_TESTS $LAVF_TESTS $LAVFI_TESTS $SEEK_TESTS
  1528. die_unknown(){
  1529. echo "Unknown option \"$1\"."
  1530. echo "See $0 --help for available options."
  1531. exit 1
  1532. }
  1533. show_list() {
  1534. suffix=_$1
  1535. shift
  1536. echo $* | sed s/$suffix//g | tr ' ' '\n' | sort | pr -3 -t
  1537. exit 0
  1538. }
  1539. for opt do
  1540. optval="${opt#*=}"
  1541. case "$opt" in
  1542. --extra-ldflags=*) add_ldflags $optval
  1543. ;;
  1544. --extra-libs=*) add_extralibs $optval
  1545. ;;
  1546. --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
  1547. ;;
  1548. --enable-debug=*) debuglevel="$optval"
  1549. ;;
  1550. --disable-everything)
  1551. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  1552. ;;
  1553. --enable-*=*|--disable-*=*)
  1554. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  1555. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  1556. eval list=\$$(toupper $thing)_LIST
  1557. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  1558. $action $(filter "$name" $list)
  1559. ;;
  1560. --enable-?*|--disable-?*)
  1561. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  1562. if is_in $option $COMPONENT_LIST; then
  1563. test $action = disable && action=unset
  1564. eval $action \$$(toupper ${option%s})_LIST
  1565. elif is_in $option $CMDLINE_SELECT; then
  1566. $action $option
  1567. else
  1568. die_unknown $opt
  1569. fi
  1570. ;;
  1571. --list-*)
  1572. NAME="${opt#--list-}"
  1573. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  1574. NAME=${NAME%s}
  1575. eval show_list $NAME \$$(toupper $NAME)_LIST
  1576. ;;
  1577. --help|-h) show_help
  1578. ;;
  1579. *)
  1580. optname="${opt%%=*}"
  1581. optname="${optname#--}"
  1582. optname=$(echo "$optname" | sed 's/-/_/g')
  1583. if is_in $optname $CMDLINE_SET; then
  1584. eval $optname='$optval'
  1585. elif is_in $optname $CMDLINE_APPEND; then
  1586. append $optname "$optval"
  1587. else
  1588. die_unknown $opt
  1589. fi
  1590. ;;
  1591. esac
  1592. done
  1593. disabled logging && logfile=/dev/null
  1594. echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
  1595. set >> $logfile
  1596. test -n "$cross_prefix" && enable cross_compile
  1597. if enabled cross_compile; then
  1598. test -n "$arch" && test -n "$target_os" ||
  1599. die "Must specify target arch and OS when cross-compiling"
  1600. fi
  1601. set_default arch target_os
  1602. ar_default="${cross_prefix}${ar_default}"
  1603. cc_default="${cross_prefix}${cc_default}"
  1604. nm_default="${cross_prefix}${nm_default}"
  1605. ranlib="${cross_prefix}${ranlib}"
  1606. strip_default="${cross_prefix}${strip_default}"
  1607. sysinclude_default="${sysroot}/usr/include"
  1608. set_default cc nm strip sysinclude
  1609. enabled cross_compile || host_cc_default=$cc
  1610. set_default host_cc
  1611. exesuf() {
  1612. case $1 in
  1613. mingw32*|cygwin*|*-dos|freedos|opendos|os/2*) echo .exe ;;
  1614. esac
  1615. }
  1616. EXESUF=$(exesuf $target_os)
  1617. HOSTEXESUF=$(exesuf $host_os)
  1618. # set temporary file name
  1619. : ${TMPDIR:=$TEMPDIR}
  1620. : ${TMPDIR:=$TMP}
  1621. : ${TMPDIR:=/tmp}
  1622. if ! check_cmd mktemp -u XXXXXX; then
  1623. # simple replacement for missing mktemp
  1624. # NOT SAFE FOR GENERAL USE
  1625. mktemp(){
  1626. echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  1627. }
  1628. fi
  1629. tmpfile(){
  1630. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  1631. (set -C; exec > $tmp) 2>/dev/null ||
  1632. die "Unable to create temporary file in $TMPDIR."
  1633. append TMPFILES $tmp
  1634. eval $1=$tmp
  1635. }
  1636. trap 'rm -f -- $TMPFILES' EXIT
  1637. tmpfile TMPC .c
  1638. tmpfile TMPE $EXESUF
  1639. tmpfile TMPH .h
  1640. tmpfile TMPO .o
  1641. tmpfile TMPS .S
  1642. tmpfile TMPV .ver
  1643. tmpfile TMPSH .sh
  1644. tmpfile TMPASM .asm
  1645. unset -f mktemp
  1646. chmod +x $TMPE
  1647. # make sure we can execute files in $TMPDIR
  1648. cat > $TMPSH 2>> $logfile <<EOF
  1649. #! /bin/sh
  1650. EOF
  1651. chmod +x $TMPSH >> $logfile 2>&1
  1652. if ! $TMPSH >> $logfile 2>&1; then
  1653. cat <<EOF
  1654. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  1655. variable to another directory and make sure that it is not mounted noexec.
  1656. EOF
  1657. die "Sanity test failed."
  1658. fi
  1659. filter_cflags=echo
  1660. filter_cppflags=echo
  1661. filter_asflags=echo
  1662. if $cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  1663. cc_type=llvm_gcc
  1664. cc_version=__VERSION__
  1665. gcc_extra_ver=$(expr "$($cc --version | head -n1)" : '.*\((.*)\)')
  1666. cc_ident="llvm-gcc $($cc -dumpversion) $gcc_extra_ver"
  1667. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1668. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1669. speed_cflags='-O3'
  1670. size_cflags='-Os'
  1671. elif $cc -v 2>&1 | grep -qi ^gcc; then
  1672. cc_type=gcc
  1673. cc_version=__VERSION__
  1674. gcc_extra_ver=$(expr "$($cc --version | head -n1)" : '.*\((.*)\)')
  1675. cc_ident="gcc $($cc -dumpversion) $gcc_extra_ver"
  1676. if ! $cc -dumpversion | grep -q '^2\.'; then
  1677. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1678. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1679. fi
  1680. speed_cflags='-O3'
  1681. size_cflags='-Os'
  1682. elif $cc --version 2>/dev/null | grep -q Intel; then
  1683. cc_type=icc
  1684. cc_version="AV_STRINGIFY(__INTEL_COMPILER)"
  1685. cc_ident=$($cc --version | head -n1)
  1686. icc_version=$($cc -dumpversion)
  1687. CC_DEPFLAGS='-MMD'
  1688. AS_DEPFLAGS='-MMD'
  1689. speed_cflags='-O3'
  1690. size_cflags='-Os'
  1691. noopt_cflags='-O1'
  1692. elif $cc -v 2>&1 | grep -q xlc; then
  1693. cc_type=xlc
  1694. cc_version="AV_STRINGIFY(__IBMC__)"
  1695. cc_ident=$($cc -qversion 2>/dev/null | head -n1)
  1696. speed_cflags='-O5'
  1697. size_cflags='-O5 -qcompact'
  1698. elif $cc -V 2>/dev/null | grep -q Compaq; then
  1699. cc_type=ccc
  1700. cc_version="AV_STRINGIFY(__DECC_VER)"
  1701. cc_ident=$($cc -V | head -n1 | cut -d' ' -f1-3)
  1702. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M'
  1703. debuglevel=3
  1704. add_ldflags -Wl,-z,now # calls to libots crash without this
  1705. speed_cflags='-fast'
  1706. size_cflags='-O1'
  1707. elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
  1708. test -d "$sysroot" || die "No valid sysroot specified."
  1709. cc_type=armcc
  1710. cc_version="AV_STRINGIFY(__ARMCC_VERSION)"
  1711. cc_ident=$($cc --vsn | head -n1)
  1712. armcc_conf="$PWD/armcc.conf"
  1713. $cc --arm_linux_configure \
  1714. --arm_linux_config_file="$armcc_conf" \
  1715. --configure_sysroot="$sysroot" \
  1716. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  1717. die "Error creating armcc configuration file."
  1718. $cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  1719. cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc"
  1720. as_default="${cross_prefix}gcc"
  1721. CC_DEPFLAGS='-MMD'
  1722. AS_DEPFLAGS='-MMD'
  1723. speed_cflags='-O3'
  1724. size_cflags='-Os'
  1725. elif $cc -version 2>/dev/null | grep -q TMS470; then
  1726. cc_type=tms470
  1727. cc_version="AV_STRINGIFY(__TI_COMPILER_VERSION__)"
  1728. cc_ident=$($cc -version | head -n1 | tr -s ' ')
  1729. cc="$cc --gcc --abi=eabi -eo=.o -mc -me"
  1730. CC_O='-fr=$(@D)'
  1731. as_default="${cross_prefix}gcc"
  1732. ld_default="${cross_prefix}gcc"
  1733. TMPO=$(basename $TMPC .c).o
  1734. append TMPFILES $TMPO
  1735. add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__=
  1736. CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)'
  1737. AS_DEPFLAGS='-MMD'
  1738. speed_cflags='-O3 -mf=5'
  1739. size_cflags='-O3 -mf=2'
  1740. filter_cflags=tms470_flags
  1741. tms470_flags(){
  1742. for flag; do
  1743. case $flag in
  1744. -march=*|-mcpu=*)
  1745. case "${flag#*=}" in
  1746. armv7-a|cortex-a*) echo -mv=7a8 ;;
  1747. armv7-r|cortex-r*) echo -mv=7r4 ;;
  1748. armv7-m|cortex-m*) echo -mv=7m3 ;;
  1749. armv6*|arm11*) echo -mv=6 ;;
  1750. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  1751. echo -mv=5e ;;
  1752. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  1753. esac
  1754. ;;
  1755. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  1756. -mfpu=vfp) echo --float_support=vfpv2 ;;
  1757. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  1758. -msoft-float) echo --float_support=vfplib ;;
  1759. -O[0-3]|-mf=*) echo $flag ;;
  1760. -g) echo -g -mn ;;
  1761. -pds=*) echo $flag ;;
  1762. esac
  1763. done
  1764. }
  1765. elif $cc -v 2>&1 | grep -q clang; then
  1766. cc_type=clang
  1767. $cc -dM -E $TMPC | grep -q __clang_version__ &&
  1768. cc_version=__clang_version__ || cc_version=__VERSION__
  1769. cc_ident=$($cc --version | head -n1)
  1770. CC_DEPFLAGS='-MMD'
  1771. AS_DEPFLAGS='-MMD'
  1772. speed_cflags='-O3'
  1773. size_cflags='-Os'
  1774. elif $cc -V 2>&1 | grep -q Sun; then
  1775. cc_type=suncc
  1776. cc_version="AV_STRINGIFY(__SUNPRO_C)"
  1777. cc_ident=$($cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  1778. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  1779. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1'
  1780. speed_cflags='-O5'
  1781. size_cflags='-O5 -xspace'
  1782. filter_cflags=suncc_flags
  1783. suncc_flags(){
  1784. for flag; do
  1785. case $flag in
  1786. -march=*|-mcpu=*)
  1787. case "${flag#*=}" in
  1788. native) echo -xtarget=native ;;
  1789. v9|niagara) echo -xarch=sparc ;;
  1790. ultrasparc) echo -xarch=sparcvis ;;
  1791. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  1792. i586|pentium) echo -xchip=pentium ;;
  1793. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  1794. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  1795. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  1796. pentium4*) echo -xtarget=pentium4 ;;
  1797. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  1798. *-sse3) echo -xarch=sse3 ;;
  1799. core2) echo -xarch=ssse3 -xchip=core2 ;;
  1800. amdfam10|barcelona) echo -xarch=sse4_1 ;;
  1801. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  1802. k8|opteron|athlon64|athlon-fx)
  1803. echo -xarch=sse2a ;;
  1804. athlon*) echo -xarch=pentium_proa ;;
  1805. esac
  1806. ;;
  1807. -std=c99) echo -xc99 ;;
  1808. -fomit-frame-pointer) echo -xregs=frameptr ;;
  1809. -fPIC) echo -KPIC -xcode=pic32 ;;
  1810. -W*,*) echo $flag ;;
  1811. -f*-*|-W*) ;;
  1812. *) echo $flag ;;
  1813. esac
  1814. done
  1815. }
  1816. elif $cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  1817. cc_type=pathscale
  1818. cc_version=__PATHSCALE__
  1819. cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
  1820. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1821. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1822. speed_cflags='-O2'
  1823. size_cflags='-Os'
  1824. elif $cc -v 2>&1 | grep -q Open64; then
  1825. cc_type=open64
  1826. cc_version=__OPEN64__
  1827. cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
  1828. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1829. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1830. speed_cflags='-O2'
  1831. size_cflags='-Os'
  1832. fi
  1833. test -n "$cc_type" && enable $cc_type ||
  1834. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  1835. : ${as_default:=$cc}
  1836. : ${dep_cc_default:=$cc}
  1837. : ${ld_default:=$cc}
  1838. set_default ar as dep_cc ld
  1839. test -n "$CC_DEPFLAGS" || CCDEP=$DEPEND_CMD
  1840. test -n "$AS_DEPFLAGS" || ASDEP=$DEPEND_CMD
  1841. add_cflags $extra_cflags
  1842. add_asflags $extra_cflags
  1843. if test -n "$sysroot"; then
  1844. case "$cc_type" in
  1845. gcc|llvm_gcc)
  1846. add_cppflags --sysroot="$sysroot"
  1847. add_ldflags --sysroot="$sysroot"
  1848. ;;
  1849. tms470)
  1850. add_cppflags -I"$sysinclude"
  1851. add_ldflags --sysroot="$sysroot"
  1852. ;;
  1853. clang)
  1854. add_cppflags -isysroot "$sysroot"
  1855. add_ldflags -isysroot "$sysroot"
  1856. ;;
  1857. esac
  1858. fi
  1859. if test "$cpu" = host; then
  1860. enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
  1861. case "$cc_type" in
  1862. gcc|llvm_gcc)
  1863. check_native(){
  1864. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  1865. sed -n "/$1=/{
  1866. s/.*$1=\\([^ ]*\\).*/\\1/
  1867. p
  1868. q
  1869. }" $TMPE
  1870. }
  1871. cpu=$(check_native -march || check_native -mcpu)
  1872. ;;
  1873. esac
  1874. test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
  1875. fi
  1876. # Deal with common $arch aliases
  1877. case "$arch" in
  1878. arm*)
  1879. arch="arm"
  1880. ;;
  1881. mips|mipsel|IP*)
  1882. arch="mips"
  1883. ;;
  1884. mips64*)
  1885. arch="mips"
  1886. subarch="mips64"
  1887. ;;
  1888. parisc|hppa)
  1889. arch="parisc"
  1890. ;;
  1891. parisc64|hppa64)
  1892. arch="parisc"
  1893. subarch="parisc64"
  1894. ;;
  1895. "Power Macintosh"|ppc|powerpc)
  1896. arch="ppc"
  1897. ;;
  1898. ppc64|powerpc64)
  1899. arch="ppc"
  1900. subarch="ppc64"
  1901. ;;
  1902. s390|s390x)
  1903. arch="s390"
  1904. ;;
  1905. sh4|sh)
  1906. arch="sh4"
  1907. ;;
  1908. sun4u|sparc64)
  1909. arch="sparc"
  1910. subarch="sparc64"
  1911. ;;
  1912. i[3-6]86|i86pc|BePC|x86_64|amd64)
  1913. arch="x86"
  1914. ;;
  1915. esac
  1916. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  1917. enable $arch
  1918. # Add processor-specific flags
  1919. if test "$cpu" = generic; then
  1920. : do nothing
  1921. elif enabled ppc; then
  1922. case $(tolower $cpu) in
  1923. 601|ppc601|powerpc601)
  1924. cpuflags="-mcpu=601"
  1925. disable altivec
  1926. ;;
  1927. 603*|ppc603*|powerpc603*)
  1928. cpuflags="-mcpu=603"
  1929. disable altivec
  1930. ;;
  1931. 604*|ppc604*|powerpc604*)
  1932. cpuflags="-mcpu=604"
  1933. disable altivec
  1934. ;;
  1935. g3|75*|ppc75*|powerpc75*)
  1936. cpuflags="-mcpu=750 -mpowerpc-gfxopt"
  1937. disable altivec
  1938. ;;
  1939. g4|745*|ppc745*|powerpc745*)
  1940. cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
  1941. ;;
  1942. 74*|ppc74*|powerpc74*)
  1943. cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
  1944. ;;
  1945. g5|970|ppc970|powerpc970|power4*)
  1946. cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
  1947. ;;
  1948. cell)
  1949. cpuflags="-mcpu=cell"
  1950. enable ldbrx
  1951. ;;
  1952. e500v2)
  1953. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  1954. disable altivec
  1955. ;;
  1956. e500)
  1957. cpuflags="-mcpu=8540 -mhard-float"
  1958. disable altivec
  1959. ;;
  1960. esac
  1961. elif enabled x86; then
  1962. case $cpu in
  1963. i[345]86|pentium)
  1964. cpuflags="-march=$cpu"
  1965. disable mmx
  1966. ;;
  1967. # targets that do NOT support conditional mov (cmov)
  1968. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  1969. cpuflags="-march=$cpu"
  1970. disable cmov
  1971. ;;
  1972. # targets that do support conditional mov (cmov)
  1973. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2|amdfam10|barcelona|atom)
  1974. cpuflags="-march=$cpu"
  1975. enable cmov
  1976. enable fast_cmov
  1977. ;;
  1978. # targets that do support conditional mov but on which it's slow
  1979. pentium4|pentium4m|prescott|nocona)
  1980. cpuflags="-march=$cpu"
  1981. enable cmov
  1982. disable fast_cmov
  1983. ;;
  1984. esac
  1985. elif enabled sparc; then
  1986. case $cpu in
  1987. niagara)
  1988. cpuflags="-mcpu=$cpu"
  1989. disable vis
  1990. ;;
  1991. sparc64)
  1992. cpuflags="-mcpu=v9"
  1993. ;;
  1994. esac
  1995. elif enabled arm; then
  1996. case $cpu in
  1997. armv*)
  1998. cpuflags="-march=$cpu"
  1999. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  2000. ;;
  2001. *)
  2002. cpuflags="-mcpu=$cpu"
  2003. case $cpu in
  2004. cortex-a*) subarch=armv7a ;;
  2005. cortex-r*) subarch=armv7r ;;
  2006. cortex-m*) subarch=armv7m ;;
  2007. arm11*) subarch=armv6 ;;
  2008. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  2009. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  2010. esac
  2011. ;;
  2012. esac
  2013. elif enabled alpha; then
  2014. enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
  2015. elif enabled bfin; then
  2016. cpuflags="-mcpu=$cpu"
  2017. elif enabled mips; then
  2018. cpuflags="-march=$cpu"
  2019. elif enabled avr32; then
  2020. case $cpu in
  2021. ap7[02]0[0-2])
  2022. subarch="avr32_ap"
  2023. cpuflags="-mpart=$cpu"
  2024. ;;
  2025. ap)
  2026. subarch="avr32_ap"
  2027. cpuflags="-march=$cpu"
  2028. ;;
  2029. uc3[ab]*)
  2030. subarch="avr32_uc"
  2031. cpuflags="-mcpu=$cpu"
  2032. ;;
  2033. uc)
  2034. subarch="avr32_uc"
  2035. cpuflags="-march=$cpu"
  2036. ;;
  2037. esac
  2038. fi
  2039. add_cflags $cpuflags
  2040. add_asflags $cpuflags
  2041. # compiler sanity check
  2042. check_exec <<EOF
  2043. int main(void){ return 0; }
  2044. EOF
  2045. if test "$?" != 0; then
  2046. echo "$cc is unable to create an executable file."
  2047. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  2048. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  2049. echo "Only do this if you know what cross compiling means."
  2050. fi
  2051. die "C compiler test failed."
  2052. fi
  2053. add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
  2054. check_cflags -std=c99
  2055. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  2056. #include <stdlib.h>
  2057. EOF
  2058. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  2059. #include <stdlib.h>
  2060. EOF
  2061. check_host_cflags -std=c99
  2062. case "$arch" in
  2063. alpha|ia64|mips|parisc|sparc)
  2064. spic=$shared
  2065. ;;
  2066. x86)
  2067. subarch="x86_32"
  2068. check_cc <<EOF && subarch="x86_64"
  2069. int test[(int)sizeof(char*) - 7];
  2070. EOF
  2071. if test "$subarch" = "x86_64"; then
  2072. spic=$shared
  2073. fi
  2074. ;;
  2075. esac
  2076. enable $subarch
  2077. enabled spic && enable pic
  2078. # OS specific
  2079. case $target_os in
  2080. haiku)
  2081. prefix_default="/boot/common"
  2082. network_extralibs="-lnetwork"
  2083. ;;
  2084. sunos)
  2085. FFSERVERLDFLAGS=""
  2086. SHFLAGS='-shared -Wl,-h,$$(@F)'
  2087. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  2088. network_extralibs="-lsocket -lnsl"
  2089. add_cppflags -D__EXTENSIONS__
  2090. nm_opts='-P -g'
  2091. ;;
  2092. netbsd)
  2093. disable symver
  2094. oss_indev_extralibs="-lossaudio"
  2095. oss_outdev_extralibs="-lossaudio"
  2096. add_cppflags -D_XOPEN_SOURCE=600
  2097. ;;
  2098. openbsd)
  2099. enable malloc_aligned
  2100. # On OpenBSD 4.5. the compiler does not use PIC unless
  2101. # explicitly using -fPIC. FFmpeg builds fine without PIC,
  2102. # however the generated executable will not do anything
  2103. # (simply quits with exit-code 1, no crash, no output).
  2104. # Thus explicitly enable PIC here.
  2105. enable pic
  2106. disable symver
  2107. SHFLAGS='-shared'
  2108. oss_indev_extralibs="-lossaudio"
  2109. oss_outdev_extralibs="-lossaudio"
  2110. ;;
  2111. dragonfly)
  2112. enable malloc_aligned
  2113. disable symver
  2114. ;;
  2115. freebsd)
  2116. enable malloc_aligned
  2117. ;;
  2118. bsd/os)
  2119. add_extralibs -lpoll -lgnugetopt
  2120. strip="strip -d"
  2121. ;;
  2122. darwin)
  2123. enable malloc_aligned
  2124. gas="gas-preprocessor.pl $cc"
  2125. enabled ppc && add_asflags -force_cpusubtype_ALL
  2126. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
  2127. strip="${strip} -x"
  2128. add_ldflags -Wl,-dynamic,-search_paths_first
  2129. SLIBSUF=".dylib"
  2130. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  2131. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  2132. FFSERVERLDFLAGS=-Wl,-bind_at_load
  2133. objformat="macho"
  2134. enabled x86_64 && objformat="macho64"
  2135. enabled_any pic shared ||
  2136. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  2137. ;;
  2138. mingw32*)
  2139. if test $target_os = "mingw32ce"; then
  2140. disable network
  2141. else
  2142. target_os=mingw32
  2143. fi
  2144. LIBTARGET=i386
  2145. if enabled x86_64; then
  2146. enable malloc_aligned
  2147. LIBTARGET=x64
  2148. elif enabled arm; then
  2149. LIBTARGET=arm
  2150. fi
  2151. shlibdir_default="$bindir_default"
  2152. disable ffserver
  2153. SLIBPREF=""
  2154. SLIBSUF=".dll"
  2155. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2156. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2157. SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
  2158. SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
  2159. install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"; \
  2160. install -d "$(LIBDIR)"; \
  2161. install -m 644 $(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) "$(LIBDIR)/lib$(SLIBNAME:$(SLIBSUF)=.dll.a)"'
  2162. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
  2163. 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'
  2164. objformat="win32"
  2165. enable dos_paths
  2166. check_cflags -fno-common
  2167. check_cpp_condition _mingw.h "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) \
  2168. || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  2169. die "ERROR: MinGW runtime version must be >= 3.15."
  2170. ;;
  2171. cygwin*)
  2172. target_os=cygwin
  2173. shlibdir_default="$bindir_default"
  2174. SLIBPREF="cyg"
  2175. SLIBSUF=".dll"
  2176. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2177. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2178. SHFLAGS='-shared -Wl,--enable-auto-image-base'
  2179. objformat="win32"
  2180. enable dos_paths
  2181. check_cflags -fno-common
  2182. ;;
  2183. *-dos|freedos|opendos)
  2184. disable ffplay ffserver
  2185. disable $INDEV_LIST $OUTDEV_LIST
  2186. network_extralibs="-lsocket"
  2187. objformat="coff"
  2188. enable dos_paths
  2189. ;;
  2190. linux)
  2191. enable dv1394
  2192. ;;
  2193. irix*)
  2194. target_os=irix
  2195. ranlib="echo ignoring ranlib"
  2196. ;;
  2197. os/2*)
  2198. strip="lxlite"
  2199. ln_s="cp -f"
  2200. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  2201. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  2202. FFSERVERLDFLAGS=""
  2203. LIBSUF="_s.a"
  2204. SLIBPREF=""
  2205. SLIBSUF=".dll"
  2206. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  2207. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  2208. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  2209. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  2210. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  2211. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  2212. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  2213. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  2214. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  2215. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  2216. SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
  2217. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
  2218. enable dos_paths
  2219. ;;
  2220. gnu/kfreebsd)
  2221. ;;
  2222. gnu)
  2223. ;;
  2224. none)
  2225. ;;
  2226. *)
  2227. die "Unknown OS '$target_os'."
  2228. ;;
  2229. esac
  2230. echo "config:$arch:$subarch:$cpu:$target_os:$cc_ident:$FFMPEG_CONFIGURATION" >config.fate
  2231. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
  2232. set_default $PATHS_LIST
  2233. # we need to build at least one lib type
  2234. if ! enabled_any static shared; then
  2235. cat <<EOF
  2236. At least one library type must be built.
  2237. Specify --enable-static to build the static libraries or --enable-shared to
  2238. build the shared libraries as well. To only build the shared libraries specify
  2239. --disable-static in addition to --enable-shared.
  2240. EOF
  2241. exit 1;
  2242. fi
  2243. disabled static && LIBNAME=""
  2244. die_license_disabled() {
  2245. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  2246. }
  2247. die_license_disabled gpl libx264
  2248. die_license_disabled gpl libxavs
  2249. die_license_disabled gpl libxvid
  2250. die_license_disabled gpl postproc
  2251. die_license_disabled gpl x11grab
  2252. die_license_disabled nonfree libfaac
  2253. die_license_disabled version3 libopencore_amrnb
  2254. die_license_disabled version3 libopencore_amrwb
  2255. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  2256. check_deps $ARCH_EXT_LIST
  2257. disabled optimizations || check_cflags -fomit-frame-pointer
  2258. enable_pic() {
  2259. enable pic
  2260. add_cppflags -DPIC
  2261. add_cflags -fPIC
  2262. add_asflags -fPIC
  2263. }
  2264. enabled pic && enable_pic
  2265. check_cc <<EOF || die "Symbol mangling check failed."
  2266. int ff_extern;
  2267. EOF
  2268. sym=$($nm $nm_opts $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  2269. extern_prefix=${sym%%ff_extern*}
  2270. check_cc <<EOF && enable inline_asm
  2271. void foo(void) { __asm__ volatile ("" ::); }
  2272. EOF
  2273. _restrict=
  2274. for restrict_keyword in restrict __restrict__ __restrict; do
  2275. check_cc <<EOF && _restrict=$restrict_keyword && break
  2276. void foo(char * $restrict_keyword p);
  2277. EOF
  2278. done
  2279. check_cc <<EOF && enable attribute_packed
  2280. struct { int x; } __attribute__((packed)) x;
  2281. EOF
  2282. check_cc <<EOF && enable attribute_may_alias
  2283. union { int x; } __attribute__((may_alias)) x;
  2284. EOF
  2285. check_cc <<EOF || die "endian test failed"
  2286. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  2287. EOF
  2288. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  2289. if enabled alpha; then
  2290. check_cflags -mieee
  2291. elif enabled arm; then
  2292. check_cflags -marm
  2293. nogas=die
  2294. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  2295. enable vfp_args
  2296. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
  2297. case "${cross_prefix:-$cc}" in
  2298. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  2299. *) check_ld <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  2300. __asm__ (".eabi_attribute 28, 1");
  2301. int main(void) { return 0; }
  2302. EOF
  2303. esac
  2304. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  2305. fi
  2306. # We have to check if pld is a nop and disable it.
  2307. check_asm pld '"pld [r0]"'
  2308. enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
  2309. enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
  2310. enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
  2311. enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
  2312. enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
  2313. enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
  2314. enabled_all armv6t2 shared !pic && enable_pic
  2315. elif enabled mips; then
  2316. check_asm loongson '"dmult.g $1, $2, $3"'
  2317. enabled mmi && check_asm mmi '"lq $2, 0($2)"'
  2318. elif enabled ppc; then
  2319. enable local_aligned_8 local_aligned_16
  2320. check_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  2321. check_asm ibm_asm '"add 0, 0, 0"'
  2322. check_asm ppc4xx '"maclhw r10, r11, r12"'
  2323. check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  2324. # AltiVec flags: The FSF version of GCC differs from the Apple version
  2325. if enabled altivec; then
  2326. nogas=warn
  2327. check_cflags -maltivec -mabi=altivec &&
  2328. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  2329. check_cflags -faltivec
  2330. # check if our compiler supports Motorola AltiVec C API
  2331. check_cc <<EOF || disable altivec
  2332. $inc_altivec_h
  2333. int main(void) {
  2334. vector signed int v1, v2, v3;
  2335. v1 = vec_add(v2,v3);
  2336. return 0;
  2337. }
  2338. EOF
  2339. # check if our compiler supports braces for vector declarations
  2340. check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
  2341. $inc_altivec_h
  2342. int main (void) { (vector int) {1}; return 0; }
  2343. EOF
  2344. fi
  2345. elif enabled sparc; then
  2346. enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
  2347. add_cflags -mcpu=ultrasparc -mtune=ultrasparc
  2348. elif enabled x86; then
  2349. enable local_aligned_8 local_aligned_16
  2350. # check whether EBP is available on x86
  2351. # As 'i' is stored on the stack, this program will crash
  2352. # if the base pointer is used to access it because the
  2353. # base pointer is cleared in the inline assembly code.
  2354. check_exec_crash <<EOF && enable ebp_available
  2355. volatile int i=0;
  2356. __asm__ volatile (
  2357. "xorl %%ebp, %%ebp"
  2358. ::: "%ebp");
  2359. return i;
  2360. EOF
  2361. # check whether EBX is available on x86
  2362. check_asm ebx_available '""::"b"(0)' &&
  2363. check_asm ebx_available '"":::"%ebx"'
  2364. # check whether xmm clobbers are supported
  2365. check_asm xmm_clobbers '"":::"%xmm0"'
  2366. # check whether more than 10 operands are supported
  2367. check_cc <<EOF && enable ten_operands
  2368. int main(void) {
  2369. int x=0;
  2370. __asm__ volatile(
  2371. ""
  2372. :"+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x)
  2373. );
  2374. return 0;
  2375. }
  2376. EOF
  2377. # check whether binutils is new enough to compile SSSE3/MMX2
  2378. enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
  2379. enabled mmx2 && check_asm mmx2 '"pmaxub %mm0, %mm1"'
  2380. check_asm bswap '"bswap %%eax" ::: "%eax"'
  2381. if ! disabled_any asm mmx yasm; then
  2382. if check_cmd $yasmexe --version; then
  2383. enabled x86_64 && yasm_extra="-m amd64"
  2384. yasm_debug="-g dwarf2"
  2385. elif check_cmd nasm -v; then
  2386. yasmexe=nasm
  2387. yasm_debug="-g -F dwarf"
  2388. enabled x86_64 && test "$objformat" = elf && objformat=elf64
  2389. fi
  2390. YASMFLAGS="-f $objformat $yasm_extra"
  2391. enabled pic && append YASMFLAGS "-DPIC"
  2392. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  2393. case "$objformat" in
  2394. elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
  2395. esac
  2396. check_yasm "pabsw xmm0, xmm0" && enable yasm ||
  2397. die "yasm not found, use --disable-yasm for a crippled build"
  2398. fi
  2399. case "$cpu" in
  2400. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  2401. disable fast_clz
  2402. ;;
  2403. esac
  2404. fi
  2405. if enabled asm; then
  2406. as=${gas:=$as}
  2407. check_asm gnu_as '".macro m n\n\\n:.int 0\n.endm\nm x"' ||
  2408. $nogas "GNU assembler not found, install gas-preprocessor"
  2409. fi
  2410. if check_func dlopen; then
  2411. ldl=
  2412. elif check_func dlopen -ldl; then
  2413. ldl=-ldl
  2414. fi
  2415. if enabled network; then
  2416. check_type "sys/types.h sys/socket.h" socklen_t
  2417. check_type netdb.h "struct addrinfo"
  2418. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  2419. check_type netinet/in.h "struct sockaddr_in6"
  2420. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  2421. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  2422. # Prefer arpa/inet.h over winsock2
  2423. if check_header arpa/inet.h ; then
  2424. check_func closesocket
  2425. elif check_header winsock2.h ; then
  2426. check_func_headers winsock2.h closesocket -lws2 && \
  2427. network_extralibs="-lws2" || \
  2428. { check_func_headers winsock2.h closesocket -lws2_32 && \
  2429. network_extralibs="-lws2_32"; }
  2430. check_type ws2tcpip.h socklen_t
  2431. check_type ws2tcpip.h "struct addrinfo"
  2432. check_type ws2tcpip.h "struct ipv6_mreq"
  2433. check_type ws2tcpip.h "struct sockaddr_in6"
  2434. check_type ws2tcpip.h "struct sockaddr_storage"
  2435. check_struct winsock2.h "struct sockaddr" sa_len
  2436. else
  2437. disable network
  2438. fi
  2439. fi
  2440. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  2441. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  2442. check_func fcntl
  2443. check_func fork
  2444. check_func getaddrinfo $network_extralibs
  2445. check_func gethrtime
  2446. check_func getrusage
  2447. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  2448. check_func inet_aton $network_extralibs
  2449. check_func isatty
  2450. check_func ${malloc_prefix}memalign && enable memalign
  2451. check_func mkstemp
  2452. check_func mmap
  2453. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  2454. check_func setrlimit
  2455. check_func strerror_r
  2456. check_func strtok_r
  2457. check_func_headers io.h setmode
  2458. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  2459. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  2460. check_func_headers windows.h GetProcessTimes
  2461. check_func_headers windows.h MapViewOfFile
  2462. check_func_headers windows.h VirtualAlloc
  2463. check_header conio.h
  2464. check_header dlfcn.h
  2465. check_header dxva2api.h
  2466. check_header malloc.h
  2467. check_header poll.h
  2468. check_header sys/mman.h
  2469. check_header sys/resource.h
  2470. check_header sys/select.h
  2471. check_header termios.h
  2472. check_header vdpau/vdpau.h
  2473. check_header vdpau/vdpau_x11.h
  2474. check_header X11/extensions/XvMClib.h
  2475. check_struct dxva2api.h DXVA_PictureParameters wDecodedPictureIndex
  2476. if ! enabled_any memalign memalign_hack posix_memalign malloc_aligned &&
  2477. enabled_any $need_memalign ; then
  2478. die "Error, no aligned memory allocator but SSE enabled, disable it or use --enable-memalign-hack."
  2479. fi
  2480. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  2481. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  2482. # check for some common methods of building with pthread support
  2483. # do this before the optional library checks as some of them require pthreads
  2484. if ! disabled pthreads && ! enabled w32threads; then
  2485. enable pthreads
  2486. if check_func pthread_create; then
  2487. :
  2488. elif check_func pthread_create -pthread; then
  2489. add_cflags -pthread
  2490. add_extralibs -pthread
  2491. elif check_func pthread_create -pthreads; then
  2492. add_cflags -pthreads
  2493. add_extralibs -pthreads
  2494. elif check_func pthread_create -lpthreadGC2; then
  2495. add_extralibs -lpthreadGC2
  2496. elif ! check_lib pthread.h pthread_create -lpthread; then
  2497. disable pthreads
  2498. fi
  2499. fi
  2500. for thread in $THREADS_LIST; do
  2501. if enabled $thread; then
  2502. test -n "$thread_type" &&
  2503. die "ERROR: Only one thread type must be selected." ||
  2504. thread_type="$thread"
  2505. fi
  2506. done
  2507. check_lib math.h sin -lm
  2508. disabled vaapi || check_lib va/va.h vaInitialize -lva
  2509. check_mathfunc exp2
  2510. check_mathfunc exp2f
  2511. check_mathfunc llrint
  2512. check_mathfunc llrintf
  2513. check_mathfunc log2
  2514. check_mathfunc log2f
  2515. check_mathfunc lrint
  2516. check_mathfunc lrintf
  2517. check_mathfunc round
  2518. check_mathfunc roundf
  2519. check_mathfunc truncf
  2520. # these are off by default, so fail if requested and not available
  2521. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
  2522. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  2523. enabled libdirac && add_cflags $(pkg-config --cflags dirac) &&
  2524. require libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init $(pkg-config --libs dirac) &&
  2525. require libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init $(pkg-config --libs dirac)
  2526. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  2527. enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm
  2528. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  2529. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  2530. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  2531. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  2532. enabled libopencv && { check_lib opencv/cv.h cvCreateImageHeader $(pkg-config --libs opencv) ||
  2533. die "ERROR: libopencv not found"; }
  2534. enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
  2535. enabled librtmp && { check_lib librtmp/rtmp.h RTMP_Socket $(pkg-config --libs librtmp) ||
  2536. die "ERROR: librtmp not found or RTMP_Socket() missing, librtmp version must be >= 2.2.f"; }
  2537. enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
  2538. require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
  2539. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  2540. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  2541. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  2542. enabled libvpx && {
  2543. enabled libvpx_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
  2544. die "ERROR: libvpx decoder version must be >=0.9.1"; }
  2545. enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_enc_init_ver -lvpx ||
  2546. die "ERROR: libvpx encoder version must be >=0.9.1"; } }
  2547. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
  2548. { check_cpp_condition x264.h "X264_BUILD >= 99" ||
  2549. die "ERROR: libx264 version must be >= 0.99."; }
  2550. enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
  2551. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  2552. enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  2553. # libdc1394 check
  2554. if enabled libdc1394; then
  2555. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  2556. enable libdc1394_2; } ||
  2557. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  2558. enable libdc1394_1; } ||
  2559. die "ERROR: No version of libdc1394 found "
  2560. fi
  2561. SDL_CONFIG="${cross_prefix}sdl-config"
  2562. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  2563. sdl_cflags=$("${SDL_CONFIG}" --cflags)
  2564. sdl_libs=$("${SDL_CONFIG}" --libs)
  2565. check_func_headers SDL.h SDL_Init $sdl_cflags $sdl_libs &&
  2566. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  2567. enable sdl &&
  2568. check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
  2569. fi
  2570. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  2571. check_header linux/videodev.h
  2572. check_header linux/videodev2.h
  2573. check_header sys/videoio.h
  2574. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  2575. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  2576. # w32api 3.12 had it defined wrong
  2577. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  2578. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  2579. { check_header dev/bktr/ioctl_meteor.h &&
  2580. check_header dev/bktr/ioctl_bt848.h; } ||
  2581. { check_header machine/ioctl_meteor.h &&
  2582. check_header machine/ioctl_bt848.h; } ||
  2583. { check_header dev/video/meteor/ioctl_meteor.h &&
  2584. check_header dev/video/bktr/ioctl_bt848.h; } ||
  2585. check_header dev/ic/bt8xx.h
  2586. check_header sys/soundcard.h
  2587. check_header soundcard.h
  2588. enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  2589. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack
  2590. enabled x11grab &&
  2591. check_header X11/Xlib.h &&
  2592. check_header X11/extensions/XShm.h &&
  2593. check_header X11/extensions/Xfixes.h &&
  2594. check_func XOpenDisplay -lX11 &&
  2595. check_func XShmCreateImage -lX11 -lXext &&
  2596. check_func XFixesGetCursorImage -lX11 -lXext -lXfixes
  2597. if ! disabled vdpau && enabled vdpau_vdpau_h; then
  2598. check_cpp_condition \
  2599. vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  2600. { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
  2601. disable vdpau; }
  2602. fi
  2603. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  2604. # add some useful compiler flags if supported
  2605. check_cflags -Wdeclaration-after-statement
  2606. check_cflags -Wall
  2607. check_cflags -Wno-parentheses
  2608. check_cflags -Wno-switch
  2609. check_cflags -Wdisabled-optimization
  2610. check_cflags -Wpointer-arith
  2611. check_cflags -Wredundant-decls
  2612. check_cflags -Wno-pointer-sign
  2613. check_cflags -Wcast-qual
  2614. check_cflags -Wwrite-strings
  2615. check_cflags -Wtype-limits
  2616. check_cflags -Wundef
  2617. check_cflags -Wmissing-prototypes
  2618. enabled extra_warnings && check_cflags -Winline
  2619. # add some linker flags
  2620. check_ldflags -Wl,--warn-common
  2621. check_ldflags -Wl,--as-needed
  2622. check_ldflags '-Wl,-rpath-link,\$(BUILD_ROOT)/libpostproc -Wl,-rpath-link,\$(BUILD_ROOT)/libswscale -Wl,-rpath-link,\$(BUILD_ROOT)/libavfilter -Wl,-rpath-link,\$(BUILD_ROOT)/libavdevice -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavcore -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
  2623. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  2624. echo "X{};" > $TMPV
  2625. if test_ldflags -Wl,--version-script,$TMPV; then
  2626. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  2627. check_cc <<EOF && enable symver_asm_label
  2628. void ff_foo(void) __asm__ ("av_foo@VERSION");
  2629. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  2630. EOF
  2631. check_cc <<EOF && enable symver_gnu_asm
  2632. __asm__(".symver ff_foo,av_foo@VERSION");
  2633. void ff_foo(void) {}
  2634. EOF
  2635. fi
  2636. if enabled small; then
  2637. add_cflags $size_cflags
  2638. optimizations="small"
  2639. elif enabled optimizations; then
  2640. add_cflags $speed_cflags
  2641. else
  2642. add_cflags $noopt_cflags
  2643. fi
  2644. check_cflags -fno-math-errno
  2645. check_cflags -fno-signed-zeros
  2646. if enabled icc; then
  2647. # Just warnings, no remarks
  2648. check_cflags -w1
  2649. # -wd: Disable following warnings
  2650. # 144, 167, 556: -Wno-pointer-sign
  2651. # 10006: ignoring unknown option -fno-signed-zeros
  2652. # 10148: ignoring unknown option -Wno-parentheses
  2653. # 10156: ignoring option '-W'; no argument required
  2654. check_cflags -wd144,167,556,10006,10148,10156
  2655. # 11030: Warning unknown option --as-needed
  2656. # 10156: ignoring option '-export'; no argument required
  2657. check_ldflags -wd10156,11030
  2658. # Allow to compile with optimizations
  2659. check_ldflags -march=$cpu
  2660. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  2661. enable ebp_available
  2662. if enabled x86_32; then
  2663. test ${icc_version%%.*} -ge 11 && \
  2664. check_cflags -falign-stack=maintain-16-byte || \
  2665. disable aligned_stack
  2666. fi
  2667. elif enabled ccc; then
  2668. # disable some annoying warnings
  2669. add_cflags -msg_disable cvtu32to64
  2670. add_cflags -msg_disable embedcomment
  2671. add_cflags -msg_disable needconstext
  2672. add_cflags -msg_disable nomainieee
  2673. add_cflags -msg_disable ptrmismatch1
  2674. add_cflags -msg_disable unreachcode
  2675. elif enabled gcc; then
  2676. check_cflags -fno-tree-vectorize
  2677. check_cflags -Werror=implicit-function-declaration
  2678. check_cflags -Werror=missing-prototypes
  2679. elif enabled llvm_gcc; then
  2680. check_cflags -mllvm -stack-alignment=16
  2681. elif enabled clang; then
  2682. check_cflags -mllvm -stack-alignment=16
  2683. check_cflags -Qunused-arguments
  2684. elif enabled armcc; then
  2685. # 2523: use of inline assembler is deprecated
  2686. add_cflags -W${armcc_opt},--diag_suppress=2523
  2687. add_cflags -W${armcc_opt},--diag_suppress=1207
  2688. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  2689. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  2690. elif enabled tms470; then
  2691. add_cflags -pds=824 -pds=837
  2692. elif enabled pathscale; then
  2693. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  2694. fi
  2695. enabled_any $THREADS_LIST && enable threads
  2696. check_deps $CONFIG_LIST \
  2697. $CONFIG_EXTRA \
  2698. $HAVE_LIST \
  2699. $DECODER_LIST \
  2700. $ENCODER_LIST \
  2701. $HWACCEL_LIST \
  2702. $PARSER_LIST \
  2703. $BSF_LIST \
  2704. $DEMUXER_LIST \
  2705. $MUXER_LIST \
  2706. $FILTER_LIST \
  2707. $INDEV_LIST \
  2708. $OUTDEV_LIST \
  2709. $PROTOCOL_LIST \
  2710. $ACODEC_TESTS \
  2711. $VCODEC_TESTS \
  2712. $LAVF_TESTS \
  2713. $LAVFI_TESTS \
  2714. $SEEK_TESTS \
  2715. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  2716. echo "install prefix $prefix"
  2717. echo "source path $source_path"
  2718. echo "C compiler $cc"
  2719. echo "ARCH $arch ($cpu)"
  2720. if test "$build_suffix" != ""; then
  2721. echo "build suffix $build_suffix"
  2722. fi
  2723. if test "$extra_version" != ""; then
  2724. echo "version string suffix $extra_version"
  2725. fi
  2726. echo "big-endian ${bigendian-no}"
  2727. echo "runtime cpu detection ${runtime_cpudetect-no}"
  2728. if enabled x86; then
  2729. echo "yasm ${yasm-no}"
  2730. echo "MMX enabled ${mmx-no}"
  2731. echo "MMX2 enabled ${mmx2-no}"
  2732. echo "3DNow! enabled ${amd3dnow-no}"
  2733. echo "3DNow! extended enabled ${amd3dnowext-no}"
  2734. echo "SSE enabled ${sse-no}"
  2735. echo "SSSE3 enabled ${ssse3-no}"
  2736. echo "CMOV enabled ${cmov-no}"
  2737. echo "CMOV is fast ${fast_cmov-no}"
  2738. echo "EBX available ${ebx_available-no}"
  2739. echo "EBP available ${ebp_available-no}"
  2740. echo "10 operands supported ${ten_operands-no}"
  2741. fi
  2742. if enabled arm; then
  2743. echo "ARMv5TE enabled ${armv5te-no}"
  2744. echo "ARMv6 enabled ${armv6-no}"
  2745. echo "ARMv6T2 enabled ${armv6t2-no}"
  2746. echo "ARM VFP enabled ${armvfp-no}"
  2747. echo "IWMMXT enabled ${iwmmxt-no}"
  2748. echo "NEON enabled ${neon-no}"
  2749. fi
  2750. if enabled mips; then
  2751. echo "MMI enabled ${mmi-no}"
  2752. fi
  2753. if enabled ppc; then
  2754. echo "AltiVec enabled ${altivec-no}"
  2755. echo "PPC 4xx optimizations ${ppc4xx-no}"
  2756. echo "dcbzl available ${dcbzl-no}"
  2757. fi
  2758. if enabled sparc; then
  2759. echo "VIS enabled ${vis-no}"
  2760. fi
  2761. echo "debug symbols ${debug-no}"
  2762. echo "strip symbols ${stripping-no}"
  2763. echo "optimizations ${optimizations-no}"
  2764. echo "static ${static-no}"
  2765. echo "shared ${shared-no}"
  2766. echo "postprocessing support ${postproc-no}"
  2767. echo "new filter support ${avfilter-no}"
  2768. echo "network support ${network-no}"
  2769. echo "threading support ${thread_type-no}"
  2770. echo "SDL support ${sdl-no}"
  2771. echo "Sun medialib support ${mlib-no}"
  2772. echo "AVISynth enabled ${avisynth-no}"
  2773. echo "frei0r enabled ${frei0r-no}"
  2774. echo "libdc1394 support ${libdc1394-no}"
  2775. echo "libdirac enabled ${libdirac-no}"
  2776. echo "libfaac enabled ${libfaac-no}"
  2777. echo "libgsm enabled ${libgsm-no}"
  2778. echo "libmp3lame enabled ${libmp3lame-no}"
  2779. echo "libnut enabled ${libnut-no}"
  2780. echo "libopencore-amrnb support ${libopencore_amrnb-no}"
  2781. echo "libopencore-amrwb support ${libopencore_amrwb-no}"
  2782. echo "libopencv support ${libopencv-no}"
  2783. echo "libopenjpeg enabled ${libopenjpeg-no}"
  2784. echo "librtmp enabled ${librtmp-no}"
  2785. echo "libschroedinger enabled ${libschroedinger-no}"
  2786. echo "libspeex enabled ${libspeex-no}"
  2787. echo "libtheora enabled ${libtheora-no}"
  2788. echo "libvorbis enabled ${libvorbis-no}"
  2789. echo "libvpx enabled ${libvpx-no}"
  2790. echo "libx264 enabled ${libx264-no}"
  2791. echo "libxavs enabled ${libxavs-no}"
  2792. echo "libxvid enabled ${libxvid-no}"
  2793. echo "zlib enabled ${zlib-no}"
  2794. echo "bzlib enabled ${bzlib-no}"
  2795. echo
  2796. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  2797. echo "Enabled ${type}s:"
  2798. eval list=\$$(toupper $type)_LIST
  2799. print_enabled '_*' $list | sort | pr -3 -t
  2800. echo
  2801. done
  2802. license="LGPL version 2.1 or later"
  2803. if enabled nonfree; then
  2804. license="nonfree and unredistributable"
  2805. elif enabled gplv3; then
  2806. license="GPL version 3 or later"
  2807. elif enabled lgplv3; then
  2808. license="LGPL version 3 or later"
  2809. elif enabled gpl; then
  2810. license="GPL version 2 or later"
  2811. fi
  2812. echo "License: $license"
  2813. echo "Creating config.mak and config.h..."
  2814. # build tree in object directory if source path is different from current one
  2815. if enabled source_path_used; then
  2816. DIRS="
  2817. doc
  2818. libavcodec
  2819. libavcodec/$arch
  2820. libavcore
  2821. libavdevice
  2822. libavfilter
  2823. libavfilter/$arch
  2824. libavformat
  2825. libavutil
  2826. libavutil/$arch
  2827. libpostproc
  2828. libswscale
  2829. libswscale/$arch
  2830. tests
  2831. tools
  2832. "
  2833. FILES="
  2834. Makefile
  2835. common.mak
  2836. subdir.mak
  2837. doc/texi2pod.pl
  2838. libavcodec/Makefile
  2839. libavcodec/${arch}/Makefile
  2840. libavcore/Makefile
  2841. libavdevice/Makefile
  2842. libavfilter/Makefile
  2843. libavfilter/${arch}/Makefile
  2844. libavformat/Makefile
  2845. libavutil/Makefile
  2846. libpostproc/Makefile
  2847. libswscale/Makefile
  2848. "
  2849. map 'mkdir -p $v' $DIRS;
  2850. map 'test -f "$source_path/$v" && $ln_s "$source_path/$v" $v' $FILES
  2851. fi
  2852. enabled stripping || strip="echo skipping strip"
  2853. config_files="$TMPH config.mak"
  2854. cat > config.mak <<EOF
  2855. # Automatically generated by configure - do not modify!
  2856. ifndef FFMPEG_CONFIG_MAK
  2857. FFMPEG_CONFIG_MAK=1
  2858. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  2859. prefix=$prefix
  2860. LIBDIR=\$(DESTDIR)$libdir
  2861. SHLIBDIR=\$(DESTDIR)$shlibdir
  2862. INCDIR=\$(DESTDIR)$incdir
  2863. BINDIR=\$(DESTDIR)$bindir
  2864. DATADIR=\$(DESTDIR)$datadir
  2865. MANDIR=\$(DESTDIR)$mandir
  2866. SRC_PATH="$source_path"
  2867. SRC_PATH_BARE=$source_path
  2868. BUILD_ROOT="$PWD"
  2869. CC_IDENT=$cc_ident
  2870. ARCH=$arch
  2871. CC=$cc
  2872. AS=$as
  2873. LD=$ld
  2874. DEPCC=$dep_cc
  2875. YASM=$yasmexe
  2876. YASMDEP=$yasmexe
  2877. AR=$ar
  2878. RANLIB=$ranlib
  2879. CP=cp -p
  2880. LN_S=$ln_s
  2881. STRIP=$strip
  2882. CPPFLAGS=$CPPFLAGS
  2883. CFLAGS=$CFLAGS
  2884. ASFLAGS=$ASFLAGS
  2885. CC_O=$CC_O
  2886. LDFLAGS=$LDFLAGS
  2887. FFSERVERLDFLAGS=$FFSERVERLDFLAGS
  2888. SHFLAGS=$SHFLAGS
  2889. YASMFLAGS=$YASMFLAGS
  2890. BUILDSUF=$build_suffix
  2891. FULLNAME=$FULLNAME
  2892. LIBPREF=$LIBPREF
  2893. LIBSUF=$LIBSUF
  2894. LIBNAME=$LIBNAME
  2895. SLIBPREF=$SLIBPREF
  2896. SLIBSUF=$SLIBSUF
  2897. EXESUF=$EXESUF
  2898. EXTRA_VERSION=$extra_version
  2899. DEPFLAGS=$DEPFLAGS
  2900. CCDEP=$CCDEP
  2901. ASDEP=$ASDEP
  2902. CC_DEPFLAGS=$CC_DEPFLAGS
  2903. AS_DEPFLAGS=$AS_DEPFLAGS
  2904. HOSTCC=$host_cc
  2905. HOSTCFLAGS=$host_cflags
  2906. HOSTEXESUF=$HOSTEXESUF
  2907. HOSTLDFLAGS=$host_ldflags
  2908. HOSTLIBS=$host_libs
  2909. TARGET_EXEC=$target_exec
  2910. TARGET_PATH=$target_path
  2911. SDL_LIBS=$sdl_libs
  2912. SDL_CFLAGS=$sdl_cflags
  2913. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  2914. EXTRALIBS=$extralibs
  2915. INSTALL=install
  2916. LIBTARGET=${LIBTARGET}
  2917. SLIBNAME=${SLIBNAME}
  2918. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  2919. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  2920. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  2921. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  2922. SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}
  2923. SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}
  2924. SAMPLES=$samples
  2925. EOF
  2926. get_version(){
  2927. name=$1
  2928. file=$source_path/$2
  2929. eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
  2930. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  2931. lcname=$(tolower $name)
  2932. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  2933. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  2934. }
  2935. get_version LIBSWSCALE libswscale/swscale.h
  2936. get_version LIBPOSTPROC libpostproc/postprocess.h
  2937. get_version LIBAVCODEC libavcodec/avcodec.h
  2938. get_version LIBAVCORE libavcore/avcore.h
  2939. get_version LIBAVDEVICE libavdevice/avdevice.h
  2940. get_version LIBAVFORMAT libavformat/version.h
  2941. get_version LIBAVUTIL libavutil/avutil.h
  2942. get_version LIBAVFILTER libavfilter/avfilter.h
  2943. cat > $TMPH <<EOF
  2944. /* Automatically generated by configure - do not modify! */
  2945. #ifndef FFMPEG_CONFIG_H
  2946. #define FFMPEG_CONFIG_H
  2947. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  2948. #define FFMPEG_LICENSE "$(c_escape $license)"
  2949. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  2950. #define CC_TYPE "$cc_type"
  2951. #define CC_VERSION $cc_version
  2952. #define restrict $_restrict
  2953. #define EXTERN_PREFIX "${extern_prefix}"
  2954. #define EXTERN_ASM ${extern_prefix}
  2955. #define SLIBSUF "$SLIBSUF"
  2956. EOF
  2957. test -n "$malloc_prefix" &&
  2958. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  2959. if enabled small || disabled optimizations; then
  2960. echo "#undef av_always_inline" >> $TMPH
  2961. if enabled small; then
  2962. echo "#define av_always_inline inline" >> $TMPH
  2963. else
  2964. echo "#define av_always_inline av_unused" >> $TMPH
  2965. fi
  2966. fi
  2967. if enabled yasm; then
  2968. append config_files $TMPASM
  2969. printf '' >$TMPASM
  2970. fi
  2971. print_config ARCH_ "$config_files" $ARCH_LIST
  2972. print_config HAVE_ "$config_files" $HAVE_LIST
  2973. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  2974. $CONFIG_EXTRA \
  2975. $DECODER_LIST \
  2976. $ENCODER_LIST \
  2977. $HWACCEL_LIST \
  2978. $PARSER_LIST \
  2979. $BSF_LIST \
  2980. $DEMUXER_LIST \
  2981. $MUXER_LIST \
  2982. $FILTER_LIST \
  2983. $PROTOCOL_LIST \
  2984. $INDEV_LIST \
  2985. $OUTDEV_LIST \
  2986. cat >>config.mak <<EOF
  2987. ACODEC_TESTS=$(print_enabled -n _test $ACODEC_TESTS)
  2988. VCODEC_TESTS=$(print_enabled -n _test $VCODEC_TESTS)
  2989. LAVF_TESTS=$(print_enabled -n _test $LAVF_TESTS)
  2990. LAVFI_TESTS=$(print_enabled -n _test $LAVFI_TESTS)
  2991. SEEK_TESTS=$(print_enabled -n _test $SEEK_TESTS)
  2992. EOF
  2993. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  2994. echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
  2995. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  2996. cp_if_changed $TMPH config.h
  2997. touch .config
  2998. enabled yasm && cp_if_changed $TMPASM config.asm
  2999. cat > $TMPH <<EOF
  3000. /* Generated by ffconf */
  3001. #ifndef AVUTIL_AVCONFIG_H
  3002. #define AVUTIL_AVCONFIG_H
  3003. EOF
  3004. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  3005. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  3006. cp_if_changed $TMPH libavutil/avconfig.h
  3007. test -n "$WARNINGS" && printf "\n$WARNINGS"
  3008. # build pkg-config files
  3009. pkgconfig_generate(){
  3010. name=$1
  3011. shortname=${name#lib}${build_suffix}
  3012. comment=$2
  3013. version=$3
  3014. libs=$4
  3015. requires=$5
  3016. enabled ${name#lib} || return 0
  3017. cat <<EOF > $name/$name.pc
  3018. prefix=$prefix
  3019. exec_prefix=\${prefix}
  3020. libdir=$libdir
  3021. includedir=$incdir
  3022. Name: $name
  3023. Description: $comment
  3024. Version: $version
  3025. Requires: $(enabled shared || echo $requires)
  3026. Requires.private: $(enabled shared && echo $requires)
  3027. Conflicts:
  3028. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  3029. Libs.private: $(enabled shared && echo $libs)
  3030. Cflags: -I\${includedir}
  3031. EOF
  3032. cat <<EOF > $name/$name-uninstalled.pc
  3033. prefix=
  3034. exec_prefix=
  3035. libdir=\${pcfiledir}
  3036. includedir=${source_path}
  3037. Name: $name
  3038. Description: $comment
  3039. Version: $version
  3040. Requires: $requires
  3041. Conflicts:
  3042. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  3043. Cflags: -I\${includedir}
  3044. EOF
  3045. }
  3046. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
  3047. pkgconfig_generate libavcore "FFmpeg multimedia shared core utilities library" "$LIBAVCORE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
  3048. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavcore = $LIBAVCORE_VERSION"
  3049. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
  3050. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
  3051. pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavcore = $LIBAVCORE_VERSION"
  3052. pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
  3053. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"