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.

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