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.

3069 lines
86KB

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