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.

3119 lines
87KB

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