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.

3235 lines
94KB

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