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.

3310 lines
97KB

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