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.

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