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.

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