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.

3419 lines
101KB

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