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.

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