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.

3404 lines
100KB

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