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.

3318 lines
97KB

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