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.

3400 lines
100KB

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