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.

3401 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_extra_ver=$(expr "$($cc --version | head -n1)" : '.*\((.*)\)')
  1685. cc_ident="gcc $($cc -dumpversion) $gcc_extra_ver"
  1686. if ! $cc -dumpversion | grep -q '^2\.'; then
  1687. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1688. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1689. fi
  1690. speed_cflags='-O3'
  1691. size_cflags='-Os'
  1692. elif $cc --version 2>/dev/null | grep -q Intel; then
  1693. cc_type=icc
  1694. cc_version="AV_STRINGIFY(__INTEL_COMPILER)"
  1695. cc_ident=$($cc --version | head -n1)
  1696. icc_version=$($cc -dumpversion)
  1697. CC_DEPFLAGS='-MMD'
  1698. AS_DEPFLAGS='-MMD'
  1699. speed_cflags='-O3'
  1700. size_cflags='-Os'
  1701. noopt_cflags='-O1'
  1702. elif $cc -v 2>&1 | grep -q xlc; then
  1703. cc_type=xlc
  1704. cc_version="AV_STRINGIFY(__IBMC__)"
  1705. cc_ident=$($cc -qversion 2>/dev/null | head -n1)
  1706. speed_cflags='-O5'
  1707. size_cflags='-O5 -qcompact'
  1708. elif $cc -V 2>/dev/null | grep -q Compaq; then
  1709. cc_type=ccc
  1710. cc_version="AV_STRINGIFY(__DECC_VER)"
  1711. cc_ident=$($cc -V | head -n1 | cut -d' ' -f1-3)
  1712. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M'
  1713. debuglevel=3
  1714. add_ldflags -Wl,-z,now # calls to libots crash without this
  1715. speed_cflags='-fast'
  1716. size_cflags='-O1'
  1717. elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
  1718. test -d "$sysroot" || die "No valid sysroot specified."
  1719. cc_type=armcc
  1720. cc_version="AV_STRINGIFY(__ARMCC_VERSION)"
  1721. cc_ident=$($cc --vsn | head -n1)
  1722. armcc_conf="$PWD/armcc.conf"
  1723. $cc --arm_linux_configure \
  1724. --arm_linux_config_file="$armcc_conf" \
  1725. --configure_sysroot="$sysroot" \
  1726. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  1727. die "Error creating armcc configuration file."
  1728. $cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  1729. cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc"
  1730. as_default="${cross_prefix}gcc"
  1731. CC_DEPFLAGS='-MMD'
  1732. AS_DEPFLAGS='-MMD'
  1733. speed_cflags='-O3'
  1734. size_cflags='-Os'
  1735. filter_asflags="filter_out -W${armcc_opt}*"
  1736. elif $cc -version 2>/dev/null | grep -q TMS470; then
  1737. cc_type=tms470
  1738. cc_version="AV_STRINGIFY(__TI_COMPILER_VERSION__)"
  1739. cc_ident=$($cc -version | head -n1 | tr -s ' ')
  1740. cc="$cc --gcc --abi=eabi -eo=.o -mc -me"
  1741. CC_O='-fr=$(@D)'
  1742. as_default="${cross_prefix}gcc"
  1743. ld_default="${cross_prefix}gcc"
  1744. TMPO=$(basename $TMPC .c).o
  1745. append TMPFILES $TMPO
  1746. add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__=
  1747. CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)'
  1748. AS_DEPFLAGS='-MMD'
  1749. speed_cflags='-O3 -mf=5'
  1750. size_cflags='-O3 -mf=2'
  1751. filter_cflags=tms470_flags
  1752. tms470_flags(){
  1753. for flag; do
  1754. case $flag in
  1755. -march=*|-mcpu=*)
  1756. case "${flag#*=}" in
  1757. armv7-a|cortex-a*) echo -mv=7a8 ;;
  1758. armv7-r|cortex-r*) echo -mv=7r4 ;;
  1759. armv7-m|cortex-m*) echo -mv=7m3 ;;
  1760. armv6*|arm11*) echo -mv=6 ;;
  1761. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  1762. echo -mv=5e ;;
  1763. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  1764. esac
  1765. ;;
  1766. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  1767. -mfpu=vfp) echo --float_support=vfpv2 ;;
  1768. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  1769. -msoft-float) echo --float_support=vfplib ;;
  1770. -O[0-3]|-mf=*) echo $flag ;;
  1771. -g) echo -g -mn ;;
  1772. -pds=*) echo $flag ;;
  1773. esac
  1774. done
  1775. }
  1776. elif $cc -v 2>&1 | grep -q clang; then
  1777. cc_type=clang
  1778. $cc -dM -E $TMPC | grep -q __clang_version__ &&
  1779. cc_version=__clang_version__ || cc_version=__VERSION__
  1780. cc_ident=$($cc --version | head -n1)
  1781. CC_DEPFLAGS='-MMD'
  1782. AS_DEPFLAGS='-MMD'
  1783. speed_cflags='-O3'
  1784. size_cflags='-Os'
  1785. elif $cc -V 2>&1 | grep -q Sun; then
  1786. cc_type=suncc
  1787. cc_version="AV_STRINGIFY(__SUNPRO_C)"
  1788. cc_ident=$($cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  1789. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  1790. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1'
  1791. speed_cflags='-O5'
  1792. size_cflags='-O5 -xspace'
  1793. filter_cflags=suncc_flags
  1794. suncc_flags(){
  1795. for flag; do
  1796. case $flag in
  1797. -march=*|-mcpu=*)
  1798. case "${flag#*=}" in
  1799. native) echo -xtarget=native ;;
  1800. v9|niagara) echo -xarch=sparc ;;
  1801. ultrasparc) echo -xarch=sparcvis ;;
  1802. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  1803. i586|pentium) echo -xchip=pentium ;;
  1804. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  1805. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  1806. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  1807. pentium4*) echo -xtarget=pentium4 ;;
  1808. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  1809. *-sse3) echo -xarch=sse3 ;;
  1810. core2) echo -xarch=ssse3 -xchip=core2 ;;
  1811. amdfam10|barcelona) echo -xarch=sse4_1 ;;
  1812. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  1813. k8|opteron|athlon64|athlon-fx)
  1814. echo -xarch=sse2a ;;
  1815. athlon*) echo -xarch=pentium_proa ;;
  1816. esac
  1817. ;;
  1818. -std=c99) echo -xc99 ;;
  1819. -fomit-frame-pointer) echo -xregs=frameptr ;;
  1820. -fPIC) echo -KPIC -xcode=pic32 ;;
  1821. -W*,*) echo $flag ;;
  1822. -f*-*|-W*) ;;
  1823. *) echo $flag ;;
  1824. esac
  1825. done
  1826. }
  1827. elif $cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  1828. cc_type=pathscale
  1829. cc_version=__PATHSCALE__
  1830. cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
  1831. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1832. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1833. speed_cflags='-O2'
  1834. size_cflags='-Os'
  1835. elif $cc -v 2>&1 | grep -q Open64; then
  1836. cc_type=open64
  1837. cc_version=__OPEN64__
  1838. cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
  1839. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1840. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1841. speed_cflags='-O2'
  1842. size_cflags='-Os'
  1843. fi
  1844. test -n "$cc_type" && enable $cc_type ||
  1845. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  1846. : ${as_default:=$cc}
  1847. : ${dep_cc_default:=$cc}
  1848. : ${ld_default:=$cc}
  1849. set_default ar as dep_cc ld
  1850. test -n "$CC_DEPFLAGS" || CCDEP=$DEPEND_CMD
  1851. test -n "$AS_DEPFLAGS" || ASDEP=$DEPEND_CMD
  1852. add_cflags $extra_cflags
  1853. add_asflags $extra_cflags
  1854. if test -n "$sysroot"; then
  1855. case "$cc_type" in
  1856. gcc|llvm_gcc)
  1857. add_cppflags --sysroot="$sysroot"
  1858. add_ldflags --sysroot="$sysroot"
  1859. ;;
  1860. tms470)
  1861. add_cppflags -I"$sysinclude"
  1862. add_ldflags --sysroot="$sysroot"
  1863. ;;
  1864. clang)
  1865. add_cppflags -isysroot "$sysroot"
  1866. add_ldflags -isysroot "$sysroot"
  1867. ;;
  1868. esac
  1869. fi
  1870. if test "$cpu" = host; then
  1871. enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
  1872. case "$cc_type" in
  1873. gcc|llvm_gcc)
  1874. check_native(){
  1875. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  1876. sed -n "/$1=/{
  1877. s/.*$1=\\([^ ]*\\).*/\\1/
  1878. p
  1879. q
  1880. }" $TMPE
  1881. }
  1882. cpu=$(check_native -march || check_native -mcpu)
  1883. ;;
  1884. esac
  1885. test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
  1886. fi
  1887. # Deal with common $arch aliases
  1888. case "$arch" in
  1889. arm*)
  1890. arch="arm"
  1891. ;;
  1892. mips|mipsel|IP*)
  1893. arch="mips"
  1894. ;;
  1895. mips64*)
  1896. arch="mips"
  1897. subarch="mips64"
  1898. ;;
  1899. parisc|hppa)
  1900. arch="parisc"
  1901. ;;
  1902. parisc64|hppa64)
  1903. arch="parisc"
  1904. subarch="parisc64"
  1905. ;;
  1906. "Power Macintosh"|ppc|powerpc)
  1907. arch="ppc"
  1908. ;;
  1909. ppc64|powerpc64)
  1910. arch="ppc"
  1911. subarch="ppc64"
  1912. ;;
  1913. s390|s390x)
  1914. arch="s390"
  1915. ;;
  1916. sh4|sh)
  1917. arch="sh4"
  1918. ;;
  1919. sun4u|sparc64)
  1920. arch="sparc"
  1921. subarch="sparc64"
  1922. ;;
  1923. i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64)
  1924. arch="x86"
  1925. ;;
  1926. esac
  1927. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  1928. enable $arch
  1929. # Add processor-specific flags
  1930. if test "$cpu" = generic; then
  1931. : do nothing
  1932. elif enabled ppc; then
  1933. case $(tolower $cpu) in
  1934. 601|ppc601|powerpc601)
  1935. cpuflags="-mcpu=601"
  1936. disable altivec
  1937. ;;
  1938. 603*|ppc603*|powerpc603*)
  1939. cpuflags="-mcpu=603"
  1940. disable altivec
  1941. ;;
  1942. 604*|ppc604*|powerpc604*)
  1943. cpuflags="-mcpu=604"
  1944. disable altivec
  1945. ;;
  1946. g3|75*|ppc75*|powerpc75*)
  1947. cpuflags="-mcpu=750 -mpowerpc-gfxopt"
  1948. disable altivec
  1949. ;;
  1950. g4|745*|ppc745*|powerpc745*)
  1951. cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
  1952. ;;
  1953. 74*|ppc74*|powerpc74*)
  1954. cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
  1955. ;;
  1956. g5|970|ppc970|powerpc970|power4*)
  1957. cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
  1958. ;;
  1959. cell)
  1960. cpuflags="-mcpu=cell"
  1961. enable ldbrx
  1962. ;;
  1963. e500v2)
  1964. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  1965. disable altivec
  1966. ;;
  1967. e500)
  1968. cpuflags="-mcpu=8540 -mhard-float"
  1969. disable altivec
  1970. ;;
  1971. esac
  1972. elif enabled x86; then
  1973. case $cpu in
  1974. i[345]86|pentium)
  1975. cpuflags="-march=$cpu"
  1976. disable mmx
  1977. ;;
  1978. # targets that do NOT support conditional mov (cmov)
  1979. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  1980. cpuflags="-march=$cpu"
  1981. disable cmov
  1982. ;;
  1983. # targets that do support conditional mov (cmov)
  1984. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2|amdfam10|barcelona|atom)
  1985. cpuflags="-march=$cpu"
  1986. enable cmov
  1987. enable fast_cmov
  1988. ;;
  1989. # targets that do support conditional mov but on which it's slow
  1990. pentium4|pentium4m|prescott|nocona)
  1991. cpuflags="-march=$cpu"
  1992. enable cmov
  1993. disable fast_cmov
  1994. ;;
  1995. esac
  1996. elif enabled sparc; then
  1997. case $cpu in
  1998. niagara)
  1999. cpuflags="-mcpu=$cpu"
  2000. disable vis
  2001. ;;
  2002. sparc64)
  2003. cpuflags="-mcpu=v9"
  2004. ;;
  2005. esac
  2006. elif enabled arm; then
  2007. case $cpu in
  2008. armv*)
  2009. cpuflags="-march=$cpu"
  2010. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  2011. ;;
  2012. *)
  2013. cpuflags="-mcpu=$cpu"
  2014. case $cpu in
  2015. cortex-a*) subarch=armv7a ;;
  2016. cortex-r*) subarch=armv7r ;;
  2017. cortex-m*) subarch=armv7m ;;
  2018. arm11*) subarch=armv6 ;;
  2019. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  2020. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  2021. esac
  2022. ;;
  2023. esac
  2024. elif enabled alpha; then
  2025. enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
  2026. elif enabled bfin; then
  2027. cpuflags="-mcpu=$cpu"
  2028. elif enabled mips; then
  2029. cpuflags="-march=$cpu"
  2030. elif enabled avr32; then
  2031. case $cpu in
  2032. ap7[02]0[0-2])
  2033. subarch="avr32_ap"
  2034. cpuflags="-mpart=$cpu"
  2035. ;;
  2036. ap)
  2037. subarch="avr32_ap"
  2038. cpuflags="-march=$cpu"
  2039. ;;
  2040. uc3[ab]*)
  2041. subarch="avr32_uc"
  2042. cpuflags="-mcpu=$cpu"
  2043. ;;
  2044. uc)
  2045. subarch="avr32_uc"
  2046. cpuflags="-march=$cpu"
  2047. ;;
  2048. esac
  2049. fi
  2050. add_cflags $cpuflags
  2051. add_asflags $cpuflags
  2052. # compiler sanity check
  2053. check_exec <<EOF
  2054. int main(void){ return 0; }
  2055. EOF
  2056. if test "$?" != 0; then
  2057. echo "$cc is unable to create an executable file."
  2058. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  2059. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  2060. echo "Only do this if you know what cross compiling means."
  2061. fi
  2062. die "C compiler test failed."
  2063. fi
  2064. add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
  2065. check_cflags -std=c99
  2066. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  2067. #include <stdlib.h>
  2068. EOF
  2069. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  2070. #include <stdlib.h>
  2071. EOF
  2072. check_host_cflags -std=c99
  2073. case "$arch" in
  2074. alpha|ia64|mips|parisc|sparc)
  2075. spic=$shared
  2076. ;;
  2077. x86)
  2078. subarch="x86_32"
  2079. check_cc <<EOF && subarch="x86_64"
  2080. int test[(int)sizeof(char*) - 7];
  2081. EOF
  2082. if test "$subarch" = "x86_64"; then
  2083. spic=$shared
  2084. fi
  2085. ;;
  2086. esac
  2087. enable $subarch
  2088. enabled spic && enable pic
  2089. # OS specific
  2090. case $target_os in
  2091. haiku)
  2092. prefix_default="/boot/common"
  2093. network_extralibs="-lnetwork"
  2094. host_libs=
  2095. ;;
  2096. sunos)
  2097. FFSERVERLDFLAGS=""
  2098. SHFLAGS='-shared -Wl,-h,$$(@F)'
  2099. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  2100. network_extralibs="-lsocket -lnsl"
  2101. add_cppflags -D__EXTENSIONS__
  2102. nm_opts='-P -g'
  2103. ;;
  2104. netbsd)
  2105. disable symver
  2106. oss_indev_extralibs="-lossaudio"
  2107. oss_outdev_extralibs="-lossaudio"
  2108. add_cppflags -D_XOPEN_SOURCE=600
  2109. ;;
  2110. openbsd)
  2111. enable malloc_aligned
  2112. # On OpenBSD 4.5. the compiler does not use PIC unless
  2113. # explicitly using -fPIC. FFmpeg builds fine without PIC,
  2114. # however the generated executable will not do anything
  2115. # (simply quits with exit-code 1, no crash, no output).
  2116. # Thus explicitly enable PIC here.
  2117. enable pic
  2118. disable symver
  2119. SHFLAGS='-shared'
  2120. oss_indev_extralibs="-lossaudio"
  2121. oss_outdev_extralibs="-lossaudio"
  2122. ;;
  2123. dragonfly)
  2124. enable malloc_aligned
  2125. disable symver
  2126. ;;
  2127. freebsd)
  2128. enable malloc_aligned
  2129. ;;
  2130. bsd/os)
  2131. add_extralibs -lpoll -lgnugetopt
  2132. strip="strip -d"
  2133. ;;
  2134. darwin)
  2135. enable malloc_aligned
  2136. gas="gas-preprocessor.pl $cc"
  2137. enabled ppc && add_asflags -force_cpusubtype_ALL
  2138. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
  2139. strip="${strip} -x"
  2140. add_ldflags -Wl,-dynamic,-search_paths_first
  2141. SLIBSUF=".dylib"
  2142. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  2143. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  2144. FFSERVERLDFLAGS=-Wl,-bind_at_load
  2145. objformat="macho"
  2146. enabled x86_64 && objformat="macho64"
  2147. enabled_any pic shared ||
  2148. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  2149. ;;
  2150. mingw32*)
  2151. if test $target_os = "mingw32ce"; then
  2152. disable network
  2153. else
  2154. target_os=mingw32
  2155. fi
  2156. LIBTARGET=i386
  2157. if enabled x86_64; then
  2158. enable malloc_aligned
  2159. LIBTARGET=x64
  2160. elif enabled arm; then
  2161. LIBTARGET=arm
  2162. fi
  2163. shlibdir_default="$bindir_default"
  2164. disable ffserver
  2165. SLIBPREF=""
  2166. SLIBSUF=".dll"
  2167. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2168. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2169. SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
  2170. SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
  2171. install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"; \
  2172. install -d "$(LIBDIR)"; \
  2173. install -m 644 $(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) "$(LIBDIR)/lib$(SLIBNAME:$(SLIBSUF)=.dll.a)"'
  2174. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
  2175. 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'
  2176. objformat="win32"
  2177. enable dos_paths
  2178. check_cflags -fno-common
  2179. check_cpp_condition _mingw.h "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) \
  2180. || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  2181. die "ERROR: MinGW runtime version must be >= 3.15."
  2182. ;;
  2183. cygwin*)
  2184. target_os=cygwin
  2185. shlibdir_default="$bindir_default"
  2186. SLIBPREF="cyg"
  2187. SLIBSUF=".dll"
  2188. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2189. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2190. SHFLAGS='-shared -Wl,--enable-auto-image-base'
  2191. objformat="win32"
  2192. enable dos_paths
  2193. check_cflags -fno-common
  2194. ;;
  2195. *-dos|freedos|opendos)
  2196. disable ffplay ffserver
  2197. disable $INDEV_LIST $OUTDEV_LIST
  2198. network_extralibs="-lsocket"
  2199. objformat="coff"
  2200. enable dos_paths
  2201. ;;
  2202. linux)
  2203. enable dv1394
  2204. ;;
  2205. irix*)
  2206. target_os=irix
  2207. ranlib="echo ignoring ranlib"
  2208. ;;
  2209. os/2*)
  2210. strip="lxlite"
  2211. ln_s="cp -f"
  2212. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  2213. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  2214. FFSERVERLDFLAGS=""
  2215. LIBSUF="_s.a"
  2216. SLIBPREF=""
  2217. SLIBSUF=".dll"
  2218. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  2219. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  2220. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  2221. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  2222. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  2223. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  2224. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  2225. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  2226. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  2227. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  2228. SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
  2229. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
  2230. enable dos_paths
  2231. ;;
  2232. gnu/kfreebsd)
  2233. ;;
  2234. gnu)
  2235. ;;
  2236. qnx)
  2237. add_cppflags -D_QNX_SOURCE
  2238. network_extralibs="-lsocket"
  2239. ;;
  2240. none)
  2241. ;;
  2242. *)
  2243. die "Unknown OS '$target_os'."
  2244. ;;
  2245. esac
  2246. echo "config:$arch:$subarch:$cpu:$target_os:$cc_ident:$FFMPEG_CONFIGURATION" >config.fate
  2247. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
  2248. set_default $PATHS_LIST
  2249. # we need to build at least one lib type
  2250. if ! enabled_any static shared; then
  2251. cat <<EOF
  2252. At least one library type must be built.
  2253. Specify --enable-static to build the static libraries or --enable-shared to
  2254. build the shared libraries as well. To only build the shared libraries specify
  2255. --disable-static in addition to --enable-shared.
  2256. EOF
  2257. exit 1;
  2258. fi
  2259. disabled static && LIBNAME=""
  2260. die_license_disabled() {
  2261. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  2262. }
  2263. die_license_disabled gpl libx264
  2264. die_license_disabled gpl libxavs
  2265. die_license_disabled gpl libxvid
  2266. die_license_disabled gpl postproc
  2267. die_license_disabled gpl x11grab
  2268. die_license_disabled nonfree libfaac
  2269. die_license_disabled version3 libopencore_amrnb
  2270. die_license_disabled version3 libopencore_amrwb
  2271. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  2272. disabled optimizations || check_cflags -fomit-frame-pointer
  2273. enable_pic() {
  2274. enable pic
  2275. add_cppflags -DPIC
  2276. add_cflags -fPIC
  2277. add_asflags -fPIC
  2278. }
  2279. enabled pic && enable_pic
  2280. check_cc <<EOF || die "Symbol mangling check failed."
  2281. int ff_extern;
  2282. EOF
  2283. sym=$($nm $nm_opts $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  2284. extern_prefix=${sym%%ff_extern*}
  2285. check_cc <<EOF && enable inline_asm
  2286. void foo(void) { __asm__ volatile ("" ::); }
  2287. EOF
  2288. _restrict=
  2289. for restrict_keyword in restrict __restrict__ __restrict; do
  2290. check_cc <<EOF && _restrict=$restrict_keyword && break
  2291. void foo(char * $restrict_keyword p);
  2292. EOF
  2293. done
  2294. check_cc <<EOF && enable attribute_packed
  2295. struct { int x; } __attribute__((packed)) x;
  2296. EOF
  2297. check_cc <<EOF && enable attribute_may_alias
  2298. union { int x; } __attribute__((may_alias)) x;
  2299. EOF
  2300. check_cc <<EOF || die "endian test failed"
  2301. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  2302. EOF
  2303. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  2304. if enabled alpha; then
  2305. check_cflags -mieee
  2306. elif enabled arm; then
  2307. check_cflags -marm
  2308. nogas=die
  2309. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  2310. enable vfp_args
  2311. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
  2312. case "${cross_prefix:-$cc}" in
  2313. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  2314. *) check_ld <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  2315. __asm__ (".eabi_attribute 28, 1");
  2316. int main(void) { return 0; }
  2317. EOF
  2318. esac
  2319. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  2320. fi
  2321. # We have to check if pld is a nop and disable it.
  2322. check_asm pld '"pld [r0]"'
  2323. enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
  2324. enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
  2325. enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
  2326. enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
  2327. enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
  2328. enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
  2329. enabled_all armv6t2 shared !pic && enable_pic
  2330. elif enabled mips; then
  2331. check_asm loongson '"dmult.g $1, $2, $3"'
  2332. enabled mmi && check_asm mmi '"lq $2, 0($2)"'
  2333. elif enabled ppc; then
  2334. enable local_aligned_8 local_aligned_16
  2335. check_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  2336. check_asm ibm_asm '"add 0, 0, 0"'
  2337. check_asm ppc4xx '"maclhw r10, r11, r12"'
  2338. check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  2339. # AltiVec flags: The FSF version of GCC differs from the Apple version
  2340. if enabled altivec; then
  2341. nogas=warn
  2342. check_cflags -maltivec -mabi=altivec &&
  2343. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  2344. check_cflags -faltivec
  2345. # check if our compiler supports Motorola AltiVec C API
  2346. check_cc <<EOF || disable altivec
  2347. $inc_altivec_h
  2348. int main(void) {
  2349. vector signed int v1, v2, v3;
  2350. v1 = vec_add(v2,v3);
  2351. return 0;
  2352. }
  2353. EOF
  2354. # check if our compiler supports braces for vector declarations
  2355. check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
  2356. $inc_altivec_h
  2357. int main (void) { (vector int) {1}; return 0; }
  2358. EOF
  2359. fi
  2360. elif enabled sparc; then
  2361. enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
  2362. add_cflags -mcpu=ultrasparc -mtune=ultrasparc
  2363. elif enabled x86; then
  2364. enable local_aligned_8 local_aligned_16
  2365. # check whether EBP is available on x86
  2366. # As 'i' is stored on the stack, this program will crash
  2367. # if the base pointer is used to access it because the
  2368. # base pointer is cleared in the inline assembly code.
  2369. check_exec_crash <<EOF && enable ebp_available
  2370. volatile int i=0;
  2371. __asm__ volatile (
  2372. "xorl %%ebp, %%ebp"
  2373. ::: "%ebp");
  2374. return i;
  2375. EOF
  2376. # check whether EBX is available on x86
  2377. check_asm ebx_available '""::"b"(0)' &&
  2378. check_asm ebx_available '"":::"%ebx"'
  2379. # check whether xmm clobbers are supported
  2380. check_asm xmm_clobbers '"":::"%xmm0"'
  2381. # check whether more than 10 operands are supported
  2382. check_cc <<EOF && enable ten_operands
  2383. int main(void) {
  2384. int x=0;
  2385. __asm__ volatile(
  2386. ""
  2387. :"+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x)
  2388. );
  2389. return 0;
  2390. }
  2391. EOF
  2392. # check whether binutils is new enough to compile SSSE3/MMX2
  2393. enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
  2394. enabled mmx2 && check_asm mmx2 '"pmaxub %mm0, %mm1"'
  2395. check_asm bswap '"bswap %%eax" ::: "%eax"'
  2396. if ! disabled_any asm mmx yasm; then
  2397. if check_cmd $yasmexe --version; then
  2398. enabled x86_64 && yasm_extra="-m amd64"
  2399. yasm_debug="-g dwarf2"
  2400. elif check_cmd nasm -v; then
  2401. yasmexe=nasm
  2402. yasm_debug="-g -F dwarf"
  2403. enabled x86_64 && test "$objformat" = elf && objformat=elf64
  2404. fi
  2405. YASMFLAGS="-f $objformat $yasm_extra"
  2406. enabled pic && append YASMFLAGS "-DPIC"
  2407. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  2408. case "$objformat" in
  2409. elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
  2410. esac
  2411. check_yasm "pextrd [eax], xmm0, 1" && enable yasm ||
  2412. die "yasm not found, use --disable-yasm for a crippled build"
  2413. fi
  2414. case "$cpu" in
  2415. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  2416. disable fast_clz
  2417. ;;
  2418. esac
  2419. fi
  2420. if enabled asm; then
  2421. as=${gas:=$as}
  2422. check_asm gnu_as '".macro m n\n\\n:.int 0\n.endm\nm x"' ||
  2423. $nogas "GNU assembler not found, install gas-preprocessor"
  2424. fi
  2425. if check_func dlopen; then
  2426. ldl=
  2427. elif check_func dlopen -ldl; then
  2428. ldl=-ldl
  2429. fi
  2430. if enabled network; then
  2431. check_type "sys/types.h sys/socket.h" socklen_t
  2432. check_type netdb.h "struct addrinfo"
  2433. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  2434. check_type netinet/in.h "struct sockaddr_in6"
  2435. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  2436. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  2437. # Prefer arpa/inet.h over winsock2
  2438. if check_header arpa/inet.h ; then
  2439. check_func closesocket
  2440. elif check_header winsock2.h ; then
  2441. check_func_headers winsock2.h closesocket -lws2 && \
  2442. network_extralibs="-lws2" || \
  2443. { check_func_headers winsock2.h closesocket -lws2_32 && \
  2444. network_extralibs="-lws2_32"; }
  2445. check_type ws2tcpip.h socklen_t
  2446. check_type ws2tcpip.h "struct addrinfo"
  2447. check_type ws2tcpip.h "struct ipv6_mreq"
  2448. check_type ws2tcpip.h "struct sockaddr_in6"
  2449. check_type ws2tcpip.h "struct sockaddr_storage"
  2450. check_struct winsock2.h "struct sockaddr" sa_len
  2451. else
  2452. disable network
  2453. fi
  2454. fi
  2455. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  2456. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  2457. check_func fcntl
  2458. check_func fork
  2459. check_func getaddrinfo $network_extralibs
  2460. check_func gethrtime
  2461. check_func getrusage
  2462. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  2463. check_func inet_aton $network_extralibs
  2464. check_func isatty
  2465. check_func ${malloc_prefix}memalign && enable memalign
  2466. check_func mkstemp
  2467. check_func mmap
  2468. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  2469. check_func setrlimit
  2470. check_func strerror_r
  2471. check_func strtok_r
  2472. check_func_headers io.h setmode
  2473. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  2474. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  2475. check_func_headers windows.h GetProcessTimes
  2476. check_func_headers windows.h MapViewOfFile
  2477. check_func_headers windows.h VirtualAlloc
  2478. check_header conio.h
  2479. check_header dlfcn.h
  2480. check_header dxva2api.h
  2481. check_header malloc.h
  2482. check_header poll.h
  2483. check_header sys/mman.h
  2484. check_header sys/resource.h
  2485. check_header sys/select.h
  2486. check_header termios.h
  2487. check_header vdpau/vdpau.h
  2488. check_header vdpau/vdpau_x11.h
  2489. check_header X11/extensions/XvMClib.h
  2490. check_struct dxva2api.h DXVA_PictureParameters wDecodedPictureIndex
  2491. if ! enabled_any memalign memalign_hack posix_memalign malloc_aligned &&
  2492. enabled_any $need_memalign ; then
  2493. die "Error, no aligned memory allocator but SSE enabled, disable it or use --enable-memalign-hack."
  2494. fi
  2495. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  2496. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  2497. # check for some common methods of building with pthread support
  2498. # do this before the optional library checks as some of them require pthreads
  2499. if ! disabled pthreads && ! enabled w32threads; then
  2500. enable pthreads
  2501. if check_func pthread_create; then
  2502. :
  2503. elif check_func pthread_create -pthread; then
  2504. add_cflags -pthread
  2505. add_extralibs -pthread
  2506. elif check_func pthread_create -pthreads; then
  2507. add_cflags -pthreads
  2508. add_extralibs -pthreads
  2509. elif check_func pthread_create -lpthreadGC2; then
  2510. add_extralibs -lpthreadGC2
  2511. elif ! check_lib pthread.h pthread_create -lpthread; then
  2512. disable pthreads
  2513. fi
  2514. fi
  2515. for thread in $THREADS_LIST; do
  2516. if enabled $thread; then
  2517. test -n "$thread_type" &&
  2518. die "ERROR: Only one thread type must be selected." ||
  2519. thread_type="$thread"
  2520. fi
  2521. done
  2522. check_lib math.h sin -lm
  2523. disabled vaapi || check_lib va/va.h vaInitialize -lva
  2524. check_mathfunc exp2
  2525. check_mathfunc exp2f
  2526. check_mathfunc llrint
  2527. check_mathfunc llrintf
  2528. check_mathfunc log2
  2529. check_mathfunc log2f
  2530. check_mathfunc lrint
  2531. check_mathfunc lrintf
  2532. check_mathfunc round
  2533. check_mathfunc roundf
  2534. check_mathfunc truncf
  2535. # these are off by default, so fail if requested and not available
  2536. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
  2537. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  2538. enabled libdirac && add_cflags $(pkg-config --cflags dirac) &&
  2539. require libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init $(pkg-config --libs dirac) &&
  2540. require libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init $(pkg-config --libs dirac)
  2541. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  2542. enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm
  2543. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  2544. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  2545. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  2546. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  2547. enabled libopencv && { check_lib opencv/cv.h cvCreateImageHeader $(pkg-config --libs opencv) ||
  2548. die "ERROR: libopencv not found"; }
  2549. enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
  2550. enabled librtmp && { check_lib librtmp/rtmp.h RTMP_Socket $(pkg-config --libs librtmp) ||
  2551. die "ERROR: librtmp not found or RTMP_Socket() missing, librtmp version must be >= 2.2.f"; }
  2552. enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
  2553. require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
  2554. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  2555. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  2556. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  2557. enabled libvpx && {
  2558. enabled libvpx_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
  2559. die "ERROR: libvpx decoder version must be >=0.9.1"; }
  2560. enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_enc_init_ver -lvpx ||
  2561. die "ERROR: libvpx encoder version must be >=0.9.1"; } }
  2562. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
  2563. { check_cpp_condition x264.h "X264_BUILD >= 99" ||
  2564. die "ERROR: libx264 version must be >= 0.99."; }
  2565. enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
  2566. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  2567. enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  2568. # libdc1394 check
  2569. if enabled libdc1394; then
  2570. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  2571. enable libdc1394_2; } ||
  2572. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  2573. enable libdc1394_1; } ||
  2574. die "ERROR: No version of libdc1394 found "
  2575. fi
  2576. SDL_CONFIG="${cross_prefix}sdl-config"
  2577. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  2578. sdl_cflags=$("${SDL_CONFIG}" --cflags)
  2579. sdl_libs=$("${SDL_CONFIG}" --libs)
  2580. check_func_headers SDL.h SDL_Init $sdl_cflags $sdl_libs &&
  2581. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  2582. enable sdl &&
  2583. check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
  2584. fi
  2585. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  2586. check_header linux/videodev.h
  2587. check_header linux/videodev2.h
  2588. check_header sys/videoio.h
  2589. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  2590. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  2591. # w32api 3.12 had it defined wrong
  2592. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  2593. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  2594. { check_header dev/bktr/ioctl_meteor.h &&
  2595. check_header dev/bktr/ioctl_bt848.h; } ||
  2596. { check_header machine/ioctl_meteor.h &&
  2597. check_header machine/ioctl_bt848.h; } ||
  2598. { check_header dev/video/meteor/ioctl_meteor.h &&
  2599. check_header dev/video/bktr/ioctl_bt848.h; } ||
  2600. check_header dev/ic/bt8xx.h
  2601. check_header sys/soundcard.h
  2602. check_header soundcard.h
  2603. enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  2604. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack
  2605. enabled x11grab &&
  2606. check_header X11/Xlib.h &&
  2607. check_header X11/extensions/XShm.h &&
  2608. check_header X11/extensions/Xfixes.h &&
  2609. check_func XOpenDisplay -lX11 &&
  2610. check_func XShmCreateImage -lX11 -lXext &&
  2611. check_func XFixesGetCursorImage -lX11 -lXext -lXfixes
  2612. if ! disabled vdpau && enabled vdpau_vdpau_h; then
  2613. check_cpp_condition \
  2614. vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  2615. { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
  2616. disable vdpau; }
  2617. fi
  2618. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  2619. # add some useful compiler flags if supported
  2620. check_cflags -Wdeclaration-after-statement
  2621. check_cflags -Wall
  2622. check_cflags -Wno-parentheses
  2623. check_cflags -Wno-switch
  2624. check_cflags -Wdisabled-optimization
  2625. check_cflags -Wpointer-arith
  2626. check_cflags -Wredundant-decls
  2627. check_cflags -Wno-pointer-sign
  2628. check_cflags -Wcast-qual
  2629. check_cflags -Wwrite-strings
  2630. check_cflags -Wtype-limits
  2631. check_cflags -Wundef
  2632. check_cflags -Wmissing-prototypes
  2633. enabled extra_warnings && check_cflags -Winline
  2634. # add some linker flags
  2635. check_ldflags -Wl,--warn-common
  2636. check_ldflags -Wl,--as-needed
  2637. 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'
  2638. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  2639. echo "X{};" > $TMPV
  2640. if test_ldflags -Wl,--version-script,$TMPV; then
  2641. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  2642. check_cc <<EOF && enable symver_asm_label
  2643. void ff_foo(void) __asm__ ("av_foo@VERSION");
  2644. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  2645. EOF
  2646. check_cc <<EOF && enable symver_gnu_asm
  2647. __asm__(".symver ff_foo,av_foo@VERSION");
  2648. void ff_foo(void) {}
  2649. EOF
  2650. fi
  2651. if enabled small; then
  2652. add_cflags $size_cflags
  2653. optimizations="small"
  2654. elif enabled optimizations; then
  2655. add_cflags $speed_cflags
  2656. else
  2657. add_cflags $noopt_cflags
  2658. fi
  2659. check_cflags -fno-math-errno
  2660. check_cflags -fno-signed-zeros
  2661. if enabled icc; then
  2662. # Just warnings, no remarks
  2663. check_cflags -w1
  2664. # -wd: Disable following warnings
  2665. # 144, 167, 556: -Wno-pointer-sign
  2666. # 10006: ignoring unknown option -fno-signed-zeros
  2667. # 10148: ignoring unknown option -Wno-parentheses
  2668. # 10156: ignoring option '-W'; no argument required
  2669. check_cflags -wd144,167,556,10006,10148,10156
  2670. # 11030: Warning unknown option --as-needed
  2671. # 10156: ignoring option '-export'; no argument required
  2672. check_ldflags -wd10156,11030
  2673. # Allow to compile with optimizations
  2674. check_ldflags -march=$cpu
  2675. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  2676. enable ebp_available
  2677. if enabled x86_32; then
  2678. test ${icc_version%%.*} -ge 11 && \
  2679. check_cflags -falign-stack=maintain-16-byte || \
  2680. disable aligned_stack
  2681. fi
  2682. elif enabled ccc; then
  2683. # disable some annoying warnings
  2684. add_cflags -msg_disable cvtu32to64
  2685. add_cflags -msg_disable embedcomment
  2686. add_cflags -msg_disable needconstext
  2687. add_cflags -msg_disable nomainieee
  2688. add_cflags -msg_disable ptrmismatch1
  2689. add_cflags -msg_disable unreachcode
  2690. elif enabled gcc; then
  2691. check_cflags -fno-tree-vectorize
  2692. check_cflags -Werror=implicit-function-declaration
  2693. check_cflags -Werror=missing-prototypes
  2694. elif enabled llvm_gcc; then
  2695. check_cflags -mllvm -stack-alignment=16
  2696. elif enabled clang; then
  2697. check_cflags -mllvm -stack-alignment=16
  2698. check_cflags -Qunused-arguments
  2699. elif enabled armcc; then
  2700. # 2523: use of inline assembler is deprecated
  2701. add_cflags -W${armcc_opt},--diag_suppress=2523
  2702. add_cflags -W${armcc_opt},--diag_suppress=1207
  2703. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  2704. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  2705. elif enabled tms470; then
  2706. add_cflags -pds=824 -pds=837
  2707. elif enabled pathscale; then
  2708. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  2709. fi
  2710. enabled_any $THREADS_LIST && enable threads
  2711. check_deps $CONFIG_LIST \
  2712. $CONFIG_EXTRA \
  2713. $HAVE_LIST \
  2714. $DECODER_LIST \
  2715. $ENCODER_LIST \
  2716. $HWACCEL_LIST \
  2717. $PARSER_LIST \
  2718. $BSF_LIST \
  2719. $DEMUXER_LIST \
  2720. $MUXER_LIST \
  2721. $FILTER_LIST \
  2722. $INDEV_LIST \
  2723. $OUTDEV_LIST \
  2724. $PROTOCOL_LIST \
  2725. $ACODEC_TESTS \
  2726. $VCODEC_TESTS \
  2727. $LAVF_TESTS \
  2728. $LAVFI_TESTS \
  2729. $SEEK_TESTS \
  2730. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  2731. echo "install prefix $prefix"
  2732. echo "source path $source_path"
  2733. echo "C compiler $cc"
  2734. echo "ARCH $arch ($cpu)"
  2735. if test "$build_suffix" != ""; then
  2736. echo "build suffix $build_suffix"
  2737. fi
  2738. if test "$extra_version" != ""; then
  2739. echo "version string suffix $extra_version"
  2740. fi
  2741. echo "big-endian ${bigendian-no}"
  2742. echo "runtime cpu detection ${runtime_cpudetect-no}"
  2743. if enabled x86; then
  2744. echo "yasm ${yasm-no}"
  2745. echo "MMX enabled ${mmx-no}"
  2746. echo "MMX2 enabled ${mmx2-no}"
  2747. echo "3DNow! enabled ${amd3dnow-no}"
  2748. echo "3DNow! extended enabled ${amd3dnowext-no}"
  2749. echo "SSE enabled ${sse-no}"
  2750. echo "SSSE3 enabled ${ssse3-no}"
  2751. echo "CMOV enabled ${cmov-no}"
  2752. echo "CMOV is fast ${fast_cmov-no}"
  2753. echo "EBX available ${ebx_available-no}"
  2754. echo "EBP available ${ebp_available-no}"
  2755. echo "10 operands supported ${ten_operands-no}"
  2756. fi
  2757. if enabled arm; then
  2758. echo "ARMv5TE enabled ${armv5te-no}"
  2759. echo "ARMv6 enabled ${armv6-no}"
  2760. echo "ARMv6T2 enabled ${armv6t2-no}"
  2761. echo "ARM VFP enabled ${armvfp-no}"
  2762. echo "IWMMXT enabled ${iwmmxt-no}"
  2763. echo "NEON enabled ${neon-no}"
  2764. fi
  2765. if enabled mips; then
  2766. echo "MMI enabled ${mmi-no}"
  2767. fi
  2768. if enabled ppc; then
  2769. echo "AltiVec enabled ${altivec-no}"
  2770. echo "PPC 4xx optimizations ${ppc4xx-no}"
  2771. echo "dcbzl available ${dcbzl-no}"
  2772. fi
  2773. if enabled sparc; then
  2774. echo "VIS enabled ${vis-no}"
  2775. fi
  2776. echo "debug symbols ${debug-no}"
  2777. echo "strip symbols ${stripping-no}"
  2778. echo "optimizations ${optimizations-no}"
  2779. echo "static ${static-no}"
  2780. echo "shared ${shared-no}"
  2781. echo "postprocessing support ${postproc-no}"
  2782. echo "new filter support ${avfilter-no}"
  2783. echo "network support ${network-no}"
  2784. echo "threading support ${thread_type-no}"
  2785. echo "SDL support ${sdl-no}"
  2786. echo "Sun medialib support ${mlib-no}"
  2787. echo "AVISynth enabled ${avisynth-no}"
  2788. echo "frei0r enabled ${frei0r-no}"
  2789. echo "libdc1394 support ${libdc1394-no}"
  2790. echo "libdirac enabled ${libdirac-no}"
  2791. echo "libfaac enabled ${libfaac-no}"
  2792. echo "libgsm enabled ${libgsm-no}"
  2793. echo "libmp3lame enabled ${libmp3lame-no}"
  2794. echo "libnut enabled ${libnut-no}"
  2795. echo "libopencore-amrnb support ${libopencore_amrnb-no}"
  2796. echo "libopencore-amrwb support ${libopencore_amrwb-no}"
  2797. echo "libopencv support ${libopencv-no}"
  2798. echo "libopenjpeg enabled ${libopenjpeg-no}"
  2799. echo "librtmp enabled ${librtmp-no}"
  2800. echo "libschroedinger enabled ${libschroedinger-no}"
  2801. echo "libspeex enabled ${libspeex-no}"
  2802. echo "libtheora enabled ${libtheora-no}"
  2803. echo "libvorbis enabled ${libvorbis-no}"
  2804. echo "libvpx enabled ${libvpx-no}"
  2805. echo "libx264 enabled ${libx264-no}"
  2806. echo "libxavs enabled ${libxavs-no}"
  2807. echo "libxvid enabled ${libxvid-no}"
  2808. echo "zlib enabled ${zlib-no}"
  2809. echo "bzlib enabled ${bzlib-no}"
  2810. echo
  2811. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  2812. echo "Enabled ${type}s:"
  2813. eval list=\$$(toupper $type)_LIST
  2814. print_enabled '_*' $list | sort | pr -3 -t
  2815. echo
  2816. done
  2817. license="LGPL version 2.1 or later"
  2818. if enabled nonfree; then
  2819. license="nonfree and unredistributable"
  2820. elif enabled gplv3; then
  2821. license="GPL version 3 or later"
  2822. elif enabled lgplv3; then
  2823. license="LGPL version 3 or later"
  2824. elif enabled gpl; then
  2825. license="GPL version 2 or later"
  2826. fi
  2827. echo "License: $license"
  2828. echo "Creating config.mak and config.h..."
  2829. # build tree in object directory if source path is different from current one
  2830. if enabled source_path_used; then
  2831. DIRS="
  2832. doc
  2833. libavcodec
  2834. libavcodec/$arch
  2835. libavcore
  2836. libavdevice
  2837. libavfilter
  2838. libavfilter/$arch
  2839. libavformat
  2840. libavutil
  2841. libavutil/$arch
  2842. libpostproc
  2843. libswscale
  2844. libswscale/$arch
  2845. tests
  2846. tools
  2847. "
  2848. FILES="
  2849. Makefile
  2850. common.mak
  2851. subdir.mak
  2852. doc/texi2pod.pl
  2853. libavcodec/Makefile
  2854. libavcodec/${arch}/Makefile
  2855. libavcore/Makefile
  2856. libavdevice/Makefile
  2857. libavfilter/Makefile
  2858. libavfilter/${arch}/Makefile
  2859. libavformat/Makefile
  2860. libavutil/Makefile
  2861. libpostproc/Makefile
  2862. libswscale/Makefile
  2863. "
  2864. map 'mkdir -p $v' $DIRS;
  2865. map 'test -f "$source_path/$v" && $ln_s "$source_path/$v" $v' $FILES
  2866. fi
  2867. enabled stripping || strip="echo skipping strip"
  2868. config_files="$TMPH config.mak"
  2869. cat > config.mak <<EOF
  2870. # Automatically generated by configure - do not modify!
  2871. ifndef FFMPEG_CONFIG_MAK
  2872. FFMPEG_CONFIG_MAK=1
  2873. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  2874. prefix=$prefix
  2875. LIBDIR=\$(DESTDIR)$libdir
  2876. SHLIBDIR=\$(DESTDIR)$shlibdir
  2877. INCDIR=\$(DESTDIR)$incdir
  2878. BINDIR=\$(DESTDIR)$bindir
  2879. DATADIR=\$(DESTDIR)$datadir
  2880. MANDIR=\$(DESTDIR)$mandir
  2881. SRC_PATH="$source_path"
  2882. SRC_PATH_BARE=$source_path
  2883. BUILD_ROOT="$PWD"
  2884. CC_IDENT=$cc_ident
  2885. ARCH=$arch
  2886. CC=$cc
  2887. AS=$as
  2888. LD=$ld
  2889. DEPCC=$dep_cc
  2890. YASM=$yasmexe
  2891. YASMDEP=$yasmexe
  2892. AR=$ar
  2893. RANLIB=$ranlib
  2894. CP=cp -p
  2895. LN_S=$ln_s
  2896. STRIP=$strip
  2897. CPPFLAGS=$CPPFLAGS
  2898. CFLAGS=$CFLAGS
  2899. ASFLAGS=$ASFLAGS
  2900. CC_O=$CC_O
  2901. LDFLAGS=$LDFLAGS
  2902. FFSERVERLDFLAGS=$FFSERVERLDFLAGS
  2903. SHFLAGS=$SHFLAGS
  2904. YASMFLAGS=$YASMFLAGS
  2905. BUILDSUF=$build_suffix
  2906. FULLNAME=$FULLNAME
  2907. LIBPREF=$LIBPREF
  2908. LIBSUF=$LIBSUF
  2909. LIBNAME=$LIBNAME
  2910. SLIBPREF=$SLIBPREF
  2911. SLIBSUF=$SLIBSUF
  2912. EXESUF=$EXESUF
  2913. EXTRA_VERSION=$extra_version
  2914. DEPFLAGS=$DEPFLAGS
  2915. CCDEP=$CCDEP
  2916. ASDEP=$ASDEP
  2917. CC_DEPFLAGS=$CC_DEPFLAGS
  2918. AS_DEPFLAGS=$AS_DEPFLAGS
  2919. HOSTCC=$host_cc
  2920. HOSTCFLAGS=$host_cflags
  2921. HOSTEXESUF=$HOSTEXESUF
  2922. HOSTLDFLAGS=$host_ldflags
  2923. HOSTLIBS=$host_libs
  2924. TARGET_EXEC=$target_exec
  2925. TARGET_PATH=$target_path
  2926. SDL_LIBS=$sdl_libs
  2927. SDL_CFLAGS=$sdl_cflags
  2928. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  2929. EXTRALIBS=$extralibs
  2930. INSTALL=install
  2931. LIBTARGET=${LIBTARGET}
  2932. SLIBNAME=${SLIBNAME}
  2933. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  2934. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  2935. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  2936. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  2937. SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}
  2938. SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}
  2939. SAMPLES=$samples
  2940. EOF
  2941. get_version(){
  2942. name=$1
  2943. file=$source_path/$2
  2944. eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
  2945. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  2946. lcname=$(tolower $name)
  2947. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  2948. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  2949. }
  2950. get_version LIBSWSCALE libswscale/swscale.h
  2951. get_version LIBPOSTPROC libpostproc/postprocess.h
  2952. get_version LIBAVCODEC libavcodec/avcodec.h
  2953. get_version LIBAVCORE libavcore/avcore.h
  2954. get_version LIBAVDEVICE libavdevice/avdevice.h
  2955. get_version LIBAVFORMAT libavformat/version.h
  2956. get_version LIBAVUTIL libavutil/avutil.h
  2957. get_version LIBAVFILTER libavfilter/avfilter.h
  2958. cat > $TMPH <<EOF
  2959. /* Automatically generated by configure - do not modify! */
  2960. #ifndef FFMPEG_CONFIG_H
  2961. #define FFMPEG_CONFIG_H
  2962. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  2963. #define FFMPEG_LICENSE "$(c_escape $license)"
  2964. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  2965. #define CC_TYPE "$cc_type"
  2966. #define CC_VERSION $cc_version
  2967. #define restrict $_restrict
  2968. #define EXTERN_PREFIX "${extern_prefix}"
  2969. #define EXTERN_ASM ${extern_prefix}
  2970. #define SLIBSUF "$SLIBSUF"
  2971. EOF
  2972. test -n "$malloc_prefix" &&
  2973. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  2974. if enabled small || disabled optimizations; then
  2975. echo "#undef av_always_inline" >> $TMPH
  2976. if enabled small; then
  2977. echo "#define av_always_inline inline" >> $TMPH
  2978. else
  2979. echo "#define av_always_inline av_unused" >> $TMPH
  2980. fi
  2981. fi
  2982. if enabled yasm; then
  2983. append config_files $TMPASM
  2984. printf '' >$TMPASM
  2985. fi
  2986. print_config ARCH_ "$config_files" $ARCH_LIST
  2987. print_config HAVE_ "$config_files" $HAVE_LIST
  2988. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  2989. $CONFIG_EXTRA \
  2990. $DECODER_LIST \
  2991. $ENCODER_LIST \
  2992. $HWACCEL_LIST \
  2993. $PARSER_LIST \
  2994. $BSF_LIST \
  2995. $DEMUXER_LIST \
  2996. $MUXER_LIST \
  2997. $FILTER_LIST \
  2998. $PROTOCOL_LIST \
  2999. $INDEV_LIST \
  3000. $OUTDEV_LIST \
  3001. cat >>config.mak <<EOF
  3002. ACODEC_TESTS=$(print_enabled -n _test $ACODEC_TESTS)
  3003. VCODEC_TESTS=$(print_enabled -n _test $VCODEC_TESTS)
  3004. LAVF_TESTS=$(print_enabled -n _test $LAVF_TESTS)
  3005. LAVFI_TESTS=$(print_enabled -n _test $LAVFI_TESTS)
  3006. SEEK_TESTS=$(print_enabled -n _test $SEEK_TESTS)
  3007. EOF
  3008. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  3009. echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
  3010. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  3011. cp_if_changed $TMPH config.h
  3012. touch .config
  3013. enabled yasm && cp_if_changed $TMPASM config.asm
  3014. cat > $TMPH <<EOF
  3015. /* Generated by ffconf */
  3016. #ifndef AVUTIL_AVCONFIG_H
  3017. #define AVUTIL_AVCONFIG_H
  3018. EOF
  3019. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  3020. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  3021. cp_if_changed $TMPH libavutil/avconfig.h
  3022. test -n "$WARNINGS" && printf "\n$WARNINGS"
  3023. # build pkg-config files
  3024. pkgconfig_generate(){
  3025. name=$1
  3026. shortname=${name#lib}${build_suffix}
  3027. comment=$2
  3028. version=$3
  3029. libs=$4
  3030. requires=$5
  3031. enabled ${name#lib} || return 0
  3032. cat <<EOF > $name/$name.pc
  3033. prefix=$prefix
  3034. exec_prefix=\${prefix}
  3035. libdir=$libdir
  3036. includedir=$incdir
  3037. Name: $name
  3038. Description: $comment
  3039. Version: $version
  3040. Requires: $(enabled shared || echo $requires)
  3041. Requires.private: $(enabled shared && echo $requires)
  3042. Conflicts:
  3043. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  3044. Libs.private: $(enabled shared && echo $libs)
  3045. Cflags: -I\${includedir}
  3046. EOF
  3047. cat <<EOF > $name/$name-uninstalled.pc
  3048. prefix=
  3049. exec_prefix=
  3050. libdir=\${pcfiledir}
  3051. includedir=${source_path}
  3052. Name: $name
  3053. Description: $comment
  3054. Version: $version
  3055. Requires: $requires
  3056. Conflicts:
  3057. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  3058. Cflags: -I\${includedir}
  3059. EOF
  3060. }
  3061. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
  3062. pkgconfig_generate libavcore "FFmpeg multimedia shared core utilities library" "$LIBAVCORE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
  3063. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavcore = $LIBAVCORE_VERSION"
  3064. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
  3065. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
  3066. pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavcore = $LIBAVCORE_VERSION"
  3067. pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
  3068. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"