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.

3082 lines
87KB

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