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.

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