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.

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