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.

3407 lines
100KB

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