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.

3282 lines
96KB

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