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.

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