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.

3088 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. binkaudio_dct_decoder_select="fft mdct rdft dct"
  1053. binkaudio_rdft_decoder_select="fft mdct rdft"
  1054. cavs_decoder_select="golomb"
  1055. cook_decoder_select="fft mdct"
  1056. cscd_decoder_suggest="zlib"
  1057. dca_decoder_select="fft mdct"
  1058. dnxhd_encoder_select="aandct"
  1059. dxa_decoder_select="zlib"
  1060. eac3_decoder_select="ac3_decoder"
  1061. eamad_decoder_select="aandct"
  1062. eatgq_decoder_select="aandct"
  1063. eatqi_decoder_select="aandct"
  1064. ffv1_decoder_select="golomb"
  1065. flac_decoder_select="golomb"
  1066. flac_encoder_select="golomb lpc"
  1067. flashsv_decoder_select="zlib"
  1068. flashsv_encoder_select="zlib"
  1069. flv_decoder_select="h263_decoder"
  1070. flv_encoder_select="h263_encoder"
  1071. h261_encoder_select="aandct"
  1072. h263_decoder_select="h263_parser"
  1073. h263_encoder_select="aandct"
  1074. h263_vaapi_hwaccel_deps="va_va_h"
  1075. h263_vaapi_hwaccel_select="vaapi h263_decoder"
  1076. h263i_decoder_select="h263_decoder"
  1077. h263p_encoder_select="h263_encoder"
  1078. h264_decoder_select="golomb"
  1079. h264_dxva2_hwaccel_deps="dxva2api_h"
  1080. h264_dxva2_hwaccel_select="dxva2 h264_decoder"
  1081. h264_vaapi_hwaccel_deps="va_va_h"
  1082. h264_vaapi_hwaccel_select="vaapi"
  1083. h264_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1084. h264_vdpau_decoder_select="vdpau h264_decoder"
  1085. imc_decoder_select="fft mdct"
  1086. jpegls_decoder_select="golomb"
  1087. jpegls_encoder_select="golomb"
  1088. ljpeg_encoder_select="aandct"
  1089. loco_decoder_select="golomb"
  1090. mjpeg_encoder_select="aandct"
  1091. mlp_decoder_select="mlp_parser"
  1092. mpeg1video_encoder_select="aandct"
  1093. mpeg2video_encoder_select="aandct"
  1094. mpeg4_decoder_select="h263_decoder mpeg4video_parser"
  1095. mpeg4_encoder_select="h263_encoder"
  1096. mpeg_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1097. mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder"
  1098. mpeg1_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1099. mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder"
  1100. mpeg2_vaapi_hwaccel_deps="va_va_h"
  1101. mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
  1102. mpeg4_vaapi_hwaccel_deps="va_va_h"
  1103. mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
  1104. mpeg4_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1105. mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
  1106. mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
  1107. mpeg_xvmc_decoder_select="mpegvideo_decoder"
  1108. msmpeg4v1_decoder_select="h263_decoder"
  1109. msmpeg4v1_encoder_select="h263_encoder"
  1110. msmpeg4v2_decoder_select="h263_decoder"
  1111. msmpeg4v2_encoder_select="h263_encoder"
  1112. msmpeg4v3_decoder_select="h263_decoder"
  1113. msmpeg4v3_encoder_select="h263_encoder"
  1114. nellymoser_decoder_select="fft mdct"
  1115. nellymoser_encoder_select="fft mdct"
  1116. png_decoder_select="zlib"
  1117. png_encoder_select="zlib"
  1118. qdm2_decoder_select="fft mdct rdft"
  1119. rv10_decoder_select="h263_decoder"
  1120. rv10_encoder_select="h263_encoder"
  1121. rv20_decoder_select="h263_decoder"
  1122. rv20_encoder_select="h263_encoder"
  1123. rv30_decoder_select="golomb"
  1124. rv40_decoder_select="golomb"
  1125. shorten_decoder_select="golomb"
  1126. sonic_decoder_select="golomb"
  1127. sonic_encoder_select="golomb"
  1128. sonic_ls_encoder_select="golomb"
  1129. svq3_decoder_select="golomb"
  1130. svq3_decoder_suggest="zlib"
  1131. theora_decoder_select="vp3_decoder"
  1132. tiff_decoder_suggest="zlib"
  1133. tiff_encoder_suggest="zlib"
  1134. truehd_decoder_select="mlp_decoder"
  1135. tscc_decoder_select="zlib"
  1136. vc1_decoder_select="h263_decoder"
  1137. vc1_dxva2_hwaccel_deps="dxva2api_h DXVA_PictureParameters_wDecodedPictureIndex"
  1138. vc1_dxva2_hwaccel_select="dxva2 vc1_decoder"
  1139. vc1_vaapi_hwaccel_deps="va_va_h"
  1140. vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
  1141. vc1_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1142. vc1_vdpau_decoder_select="vdpau vc1_decoder"
  1143. vorbis_decoder_select="fft mdct"
  1144. vorbis_encoder_select="fft mdct"
  1145. vp6a_decoder_select="vp6_decoder"
  1146. vp6f_decoder_select="vp6_decoder"
  1147. wmav1_decoder_select="fft mdct"
  1148. wmav1_encoder_select="fft mdct"
  1149. wmav2_decoder_select="fft mdct"
  1150. wmav2_encoder_select="fft mdct"
  1151. wmv1_decoder_select="h263_decoder"
  1152. wmv1_encoder_select="h263_encoder"
  1153. wmv2_decoder_select="h263_decoder"
  1154. wmv2_encoder_select="h263_encoder"
  1155. wmv3_decoder_select="vc1_decoder"
  1156. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  1157. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  1158. wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
  1159. zlib_decoder_select="zlib"
  1160. zlib_encoder_select="zlib"
  1161. zmbv_decoder_select="zlib"
  1162. zmbv_encoder_select="zlib"
  1163. # parsers
  1164. h264_parser_select="golomb"
  1165. # bitstream_filters
  1166. aac_adtstoasc_bsf_select="aac_parser"
  1167. # external libraries
  1168. libdirac_decoder_deps="libdirac !libschroedinger"
  1169. libdirac_encoder_deps="libdirac"
  1170. libfaac_encoder_deps="libfaac"
  1171. libfaad_decoder_deps="libfaad"
  1172. libfaadbin_decoder_extralibs='$ldl'
  1173. libgsm_decoder_deps="libgsm"
  1174. libgsm_encoder_deps="libgsm"
  1175. libgsm_ms_decoder_deps="libgsm"
  1176. libgsm_ms_encoder_deps="libgsm"
  1177. libmp3lame_encoder_deps="libmp3lame"
  1178. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  1179. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  1180. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  1181. libopenjpeg_decoder_deps="libopenjpeg"
  1182. libschroedinger_decoder_deps="libschroedinger"
  1183. libschroedinger_encoder_deps="libschroedinger"
  1184. libspeex_decoder_deps="libspeex"
  1185. libtheora_encoder_deps="libtheora"
  1186. libvorbis_encoder_deps="libvorbis"
  1187. libx264_encoder_deps="libx264"
  1188. libxvid_encoder_deps="libxvid"
  1189. # demuxers / muxers
  1190. ac3_demuxer_deps="ac3_parser"
  1191. asf_stream_muxer_select="asf_muxer"
  1192. avisynth_demuxer_deps="avisynth"
  1193. dirac_demuxer_deps="dirac_parser"
  1194. eac3_demuxer_select="ac3_parser"
  1195. ipod_muxer_select="mov_muxer"
  1196. libnut_demuxer_deps="libnut"
  1197. libnut_muxer_deps="libnut"
  1198. matroska_audio_muxer_select="matroska_muxer"
  1199. matroska_demuxer_suggest="zlib bzlib"
  1200. mov_demuxer_suggest="zlib"
  1201. mp3_demuxer_deps="mpegaudio_parser"
  1202. mp4_muxer_select="mov_muxer"
  1203. mpegtsraw_demuxer_select="mpegts_demuxer"
  1204. mxf_d10_muxer_select="mxf_muxer"
  1205. ogg_demuxer_select="golomb"
  1206. psp_muxer_select="mov_muxer"
  1207. rtsp_demuxer_deps="sdp_demuxer"
  1208. sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
  1209. spdif_muxer_select="aac_parser"
  1210. tg2_muxer_select="mov_muxer"
  1211. tgp_muxer_select="mov_muxer"
  1212. w64_demuxer_deps="wav_demuxer"
  1213. # indevs / outdevs
  1214. alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  1215. alsa_indev_extralibs="-lasound"
  1216. alsa_outdev_deps="alsa_asoundlib_h"
  1217. alsa_outdev_extralibs="-lasound"
  1218. audio_beos_indev_deps="audio_beos"
  1219. audio_beos_indev_extralibs="-lmedia -lbe"
  1220. audio_beos_outdev_deps="audio_beos"
  1221. audio_beos_outdev_extralibs="-lmedia -lbe"
  1222. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  1223. dv1394_indev_deps="dv1394 dv_demuxer"
  1224. jack_indev_deps="jack_jack_h"
  1225. jack_indev_extralibs="-ljack"
  1226. libdc1394_indev_deps="libdc1394"
  1227. oss_indev_deps_any="soundcard_h sys_soundcard_h"
  1228. oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  1229. v4l_indev_deps="linux_videodev_h"
  1230. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  1231. vfwcap_indev_deps="capCreateCaptureWindow"
  1232. vfwcap_indev_extralibs="-lavicap32"
  1233. x11_grab_device_indev_deps="x11grab XShmCreateImage"
  1234. x11_grab_device_indev_extralibs="-lX11 -lXext -lXfixes"
  1235. # protocols
  1236. gopher_protocol_deps="network"
  1237. http_protocol_deps="network"
  1238. rtmp_protocol_deps="tcp_protocol"
  1239. rtp_protocol_deps="udp_protocol"
  1240. tcp_protocol_deps="network"
  1241. udp_protocol_deps="network"
  1242. # filters
  1243. movie_filter_deps="avfilter_lavf"
  1244. avfilter_lavf_deps="avformat"
  1245. # libraries
  1246. avdevice_deps="avcodec avformat"
  1247. avformat_deps="avcodec"
  1248. # programs
  1249. ffmpeg_deps="avcodec avformat swscale"
  1250. ffplay_deps="avcodec avformat swscale sdl"
  1251. ffserver_deps="avformat ffm_muxer rtp_protocol rtsp_demuxer"
  1252. ffserver_extralibs='$ldl'
  1253. doc_deps="texi2html"
  1254. # default parameters
  1255. logfile="config.err"
  1256. # installation paths
  1257. prefix_default="/usr/local"
  1258. bindir_default='${prefix}/bin'
  1259. datadir_default='${prefix}/share/ffmpeg'
  1260. incdir_default='${prefix}/include'
  1261. libdir_default='${prefix}/lib'
  1262. mandir_default='${prefix}/share/man'
  1263. shlibdir_default="$libdir_default"
  1264. # toolchain
  1265. ar="ar"
  1266. cc_default="gcc"
  1267. cc_version=\"unknown\"
  1268. host_cc_default="gcc"
  1269. ln_s="ln -sf"
  1270. nm_default="nm"
  1271. objformat="elf"
  1272. ranlib="ranlib"
  1273. strip="strip"
  1274. yasmexe="yasm"
  1275. nm_opts='-g'
  1276. # machine
  1277. arch=$(uname -m)
  1278. cpu="generic"
  1279. # OS
  1280. target_os=$(tolower $(uname -s))
  1281. host_os=$target_os
  1282. # configurable options
  1283. enable avcodec
  1284. enable avdevice
  1285. enable avformat
  1286. enable avutil
  1287. enable asm
  1288. enable debug
  1289. enable doc
  1290. enable fastdiv
  1291. enable ffmpeg
  1292. enable ffplay
  1293. enable ffserver
  1294. enable mpegaudio_hp
  1295. enable network
  1296. enable optimizations
  1297. enable protocols
  1298. enable static
  1299. enable stripping
  1300. enable swscale
  1301. enable swscale_alpha
  1302. # build settings
  1303. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  1304. FFSERVERLDFLAGS=-Wl,-E
  1305. LIBPREF="lib"
  1306. LIBSUF=".a"
  1307. FULLNAME='$(NAME)$(BUILDSUF)'
  1308. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  1309. SLIBPREF="lib"
  1310. SLIBSUF=".so"
  1311. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  1312. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  1313. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  1314. LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  1315. CC_O='-o $@'
  1316. host_cflags='-D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -O3 -g -Wall'
  1317. host_libs='-lm'
  1318. target_path='$(CURDIR)'
  1319. # gcc stupidly only outputs the basename of targets with -MM, but we need the
  1320. # full relative path for objects in subdirectories for non-recursive Make.
  1321. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  1322. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM'
  1323. # find source path
  1324. source_path="$(dirname "$0")"
  1325. enable source_path_used
  1326. if test -f configure; then
  1327. source_path="$(pwd)"
  1328. disable source_path_used
  1329. else
  1330. source_path="$(cd "$source_path"; pwd)"
  1331. echo "$source_path" | grep -q '[[:blank:]]' &&
  1332. die "Out of tree builds are impossible with whitespace in source path."
  1333. test -e "$source_path/config.h" &&
  1334. die "Out of tree builds are impossible with config.h in source dir."
  1335. fi
  1336. for v in "$@"; do
  1337. r=${v#*=}
  1338. l=${v%"$r"}
  1339. r=$(sh_quote "$r")
  1340. FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
  1341. done
  1342. find_things(){
  1343. thing=$1
  1344. pattern=$2
  1345. file=$source_path/$3
  1346. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  1347. }
  1348. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  1349. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  1350. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  1351. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  1352. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  1353. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  1354. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  1355. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  1356. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  1357. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  1358. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  1359. enable $ARCH_EXT_LIST \
  1360. $DECODER_LIST \
  1361. $ENCODER_LIST \
  1362. $HWACCEL_LIST \
  1363. $PARSER_LIST \
  1364. $BSF_LIST \
  1365. $DEMUXER_LIST \
  1366. $MUXER_LIST \
  1367. $FILTER_LIST \
  1368. $PROTOCOL_LIST \
  1369. $INDEV_LIST \
  1370. $OUTDEV_LIST \
  1371. die_unknown(){
  1372. echo "Unknown option \"$1\"."
  1373. echo "See $0 --help for available options."
  1374. exit 1
  1375. }
  1376. show_list() {
  1377. suffix=_$1
  1378. shift
  1379. echo $* | sed s/$suffix//g | tr ' ' '\n' | sort | pr -3 -t
  1380. exit 0
  1381. }
  1382. for opt do
  1383. optval="${opt#*=}"
  1384. case "$opt" in
  1385. --extra-ldflags=*) add_ldflags $optval
  1386. ;;
  1387. --extra-libs=*) add_extralibs $optval
  1388. ;;
  1389. --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
  1390. ;;
  1391. --enable-debug=*) debuglevel="$optval"
  1392. ;;
  1393. --enable-*=*|--disable-*=*)
  1394. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  1395. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  1396. eval list=\$$(toupper $thing)_LIST
  1397. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  1398. $action $(filter "$name" $list)
  1399. ;;
  1400. --enable-?*|--disable-?*)
  1401. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  1402. if is_in $option $COMPONENT_LIST; then
  1403. test $action = disable && action=unset
  1404. eval $action \$$(toupper ${option%s})_LIST
  1405. elif is_in $option $CMDLINE_SELECT; then
  1406. $action $option
  1407. else
  1408. die_unknown $opt
  1409. fi
  1410. ;;
  1411. --list-*)
  1412. NAME="${opt#--list-}"
  1413. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  1414. NAME=${NAME%s}
  1415. eval show_list $NAME \$$(toupper $NAME)_LIST
  1416. ;;
  1417. --help|-h) show_help
  1418. ;;
  1419. *)
  1420. optname="${opt%%=*}"
  1421. optname="${optname#--}"
  1422. optname=$(echo "$optname" | sed 's/-/_/g')
  1423. if is_in $optname $CMDLINE_SET; then
  1424. eval $optname='$optval'
  1425. elif is_in $optname $CMDLINE_APPEND; then
  1426. append $optname "$optval"
  1427. else
  1428. die_unknown $opt
  1429. fi
  1430. ;;
  1431. esac
  1432. done
  1433. disabled logging && logfile=/dev/null
  1434. echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
  1435. set >> $logfile
  1436. test -n "$cross_prefix" && enable cross_compile
  1437. ar="${cross_prefix}${ar}"
  1438. cc_default="${cross_prefix}${cc_default}"
  1439. nm_default="${cross_prefix}${nm_default}"
  1440. ranlib="${cross_prefix}${ranlib}"
  1441. strip="${cross_prefix}${strip}"
  1442. sysinclude_default="${sysroot}/usr/include"
  1443. set_default cc nm sysinclude
  1444. enabled cross_compile || host_cc_default=$cc
  1445. set_default host_cc
  1446. exesuf() {
  1447. case $1 in
  1448. mingw32*|cygwin*|*-dos|freedos|opendos|os/2*) echo .exe ;;
  1449. esac
  1450. }
  1451. EXESUF=$(exesuf $target_os)
  1452. HOSTEXESUF=$(exesuf $host_os)
  1453. # set temporary file name
  1454. : ${TMPDIR:=$TEMPDIR}
  1455. : ${TMPDIR:=$TMP}
  1456. : ${TMPDIR:=/tmp}
  1457. if ! check_cmd type mktemp; then
  1458. # simple replacement for missing mktemp
  1459. # NOT SAFE FOR GENERAL USE
  1460. mktemp(){
  1461. echo "${2%XXX*}.${HOSTNAME}.${UID}.$$"
  1462. }
  1463. fi
  1464. tmpfile(){
  1465. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  1466. (set -C; exec > $tmp) 2>/dev/null ||
  1467. die "Unable to create temporary file in $TMPDIR."
  1468. append TMPFILES $tmp
  1469. eval $1=$tmp
  1470. }
  1471. trap 'rm -f -- $TMPFILES' EXIT
  1472. trap exit HUP INT TERM
  1473. tmpfile TMPC .c
  1474. tmpfile TMPE $EXESUF
  1475. tmpfile TMPH .h
  1476. tmpfile TMPO .o
  1477. tmpfile TMPS .S
  1478. tmpfile TMPV .ver
  1479. tmpfile TMPSH .sh
  1480. unset -f mktemp
  1481. # make sure we can execute files in $TMPDIR
  1482. cat > $TMPSH 2>> $logfile <<EOF
  1483. #! /bin/sh
  1484. EOF
  1485. chmod +x $TMPSH >> $logfile 2>&1
  1486. if ! $TMPSH >> $logfile 2>&1; then
  1487. cat <<EOF
  1488. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  1489. variable to another directory and make sure that it is not mounted noexec.
  1490. EOF
  1491. die "Sanity test failed."
  1492. fi
  1493. filter_cflags=echo
  1494. filter_cppflags=echo
  1495. filter_asflags=echo
  1496. if $cc -v 2>&1 | grep -qi ^gcc; then
  1497. cc_type=gcc
  1498. cc_version=__VERSION__
  1499. if ! $cc -dumpversion | grep -q '^2\.'; then
  1500. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1501. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1502. fi
  1503. speed_cflags='-O3'
  1504. size_cflags='-Os'
  1505. elif $cc --version 2>/dev/null | grep -q Intel; then
  1506. cc_type=icc
  1507. cc_version="AV_STRINGIFY(__INTEL_COMPILER)"
  1508. CC_DEPFLAGS='-MMD'
  1509. AS_DEPFLAGS='-MMD'
  1510. speed_cflags='-O3'
  1511. size_cflags='-Os'
  1512. elif $cc -v 2>&1 | grep -q xlc; then
  1513. cc_type=xlc
  1514. cc_version="AV_STRINGIFY(__IBMC__)"
  1515. speed_cflags='-O5'
  1516. size_cflags='-O5 -qcompact'
  1517. elif $cc -V 2>/dev/null | grep -q Compaq; then
  1518. cc_type=ccc
  1519. cc_version="AV_STRINGIFY(__DECC_VER)"
  1520. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M'
  1521. debuglevel=3
  1522. add_ldflags -Wl,-z,now # calls to libots crash without this
  1523. speed_cflags='-fast'
  1524. size_cflags='-O1'
  1525. elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
  1526. test -d "$sysroot" || die "No valid sysroot specified."
  1527. cc_type=armcc
  1528. cc_version="AV_STRINGIFY(__ARMCC_VERSION)"
  1529. armcc_conf="$PWD/armcc.conf"
  1530. $cc --arm_linux_configure \
  1531. --arm_linux_config_file="$armcc_conf" \
  1532. --configure_sysroot="$sysroot" \
  1533. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  1534. die "Error creating armcc configuration file."
  1535. cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc"
  1536. as_default="${cross_prefix}gcc"
  1537. CC_DEPFLAGS='-MMD'
  1538. AS_DEPFLAGS='-MMD'
  1539. speed_cflags='-O3'
  1540. size_cflags='-Os'
  1541. elif $cc -version 2>/dev/null | grep -q TMS470; then
  1542. cc_type=tms470
  1543. cc_version="AV_STRINGIFY(__TI_COMPILER_VERSION__)"
  1544. cc="$cc --gcc --abi=eabi -eo=.o -mc -me"
  1545. CC_O='-fr=$(@D)'
  1546. as_default="${cross_prefix}gcc"
  1547. ld_default="${cross_prefix}gcc"
  1548. TMPO=$(basename $TMPC .c).o
  1549. append TMPFILES $TMPO
  1550. add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__=
  1551. CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)'
  1552. AS_DEPFLAGS='-MMD'
  1553. speed_cflags='-O3 -mf=5'
  1554. size_cflags='-O3 -mf=2'
  1555. filter_cflags=tms470_flags
  1556. tms470_flags(){
  1557. for flag; do
  1558. case $flag in
  1559. -march=*|-mcpu=*)
  1560. case "${flag#*=}" in
  1561. armv7-a|cortex-a*) echo -mv=7a8 ;;
  1562. armv7-r|cortex-r*) echo -mv=7r4 ;;
  1563. armv7-m|cortex-m*) echo -mv=7m3 ;;
  1564. armv6*|arm11*) echo -mv=6 ;;
  1565. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  1566. echo -mv=5e ;;
  1567. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  1568. esac
  1569. ;;
  1570. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  1571. -mfpu=vfp) echo --float_support=vfpv2 ;;
  1572. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  1573. -msoft-float) echo --float_support=vfplib ;;
  1574. -O[0-3]|-mf=*) echo $flag ;;
  1575. -g) echo -g -mn ;;
  1576. -pds=*) echo $flag ;;
  1577. esac
  1578. done
  1579. }
  1580. elif $cc -v 2>&1 | grep -q clang; then
  1581. cc_type=clang
  1582. cc_version=__VERSION__
  1583. CC_DEPFLAGS='-MMD'
  1584. AS_DEPFLAGS='-MMD'
  1585. speed_cflags='-O3'
  1586. size_cflags='-Os'
  1587. elif $cc -V 2>&1 | grep -q Sun; then
  1588. cc_type=suncc
  1589. cc_version="AV_STRINGIFY(__SUNPRO_C)"
  1590. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  1591. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1'
  1592. speed_cflags='-O5'
  1593. size_cflags='-O5 -xspace'
  1594. filter_cflags=suncc_flags
  1595. suncc_flags(){
  1596. for flag; do
  1597. case $flag in
  1598. -march=*|-mcpu=*)
  1599. case "${flag#*=}" in
  1600. native) echo -xtarget=native ;;
  1601. v9) echo -xarch=sparc ;;
  1602. ultrasparc) echo -xarch=sparcvis ;;
  1603. ultrasparc3|niagara*) echo -xarch=sparcvis2 ;;
  1604. i586|pentium) echo -xchip=pentium ;;
  1605. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  1606. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  1607. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  1608. pentium4*) echo -xtarget=pentium4 ;;
  1609. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  1610. *-sse3) echo -xarch=sse3 ;;
  1611. core2) echo -xarch=ssse3 -xchip=core2 ;;
  1612. amdfam10|barcelona) echo -xarch=sse4_1 ;;
  1613. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  1614. k8|opteron|athlon64|athlon-fx)
  1615. echo -xarch=sse2a ;;
  1616. athlon*) echo -xarch=pentium_proa ;;
  1617. esac
  1618. ;;
  1619. -std=c99) echo -xc99 ;;
  1620. -fomit-frame-pointer) echo -xregs=frameptr ;;
  1621. -fPIC) echo -KPIC -xcode=pic32 ;;
  1622. -W*,*) echo $flag ;;
  1623. -f*-*|-W*) ;;
  1624. *) echo $flag ;;
  1625. esac
  1626. done
  1627. }
  1628. fi
  1629. test -n "$cc_type" && enable $cc_type || echolog "Unknown C compiler $cc"
  1630. : ${as_default:=$cc}
  1631. : ${dep_cc_default:=$cc}
  1632. : ${ld_default:=$cc}
  1633. set_default as dep_cc ld
  1634. test -n "$CC_DEPFLAGS" || CCDEP=$DEPEND_CMD
  1635. test -n "$AS_DEPFLAGS" || ASDEP=$DEPEND_CMD
  1636. add_cflags $extra_cflags
  1637. add_asflags $extra_cflags
  1638. if test -n "$sysroot"; then
  1639. case "$cc_type" in
  1640. gcc)
  1641. add_cppflags --sysroot="$sysroot"
  1642. add_ldflags --sysroot="$sysroot"
  1643. ;;
  1644. tms470)
  1645. add_cppflags -I"$sysinclude"
  1646. add_ldflags --sysroot="$sysroot"
  1647. ;;
  1648. clang)
  1649. add_cppflags -isysroot="$sysroot"
  1650. add_ldflags -isysroot="$sysroot"
  1651. ;;
  1652. esac
  1653. fi
  1654. if test "$cpu" = host; then
  1655. enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
  1656. case "$cc_type" in
  1657. gcc)
  1658. check_native(){
  1659. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  1660. sed -n "/$1=/{
  1661. s/.*$1=\\([^ ]*\\).*/\\1/
  1662. p
  1663. q
  1664. }" $TMPE
  1665. }
  1666. cpu=$(check_native -march || check_native -mcpu)
  1667. ;;
  1668. esac
  1669. test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
  1670. fi
  1671. # Deal with common $arch aliases
  1672. case "$arch" in
  1673. arm*)
  1674. arch="arm"
  1675. ;;
  1676. mips|mipsel|IP*)
  1677. arch="mips"
  1678. ;;
  1679. mips64)
  1680. arch="mips"
  1681. subarch="mips64"
  1682. ;;
  1683. parisc|hppa)
  1684. arch="parisc"
  1685. ;;
  1686. parisc64|hppa64)
  1687. arch="parisc"
  1688. subarch="parisc64"
  1689. ;;
  1690. "Power Macintosh"|ppc|powerpc)
  1691. arch="ppc"
  1692. ;;
  1693. ppc64)
  1694. arch="ppc"
  1695. subarch="ppc64"
  1696. ;;
  1697. s390|s390x)
  1698. arch="s390"
  1699. ;;
  1700. sh4|sh)
  1701. arch="sh4"
  1702. ;;
  1703. sun4u|sparc64)
  1704. arch="sparc"
  1705. subarch="sparc64"
  1706. ;;
  1707. i[3-6]86|i86pc|BePC|x86_64|amd64)
  1708. arch="x86"
  1709. ;;
  1710. esac
  1711. is_in $arch $ARCH_LIST || echo "WARNING: unknown arch $arch"
  1712. enable $arch
  1713. # Add processor-specific flags
  1714. if test "$cpu" = generic; then
  1715. : do nothing
  1716. elif enabled ppc; then
  1717. case $(tolower $cpu) in
  1718. 601|ppc601|powerpc601)
  1719. cpuflags="-mcpu=601"
  1720. disable altivec
  1721. ;;
  1722. 603*|ppc603*|powerpc603*)
  1723. cpuflags="-mcpu=603"
  1724. disable altivec
  1725. ;;
  1726. 604*|ppc604*|powerpc604*)
  1727. cpuflags="-mcpu=604"
  1728. disable altivec
  1729. ;;
  1730. g3|75*|ppc75*|powerpc75*)
  1731. cpuflags="-mcpu=750 -mpowerpc-gfxopt"
  1732. disable altivec
  1733. ;;
  1734. g4|745*|ppc745*|powerpc745*)
  1735. cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
  1736. ;;
  1737. 74*|ppc74*|powerpc74*)
  1738. cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
  1739. ;;
  1740. g5|970|ppc970|powerpc970|power4*)
  1741. cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
  1742. ;;
  1743. cell)
  1744. cpuflags="-mcpu=cell"
  1745. enable ldbrx
  1746. ;;
  1747. e500v2)
  1748. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  1749. disable altivec
  1750. ;;
  1751. e500)
  1752. cpuflags="-mcpu=8540 -mhard-float"
  1753. disable altivec
  1754. ;;
  1755. esac
  1756. elif enabled x86; then
  1757. case $cpu in
  1758. i[345]86|pentium)
  1759. cpuflags="-march=$cpu"
  1760. disable mmx
  1761. ;;
  1762. # targets that do NOT support conditional mov (cmov)
  1763. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  1764. cpuflags="-march=$cpu"
  1765. disable cmov
  1766. ;;
  1767. # targets that do support conditional mov (cmov)
  1768. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2|amdfam10)
  1769. cpuflags="-march=$cpu"
  1770. enable cmov
  1771. enable fast_cmov
  1772. ;;
  1773. # targets that do support conditional mov but on which it's slow
  1774. pentium4|pentium4m|prescott|nocona)
  1775. cpuflags="-march=$cpu"
  1776. enable cmov
  1777. disable fast_cmov
  1778. ;;
  1779. esac
  1780. elif enabled sparc; then
  1781. case $cpu in
  1782. sparc64)
  1783. cpuflags="-mcpu=v9"
  1784. ;;
  1785. esac
  1786. elif enabled arm; then
  1787. case $cpu in
  1788. armv*)
  1789. cpuflags="-march=$cpu"
  1790. ;;
  1791. *)
  1792. cpuflags="-mcpu=$cpu"
  1793. ;;
  1794. esac
  1795. elif enabled alpha; then
  1796. enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
  1797. elif enabled bfin; then
  1798. cpuflags="-mcpu=$cpu"
  1799. elif enabled mips; then
  1800. cpuflags="-march=$cpu"
  1801. elif enabled avr32; then
  1802. case $cpu in
  1803. ap7[02]0[0-2])
  1804. subarch="avr32_ap"
  1805. cpuflags="-mpart=$cpu"
  1806. ;;
  1807. ap)
  1808. subarch="avr32_ap"
  1809. cpuflags="-march=$cpu"
  1810. ;;
  1811. uc3[ab]*)
  1812. subarch="avr32_uc"
  1813. cpuflags="-mcpu=$cpu"
  1814. ;;
  1815. uc)
  1816. subarch="avr32_uc"
  1817. cpuflags="-march=$cpu"
  1818. ;;
  1819. esac
  1820. fi
  1821. add_cflags $cpuflags
  1822. add_asflags $cpuflags
  1823. # compiler sanity check
  1824. check_exec <<EOF
  1825. int main(void){ return 0; }
  1826. EOF
  1827. if test "$?" != 0; then
  1828. echo "$cc is unable to create an executable file."
  1829. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  1830. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  1831. echo "Only do this if you know what cross compiling means."
  1832. fi
  1833. die "C compiler test failed."
  1834. fi
  1835. add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
  1836. check_cflags -std=c99
  1837. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  1838. #include <stdlib.h>
  1839. EOF
  1840. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  1841. #include <stdlib.h>
  1842. EOF
  1843. check_host_cflags -std=c99
  1844. case "$arch" in
  1845. alpha|ia64|mips|parisc|sparc)
  1846. spic=$shared
  1847. ;;
  1848. x86)
  1849. subarch="x86_32"
  1850. check_cc <<EOF && subarch="x86_64"
  1851. int test[(int)sizeof(char*) - 7];
  1852. EOF
  1853. if test "$subarch" = "x86_64"; then
  1854. spic=$shared
  1855. fi
  1856. ;;
  1857. esac
  1858. enable $subarch
  1859. enabled spic && enable pic
  1860. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
  1861. # OS specific
  1862. case $target_os in
  1863. beos|haiku|zeta)
  1864. prefix_default="$HOME/config"
  1865. # 3 gcc releases known for BeOS, each with ugly bugs
  1866. gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
  1867. case "$gcc_version" in
  1868. 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
  1869. disable mmx
  1870. ;;
  1871. *20010315*) echo "BeBits gcc"
  1872. add_cflags -fno-expensive-optimizations
  1873. ;;
  1874. esac
  1875. SHFLAGS=-nostart
  1876. # enable BeOS things
  1877. enable audio_beos
  1878. # no need for libm, but the inet stuff
  1879. # Check for BONE
  1880. # XXX: actually should check for NOT net_server
  1881. if echo $BEINCLUDES | grep -q 'headers/be/bone'; then
  1882. network_extralibs="-lbind -lsocket"
  1883. else
  1884. enable beos_netserver
  1885. network_extralibs="-lnet"
  1886. fi ;;
  1887. sunos)
  1888. FFSERVERLDFLAGS=""
  1889. SHFLAGS='-shared -Wl,-h,$$(@F)'
  1890. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  1891. network_extralibs="-lsocket -lnsl"
  1892. add_cppflags -D__EXTENSIONS__
  1893. nm_opts='-P -g'
  1894. ;;
  1895. netbsd)
  1896. oss_indev_extralibs="-lossaudio"
  1897. oss_outdev_extralibs="-lossaudio"
  1898. ;;
  1899. openbsd)
  1900. enable malloc_aligned
  1901. # On OpenBSD 4.5. the compiler does not use PIC unless
  1902. # explicitly using -fPIC. FFmpeg builds fine without PIC,
  1903. # however the generated executable will not do anything
  1904. # (simply quits with exit-code 1, no crash, no output).
  1905. # Thus explicitly enable PIC here.
  1906. enable pic
  1907. SHFLAGS='-shared'
  1908. oss_indev_extralibs="-lossaudio"
  1909. oss_outdev_extralibs="-lossaudio"
  1910. ;;
  1911. freebsd|dragonfly)
  1912. enable malloc_aligned
  1913. ;;
  1914. bsd/os)
  1915. osextralibs="-lpoll -lgnugetopt"
  1916. strip="strip -d"
  1917. ;;
  1918. darwin)
  1919. enable malloc_aligned
  1920. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
  1921. strip="strip -x"
  1922. FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
  1923. SLIBSUF=".dylib"
  1924. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  1925. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  1926. FFSERVERLDFLAGS=-Wl,-bind_at_load
  1927. objformat="macho"
  1928. enabled x86_64 && objformat="macho64"
  1929. enabled_any pic shared ||
  1930. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  1931. ;;
  1932. mingw32*)
  1933. if test $target_os = "mingw32ce"; then
  1934. disable network
  1935. else
  1936. target_os=mingw32
  1937. fi
  1938. LIBTARGET=i386
  1939. if enabled x86_64; then
  1940. enable malloc_aligned
  1941. LIBTARGET=x64
  1942. elif enabled arm; then
  1943. LIBTARGET=arm
  1944. fi
  1945. shlibdir_default="$bindir_default"
  1946. disable ffserver
  1947. SLIBPREF=""
  1948. SLIBSUF=".dll"
  1949. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  1950. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  1951. SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
  1952. SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
  1953. install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"; \
  1954. install -d "$(LIBDIR)"; \
  1955. install -m 644 $(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) "$(LIBDIR)/lib$(SLIBNAME:$(SLIBSUF)=.dll.a)"'
  1956. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
  1957. 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'
  1958. objformat="win32"
  1959. enable dos_paths
  1960. check_cflags -fno-common
  1961. if ! enabled x86_64; then
  1962. check_cpp_condition _mingw.h "(__MINGW32_MAJOR_VERSION > 3) || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  1963. die "ERROR: MinGW runtime version must be >= 3.15."
  1964. enabled_any avisynth vfwcap_indev &&
  1965. { check_cpp_condition w32api.h "(__W32API_MAJOR_VERSION > 3) || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION >= 13)" ||
  1966. die "ERROR: avisynth and vfwcap_indev require w32api version 3.13 or later."; }
  1967. fi
  1968. ;;
  1969. cygwin*)
  1970. target_os=cygwin
  1971. shlibdir_default="$bindir_default"
  1972. SLIBPREF="cyg"
  1973. SLIBSUF=".dll"
  1974. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  1975. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  1976. SHFLAGS='-shared -Wl,--enable-auto-image-base'
  1977. objformat="win32"
  1978. enable dos_paths
  1979. check_cflags -fno-common
  1980. ;;
  1981. *-dos|freedos|opendos)
  1982. disable ffplay ffserver
  1983. disable $INDEV_LIST $OUTDEV_LIST
  1984. network_extralibs="-lsocket"
  1985. objformat="coff"
  1986. enable dos_paths
  1987. ;;
  1988. linux)
  1989. enable dv1394
  1990. ;;
  1991. irix*)
  1992. target_os=irix
  1993. ranlib="echo ignoring ranlib"
  1994. ;;
  1995. os/2*)
  1996. strip="lxlite"
  1997. ln_s="cp -f"
  1998. FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
  1999. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  2000. FFSERVERLDFLAGS=""
  2001. LIBSUF="_s.a"
  2002. SLIBPREF=""
  2003. SLIBSUF=".dll"
  2004. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  2005. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  2006. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  2007. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  2008. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  2009. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  2010. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  2011. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  2012. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  2013. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  2014. SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
  2015. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
  2016. enable dos_paths
  2017. ;;
  2018. gnu/kfreebsd)
  2019. ;;
  2020. gnu)
  2021. ;;
  2022. *)
  2023. die "Unknown OS '$target_os'."
  2024. ;;
  2025. esac
  2026. set_default $PATHS_LIST
  2027. add_extralibs $osextralibs
  2028. # Combine FFLDFLAGS and the LDFLAGS environment variable.
  2029. LDFLAGS="$FFLDFLAGS $LDFLAGS"
  2030. # we need to build at least one lib type
  2031. if ! enabled_any static shared; then
  2032. cat <<EOF
  2033. At least one library type must be built.
  2034. Specify --enable-static to build the static libraries or --enable-shared to
  2035. build the shared libraries as well. To only build the shared libraries specify
  2036. --disable-static in addition to --enable-shared.
  2037. EOF
  2038. exit 1;
  2039. fi
  2040. disabled static && LIBNAME=""
  2041. if enabled_any libfaad libfaadbin ; then
  2042. if check_header faad.h; then
  2043. check_cc <<EOF
  2044. #include <faad.h>
  2045. #ifndef FAAD2_VERSION
  2046. ok faad1
  2047. #endif
  2048. int main(void) { return 0; }
  2049. EOF
  2050. test $? = 0 && enable libfaad2
  2051. else
  2052. die "FAAD test failed."
  2053. fi
  2054. fi
  2055. die_license_disabled() {
  2056. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  2057. }
  2058. die_license_disabled gpl libfaad2
  2059. die_license_disabled gpl libx264
  2060. die_license_disabled gpl libxvid
  2061. die_license_disabled gpl postproc
  2062. die_license_disabled gpl x11grab
  2063. die_license_disabled nonfree libfaac
  2064. die_license_disabled version3 libopencore_amrnb
  2065. die_license_disabled version3 libopencore_amrwb
  2066. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  2067. check_deps $ARCH_EXT_LIST
  2068. disabled optimizations || check_cflags -fomit-frame-pointer
  2069. enable_pic() {
  2070. enable pic
  2071. add_cppflags -DPIC
  2072. add_cflags -fPIC
  2073. add_asflags -fPIC
  2074. }
  2075. enabled pic && enable_pic
  2076. check_cc <<EOF || die "Symbol mangling check failed."
  2077. int ff_extern;
  2078. EOF
  2079. sym=$($nm $nm_opts $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  2080. extern_prefix=${sym%%ff_extern*}
  2081. check_cc <<EOF && enable inline_asm
  2082. void foo(void) { __asm__ volatile ("" ::); }
  2083. EOF
  2084. _restrict=
  2085. for restrict_keyword in restrict __restrict__ __restrict; do
  2086. check_cc <<EOF && _restrict=$restrict_keyword && break
  2087. void foo(char * $restrict_keyword p);
  2088. EOF
  2089. done
  2090. check_cc <<EOF && enable attribute_packed
  2091. struct { int x; } __attribute__((packed)) x;
  2092. EOF
  2093. check_cc <<EOF && enable attribute_may_alias
  2094. union { int x; } __attribute__((may_alias)) x;
  2095. EOF
  2096. check_cc <<EOF || die "endian test failed"
  2097. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  2098. EOF
  2099. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  2100. if enabled alpha; then
  2101. check_cflags -mieee
  2102. elif enabled arm; then
  2103. check_cflags -marm
  2104. check_ld <<EOF && enable vfp_args
  2105. __asm__ (".eabi_attribute 28, 1");
  2106. int main(void) { return 0; }
  2107. EOF
  2108. # We have to check if pld is a nop and disable it.
  2109. check_asm pld '"pld [r0]"'
  2110. enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
  2111. enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
  2112. enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
  2113. enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
  2114. enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
  2115. enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
  2116. enabled_all armv6t2 shared !pic && enable_pic
  2117. elif enabled ia64; then
  2118. # HACK: currently fails to build if .bss is > 4MB and shared libs are built
  2119. enabled shared && enable_weak hardcoded_tables
  2120. elif enabled mips; then
  2121. check_asm loongson '"dmult.g $1, $2, $3"'
  2122. enabled mmi && check_asm mmi '"lq $2, 0($2)"'
  2123. elif enabled ppc; then
  2124. check_asm dcbzl '"dcbzl 0, 1"'
  2125. check_asm ppc4xx '"maclhw r10, r11, r12"'
  2126. check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  2127. # AltiVec flags: The FSF version of GCC differs from the Apple version
  2128. if enabled altivec; then
  2129. check_cflags -maltivec -mabi=altivec &&
  2130. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  2131. check_cflags -faltivec
  2132. # check if our compiler supports Motorola AltiVec C API
  2133. check_cc <<EOF || disable altivec
  2134. $inc_altivec_h
  2135. int main(void) {
  2136. vector signed int v1, v2, v3;
  2137. v1 = vec_add(v2,v3);
  2138. return 0;
  2139. }
  2140. EOF
  2141. # check if our compiler supports braces for vector declarations
  2142. check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
  2143. $inc_altivec_h
  2144. int main (void) { (vector int) {1}; return 0; }
  2145. EOF
  2146. fi
  2147. elif enabled sparc; then
  2148. enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
  2149. add_cflags -mcpu=ultrasparc -mtune=ultrasparc
  2150. elif enabled x86; then
  2151. # check whether EBP is available on x86
  2152. # As 'i' is stored on the stack, this program will crash
  2153. # if the base pointer is used to access it because the
  2154. # base pointer is cleared in the inline assembly code.
  2155. check_exec_crash <<EOF && enable ebp_available
  2156. volatile int i=0;
  2157. __asm__ volatile (
  2158. "xorl %%ebp, %%ebp"
  2159. ::: "%ebp");
  2160. return i;
  2161. EOF
  2162. # check whether EBX is available on x86
  2163. check_asm ebx_available '""::"b"(0)' &&
  2164. check_asm ebx_available '"":::"%ebx"'
  2165. # check whether more than 10 operands are supported
  2166. check_cc <<EOF && enable ten_operands
  2167. int main(void) {
  2168. int x=0;
  2169. __asm__ volatile(
  2170. ""
  2171. :"+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x)
  2172. );
  2173. return 0;
  2174. }
  2175. EOF
  2176. # check whether binutils is new enough to compile SSSE3/MMX2
  2177. enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
  2178. enabled mmx2 && check_asm mmx2 '"pmaxub %mm0, %mm1"'
  2179. check_asm bswap '"bswap %%eax" ::: "%eax"'
  2180. YASMFLAGS="-f $objformat -DARCH_$(toupper $subarch)"
  2181. enabled x86_64 && append YASMFLAGS "-m amd64"
  2182. enabled pic && append YASMFLAGS "-DPIC"
  2183. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  2184. case "$objformat" in
  2185. elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
  2186. esac
  2187. disabled yasm || { check_yasm "pabsw xmm0, xmm0" && enable yasm; }
  2188. case "$cpu" in
  2189. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  2190. disable fast_clz
  2191. ;;
  2192. esac
  2193. fi
  2194. if check_func dlopen; then
  2195. ldl=
  2196. elif check_func dlopen -ldl; then
  2197. ldl=-ldl
  2198. fi
  2199. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  2200. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  2201. check_func fork
  2202. check_func getaddrinfo $network_extralibs
  2203. check_func gethrtime
  2204. check_func getrusage
  2205. check_func inet_aton $network_extralibs
  2206. check_func isatty
  2207. check_func ${malloc_prefix}memalign && enable memalign
  2208. check_func mkstemp
  2209. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  2210. check_func_headers io.h setmode
  2211. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  2212. check_func_headers windows.h GetProcessTimes
  2213. check_func_headers windows.h VirtualAlloc
  2214. check_header conio.h
  2215. check_header dlfcn.h
  2216. check_header dxva2api.h
  2217. check_header malloc.h
  2218. check_header poll.h
  2219. check_header sys/mman.h
  2220. check_header sys/resource.h
  2221. check_header sys/select.h
  2222. check_header termios.h
  2223. check_header vdpau/vdpau.h
  2224. check_header vdpau/vdpau_x11.h
  2225. check_header X11/extensions/XvMClib.h
  2226. check_struct dxva2api.h DXVA_PictureParameters wDecodedPictureIndex
  2227. if ! enabled_any memalign memalign_hack posix_memalign malloc_aligned &&
  2228. enabled_any $need_memalign ; then
  2229. die "Error, no aligned memory allocator but SSE enabled, disable it or use --enable-memalign-hack."
  2230. fi
  2231. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  2232. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  2233. # check for some common methods of building with pthread support
  2234. # do this before the optional library checks as some of them require pthreads
  2235. if enabled pthreads; then
  2236. if check_func pthread_create; then
  2237. :
  2238. elif check_func pthread_create -pthread; then
  2239. add_cflags -pthread
  2240. add_extralibs -pthread
  2241. elif check_func pthread_create -pthreads; then
  2242. add_cflags -pthreads
  2243. add_extralibs -pthreads
  2244. elif check_func pthread_create -lpthreadGC2; then
  2245. add_extralibs -lpthreadGC2
  2246. elif ! check_lib pthread.h pthread_create -lpthread; then
  2247. die "ERROR: can't find pthreads library"
  2248. fi
  2249. fi
  2250. for thread in $THREADS_LIST; do
  2251. if enabled $thread; then
  2252. test -n "$thread_type" &&
  2253. die "ERROR: Only one thread type must be selected." ||
  2254. thread_type="$thread"
  2255. fi
  2256. done
  2257. check_lib math.h sin -lm
  2258. check_lib va/va.h vaInitialize -lva
  2259. check_func exp2
  2260. check_func exp2f
  2261. check_func llrint
  2262. check_func log2
  2263. check_func log2f
  2264. check_func lrint
  2265. check_func lrintf
  2266. check_func round
  2267. check_func roundf
  2268. check_func truncf
  2269. # these are off by default, so fail if requested and not available
  2270. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
  2271. enabled libdirac && add_cflags $(pkg-config --cflags dirac) &&
  2272. require libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init $(pkg-config --libs dirac) &&
  2273. require libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init $(pkg-config --libs dirac)
  2274. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  2275. enabled libfaad && require2 libfaad faad.h faacDecOpen -lfaad
  2276. enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm
  2277. enabled libmp3lame && require libmp3lame lame/lame.h lame_init -lmp3lame -lm
  2278. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  2279. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb -lm
  2280. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb -lm
  2281. enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
  2282. enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
  2283. require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
  2284. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  2285. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  2286. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  2287. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 -lm &&
  2288. { check_cpp_condition x264.h "X264_BUILD >= 83" ||
  2289. die "ERROR: libx264 version must be >= 0.83."; }
  2290. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  2291. enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  2292. # libdc1394 check
  2293. if enabled libdc1394; then
  2294. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  2295. enable libdc1394_2; } ||
  2296. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  2297. enable libdc1394_1; } ||
  2298. die "ERROR: No version of libdc1394 found "
  2299. fi
  2300. SDL_CONFIG="${cross_prefix}sdl-config"
  2301. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  2302. sdl_cflags=$("${SDL_CONFIG}" --cflags)
  2303. sdl_libs=$("${SDL_CONFIG}" --libs)
  2304. check_func_headers SDL.h SDL_Init $sdl_cflags $sdl_libs &&
  2305. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  2306. enable sdl &&
  2307. check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
  2308. fi
  2309. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  2310. if enabled network; then
  2311. check_type "sys/types.h sys/socket.h" socklen_t
  2312. check_type netdb.h "struct addrinfo"
  2313. check_type netinet/in.h "struct ipv6_mreq"
  2314. check_type netinet/in.h "struct sockaddr_in6"
  2315. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  2316. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  2317. # Prefer arpa/inet.h over winsock2
  2318. if check_header arpa/inet.h ; then
  2319. check_func closesocket
  2320. elif check_header winsock2.h ; then
  2321. check_func_headers winsock2.h closesocket -lws2 && \
  2322. network_extralibs="-lws2" || \
  2323. { check_func_headers winsock2.h closesocket -lws2_32 && \
  2324. network_extralibs="-lws2_32"; }
  2325. check_type ws2tcpip.h socklen_t
  2326. check_type ws2tcpip.h "struct addrinfo"
  2327. check_type ws2tcpip.h "struct ipv6_mreq"
  2328. check_type ws2tcpip.h "struct sockaddr_in6"
  2329. check_type ws2tcpip.h "struct sockaddr_storage"
  2330. check_struct winsock2.h "struct sockaddr" sa_len
  2331. else
  2332. disable network
  2333. fi
  2334. fi
  2335. check_header linux/videodev.h
  2336. check_header linux/videodev2.h
  2337. check_header sys/videoio.h
  2338. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  2339. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  2340. { check_header dev/bktr/ioctl_meteor.h &&
  2341. check_header dev/bktr/ioctl_bt848.h; } ||
  2342. { check_header machine/ioctl_meteor.h &&
  2343. check_header machine/ioctl_bt848.h; } ||
  2344. { check_header dev/video/meteor/ioctl_meteor.h &&
  2345. check_header dev/video/bktr/ioctl_bt848.h; } ||
  2346. check_header dev/ic/bt8xx.h
  2347. check_header sys/soundcard.h
  2348. check_header soundcard.h
  2349. enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  2350. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack
  2351. enabled x11grab &&
  2352. check_header X11/Xlib.h &&
  2353. check_header X11/extensions/XShm.h &&
  2354. check_header X11/extensions/Xfixes.h &&
  2355. check_func XOpenDisplay -lX11 &&
  2356. check_func XShmCreateImage -lX11 -lXext &&
  2357. check_func XFixesGetCursorImage -lX11 -lXext -lXfixes
  2358. if ! disabled vdpau && enabled vdpau_vdpau_h; then
  2359. check_cpp_condition \
  2360. vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  2361. { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
  2362. disable vdpau; }
  2363. fi
  2364. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  2365. # add some useful compiler flags if supported
  2366. check_cflags -Wdeclaration-after-statement
  2367. check_cflags -Wall
  2368. check_cflags -Wno-switch
  2369. check_cflags -Wdisabled-optimization
  2370. check_cflags -Wpointer-arith
  2371. check_cflags -Wredundant-decls
  2372. check_cflags -Wno-pointer-sign
  2373. check_cflags -Wcast-qual
  2374. check_cflags -Wwrite-strings
  2375. check_cflags -Wtype-limits
  2376. check_cflags -Wundef
  2377. enabled extra_warnings && check_cflags -Winline
  2378. # add some linker flags
  2379. check_ldflags -Wl,--warn-common
  2380. check_ldflags -Wl,--as-needed
  2381. 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'
  2382. check_ldflags -Wl,-Bsymbolic
  2383. echo "X{};" > $TMPV
  2384. test_ldflags -Wl,--version-script,$TMPV &&
  2385. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  2386. if enabled small; then
  2387. add_cflags $size_cflags
  2388. optimizations="small"
  2389. elif enabled optimizations; then
  2390. add_cflags $speed_cflags
  2391. fi
  2392. check_cflags -fno-math-errno
  2393. check_cflags -fno-signed-zeros
  2394. if enabled icc; then
  2395. # Just warnings, no remarks
  2396. check_cflags -w1
  2397. # -wd: Disable following warnings
  2398. # 144, 167, 556: -Wno-pointer-sign
  2399. # 10006: ignoring unknown option -fno-signed-zeros
  2400. # 10156: ignoring option '-W'; no argument required
  2401. check_cflags -wd144,167,556,10006,10156
  2402. # 11030: Warning unknown option --as-needed
  2403. # 10156: ignoring option '-export'; no argument required
  2404. check_ldflags -wd10156,11030
  2405. # Allow to compile with optimizations
  2406. check_ldflags -march=$cpu
  2407. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  2408. enable ebp_available
  2409. elif enabled ccc; then
  2410. # disable some annoying warnings
  2411. add_cflags -msg_disable cvtu32to64
  2412. add_cflags -msg_disable embedcomment
  2413. add_cflags -msg_disable needconstext
  2414. add_cflags -msg_disable nomainieee
  2415. add_cflags -msg_disable ptrmismatch1
  2416. add_cflags -msg_disable unreachcode
  2417. elif enabled gcc; then
  2418. check_cflags -fno-tree-vectorize
  2419. elif enabled clang; then
  2420. check_cflags -Qunused-arguments
  2421. elif enabled armcc; then
  2422. # 2523: use of inline assembler is deprecated
  2423. add_cflags -Wrvct,--diag_suppress=2523
  2424. elif enabled tms470; then
  2425. add_cflags -pds=824 -pds=837
  2426. fi
  2427. if enabled gprof; then
  2428. add_cflags -p
  2429. add_ldflags -p
  2430. fi
  2431. # Find out if the .align argument is a power of two or not.
  2432. check_asm asmalign_pot '".align 3"'
  2433. enabled_any $DECODER_LIST && enable decoders
  2434. enabled_any $ENCODER_LIST && enable encoders
  2435. enabled_any $HWACCEL_LIST && enable hwaccels
  2436. enabled_any $BSF_LIST && enable bsfs
  2437. enabled_any $DEMUXER_LIST && enable demuxers
  2438. enabled_any $MUXER_LIST && enable muxers
  2439. enabled_any $FILTER_LIST && enable filters
  2440. enabled_any $INDEV_LIST && enable indevs
  2441. enabled_any $OUTDEV_LIST && enable outdevs
  2442. enabled_any $PROTOCOL_LIST && enable protocols
  2443. enabled_any $THREADS_LIST && enable threads
  2444. check_deps $CONFIG_LIST \
  2445. $CONFIG_EXTRA \
  2446. $HAVE_LIST \
  2447. $DECODER_LIST \
  2448. $ENCODER_LIST \
  2449. $HWACCEL_LIST \
  2450. $PARSER_LIST \
  2451. $BSF_LIST \
  2452. $DEMUXER_LIST \
  2453. $MUXER_LIST \
  2454. $FILTER_LIST \
  2455. $INDEV_LIST \
  2456. $OUTDEV_LIST \
  2457. $PROTOCOL_LIST \
  2458. enabled asm || disable $ARCH_LIST $ARCH_EXT_LIST
  2459. echo "install prefix $prefix"
  2460. echo "source path $source_path"
  2461. echo "C compiler $cc"
  2462. echo ".align is power-of-two $asmalign_pot"
  2463. echo "ARCH $arch ($cpu)"
  2464. if test "$build_suffix" != ""; then
  2465. echo "build suffix $build_suffix"
  2466. fi
  2467. if test "$extra_version" != ""; then
  2468. echo "version string suffix $extra_version"
  2469. fi
  2470. echo "big-endian ${bigendian-no}"
  2471. echo "runtime cpu detection ${runtime_cpudetect-no}"
  2472. if enabled x86; then
  2473. echo "yasm ${yasm-no}"
  2474. echo "MMX enabled ${mmx-no}"
  2475. echo "MMX2 enabled ${mmx2-no}"
  2476. echo "3DNow! enabled ${amd3dnow-no}"
  2477. echo "3DNow! extended enabled ${amd3dnowext-no}"
  2478. echo "SSE enabled ${sse-no}"
  2479. echo "SSSE3 enabled ${ssse3-no}"
  2480. echo "CMOV enabled ${cmov-no}"
  2481. echo "CMOV is fast ${fast_cmov-no}"
  2482. echo "EBX available ${ebx_available-no}"
  2483. echo "EBP available ${ebp_available-no}"
  2484. echo "10 operands supported ${ten_operands-no}"
  2485. fi
  2486. if enabled arm; then
  2487. echo "ARMv5TE enabled ${armv5te-no}"
  2488. echo "ARMv6 enabled ${armv6-no}"
  2489. echo "ARMv6T2 enabled ${armv6t2-no}"
  2490. echo "ARM VFP enabled ${armvfp-no}"
  2491. echo "IWMMXT enabled ${iwmmxt-no}"
  2492. echo "NEON enabled ${neon-no}"
  2493. fi
  2494. if enabled mips; then
  2495. echo "MMI enabled ${mmi-no}"
  2496. fi
  2497. if enabled ppc; then
  2498. echo "AltiVec enabled ${altivec-no}"
  2499. echo "PPC 4xx optimizations ${ppc4xx-no}"
  2500. echo "dcbzl available ${dcbzl-no}"
  2501. echo "performance report ${powerpc_perf-no}"
  2502. fi
  2503. if enabled sparc; then
  2504. echo "VIS enabled ${vis-no}"
  2505. fi
  2506. echo "gprof enabled ${gprof-no}"
  2507. echo "debug symbols ${debug-no}"
  2508. echo "strip symbols ${stripping-no}"
  2509. echo "optimizations ${optimizations-no}"
  2510. echo "static ${static-no}"
  2511. echo "shared ${shared-no}"
  2512. echo "postprocessing support ${postproc-no}"
  2513. echo "new filter support ${avfilter-no}"
  2514. echo "filters using lavformat ${avfilter_lavf-no}"
  2515. echo "network support ${network-no}"
  2516. echo "threading support ${thread_type-no}"
  2517. echo "SDL support ${sdl-no}"
  2518. echo "Sun medialib support ${mlib-no}"
  2519. echo "AVISynth enabled ${avisynth-no}"
  2520. echo "libdc1394 support ${libdc1394-no}"
  2521. echo "libdirac enabled ${libdirac-no}"
  2522. echo "libfaac enabled ${libfaac-no}"
  2523. echo "libfaad enabled ${libfaad-no}"
  2524. echo "libfaad dlopened ${libfaadbin-no}"
  2525. echo "libgsm enabled ${libgsm-no}"
  2526. echo "libmp3lame enabled ${libmp3lame-no}"
  2527. echo "libnut enabled ${libnut-no}"
  2528. echo "libopencore-amrnb support ${libopencore_amrnb-no}"
  2529. echo "libopencore-amrwb support ${libopencore_amrwb-no}"
  2530. echo "libopenjpeg enabled ${libopenjpeg-no}"
  2531. echo "libschroedinger enabled ${libschroedinger-no}"
  2532. echo "libspeex enabled ${libspeex-no}"
  2533. echo "libtheora enabled ${libtheora-no}"
  2534. echo "libvorbis enabled ${libvorbis-no}"
  2535. echo "libx264 enabled ${libx264-no}"
  2536. echo "libxvid enabled ${libxvid-no}"
  2537. echo "zlib enabled ${zlib-no}"
  2538. echo "bzlib enabled ${bzlib-no}"
  2539. echo
  2540. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  2541. echo "Enabled ${type}s:"
  2542. eval list=\$$(toupper $type)_LIST
  2543. for part in $list; do
  2544. enabled $part && echo ${part%_*}
  2545. done | sort | pr -3 -t
  2546. echo
  2547. done
  2548. license="LGPL version 2.1 or later"
  2549. if enabled nonfree; then
  2550. license="nonfree and unredistributable"
  2551. elif enabled gplv3; then
  2552. license="GPL version 3 or later"
  2553. elif enabled lgplv3; then
  2554. license="LGPL version 3 or later"
  2555. elif enabled gpl; then
  2556. license="GPL version 2 or later"
  2557. fi
  2558. echo "License: $license"
  2559. echo "Creating config.mak and config.h..."
  2560. # build tree in object directory if source path is different from current one
  2561. if enabled source_path_used; then
  2562. DIRS="
  2563. doc
  2564. libavcodec
  2565. libavcodec/$arch
  2566. libavdevice
  2567. libavfilter
  2568. libavformat
  2569. libavutil
  2570. libavutil/$arch
  2571. libpostproc
  2572. libswscale
  2573. libswscale/$arch
  2574. tests
  2575. tools
  2576. "
  2577. FILES="
  2578. Makefile
  2579. common.mak
  2580. subdir.mak
  2581. doc/texi2pod.pl
  2582. libavcodec/Makefile
  2583. libavdevice/Makefile
  2584. libavfilter/Makefile
  2585. libavformat/Makefile
  2586. libavutil/Makefile
  2587. libpostproc/Makefile
  2588. libswscale/Makefile
  2589. "
  2590. for dir in $DIRS ; do
  2591. mkdir -p $dir
  2592. done
  2593. for f in $FILES ; do
  2594. $ln_s "$source_path/$f" $f
  2595. done
  2596. fi
  2597. enabled stripping || strip="echo skipping strip"
  2598. cat > config.mak <<EOF
  2599. # Automatically generated by configure - do not modify!
  2600. ifndef FFMPEG_CONFIG_MAK
  2601. FFMPEG_CONFIG_MAK=1
  2602. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  2603. prefix=$prefix
  2604. LIBDIR=\$(DESTDIR)$libdir
  2605. SHLIBDIR=\$(DESTDIR)$shlibdir
  2606. INCDIR=\$(DESTDIR)$incdir
  2607. BINDIR=\$(DESTDIR)$bindir
  2608. DATADIR=\$(DESTDIR)$datadir
  2609. MANDIR=\$(DESTDIR)$mandir
  2610. SRC_PATH="$source_path"
  2611. SRC_PATH_BARE=$source_path
  2612. BUILD_ROOT="$PWD"
  2613. ARCH=$arch
  2614. CC=$cc
  2615. AS=$as
  2616. LD=$ld
  2617. DEPCC=$dep_cc
  2618. YASM=$yasmexe
  2619. AR=$ar
  2620. RANLIB=$ranlib
  2621. LN_S=$ln_s
  2622. STRIP=$strip
  2623. CPPFLAGS=$CPPFLAGS
  2624. CFLAGS=$CFLAGS
  2625. ASFLAGS=$ASFLAGS
  2626. CC_O=$CC_O
  2627. LDFLAGS=$LDFLAGS
  2628. FFSERVERLDFLAGS=$FFSERVERLDFLAGS
  2629. SHFLAGS=$SHFLAGS
  2630. YASMFLAGS=$YASMFLAGS
  2631. BUILDSUF=$build_suffix
  2632. FULLNAME=$FULLNAME
  2633. LIBPREF=$LIBPREF
  2634. LIBSUF=$LIBSUF
  2635. LIBNAME=$LIBNAME
  2636. SLIBPREF=$SLIBPREF
  2637. SLIBSUF=$SLIBSUF
  2638. EXESUF=$EXESUF
  2639. EXTRA_VERSION=$extra_version
  2640. DEPFLAGS=$DEPFLAGS
  2641. CCDEP=$CCDEP
  2642. ASDEP=$ASDEP
  2643. CC_DEPFLAGS=$CC_DEPFLAGS
  2644. AS_DEPFLAGS=$AS_DEPFLAGS
  2645. HOSTCC=$host_cc
  2646. HOSTCFLAGS=$host_cflags
  2647. HOSTEXESUF=$HOSTEXESUF
  2648. HOSTLDFLAGS=$host_ldflags
  2649. HOSTLIBS=$host_libs
  2650. TARGET_EXEC=$target_exec
  2651. TARGET_PATH=$target_path
  2652. SDL_LIBS=$sdl_libs
  2653. SDL_CFLAGS=$sdl_cflags
  2654. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  2655. EXTRALIBS=$extralibs
  2656. EOF
  2657. get_version(){
  2658. name=$1
  2659. file=$source_path/$2
  2660. eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
  2661. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  2662. lcname=$(tolower $name)
  2663. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  2664. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  2665. }
  2666. get_version LIBSWSCALE libswscale/swscale.h
  2667. get_version LIBPOSTPROC libpostproc/postprocess.h
  2668. get_version LIBAVCODEC libavcodec/avcodec.h
  2669. get_version LIBAVDEVICE libavdevice/avdevice.h
  2670. get_version LIBAVFORMAT libavformat/avformat.h
  2671. get_version LIBAVUTIL libavutil/avutil.h
  2672. get_version LIBAVFILTER libavfilter/avfilter.h
  2673. enabled shared && cat >> config.mak <<EOF
  2674. LIBTARGET=${LIBTARGET}
  2675. SLIBNAME=${SLIBNAME}
  2676. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  2677. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  2678. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  2679. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  2680. SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}
  2681. SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}
  2682. EOF
  2683. enabled asmalign_pot || align_shift="1 <<"
  2684. cat > $TMPH <<EOF
  2685. /* Automatically generated by configure - do not modify! */
  2686. #ifndef FFMPEG_CONFIG_H
  2687. #define FFMPEG_CONFIG_H
  2688. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  2689. #define FFMPEG_LICENSE "$(c_escape $license)"
  2690. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  2691. #define CC_TYPE "$cc_type"
  2692. #define CC_VERSION $cc_version
  2693. #define restrict $_restrict
  2694. #define ASMALIGN(ZEROBITS) ".align $align_shift " #ZEROBITS "\\n\\t"
  2695. #define EXTERN_PREFIX "${extern_prefix}"
  2696. #define EXTERN_ASM ${extern_prefix}
  2697. EOF
  2698. test -n "$malloc_prefix" &&
  2699. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  2700. if enabled small || disabled optimizations; then
  2701. echo "#define av_always_inline" >> $TMPH
  2702. fi
  2703. print_config ARCH_ $TMPH config.mak $ARCH_LIST
  2704. print_config HAVE_ $TMPH config.mak $HAVE_LIST
  2705. print_config CONFIG_ $TMPH config.mak $CONFIG_LIST \
  2706. $CONFIG_EXTRA \
  2707. $DECODER_LIST \
  2708. $ENCODER_LIST \
  2709. $HWACCEL_LIST \
  2710. $PARSER_LIST \
  2711. $BSF_LIST \
  2712. $DEMUXER_LIST \
  2713. $MUXER_LIST \
  2714. $FILTER_LIST \
  2715. $PROTOCOL_LIST \
  2716. $INDEV_LIST \
  2717. $OUTDEV_LIST \
  2718. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  2719. echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
  2720. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  2721. cp_if_changed $TMPH config.h
  2722. cat > $TMPH <<EOF
  2723. /* Generated by ffconf */
  2724. #ifndef AVUTIL_AVCONFIG_H
  2725. #define AVUTIL_AVCONFIG_H
  2726. EOF
  2727. print_config AV_HAVE_ $TMPH /dev/null $HAVE_LIST_PUB
  2728. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  2729. cp_if_changed $TMPH libavutil/avconfig.h
  2730. # build pkg-config files
  2731. pkgconfig_generate(){
  2732. name=$1
  2733. shortname=${name#lib}${build_suffix}
  2734. comment=$2
  2735. version=$3
  2736. libs=$4
  2737. requires=$5
  2738. cat <<EOF > $name/$name.pc
  2739. prefix=$prefix
  2740. exec_prefix=\${prefix}
  2741. libdir=$libdir
  2742. includedir=$incdir
  2743. Name: $name
  2744. Description: $comment
  2745. Version: $version
  2746. Requires: $(enabled shared || echo $requires)
  2747. Requires.private: $(enabled shared && echo $requires)
  2748. Conflicts:
  2749. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  2750. Libs.private: $(enabled shared && echo $libs)
  2751. Cflags: -I\${includedir}
  2752. EOF
  2753. cat <<EOF > $name/$name-uninstalled.pc
  2754. prefix=
  2755. exec_prefix=
  2756. libdir=\${pcfiledir}
  2757. includedir=${source_path}
  2758. Name: $name
  2759. Description: $comment
  2760. Version: $version
  2761. Requires: $requires
  2762. Conflicts:
  2763. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  2764. Cflags: -I\${includedir}
  2765. EOF
  2766. }
  2767. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
  2768. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  2769. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
  2770. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
  2771. enabled avfilter &&
  2772. pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  2773. enabled postproc &&
  2774. pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
  2775. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"