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.

3410 lines
100KB

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