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.

3062 lines
86KB

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