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.

3398 lines
100KB

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