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.

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