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.

3344 lines
98KB

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