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.

3171 lines
89KB

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