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.

3086 lines
87KB

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